Call close function for submenu windows.

svn path=/trunk/netsurf/; revision=3226
This commit is contained in:
Richard Wilson 2007-03-26 20:33:50 +00:00
parent e5129294c0
commit 933c642019
3 changed files with 25 additions and 4 deletions

View File

@ -574,10 +574,7 @@ void ro_gui_menu_closed(bool cleanup) {
current_menu = NULL;
if (cleanup) {
/* end any search operation that was started so that
the text doesn't remain highlighted */
if (ro_gui_menu_search_window_menu)
ro_gui_search_end(dialog_search);
ro_gui_wimp_event_menus_closed();
if (tree)
ro_gui_tree_menu_closed(tree);
@ -726,6 +723,7 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning) {
entries[warning->selection.items[i]];
if (IS_MENU(menu_entry->sub_menu)) {
ro_gui_wimp_event_register_submenu((wimp_w)0);
sub_menu = menu_entry->sub_menu;
i = 0;
do {
@ -736,6 +734,7 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning) {
action, false);
} while (!(sub_menu->entries[i++].menu_flags & wimp_MENU_LAST));
} else {
ro_gui_wimp_event_register_submenu((wimp_w)menu_entry->sub_menu);
action = ro_gui_menu_find_action(current_menu, menu_entry);
if (action != NO_ACTION)
ro_gui_menu_prepare_action(current_menu_window,

View File

@ -100,6 +100,7 @@ static struct event_window *ro_gui_wimp_event_remove_window(wimp_w w);
static struct event_window *ro_gui_wimp_event_windows[WIN_HASH_SIZE];
static wimp_w ro_gui_wimp_event_submenu;
/**
* Memorises the current state of any registered components in a window.
@ -856,6 +857,8 @@ bool ro_gui_wimp_event_close_window(wimp_w w) {
struct event_window *window;
LOG(("Close event received for window 0x%x", (unsigned int)w));
if (w == ro_gui_wimp_event_submenu)
ro_gui_wimp_event_submenu = 0;
window = ro_gui_wimp_event_find_window(w);
if ((window) && (window->close_window)) {
window->close_window(w);
@ -1216,3 +1219,19 @@ struct icon_event *ro_gui_wimp_event_get_event(wimp_w w, wimp_i i, event_type ty
return event;
}
/**
* Handle menus being closed
*/
void ro_gui_wimp_event_menus_closed(void) {
ro_gui_wimp_event_register_submenu(0);
}
/**
* Register a submenu as being opened
*/
void ro_gui_wimp_event_register_submenu(wimp_w w) {
if (ro_gui_wimp_event_submenu)
ro_gui_wimp_event_close_window(ro_gui_wimp_event_submenu);
ro_gui_wimp_event_submenu = w;
}

View File

@ -68,4 +68,7 @@ bool ro_gui_wimp_event_register_redraw_window(wimp_w w,
bool ro_gui_wimp_event_register_menu_selection(wimp_w w,
void (*callback)(wimp_w w, wimp_i i));
void ro_gui_wimp_event_menus_closed(void);
void ro_gui_wimp_event_register_submenu(wimp_w w);
#endif