Fix menu event propogation to be consistent across platforms, and with
the docs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19968 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -182,16 +182,16 @@ short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply))
|
|||||||
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = AECountItems(&docList, &itemsInList);
|
err = AECountItems(&docList, &itemsInList);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
ProcessSerialNumber PSN ;
|
ProcessSerialNumber PSN ;
|
||||||
PSN.highLongOfPSN = 0 ;
|
PSN.highLongOfPSN = 0 ;
|
||||||
PSN.lowLongOfPSN = kCurrentProcess ;
|
PSN.lowLongOfPSN = kCurrentProcess ;
|
||||||
SetFrontProcess( &PSN ) ;
|
SetFrontProcess( &PSN ) ;
|
||||||
|
|
||||||
for (i = 1; i <= itemsInList; i++) {
|
for (i = 1; i <= itemsInList; i++) {
|
||||||
AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
|
AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
|
||||||
(Ptr) & theSpec, sizeof(theSpec), &actualSize);
|
(Ptr) & theSpec, sizeof(theSpec), &actualSize);
|
||||||
@@ -214,16 +214,16 @@ short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply)
|
|||||||
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = AECountItems(&docList, &itemsInList);
|
err = AECountItems(&docList, &itemsInList);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
ProcessSerialNumber PSN ;
|
ProcessSerialNumber PSN ;
|
||||||
PSN.highLongOfPSN = 0 ;
|
PSN.highLongOfPSN = 0 ;
|
||||||
PSN.lowLongOfPSN = kCurrentProcess ;
|
PSN.lowLongOfPSN = kCurrentProcess ;
|
||||||
SetFrontProcess( &PSN ) ;
|
SetFrontProcess( &PSN ) ;
|
||||||
|
|
||||||
for (i = 1; i <= itemsInList; i++) {
|
for (i = 1; i <= itemsInList; i++) {
|
||||||
AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
|
AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
|
||||||
(Ptr) & theSpec, sizeof(theSpec), &actualSize);
|
(Ptr) & theSpec, sizeof(theSpec), &actualSize);
|
||||||
@@ -1375,7 +1375,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
// having a larger value here leads to large performance slowdowns
|
// having a larger value here leads to large performance slowdowns
|
||||||
// so we cannot give background apps more processor time here
|
// so we cannot give background apps more processor time here
|
||||||
// we do so however having a large sleep value in the main event loop
|
// we do so however having a large sleep value in the main event loop
|
||||||
sleepTime = 0 ;
|
sleepTime = 0 ;
|
||||||
|
|
||||||
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
|
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
|
||||||
{
|
{
|
||||||
@@ -1498,7 +1498,7 @@ void wxApp::MacHandleModifierEvents( WXEVENTREF evr )
|
|||||||
WaitNextEvent( 0 , &nev , 0 , NULL ) ;
|
WaitNextEvent( 0 , &nev , 0 , NULL ) ;
|
||||||
ev->modifiers = nev.modifiers ;
|
ev->modifiers = nev.modifiers ;
|
||||||
// KeyModifiers unfortunately don't include btnState...
|
// KeyModifiers unfortunately don't include btnState...
|
||||||
// ev->modifiers = GetCurrentKeyModifiers() ;
|
// ev->modifiers = GetCurrentKeyModifiers() ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ( ev->modifiers != s_lastModifiers && wxWindow::FindFocus() != NULL )
|
if ( ev->modifiers != s_lastModifiers && wxWindow::FindFocus() != NULL )
|
||||||
@@ -1692,8 +1692,8 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr )
|
|||||||
&constraintRect , &newContentRect ) ;
|
&constraintRect , &newContentRect ) ;
|
||||||
if ( growResult )
|
if ( growResult )
|
||||||
{
|
{
|
||||||
win->SetSize( newContentRect.left , newContentRect.top ,
|
win->SetSize( newContentRect.left , newContentRect.top ,
|
||||||
newContentRect.right - newContentRect.left ,
|
newContentRect.right - newContentRect.left ,
|
||||||
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
|
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
|
||||||
}
|
}
|
||||||
s_lastMouseDown = 0;
|
s_lastMouseDown = 0;
|
||||||
@@ -1732,7 +1732,7 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr )
|
|||||||
GrafPtr port ;
|
GrafPtr port ;
|
||||||
GetPort( &port ) ;
|
GetPort( &port ) ;
|
||||||
SetPortWindowPort(window) ;
|
SetPortWindowPort(window) ;
|
||||||
|
|
||||||
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
|
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
|
||||||
{
|
{
|
||||||
if ( s_macIsInModalLoop )
|
if ( s_macIsInModalLoop )
|
||||||
@@ -1920,7 +1920,7 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxWindow* focus = wxWindow::FindFocus() ;
|
wxWindow* focus = wxWindow::FindFocus() ;
|
||||||
|
|
||||||
if ( MacSendKeyDownEvent( focus , ev->message , ev->modifiers , ev->when , ev->where.h , ev->where.v ) == false )
|
if ( MacSendKeyDownEvent( focus , ev->message , ev->modifiers , ev->when , ev->where.h , ev->where.v ) == false )
|
||||||
{
|
{
|
||||||
// has not been handled -> perform default
|
// has not been handled -> perform default
|
||||||
@@ -1941,12 +1941,12 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
|
|||||||
{
|
{
|
||||||
if ( !focus )
|
if ( !focus )
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
short keycode ;
|
short keycode ;
|
||||||
short keychar ;
|
short keychar ;
|
||||||
keychar = short(keymessage & charCodeMask);
|
keychar = short(keymessage & charCodeMask);
|
||||||
keycode = short(keymessage & keyCodeMask) >> 8 ;
|
keycode = short(keymessage & keyCodeMask) >> 8 ;
|
||||||
|
|
||||||
if ( modifiers & ( controlKey|shiftKey|optionKey ) )
|
if ( modifiers & ( controlKey|shiftKey|optionKey ) )
|
||||||
{
|
{
|
||||||
// control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier
|
// control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier
|
||||||
@@ -1964,7 +1964,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
|
|||||||
realkeyval = short(keymessage & charCodeMask) ;
|
realkeyval = short(keymessage & charCodeMask) ;
|
||||||
keyval = wxToupper( keyval ) ;
|
keyval = wxToupper( keyval ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxKeyEvent event(wxEVT_KEY_DOWN);
|
wxKeyEvent event(wxEVT_KEY_DOWN);
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
event.m_shiftDown = modifiers & shiftKey;
|
event.m_shiftDown = modifiers & shiftKey;
|
||||||
@@ -2105,7 +2105,7 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
|
|||||||
|
|
||||||
if ( keyval == keychar )
|
if ( keyval == keychar )
|
||||||
{
|
{
|
||||||
keyval = wxToupper( keyval ) ;
|
keyval = wxToupper( keyval ) ;
|
||||||
}
|
}
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
|
|
||||||
@@ -2305,9 +2305,9 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPart = ::FindWindow(ev->where, &window);
|
windowPart = ::FindWindow(ev->where, &window);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
case inContent :
|
case inContent :
|
||||||
@@ -2363,28 +2363,12 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
|||||||
MenuCommand id ;
|
MenuCommand id ;
|
||||||
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
||||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
||||||
wxMenu* menu = NULL ;
|
wxFrame* frame = mbar->GetFrame();
|
||||||
wxMenuItem* item = NULL ;
|
wxCHECK_RET( mbar != NULL && frame != NULL, wxT("error in menu item callback") );
|
||||||
if ( mbar )
|
if ( frame )
|
||||||
{
|
{
|
||||||
item = mbar->FindItem( id , &menu ) ;
|
frame->ProcessCommand(id);
|
||||||
}
|
}
|
||||||
wxCHECK_RET( item != NULL && menu != NULL && mbar != NULL, wxT("error in menu item callback") );
|
|
||||||
|
|
||||||
if (item->IsCheckable())
|
|
||||||
{
|
|
||||||
item->Check( !item->IsChecked() ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
|
||||||
/*
|
|
||||||
wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ;
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
|
|
||||||
event.m_timeStamp = ((EventRecord*) MacGetCurrentEvent())->when ;
|
|
||||||
event.SetEventObject(menu);
|
|
||||||
event.SetInt(item->IsCheckable() ? item->IsChecked() : -1);
|
|
||||||
frontwindow->GetEventHandler()->ProcessEvent(event);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
@@ -182,16 +182,16 @@ short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply))
|
|||||||
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = AECountItems(&docList, &itemsInList);
|
err = AECountItems(&docList, &itemsInList);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
ProcessSerialNumber PSN ;
|
ProcessSerialNumber PSN ;
|
||||||
PSN.highLongOfPSN = 0 ;
|
PSN.highLongOfPSN = 0 ;
|
||||||
PSN.lowLongOfPSN = kCurrentProcess ;
|
PSN.lowLongOfPSN = kCurrentProcess ;
|
||||||
SetFrontProcess( &PSN ) ;
|
SetFrontProcess( &PSN ) ;
|
||||||
|
|
||||||
for (i = 1; i <= itemsInList; i++) {
|
for (i = 1; i <= itemsInList; i++) {
|
||||||
AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
|
AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
|
||||||
(Ptr) & theSpec, sizeof(theSpec), &actualSize);
|
(Ptr) & theSpec, sizeof(theSpec), &actualSize);
|
||||||
@@ -214,16 +214,16 @@ short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply)
|
|||||||
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = AECountItems(&docList, &itemsInList);
|
err = AECountItems(&docList, &itemsInList);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
ProcessSerialNumber PSN ;
|
ProcessSerialNumber PSN ;
|
||||||
PSN.highLongOfPSN = 0 ;
|
PSN.highLongOfPSN = 0 ;
|
||||||
PSN.lowLongOfPSN = kCurrentProcess ;
|
PSN.lowLongOfPSN = kCurrentProcess ;
|
||||||
SetFrontProcess( &PSN ) ;
|
SetFrontProcess( &PSN ) ;
|
||||||
|
|
||||||
for (i = 1; i <= itemsInList; i++) {
|
for (i = 1; i <= itemsInList; i++) {
|
||||||
AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
|
AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
|
||||||
(Ptr) & theSpec, sizeof(theSpec), &actualSize);
|
(Ptr) & theSpec, sizeof(theSpec), &actualSize);
|
||||||
@@ -1375,7 +1375,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
// having a larger value here leads to large performance slowdowns
|
// having a larger value here leads to large performance slowdowns
|
||||||
// so we cannot give background apps more processor time here
|
// so we cannot give background apps more processor time here
|
||||||
// we do so however having a large sleep value in the main event loop
|
// we do so however having a large sleep value in the main event loop
|
||||||
sleepTime = 0 ;
|
sleepTime = 0 ;
|
||||||
|
|
||||||
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
|
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
|
||||||
{
|
{
|
||||||
@@ -1498,7 +1498,7 @@ void wxApp::MacHandleModifierEvents( WXEVENTREF evr )
|
|||||||
WaitNextEvent( 0 , &nev , 0 , NULL ) ;
|
WaitNextEvent( 0 , &nev , 0 , NULL ) ;
|
||||||
ev->modifiers = nev.modifiers ;
|
ev->modifiers = nev.modifiers ;
|
||||||
// KeyModifiers unfortunately don't include btnState...
|
// KeyModifiers unfortunately don't include btnState...
|
||||||
// ev->modifiers = GetCurrentKeyModifiers() ;
|
// ev->modifiers = GetCurrentKeyModifiers() ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ( ev->modifiers != s_lastModifiers && wxWindow::FindFocus() != NULL )
|
if ( ev->modifiers != s_lastModifiers && wxWindow::FindFocus() != NULL )
|
||||||
@@ -1692,8 +1692,8 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr )
|
|||||||
&constraintRect , &newContentRect ) ;
|
&constraintRect , &newContentRect ) ;
|
||||||
if ( growResult )
|
if ( growResult )
|
||||||
{
|
{
|
||||||
win->SetSize( newContentRect.left , newContentRect.top ,
|
win->SetSize( newContentRect.left , newContentRect.top ,
|
||||||
newContentRect.right - newContentRect.left ,
|
newContentRect.right - newContentRect.left ,
|
||||||
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
|
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
|
||||||
}
|
}
|
||||||
s_lastMouseDown = 0;
|
s_lastMouseDown = 0;
|
||||||
@@ -1732,7 +1732,7 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr )
|
|||||||
GrafPtr port ;
|
GrafPtr port ;
|
||||||
GetPort( &port ) ;
|
GetPort( &port ) ;
|
||||||
SetPortWindowPort(window) ;
|
SetPortWindowPort(window) ;
|
||||||
|
|
||||||
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
|
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
|
||||||
{
|
{
|
||||||
if ( s_macIsInModalLoop )
|
if ( s_macIsInModalLoop )
|
||||||
@@ -1920,7 +1920,7 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxWindow* focus = wxWindow::FindFocus() ;
|
wxWindow* focus = wxWindow::FindFocus() ;
|
||||||
|
|
||||||
if ( MacSendKeyDownEvent( focus , ev->message , ev->modifiers , ev->when , ev->where.h , ev->where.v ) == false )
|
if ( MacSendKeyDownEvent( focus , ev->message , ev->modifiers , ev->when , ev->where.h , ev->where.v ) == false )
|
||||||
{
|
{
|
||||||
// has not been handled -> perform default
|
// has not been handled -> perform default
|
||||||
@@ -1941,12 +1941,12 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
|
|||||||
{
|
{
|
||||||
if ( !focus )
|
if ( !focus )
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
short keycode ;
|
short keycode ;
|
||||||
short keychar ;
|
short keychar ;
|
||||||
keychar = short(keymessage & charCodeMask);
|
keychar = short(keymessage & charCodeMask);
|
||||||
keycode = short(keymessage & keyCodeMask) >> 8 ;
|
keycode = short(keymessage & keyCodeMask) >> 8 ;
|
||||||
|
|
||||||
if ( modifiers & ( controlKey|shiftKey|optionKey ) )
|
if ( modifiers & ( controlKey|shiftKey|optionKey ) )
|
||||||
{
|
{
|
||||||
// control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier
|
// control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier
|
||||||
@@ -1964,7 +1964,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
|
|||||||
realkeyval = short(keymessage & charCodeMask) ;
|
realkeyval = short(keymessage & charCodeMask) ;
|
||||||
keyval = wxToupper( keyval ) ;
|
keyval = wxToupper( keyval ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxKeyEvent event(wxEVT_KEY_DOWN);
|
wxKeyEvent event(wxEVT_KEY_DOWN);
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
event.m_shiftDown = modifiers & shiftKey;
|
event.m_shiftDown = modifiers & shiftKey;
|
||||||
@@ -2105,7 +2105,7 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
|
|||||||
|
|
||||||
if ( keyval == keychar )
|
if ( keyval == keychar )
|
||||||
{
|
{
|
||||||
keyval = wxToupper( keyval ) ;
|
keyval = wxToupper( keyval ) ;
|
||||||
}
|
}
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
|
|
||||||
@@ -2305,9 +2305,9 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPart = ::FindWindow(ev->where, &window);
|
windowPart = ::FindWindow(ev->where, &window);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
case inContent :
|
case inContent :
|
||||||
@@ -2363,28 +2363,12 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
|||||||
MenuCommand id ;
|
MenuCommand id ;
|
||||||
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
||||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
||||||
wxMenu* menu = NULL ;
|
wxFrame* frame = mbar->GetFrame();
|
||||||
wxMenuItem* item = NULL ;
|
wxCHECK_RET( mbar != NULL && frame != NULL, wxT("error in menu item callback") );
|
||||||
if ( mbar )
|
if ( frame )
|
||||||
{
|
{
|
||||||
item = mbar->FindItem( id , &menu ) ;
|
frame->ProcessCommand(id);
|
||||||
}
|
}
|
||||||
wxCHECK_RET( item != NULL && menu != NULL && mbar != NULL, wxT("error in menu item callback") );
|
|
||||||
|
|
||||||
if (item->IsCheckable())
|
|
||||||
{
|
|
||||||
item->Check( !item->IsChecked() ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
|
||||||
/*
|
|
||||||
wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ;
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
|
|
||||||
event.m_timeStamp = ((EventRecord*) MacGetCurrentEvent())->when ;
|
|
||||||
event.SetEventObject(menu);
|
|
||||||
event.SetInt(item->IsCheckable() ? item->IsChecked() : -1);
|
|
||||||
frontwindow->GetEventHandler()->ProcessEvent(event);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
@@ -384,11 +384,12 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y)
|
|||||||
MenuCommand id ;
|
MenuCommand id ;
|
||||||
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ;
|
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
|
wxMenuItem* item = menu->FindChildItem(id);
|
||||||
event.m_timeStamp = TickCount() ;
|
if (item->IsCheckable())
|
||||||
event.SetEventObject(this->GetEventHandler());
|
{
|
||||||
event.SetInt( id );
|
item->Check( !item->IsChecked() );
|
||||||
GetEventHandler()->ProcessEvent(event);
|
}
|
||||||
|
menu->SendEvent(id, item->IsCheckable() ? item->IsChecked() : -1);
|
||||||
}
|
}
|
||||||
::DeleteMenu( menu->MacGetMenuId() ) ;
|
::DeleteMenu( menu->MacGetMenuId() ) ;
|
||||||
menu->SetInvokingWindow(NULL);
|
menu->SetInvokingWindow(NULL);
|
||||||
|
@@ -384,11 +384,12 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y)
|
|||||||
MenuCommand id ;
|
MenuCommand id ;
|
||||||
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ;
|
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
|
wxMenuItem* item = menu->FindChildItem(id);
|
||||||
event.m_timeStamp = TickCount() ;
|
if (item->IsCheckable())
|
||||||
event.SetEventObject(this->GetEventHandler());
|
{
|
||||||
event.SetInt( id );
|
item->Check( !item->IsChecked() );
|
||||||
GetEventHandler()->ProcessEvent(event);
|
}
|
||||||
|
menu->SendEvent(id, item->IsCheckable() ? item->IsChecked() : -1);
|
||||||
}
|
}
|
||||||
::DeleteMenu( menu->MacGetMenuId() ) ;
|
::DeleteMenu( menu->MacGetMenuId() ) ;
|
||||||
menu->SetInvokingWindow(NULL);
|
menu->SetInvokingWindow(NULL);
|
||||||
|
Reference in New Issue
Block a user