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:
@@ -95,8 +95,6 @@ public:
|
|||||||
|
|
||||||
GtkAccelGroup *m_accel;
|
GtkAccelGroup *m_accel;
|
||||||
GtkItemFactory *m_factory;
|
GtkItemFactory *m_factory;
|
||||||
|
|
||||||
private:
|
|
||||||
wxList m_menus;
|
wxList m_menus;
|
||||||
GtkWidget *m_menubar;
|
GtkWidget *m_menubar;
|
||||||
};
|
};
|
||||||
|
@@ -95,8 +95,6 @@ public:
|
|||||||
|
|
||||||
GtkAccelGroup *m_accel;
|
GtkAccelGroup *m_accel;
|
||||||
GtkItemFactory *m_factory;
|
GtkItemFactory *m_factory;
|
||||||
|
|
||||||
private:
|
|
||||||
wxList m_menus;
|
wxList m_menus;
|
||||||
GtkWidget *m_menubar;
|
GtkWidget *m_menubar;
|
||||||
};
|
};
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include "gdk/gdk.h"
|
#include "gdk/gdk.h"
|
||||||
#include "gtk/gtk.h"
|
#include "gtk/gtk.h"
|
||||||
#include "wx/gtk/win_gtk.h"
|
#include "wx/gtk/win_gtk.h"
|
||||||
|
#include "gdk/gdkkeysyms.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@@ -132,7 +133,8 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
|||||||
|
|
||||||
static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSED(child), wxFrame *win )
|
static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSED(child), wxFrame *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->m_hasVMT) return;
|
||||||
|
|
||||||
|
@@ -630,6 +630,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
ret = win->GetEventHandler()->ProcessEvent( new_event );
|
ret = win->GetEventHandler()->ProcessEvent( new_event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* generate wxID_CANCEL if <esc> has been pressed (typically in dialogs) */
|
||||||
if ( (!ret) &&
|
if ( (!ret) &&
|
||||||
(gdk_event->keyval == GDK_Escape) )
|
(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 );
|
new_event.SetEventObject( win );
|
||||||
ret = win->GetEventHandler()->ProcessEvent( new_event );
|
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.
|
Damn, I forgot why this didn't work, but it didn't work.
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include "gdk/gdk.h"
|
#include "gdk/gdk.h"
|
||||||
#include "gtk/gtk.h"
|
#include "gtk/gtk.h"
|
||||||
#include "wx/gtk/win_gtk.h"
|
#include "wx/gtk/win_gtk.h"
|
||||||
|
#include "gdk/gdkkeysyms.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@@ -132,7 +133,8 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
|||||||
|
|
||||||
static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSED(child), wxFrame *win )
|
static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSED(child), wxFrame *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->m_hasVMT) return;
|
||||||
|
|
||||||
|
@@ -630,6 +630,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
ret = win->GetEventHandler()->ProcessEvent( new_event );
|
ret = win->GetEventHandler()->ProcessEvent( new_event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* generate wxID_CANCEL if <esc> has been pressed (typically in dialogs) */
|
||||||
if ( (!ret) &&
|
if ( (!ret) &&
|
||||||
(gdk_event->keyval == GDK_Escape) )
|
(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 );
|
new_event.SetEventObject( win );
|
||||||
ret = win->GetEventHandler()->ProcessEvent( new_event );
|
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.
|
Damn, I forgot why this didn't work, but it didn't work.
|
||||||
|
Reference in New Issue
Block a user