Send menu highlight events and fix statusbar to update immediatly when
status text is changed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -290,6 +290,7 @@ void wxApp::MacNewFile()
|
||||
|
||||
{ kEventClassMenu, kEventMenuOpening },
|
||||
{ kEventClassMenu, kEventMenuClosed },
|
||||
{ kEventClassMenu, kEventMenuTargetItem },
|
||||
|
||||
{ kEventClassApplication , kEventAppActivated } ,
|
||||
{ kEventClassApplication , kEventAppDeactivated } ,
|
||||
@@ -308,8 +309,9 @@ void wxApp::MacNewFile()
|
||||
static pascal OSStatus
|
||||
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
{
|
||||
// FIXME: this doesn't work for multiple windows
|
||||
wxWindow *win = wxTheApp->GetTopWindow();
|
||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
|
||||
wxFrame* win = mbar->GetFrame();
|
||||
|
||||
if ( win )
|
||||
{
|
||||
// VZ: we could find the menu from its handle here by examining all
|
||||
@@ -325,9 +327,29 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||
&menuRef);
|
||||
#endif // 0
|
||||
|
||||
wxMenuEvent wxevent(GetEventKind(event) == kEventMenuOpening
|
||||
? wxEVT_MENU_OPEN
|
||||
: wxEVT_MENU_CLOSE);
|
||||
wxEventType type=0;
|
||||
MenuCommand cmd=0;
|
||||
switch (GetEventKind(event))
|
||||
{
|
||||
case kEventMenuOpening:
|
||||
type = wxEVT_MENU_OPEN;
|
||||
break;
|
||||
case kEventMenuClosed:
|
||||
type = wxEVT_MENU_CLOSE;
|
||||
break;
|
||||
case kEventMenuTargetItem:
|
||||
type = wxEVT_MENU_HIGHLIGHT;
|
||||
GetEventParameter(event, kEventParamMenuCommand,
|
||||
typeMenuCommand, NULL,
|
||||
sizeof(cmd), NULL, &cmd);
|
||||
if (cmd == 0) return eventNotHandledErr;
|
||||
break;
|
||||
default:
|
||||
wxFAIL_MSG(wxT("Unexpected menu event kind"));
|
||||
break;
|
||||
}
|
||||
|
||||
wxMenuEvent wxevent(type, cmd);
|
||||
wxevent.SetEventObject(win);
|
||||
|
||||
(void)win->GetEventHandler()->ProcessEvent(wxevent);
|
||||
|
Reference in New Issue
Block a user