summaryrefslogtreecommitdiff
path: root/riscos/wimp.c
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2004-07-16 16:33:45 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2004-07-16 16:33:45 +0000
commitabaa8a90938024685d39a10192586d369e44a101 (patch)
tree59006e5f7f679a9bd76b3488e20582b3e4af733c /riscos/wimp.c
parent99d1c18252833c577dc5046e73ef7f7cc12bdb3a (diff)
downloadnetsurf-abaa8a90938024685d39a10192586d369e44a101.tar.gz
netsurf-abaa8a90938024685d39a10192586d369e44a101.tar.bz2
[project @ 2004-07-16 16:33:44 by rjw]
Various fixes for the GUI. Persistant windows are closed when upon a change of content. Hotlist saves in the same format as !Browse. Neater login window. Support for interactive help from hotlist windows. svn path=/import/netsurf/; revision=1081
Diffstat (limited to 'riscos/wimp.c')
-rw-r--r--riscos/wimp.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/riscos/wimp.c b/riscos/wimp.c
index e125a0419..03d78a2ff 100644
--- a/riscos/wimp.c
+++ b/riscos/wimp.c
@@ -21,6 +21,7 @@
#include "oslib/wimpreadsysinfo.h"
#include "oslib/wimpspriteop.h"
#include "netsurf/desktop/gui.h"
+#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/utils.h"
@@ -318,6 +319,62 @@ void ro_gui_set_caret_first(wimp_w w) {
/**
+ * Opens a window at the centre of either another window or the screen
+ *
+ * /param parent the parent window (NULL for centre of screen)
+ * /param child the child window
+ */
+void ro_gui_open_window_centre(wimp_w parent, wimp_w child) {
+ os_error *error;
+ wimp_window_state state;
+ int mid_x, mid_y;
+ int dimension, scroll_width;
+
+ /* Get the parent window state
+ */
+ if (parent) {
+ state.w = parent;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+ scroll_width = ro_get_vscroll_width(parent);
+
+ /* Get the centre of the parent
+ */
+ mid_x = (state.visible.x0 + state.visible.x1 + scroll_width) / 2;
+ mid_y = (state.visible.y0 + state.visible.y1) / 2;
+ } else {
+ ro_gui_screen_size(&mid_x, &mid_y);
+ mid_x /= 2;
+ mid_y /= 2;
+ }
+
+ /* Get the child window state
+ */
+ state.w = child;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+
+ /* Move to the centre of the parent at the top of the stack
+ */
+ dimension = state.visible.x1 - state.visible.x0;
+ scroll_width = ro_get_vscroll_width(hotlist_window);
+ state.visible.x0 = mid_x - (dimension + scroll_width) / 2;
+ state.visible.x1 = state.visible.x0 + dimension;
+ dimension = state.visible.y1 - state.visible.y0;
+ state.visible.y0 = mid_y - dimension / 2;
+ state.visible.y1 = state.visible.y0 + dimension;
+ state.next = wimp_TOP;
+ wimp_open_window((wimp_open *) &state);
+}
+
+
+/**
* Load a sprite file into memory.
*
* \param pathname file to load