supporting PopUp on osx cocoa as well, see #10361

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57970 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-01-10 14:43:22 +00:00
parent 5e2ab81dbc
commit 2cb5d2d2b7
4 changed files with 39 additions and 24 deletions

View File

@@ -189,7 +189,6 @@ public :
virtual ~wxMenuCarbonImpl();
virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos)
{
// MacOS counts menu items from 1 and inserts after, therefore having the
@@ -259,6 +258,24 @@ public :
WXHMENU GetHMenu() { return m_osxMenu; }
virtual void PopUp( wxWindow *WXUNUSED(win), int x, int y )
{
long menuResult = ::PopUpMenuSelect(m_osxMenu, y, x, 0) ;
if ( HiWord(menuResult) != 0 )
{
MenuCommand macid;
GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &macid );
int id = wxMacCommandToId( macid );
wxMenuItem* item = NULL ;
wxMenu* realmenu ;
item = m_peer->FindItem( id, &realmenu ) ;
if ( item )
{
m_peer->HandleCommandProcess(item, NULL );
}
}
}
static wxMenuImpl* Create( wxMenu* peer, const wxString& title );
static wxMenuImpl* CreateRootMenu( wxMenu* peer );
protected :