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:
@@ -701,11 +701,23 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
|||||||
if (!menu->IsEnabled(id))
|
if (!menu->IsEnabled(id))
|
||||||
return;
|
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);
|
frame->ProcessCommand(id);
|
||||||
}
|
}
|
||||||
|
// otherwise let the menu have it
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMenuItem* item = menu->FindChildItem( id );
|
wxMenuItem* item = menu->FindChildItem( id );
|
||||||
|
@@ -701,11 +701,23 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
|||||||
if (!menu->IsEnabled(id))
|
if (!menu->IsEnabled(id))
|
||||||
return;
|
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);
|
frame->ProcessCommand(id);
|
||||||
}
|
}
|
||||||
|
// otherwise let the menu have it
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMenuItem* item = menu->FindChildItem( id );
|
wxMenuItem* item = menu->FindChildItem( id );
|
||||||
|
Reference in New Issue
Block a user