]> git.saurik.com Git - wxWidgets.git/commitdiff
Avoid code duplication in wxGTK menu events generation code.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Apr 2010 15:07:51 +0000 (15:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Apr 2010 15:07:51 +0000 (15:07 +0000)
Reuse the existing DoCommonMenuCallbackCode() function instead of duplicating
its code in menuitem_select() and menuitem_deselect() GTK callbacks.

No changes in behaviour.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/menu.cpp

index ebf2073c799d0a22081e408a1ac196e393fb9e31..55fc27dbca442fafaed99a8feb5e37880e68a38f 100644 (file)
@@ -501,16 +501,8 @@ static void menuitem_select(GtkWidget*, wxMenuItem* item)
     if (!item->IsEnabled())
         return;
 
-    wxMenu* menu = item->GetMenu();
     wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item->GetId());
-    event.SetEventObject( menu );
-
-    wxEvtHandler* handler = menu->GetEventHandler();
-    if (handler && handler->SafelyProcessEvent(event))
-        return;
-
-    wxWindow *win = menu->GetInvokingWindow();
-    if (win) win->HandleWindowEvent( event );
+    DoCommonMenuCallbackCode(item->GetMenu(), event);
 }
 }
 
@@ -524,17 +516,8 @@ static void menuitem_deselect(GtkWidget*, wxMenuItem* item)
     if (!item->IsEnabled())
         return;
 
-    wxMenu* menu = item->GetMenu();
     wxMenuEvent event( wxEVT_MENU_HIGHLIGHT, -1 );
-    event.SetEventObject( menu );
-
-    wxEvtHandler* handler = menu->GetEventHandler();
-    if (handler && handler->SafelyProcessEvent(event))
-        return;
-
-    wxWindow *win = menu->GetInvokingWindow();
-    if (win)
-        win->HandleWindowEvent( event );
+    DoCommonMenuCallbackCode(item->GetMenu(), event);
 }
 }