summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Fryatt <steve@stevefryatt.org.uk>2010-10-24 20:00:45 +0000
committerSteve Fryatt <steve@stevefryatt.org.uk>2010-10-24 20:00:45 +0000
commitba197f29c7e4784a6d649b262d3951e5e7fef41b (patch)
tree3e1c7f506e5a94bc0cfd781547d151f6369d95ed
parent00434615ed1a25b7d722e942406d0ddc8c08cdf3 (diff)
downloadnetsurf-ba197f29c7e4784a6d649b262d3951e5e7fef41b.tar.gz
netsurf-ba197f29c7e4784a6d649b262d3951e5e7fef41b.tar.bz2
Partially re-enable toolbar buttons in RO treeview windows.
svn path=/trunk/netsurf/; revision=10906
-rw-r--r--riscos/cookies.c47
-rw-r--r--riscos/cookies.h1
-rw-r--r--riscos/global_history.c53
-rw-r--r--riscos/global_history.h1
-rw-r--r--riscos/hotlist.c62
-rw-r--r--riscos/hotlist.h1
-rw-r--r--riscos/theme.c8
-rw-r--r--riscos/treeview.c37
-rw-r--r--riscos/treeview.h1
9 files changed, 172 insertions, 39 deletions
diff --git a/riscos/cookies.c b/riscos/cookies.c
index b0c035adc..e19a1a2fa 100644
--- a/riscos/cookies.c
+++ b/riscos/cookies.c
@@ -150,6 +150,53 @@ void ro_gui_cookies_open(void)
}
}
+
+/**
+ * Handle Mouse Click events on the toolbar.
+ *
+ * \param *pointer Pointer to the Mouse Click Event block.
+ * \return Return true if click handled; else false.
+ */
+
+bool ro_gui_cookies_toolbar_click(wimp_pointer *pointer)
+{
+ switch (pointer->i) {
+ case ICON_TOOLBAR_DELETE:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ cookies_delete_selected();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_EXPAND:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ cookies_expand_cookies();
+ return true;
+ } else if (pointer->buttons == wimp_CLICK_ADJUST) {
+ cookies_collapse_cookies();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_OPEN:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ cookies_expand_domains();
+ return true;
+ } else if (pointer->buttons == wimp_CLICK_ADJUST) {
+ cookies_collapse_domains();
+ return true;
+ }
+ break;
+ }
+
+ /* \todo -- We assume that the owning module will have attached a window menu
+ * to our parent window. If it hasn't, this call will quietly fail.
+ */
+
+ if (pointer->buttons == wimp_CLICK_MENU)
+ return ro_gui_wimp_event_process_window_menu_click(pointer);
+
+ return false;
+}
+
/**
* Prepare the cookies menu for opening
*
diff --git a/riscos/cookies.h b/riscos/cookies.h
index 3539ed9a0..8c9c14925 100644
--- a/riscos/cookies.h
+++ b/riscos/cookies.h
@@ -28,6 +28,7 @@ void ro_gui_cookies_preinitialise(void);
void ro_gui_cookies_postinitialise(void);
bool ro_gui_cookies_check_window(wimp_w window);
bool ro_gui_cookies_check_menu(wimp_menu *menu);
+bool ro_gui_cookies_toolbar_click(wimp_pointer *pointer);
void ro_gui_cookies_open(void);
void ro_gui_cookies_update_theme(void);
diff --git a/riscos/global_history.c b/riscos/global_history.c
index e9f5ea6ad..44d39b93a 100644
--- a/riscos/global_history.c
+++ b/riscos/global_history.c
@@ -159,6 +159,59 @@ void ro_gui_global_history_open(void)
}
/**
+ * Handle Mouse Click events on the toolbar.
+ *
+ * \param *pointer Pointer to the Mouse Click Event block.
+ * \return Return true if click handled; else false.
+ */
+
+bool ro_gui_global_history_toolbar_click(wimp_pointer *pointer)
+{
+ switch (pointer->i) {
+ case ICON_TOOLBAR_DELETE:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ history_global_delete_selected();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_EXPAND:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ history_global_expand_addresses();
+ return true;
+ } else if (pointer->buttons == wimp_CLICK_ADJUST) {
+ history_global_collapse_addresses();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_OPEN:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ history_global_expand_directories();
+ return true;
+ } else if (pointer->buttons == wimp_CLICK_ADJUST) {
+ history_global_collapse_directories();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_LAUNCH:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ history_global_launch_selected();
+ return true;
+ }
+ break;
+ }
+
+ /* \todo -- We assume that the owning module will have attached a window menu
+ * to our parent window. If it hasn't, this call will quietly fail.
+ */
+
+ if (pointer->buttons == wimp_CLICK_MENU)
+ return ro_gui_wimp_event_process_window_menu_click(pointer);
+
+ return true;
+}
+
+
+/**
* Prepare the global history menu for opening
*
* \param window The window owning the menu.
diff --git a/riscos/global_history.h b/riscos/global_history.h
index 951836d5d..7ca2ed9da 100644
--- a/riscos/global_history.h
+++ b/riscos/global_history.h
@@ -31,6 +31,7 @@ void ro_gui_global_history_save(void);
void ro_gui_global_history_update_theme(void);
bool ro_gui_global_history_check_window(wimp_w window);
bool ro_gui_global_history_check_menu(wimp_menu *menu);
+bool ro_gui_global_history_toolbar_click(wimp_pointer *pointer);
#endif
diff --git a/riscos/hotlist.c b/riscos/hotlist.c
index 6e2d176cc..aed66532a 100644
--- a/riscos/hotlist.c
+++ b/riscos/hotlist.c
@@ -173,6 +173,68 @@ void ro_gui_hotlist_open(void)
}
/**
+ * Handle Mouse Click events on the toolbar.
+ *
+ * \param *pointer Pointer to the Mouse Click Event block.
+ * \return Return true if click handled; else false.
+ */
+
+bool ro_gui_hotlist_toolbar_click(wimp_pointer *pointer)
+{
+ LOG(("Entering hotlist toolbar handler: b=%d, i=%d", pointer->buttons, pointer->i));
+
+ switch (pointer->i) {
+ case ICON_TOOLBAR_DELETE:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ hotlist_delete_selected();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_EXPAND:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ hotlist_expand_addresses();
+ return true;
+ } else if (pointer->buttons == wimp_CLICK_ADJUST) {
+ hotlist_collapse_addresses();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_OPEN:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ hotlist_expand_directories();
+ return true;
+ } else if (pointer->buttons == wimp_CLICK_ADJUST) {
+ hotlist_collapse_directories();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_LAUNCH:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ hotlist_launch_selected();
+ return true;
+ }
+ break;
+ case ICON_TOOLBAR_CREATE:
+ if (pointer->buttons == wimp_CLICK_SELECT) {
+ hotlist_add_folder();
+ return true;
+ }
+ break;
+ }
+
+
+ /* \todo -- We assume that the owning module will have attached a window menu
+ * to our parent window. If it hasn't, this call will quietly fail.
+ */
+
+ if (pointer->buttons == wimp_CLICK_MENU)
+ return ro_gui_wimp_event_process_window_menu_click(pointer);
+
+ return true;
+}
+
+
+/**
* Prepare the hotlist menu for opening
*
* \param window The window owning the menu.
diff --git a/riscos/hotlist.h b/riscos/hotlist.h
index e416b2124..346f14fe9 100644
--- a/riscos/hotlist.h
+++ b/riscos/hotlist.h
@@ -31,6 +31,7 @@ void ro_gui_hotlist_save(void);
void ro_gui_hotlist_update_theme(void);
bool ro_gui_hotlist_check_window(wimp_w window);
bool ro_gui_hotlist_check_menu(wimp_menu *menu);
+bool ro_gui_hotlist_toolbar_click(wimp_pointer *pointer);
#endif
diff --git a/riscos/theme.c b/riscos/theme.c
index 3f142cdd3..b5c5d8eb5 100644
--- a/riscos/theme.c
+++ b/riscos/theme.c
@@ -949,12 +949,18 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor,
break;
case THEME_HOTLIST_TOOLBAR:
case THEME_HOTLIST_EDIT_TOOLBAR:
+ ro_gui_wimp_event_register_mouse_click(toolbar->toolbar_handle,
+ ro_gui_hotlist_toolbar_click);
+ break;
case THEME_HISTORY_TOOLBAR:
case THEME_HISTORY_EDIT_TOOLBAR:
+ ro_gui_wimp_event_register_mouse_click(toolbar->toolbar_handle,
+ ro_gui_global_history_toolbar_click);
+ break;
case THEME_COOKIES_TOOLBAR:
case THEME_COOKIES_EDIT_TOOLBAR:
ro_gui_wimp_event_register_mouse_click(toolbar->toolbar_handle,
- ro_gui_treeview_toolbar_click);
+ ro_gui_cookies_toolbar_click);
break;
default:
break;
diff --git a/riscos/treeview.c b/riscos/treeview.c
index c992fdda7..27e014cac 100644
--- a/riscos/treeview.c
+++ b/riscos/treeview.c
@@ -172,8 +172,6 @@ ro_treeview *ro_treeview_create(wimp_w window, struct toolbar *toolbar,
ro_gui_wimp_event_register_keypress(tv->w, ro_treeview_keypress);
ro_gui_wimp_event_set_user_data(tv->w, tv);
- /* \todo Register wimp events to handle the supplied toolbar? */
-
return tv;
}
@@ -915,41 +913,6 @@ static bool ro_treeview_keypress(wimp_key *key)
return false;
}
-/** Respond to a mouse click on a treeview toolbar.
- *
- * \param pointer Pointer to the MouseClick Event block.
- * \return true if the event was handled; else false.
- */
-
-bool ro_gui_treeview_toolbar_click(wimp_pointer *pointer)
-{
- struct toolbar *tb;
- ro_treeview *tv;
-
- tb = (struct toolbar *) ro_gui_wimp_event_get_user_data(pointer->w);
- if (tb == NULL) {
- LOG(("NULL toolbar block for window: 0x%x",
- (unsigned int) pointer->w));
- return false;
- }
-
- tv = (ro_treeview *) ro_gui_wimp_event_get_user_data(tb->parent_handle);
- if (tv == NULL) {
- LOG(("NULL treeview block for parent window: 0x%x",
- (unsigned int) tb->parent_handle));
- return false;
- }
-
- /* \todo -- Handle menu clicks here... */
-
- /* \todo -- Deal with the editor here... */
-
- switch (pointer->i) {
-
- }
-
- return true;
-}
/**
* Update a treeview to use a new theme.
diff --git a/riscos/treeview.h b/riscos/treeview.h
index 7aa129e1b..be0a3478e 100644
--- a/riscos/treeview.h
+++ b/riscos/treeview.h
@@ -46,7 +46,6 @@ bool ro_treeview_has_selection(ro_treeview *tv);
void ro_treeview_set_origin(ro_treeview *tv, int x, int y);
void ro_treeview_mouse_at(wimp_w w, wimp_pointer *pointer);
-bool ro_gui_treeview_toolbar_click(wimp_pointer *pointer);
void ro_treeview_update_theme(ro_treeview *tv);
int ro_treeview_get_help(help_full_message_request *message_data);