]> git.saurik.com Git - wxWidgets.git/commitdiff
Use wxMenuBase:SendEvent() to emit event, shoudl also fix #801: Menu cmd events:...
authorRobert Roebling <robert@roebling.de>
Sat, 21 Jun 2008 15:03:44 +0000 (15:03 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 21 Jun 2008 15:03:44 +0000 (15:03 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/menu.cpp

index 634dae20a1b2ad570b39bc659b606ac0050e08ba..782c17ce7bea190acac0f7c26cfeba8df074d773 100644 (file)
@@ -488,34 +488,8 @@ static void menuitem_activate(GtkWidget*, wxMenuItem* item)
         }
     }
 
-
-    // Is this menu on a menubar?  (possibly nested)
     wxMenu* menu = item->GetMenu();
-    wxFrame* frame = NULL;
-    if(menu->IsAttached())
-        frame = menu->GetMenuBar()->GetFrame();
-
-    // FIXME: why do we have to call wxFrame::GetEventHandler() directly here?
-    //        normally wxMenu::SendEvent() should be enough, if it doesn't work
-    //        in wxGTK then we have a bug in wxMenu::GetInvokingWindow() which
-    //        should be fixed instead of working around it here...
-    if (frame)
-    {
-        // If it is attached then let the frame send the event.
-        // Don't call frame->ProcessCommand(id) because it toggles
-        // checkable items and we've already done that above.
-        wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
-        commandEvent.SetEventObject(frame);
-        if (item->IsCheckable())
-            commandEvent.SetInt(item->IsChecked());
-
-        frame->HandleWindowEvent(commandEvent);
-    }
-    else
-    {
-        // otherwise let the menu have it
-        menu->SendEvent(id, item->IsCheckable() ? item->IsChecked() : -1);
-    }
+    menu->SendEvent(id, item->IsCheckable() ? item->IsChecked() : -1);
 }
 }