switched menu handling to command ids
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -101,6 +101,8 @@ long wxApp::s_lastModifiers = 0 ;
|
||||
bool wxApp::s_macDefaultEncodingIsPC = true ;
|
||||
bool wxApp::s_macSupportPCMenuShortcuts = true ;
|
||||
long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
|
||||
long wxApp::s_macPreferencesMenuItemId = 0 ;
|
||||
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
|
||||
wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
|
||||
|
||||
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
|
||||
@@ -2314,35 +2316,14 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuCommand id ;
|
||||
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
||||
wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ;
|
||||
if ( frontwindow && wxMenuBar::MacGetInstalledMenuBar() )
|
||||
wxMenuBar::MacGetInstalledMenuBar()->MacMenuSelect( frontwindow->GetEventHandler() , 0 , macMenuId , macMenuItemNum ) ;
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
|
||||
event.m_timeStamp = ((EventRecord*) MacGetCurrentEvent())->when ;
|
||||
event.SetEventObject(frontwindow->GetEventHandler());
|
||||
event.SetInt( id );
|
||||
frontwindow->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
HiliteMenu(0);
|
||||
}
|
||||
|
||||
/*
|
||||
long wxApp::MacTranslateKey(char key, int mods)
|
||||
{
|
||||
}
|
||||
|
||||
void wxApp::MacAdjustCursor()
|
||||
{
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
void
|
||||
wxApp::macAdjustCursor()
|
||||
{
|
||||
if (ev->what != kHighLevelEvent)
|
||||
{
|
||||
wxWindow* theMacWxFrame = wxFrame::MacFindFrameOrDialog(::FrontWindow());
|
||||
if (theMacWxFrame)
|
||||
{
|
||||
if (!theMacWxFrame->MacAdjustCursor(ev->where))
|
||||
::SetCursor(&(qd.arrow));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@@ -101,6 +101,8 @@ long wxApp::s_lastModifiers = 0 ;
|
||||
bool wxApp::s_macDefaultEncodingIsPC = true ;
|
||||
bool wxApp::s_macSupportPCMenuShortcuts = true ;
|
||||
long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
|
||||
long wxApp::s_macPreferencesMenuItemId = 0 ;
|
||||
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
|
||||
wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
|
||||
|
||||
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
|
||||
@@ -2314,35 +2316,14 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuCommand id ;
|
||||
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
||||
wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ;
|
||||
if ( frontwindow && wxMenuBar::MacGetInstalledMenuBar() )
|
||||
wxMenuBar::MacGetInstalledMenuBar()->MacMenuSelect( frontwindow->GetEventHandler() , 0 , macMenuId , macMenuItemNum ) ;
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
|
||||
event.m_timeStamp = ((EventRecord*) MacGetCurrentEvent())->when ;
|
||||
event.SetEventObject(frontwindow->GetEventHandler());
|
||||
event.SetInt( id );
|
||||
frontwindow->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
HiliteMenu(0);
|
||||
}
|
||||
|
||||
/*
|
||||
long wxApp::MacTranslateKey(char key, int mods)
|
||||
{
|
||||
}
|
||||
|
||||
void wxApp::MacAdjustCursor()
|
||||
{
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
void
|
||||
wxApp::macAdjustCursor()
|
||||
{
|
||||
if (ev->what != kHighLevelEvent)
|
||||
{
|
||||
wxWindow* theMacWxFrame = wxFrame::MacFindFrameOrDialog(::FrontWindow());
|
||||
if (theMacWxFrame)
|
||||
{
|
||||
if (!theMacWxFrame->MacAdjustCursor(ev->where))
|
||||
::SetCursor(&(qd.arrow));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@@ -209,10 +209,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
if ( pos == (size_t)-1 )
|
||||
{
|
||||
UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), label,key,modifiers);
|
||||
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , CountMenuItems(MAC_WXHMENU(m_hMenu)) , pItem->GetId() ) ;
|
||||
if ( pItem->GetBitmap().Ok() )
|
||||
{
|
||||
ControlButtonContentInfo info ;
|
||||
wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ;
|
||||
wxMacCreateBitmapButton( &info , pItem->GetBitmap() , kControlContentCIconHandle ) ;
|
||||
if ( info.contentType != kControlNoContent )
|
||||
{
|
||||
if ( info.contentType == kControlContentCIconHandle )
|
||||
@@ -225,10 +226,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
else
|
||||
{
|
||||
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers);
|
||||
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
|
||||
if ( pItem->GetBitmap().Ok() )
|
||||
{
|
||||
ControlButtonContentInfo info ;
|
||||
wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ;
|
||||
wxMacCreateBitmapButton( &info , pItem->GetBitmap() , kControlContentCIconHandle ) ;
|
||||
if ( info.contentType != kControlNoContent )
|
||||
{
|
||||
if ( info.contentType == kControlContentCIconHandle )
|
||||
@@ -429,114 +431,6 @@ void wxMenu::MacEnableMenu( bool bDoEnable )
|
||||
::DrawMenuBar() ;
|
||||
}
|
||||
|
||||
bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum )
|
||||
{
|
||||
int pos;
|
||||
wxNode *node;
|
||||
|
||||
if ( m_macMenuId == macMenuId )
|
||||
{
|
||||
node = GetMenuItems().Nth(macMenuItemNum-1);
|
||||
if (node)
|
||||
{
|
||||
wxMenuItem *pItem = (wxMenuItem*)node->Data();
|
||||
|
||||
if (pItem->IsCheckable())
|
||||
pItem->Check(! pItem->IsChecked());
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
|
||||
event.m_timeStamp = when;
|
||||
event.SetEventObject(handler);
|
||||
event.SetInt( pItem->GetId() );
|
||||
{
|
||||
bool processed = false ;
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
// Try a callback
|
||||
if (m_callback)
|
||||
{
|
||||
(void) (*(m_callback)) (*this, event);
|
||||
processed = TRUE;
|
||||
}
|
||||
#endif
|
||||
// Try the menu's event handler
|
||||
if ( !processed && handler)
|
||||
{
|
||||
processed = handler->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// Try the window the menu was popped up from (and up
|
||||
// through the hierarchy)
|
||||
if ( !processed && GetInvokingWindow())
|
||||
processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
else if ( macMenuId == kHMHelpMenuID )
|
||||
{
|
||||
int menuItem = firstUserHelpMenuItem-1 ;
|
||||
for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++)
|
||||
{
|
||||
wxMenuItem * pItem = (wxMenuItem *) node->Data() ;
|
||||
|
||||
wxMenu *pSubMenu = pItem->GetSubMenu() ;
|
||||
if ( pSubMenu != NULL )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( pItem->GetId() != wxApp::s_macAboutMenuItemId )
|
||||
++menuItem ;
|
||||
|
||||
if ( menuItem == macMenuItemNum )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
|
||||
event.m_timeStamp = when;
|
||||
event.SetEventObject(handler);
|
||||
event.SetInt( pItem->GetId() );
|
||||
{
|
||||
bool processed = false ;
|
||||
#if WXWIN_COMPATIBILITY
|
||||
// Try a callback
|
||||
if (m_callback)
|
||||
{
|
||||
(void) (*(m_callback)) (*this, event);
|
||||
processed = TRUE;
|
||||
}
|
||||
#endif
|
||||
// Try the menu's event handler
|
||||
if ( !processed && handler)
|
||||
{
|
||||
processed = handler->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// Try the window the menu was popped up from (and up
|
||||
// through the hierarchy)
|
||||
if ( !processed && GetInvokingWindow())
|
||||
processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++)
|
||||
{
|
||||
wxMenuItem * pItem = (wxMenuItem *) node->Data() ;
|
||||
|
||||
wxMenu *pSubMenu = pItem->GetSubMenu() ;
|
||||
if ( pSubMenu != NULL )
|
||||
{
|
||||
if ( pSubMenu->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Menu Bar
|
||||
|
||||
/*
|
||||
@@ -714,11 +608,15 @@ void wxMenuBar::MacInstallMenuBar()
|
||||
{
|
||||
::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
|
||||
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
||||
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mh )
|
||||
{
|
||||
UMAAppendMenuItem(mh, label , key , modifiers );
|
||||
SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -900,44 +798,6 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum)
|
||||
{
|
||||
// first scan fast for direct commands, i.e. menus which have these commands directly in their own list
|
||||
|
||||
if ( macMenuId == kwxMacAppleMenuId && macMenuItemNum == 1 )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, wxApp::s_macAboutMenuItemId );
|
||||
event.m_timeStamp = when;
|
||||
event.SetEventObject(handler);
|
||||
event.SetInt( wxApp::s_macAboutMenuItemId );
|
||||
handler->ProcessEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < m_menus.GetCount() ; i++)
|
||||
{
|
||||
if ( m_menus[i]->MacGetMenuId() == macMenuId || ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) ) )
|
||||
{
|
||||
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
||||
return ;
|
||||
else
|
||||
{
|
||||
//TODO flag this as an error since it must contain the item
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_menus.GetCount(); i++)
|
||||
{
|
||||
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxMenu *wxMenuBar::Remove(size_t pos)
|
||||
{
|
||||
wxMenu *menu = wxMenuBarBase::Remove(pos);
|
||||
|
@@ -353,7 +353,17 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y)
|
||||
|
||||
::InsertMenu( (MenuHandle) menu->GetHMenu() , -1 ) ;
|
||||
long menuResult = ::PopUpMenuSelect((MenuHandle) menu->GetHMenu() ,y,x, 0) ;
|
||||
menu->MacMenuSelect( this , TickCount() , HiWord(menuResult) , LoWord(menuResult) ) ;
|
||||
if ( HiWord(menuResult) != 0 )
|
||||
{
|
||||
MenuCommand id ;
|
||||
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
|
||||
event.m_timeStamp = TickCount() ;
|
||||
event.SetEventObject(this->GetEventHandler());
|
||||
event.SetInt( id );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
::DeleteMenu( menu->MacGetMenuId() ) ;
|
||||
menu->SetInvokingWindow(NULL);
|
||||
|
||||
|
156
src/mac/menu.cpp
156
src/mac/menu.cpp
@@ -209,10 +209,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
if ( pos == (size_t)-1 )
|
||||
{
|
||||
UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), label,key,modifiers);
|
||||
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , CountMenuItems(MAC_WXHMENU(m_hMenu)) , pItem->GetId() ) ;
|
||||
if ( pItem->GetBitmap().Ok() )
|
||||
{
|
||||
ControlButtonContentInfo info ;
|
||||
wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ;
|
||||
wxMacCreateBitmapButton( &info , pItem->GetBitmap() , kControlContentCIconHandle ) ;
|
||||
if ( info.contentType != kControlNoContent )
|
||||
{
|
||||
if ( info.contentType == kControlContentCIconHandle )
|
||||
@@ -225,10 +226,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
else
|
||||
{
|
||||
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers);
|
||||
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
|
||||
if ( pItem->GetBitmap().Ok() )
|
||||
{
|
||||
ControlButtonContentInfo info ;
|
||||
wxMacCreateBitmapButton( &info , pItem->GetBitmap() , true ) ;
|
||||
wxMacCreateBitmapButton( &info , pItem->GetBitmap() , kControlContentCIconHandle ) ;
|
||||
if ( info.contentType != kControlNoContent )
|
||||
{
|
||||
if ( info.contentType == kControlContentCIconHandle )
|
||||
@@ -429,114 +431,6 @@ void wxMenu::MacEnableMenu( bool bDoEnable )
|
||||
::DrawMenuBar() ;
|
||||
}
|
||||
|
||||
bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum )
|
||||
{
|
||||
int pos;
|
||||
wxNode *node;
|
||||
|
||||
if ( m_macMenuId == macMenuId )
|
||||
{
|
||||
node = GetMenuItems().Nth(macMenuItemNum-1);
|
||||
if (node)
|
||||
{
|
||||
wxMenuItem *pItem = (wxMenuItem*)node->Data();
|
||||
|
||||
if (pItem->IsCheckable())
|
||||
pItem->Check(! pItem->IsChecked());
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
|
||||
event.m_timeStamp = when;
|
||||
event.SetEventObject(handler);
|
||||
event.SetInt( pItem->GetId() );
|
||||
{
|
||||
bool processed = false ;
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
// Try a callback
|
||||
if (m_callback)
|
||||
{
|
||||
(void) (*(m_callback)) (*this, event);
|
||||
processed = TRUE;
|
||||
}
|
||||
#endif
|
||||
// Try the menu's event handler
|
||||
if ( !processed && handler)
|
||||
{
|
||||
processed = handler->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// Try the window the menu was popped up from (and up
|
||||
// through the hierarchy)
|
||||
if ( !processed && GetInvokingWindow())
|
||||
processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
else if ( macMenuId == kHMHelpMenuID )
|
||||
{
|
||||
int menuItem = firstUserHelpMenuItem-1 ;
|
||||
for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++)
|
||||
{
|
||||
wxMenuItem * pItem = (wxMenuItem *) node->Data() ;
|
||||
|
||||
wxMenu *pSubMenu = pItem->GetSubMenu() ;
|
||||
if ( pSubMenu != NULL )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( pItem->GetId() != wxApp::s_macAboutMenuItemId )
|
||||
++menuItem ;
|
||||
|
||||
if ( menuItem == macMenuItemNum )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
|
||||
event.m_timeStamp = when;
|
||||
event.SetEventObject(handler);
|
||||
event.SetInt( pItem->GetId() );
|
||||
{
|
||||
bool processed = false ;
|
||||
#if WXWIN_COMPATIBILITY
|
||||
// Try a callback
|
||||
if (m_callback)
|
||||
{
|
||||
(void) (*(m_callback)) (*this, event);
|
||||
processed = TRUE;
|
||||
}
|
||||
#endif
|
||||
// Try the menu's event handler
|
||||
if ( !processed && handler)
|
||||
{
|
||||
processed = handler->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// Try the window the menu was popped up from (and up
|
||||
// through the hierarchy)
|
||||
if ( !processed && GetInvokingWindow())
|
||||
processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (pos = 0, node = GetMenuItems().First(); node; node = node->Next(), pos++)
|
||||
{
|
||||
wxMenuItem * pItem = (wxMenuItem *) node->Data() ;
|
||||
|
||||
wxMenu *pSubMenu = pItem->GetSubMenu() ;
|
||||
if ( pSubMenu != NULL )
|
||||
{
|
||||
if ( pSubMenu->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Menu Bar
|
||||
|
||||
/*
|
||||
@@ -714,11 +608,15 @@ void wxMenuBar::MacInstallMenuBar()
|
||||
{
|
||||
::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
|
||||
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
|
||||
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mh )
|
||||
{
|
||||
UMAAppendMenuItem(mh, label , key , modifiers );
|
||||
SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -900,44 +798,6 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum)
|
||||
{
|
||||
// first scan fast for direct commands, i.e. menus which have these commands directly in their own list
|
||||
|
||||
if ( macMenuId == kwxMacAppleMenuId && macMenuItemNum == 1 )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, wxApp::s_macAboutMenuItemId );
|
||||
event.m_timeStamp = when;
|
||||
event.SetEventObject(handler);
|
||||
event.SetInt( wxApp::s_macAboutMenuItemId );
|
||||
handler->ProcessEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < m_menus.GetCount() ; i++)
|
||||
{
|
||||
if ( m_menus[i]->MacGetMenuId() == macMenuId || ( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) ) )
|
||||
{
|
||||
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
||||
return ;
|
||||
else
|
||||
{
|
||||
//TODO flag this as an error since it must contain the item
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_menus.GetCount(); i++)
|
||||
{
|
||||
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxMenu *wxMenuBar::Remove(size_t pos)
|
||||
{
|
||||
wxMenu *menu = wxMenuBarBase::Remove(pos);
|
||||
|
@@ -353,7 +353,17 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y)
|
||||
|
||||
::InsertMenu( (MenuHandle) menu->GetHMenu() , -1 ) ;
|
||||
long menuResult = ::PopUpMenuSelect((MenuHandle) menu->GetHMenu() ,y,x, 0) ;
|
||||
menu->MacMenuSelect( this , TickCount() , HiWord(menuResult) , LoWord(menuResult) ) ;
|
||||
if ( HiWord(menuResult) != 0 )
|
||||
{
|
||||
MenuCommand id ;
|
||||
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &id ) ;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id );
|
||||
event.m_timeStamp = TickCount() ;
|
||||
event.SetEventObject(this->GetEventHandler());
|
||||
event.SetInt( id );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
::DeleteMenu( menu->MacGetMenuId() ) ;
|
||||
menu->SetInvokingWindow(NULL);
|
||||
|
||||
|
Reference in New Issue
Block a user