Correct wxCommandEvent.IsChecked() when generated from
a checkable menu item. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -338,32 +338,36 @@ void wxMenuItemCallback (Widget WXUNUSED(w), XtPointer clientData,
|
|||||||
wxMenuItem *item = (wxMenuItem *) clientData;
|
wxMenuItem *item = (wxMenuItem *) clientData;
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
|
||||||
|
event.SetInt( item->GetId() );
|
||||||
|
|
||||||
if (item->IsCheckable())
|
if (item->IsCheckable())
|
||||||
{
|
{
|
||||||
Boolean isChecked = FALSE;
|
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
|
// only set the flag, don't actually check anything
|
||||||
item->wxMenuItemBase::Check(isChecked);
|
item->wxMenuItemBase::Check(isChecked);
|
||||||
|
event.SetInt(isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetMenuBar() && item->GetMenuBar()->GetMenuBarFrame())
|
if (item->GetMenuBar() && item->GetMenuBar()->GetMenuBarFrame())
|
||||||
{
|
{
|
||||||
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
|
event.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
||||||
commandEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
|
||||||
commandEvent.SetInt( item->GetId() );
|
|
||||||
|
|
||||||
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(commandEvent);
|
item->GetMenuBar()->GetMenuBarFrame()
|
||||||
|
->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
// this is the child of a popup menu
|
// this is the child of a popup menu
|
||||||
else if (item->GetTopMenu())
|
else if (item->GetTopMenu())
|
||||||
{
|
{
|
||||||
wxCommandEvent event (wxEVT_COMMAND_MENU_SELECTED, item->GetId());
|
|
||||||
event.SetEventObject(item->GetTopMenu());
|
event.SetEventObject(item->GetTopMenu());
|
||||||
event.SetInt( item->GetId() );
|
|
||||||
|
|
||||||
item->GetTopMenu()->ProcessCommand (event);
|
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
|
// button events after it was closed, we need to delete
|
||||||
// the associated widgets to allow next PopUpMenu to
|
// the associated widgets to allow next PopUpMenu to
|
||||||
// appear; this needs to be done there because doing it in
|
// 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());
|
wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, item->GetId());
|
||||||
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
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);
|
wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, -1);
|
||||||
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
||||||
|
|
||||||
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
|
item->GetMenuBar()->GetMenuBarFrame()
|
||||||
|
->GetEventHandler()->ProcessEvent(menuEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user