YOu can now activate the menu pressing F10 anywhere.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-05-19 13:41:55 +00:00
parent 3dfb93fd82
commit 801aa1782c
6 changed files with 68 additions and 6 deletions

View File

@@ -630,6 +630,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
ret = win->GetEventHandler()->ProcessEvent( new_event );
}
/* generate wxID_CANCEL if <esc> has been pressed (typically in dialogs) */
if ( (!ret) &&
(gdk_event->keyval == GDK_Escape) )
{
@@ -637,6 +638,36 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
new_event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( new_event );
}
/* pressing F10 will activate the menu bar of the top frame */
if ( (!ret) &&
(gdk_event->keyval == GDK_F10) )
{
wxWindow *ancestor = win;
while (ancestor)
{
if (wxIsKindOf(ancestor,wxFrame))
{
wxFrame *frame = (wxFrame*) ancestor;
wxMenuBar *menubar = frame->GetMenuBar();
if (menubar)
{
wxNode *node = menubar->GetMenus().First();
if (node)
{
wxMenu *firstMenu = (wxMenu*) node->Data();
gtk_menu_shell_select_item(
GTK_MENU_SHELL(menubar->m_menubar),
firstMenu->m_owner );
ret = TRUE;
break;
}
}
}
ancestor = ancestor->GetParent();
}
}
/*
Damn, I forgot why this didn't work, but it didn't work.