X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/01603d4396d632163e19f8cde798bb1807f2b8a7..f51723055aa4334a355a19e87bb2b478b4204d15:/src/gtk/menu.cpp?ds=sidebyside diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index e1be8ff88a..a0a65e89c2 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -91,7 +91,7 @@ void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long st PostCreation(); - ApplyWidgetStyle(); + GTKApplyWidgetStyle(); #endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON g_object_ref(m_widget); @@ -122,7 +122,7 @@ wxMenuBar::~wxMenuBar() static void wxMenubarUnsetInvokingWindow(wxMenu* menu, wxWindow* win, GtkWindow* tlw = NULL) { - menu->SetInvokingWindow( (wxWindow*) NULL ); + menu->SetInvokingWindow( NULL ); // support for native hot keys if (menu->m_accel) @@ -226,7 +226,7 @@ void wxMenuBar::Attach(wxFrame *frame) void wxMenuBar::UnsetInvokingWindow( wxWindow *win ) { - m_invokingWindow = (wxWindow*) NULL; + m_invokingWindow = NULL; wxMenuList::compatibility_iterator node = m_menus.GetFirst(); while (node) @@ -316,7 +316,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) wxMenu *menuOld = Remove(pos); if ( menuOld && !Insert(pos, menu, title) ) { - return (wxMenu*) NULL; + return NULL; } // either Insert() succeeded or Remove() failed and menuOld is NULL @@ -327,7 +327,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu = wxMenuBarBase::Remove(pos); if ( !menu ) - return (wxMenu*) NULL; + return NULL; gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu->m_owner), NULL); gtk_container_remove(GTK_CONTAINER(m_menubar), menu->m_owner); @@ -410,7 +410,7 @@ wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const if ( menuForItem ) { - *menuForItem = result ? result->GetMenu() : (wxMenu *)NULL; + *menuForItem = result ? result->GetMenu() : NULL; } return result; @@ -695,6 +695,16 @@ static void menu_hide(GtkWidget*, wxMenu* menu) } } +// "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; +} +} + IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) void wxMenu::Init() @@ -706,9 +716,9 @@ void wxMenu::Init() // NB: keep reference to the menu so that it is not destroyed behind // our back by GTK+ e.g. when it is removed from menubar: g_object_ref(m_menu); - g_object_ref_sink(m_menu); + gtk_object_sink(GTK_OBJECT(m_menu)); - m_owner = (GtkWidget*) NULL; + m_owner = NULL; // Tearoffs are entries, just like separators. So if we want this // menu to be a tear-off one, we just append a tearoff entry @@ -832,6 +842,8 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) } else { + g_signal_connect(menuItem, "can_activate_accel", + G_CALLBACK(can_activate_accel), this); g_signal_connect (menuItem, "activate", G_CALLBACK(menuitem_activate), mitem);