Correction to my new menu code: handle submenus on menubar menus
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19970 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
6568015373
commit
02822c8cdf
@ -701,11 +701,23 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
||||
if (!menu->IsEnabled(id))
|
||||
return;
|
||||
|
||||
if ( menu->IsAttached() ) // is this menu on a menubar?
|
||||
// Is this menu on a menubar? (possibly nested)
|
||||
wxFrame* frame = NULL;
|
||||
wxMenu* pm = menu;
|
||||
while ( pm && !frame )
|
||||
{
|
||||
if ( pm->IsAttached() )
|
||||
frame = pm->GetMenuBar()->GetFrame();
|
||||
else
|
||||
pm = pm->GetParent();
|
||||
}
|
||||
|
||||
// If it is then let the frame send the event
|
||||
if (frame)
|
||||
{
|
||||
wxFrame* frame = menu->GetMenuBar()->GetFrame();
|
||||
frame->ProcessCommand(id);
|
||||
}
|
||||
// otherwise let the menu have it
|
||||
else
|
||||
{
|
||||
wxMenuItem* item = menu->FindChildItem( id );
|
||||
|
@ -701,11 +701,23 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
||||
if (!menu->IsEnabled(id))
|
||||
return;
|
||||
|
||||
if ( menu->IsAttached() ) // is this menu on a menubar?
|
||||
// Is this menu on a menubar? (possibly nested)
|
||||
wxFrame* frame = NULL;
|
||||
wxMenu* pm = menu;
|
||||
while ( pm && !frame )
|
||||
{
|
||||
if ( pm->IsAttached() )
|
||||
frame = pm->GetMenuBar()->GetFrame();
|
||||
else
|
||||
pm = pm->GetParent();
|
||||
}
|
||||
|
||||
// If it is then let the frame send the event
|
||||
if (frame)
|
||||
{
|
||||
wxFrame* frame = menu->GetMenuBar()->GetFrame();
|
||||
frame->ProcessCommand(id);
|
||||
}
|
||||
// otherwise let the menu have it
|
||||
else
|
||||
{
|
||||
wxMenuItem* item = menu->FindChildItem( id );
|
||||
|
Loading…
Reference in New Issue
Block a user