Avoid code duplication in wxGTK menu events generation code.

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
This commit is contained in:
Vadim Zeitlin 2010-04-24 15:07:51 +00:00
parent 6ea0139862
commit 341d8cb2cf

View 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);
}
}