X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5e6f2fe9210327222ff2e244d2722a0d3641109a..9d5507f7a2701395e1d5c121bd877bb9066ee6ea:/src/gtk/menu.cpp diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index e0f55864f5..71dc66a136 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -46,11 +46,8 @@ extern "C" static void gtk_menu_clicked_callback(GtkWidget *widget, wxMenu *menu); } -//----------------------------------------------------------------------------- -// idle system -//----------------------------------------------------------------------------- - #if wxUSE_ACCEL +static bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key); static wxString GetGtkHotKey( const wxMenuItem& item ); #endif @@ -63,12 +60,12 @@ static void DoCommonMenuCallbackCode(wxMenu *menu, wxMenuEvent& event) event.SetEventObject( menu ); wxEvtHandler* handler = menu->GetEventHandler(); - if (handler && handler->ProcessEvent(event)) + if (handler && handler->SafelyProcessEvent(event)) return; wxWindow *win = menu->GetInvokingWindow(); if (win) - win->GetEventHandler()->ProcessEvent( event ); + win->HandleWindowEvent( event ); } extern "C" { @@ -576,7 +573,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) if (item->IsCheckable()) commandEvent.SetInt(item->IsChecked()); - frame->GetEventHandler()->ProcessEvent(commandEvent); + frame->HandleWindowEvent(commandEvent); } else { @@ -604,11 +601,11 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu ) event.SetEventObject( menu ); wxEvtHandler* handler = menu->GetEventHandler(); - if (handler && handler->ProcessEvent(event)) + if (handler && handler->SafelyProcessEvent(event)) return; wxWindow *win = menu->GetInvokingWindow(); - if (win) win->GetEventHandler()->ProcessEvent( event ); + if (win) win->HandleWindowEvent( event ); } } @@ -630,12 +627,12 @@ static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu ) event.SetEventObject( menu ); wxEvtHandler* handler = menu->GetEventHandler(); - if (handler && handler->ProcessEvent(event)) + if (handler && handler->SafelyProcessEvent(event)) return; wxWindow *win = menu->GetInvokingWindow(); if (win) - win->GetEventHandler()->ProcessEvent( event ); + win->HandleWindowEvent( event ); } } @@ -844,7 +841,7 @@ void wxMenuItem::SetItemLabel( const wxString& str ) accel_key, accel_mods ); } -#endif // wxUSE_FILECTRL +#endif // wxUSE_ACCEL } // NOTE: this function is different from the similar functions GTKProcessMnemonics() @@ -1176,7 +1173,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) accel_mods, GTK_ACCEL_VISIBLE); } -#endif // wxUSE_FILECTRL +#endif // wxUSE_ACCEL if (pos == -1) gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem); @@ -1248,11 +1245,19 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) { if ( !wxMenuBase::DoRemove(item) ) - return (wxMenuItem *)NULL; + return NULL; + + GtkWidget * const mitem = item->GetMenuItem(); + if ( m_prevRadio == mitem ) + { + // deleting an item starts a new radio group (has to as we shouldn't + // keep a deleted pointer anyhow) + m_prevRadio = NULL; + } // TODO: this code doesn't delete the item factory item and this seems // impossible as of GTK 1.2.6. - gtk_widget_destroy( item->GetMenuItem() ); + gtk_widget_destroy( mitem ); return item; } @@ -1762,6 +1767,8 @@ const char *wxGetStockGtkID(wxWindowID id) return NULL; } +#if wxUSE_ACCEL +static bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key) { if (!id) @@ -1781,5 +1788,6 @@ bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key) return false; } +#endif // wxUSE_ACCEL #endif // wxUSE_MENUS