Partially re-enable toolbar buttons in RO treeview windows.

svn path=/trunk/netsurf/; revision=10906
This commit is contained in:
Steve Fryatt 2010-10-24 20:00:45 +00:00
parent 00434615ed
commit ba197f29c7
9 changed files with 172 additions and 39 deletions

View File

@ -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
*

View File

@ -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);

View File

@ -158,6 +158,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
*

View File

@ -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

View File

@ -172,6 +172,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
*

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -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);