make sure update UI handlers are called for accelerators, #10130

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2008-10-31 05:25:59 +00:00
parent 3a23d484e3
commit d317e7032a

View File

@@ -1040,6 +1040,18 @@ wxString wxMenuItem::GetItemLabel() const
// wxMenu
//-----------------------------------------------------------------------------
#if GTK_CHECK_VERSION(2,4,0)
// "can_activate_accel" from menu item
extern "C" {
static gboolean can_activate_accel(GtkWidget*, guint, wxMenu* menu)
{
menu->UpdateUI();
// always allow our "activate" handler to be called
return true;
}
}
#endif
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
void wxMenu::Init()
@@ -1265,6 +1277,13 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
}
else
{
#if GTK_CHECK_VERSION(2,4,0)
if (gtk_check_version(2,4,0) == NULL)
{
g_signal_connect(menuItem, "can_activate_accel",
G_CALLBACK(can_activate_accel), this);
}
#endif
g_signal_connect (menuItem, "activate",
G_CALLBACK (gtk_menu_clicked_callback),
this);