]> git.saurik.com Git - wxWidgets.git/commitdiff
Correct wxCommandEvent.IsChecked() when generated from
authorMattia Barbon <mbarbon@cpan.org>
Thu, 22 May 2003 20:39:28 +0000 (20:39 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Thu, 22 May 2003 20:39:28 +0000 (20:39 +0000)
a checkable menu item.

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

src/motif/menuitem.cpp

index 6df0931d6cdd358ae66146a5559cc3adc69c7da1..6283b0bb93b8ddb3ca16d9099c43ca7d4be3009b 100644 (file)
@@ -338,32 +338,36 @@ void wxMenuItemCallback (Widget WXUNUSED(w), XtPointer clientData,
     wxMenuItem *item = (wxMenuItem *) clientData;
     if (item)
     {
+        wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
+        event.SetInt( item->GetId() );
+
         if (item->IsCheckable())
         {
             Boolean isChecked = FALSE;
-            XtVaGetValues ((Widget) item->GetButtonWidget(), XmNset, & isChecked, NULL);
+            XtVaGetValues ((Widget) item->GetButtonWidget(),
+                           XmNset, & isChecked,
+                           NULL);
 
             // only set the flag, don't actually check anything
             item->wxMenuItemBase::Check(isChecked);
+            event.SetInt(isChecked);
         }
+
         if (item->GetMenuBar() && item->GetMenuBar()->GetMenuBarFrame())
         {
-            wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
-            commandEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
-            commandEvent.SetInt( item->GetId() );
+            event.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
 
-            item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(commandEvent);
+            item->GetMenuBar()->GetMenuBarFrame()
+                ->GetEventHandler()->ProcessEvent(event);
         }
         // this is the child of a popup menu
         else if (item->GetTopMenu())
         {
-            wxCommandEvent event (wxEVT_COMMAND_MENU_SELECTED, item->GetId());
             event.SetEventObject(item->GetTopMenu());
-            event.SetInt( item->GetId() );
 
             item->GetTopMenu()->ProcessCommand (event);
 
-            // Since PopupMenu under Motif stills grab right mouse
+            // Since PopupMenu under Motif still grab right mouse
             // button events after it was closed, we need to delete
             // the associated widgets to allow next PopUpMenu to
             // appear; this needs to be done there because doing it in
@@ -385,7 +389,8 @@ void wxMenuItemArmCallback (Widget WXUNUSED(w), XtPointer clientData,
             wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, item->GetId());
             menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
 
-            item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
+            item->GetMenuBar()->GetMenuBarFrame()
+                ->GetEventHandler()->ProcessEvent(menuEvent);
         }
     }
 }
@@ -404,7 +409,8 @@ wxMenuItemDisarmCallback (Widget WXUNUSED(w), XtPointer clientData,
             wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, -1);
             menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
 
-            item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
+            item->GetMenuBar()->GetMenuBarFrame()
+                ->GetEventHandler()->ProcessEvent(menuEvent);
         }
     }
 }