- UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding() , pSubMenu->m_macMenuId);
+ UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), wxStripMenuCodes(pItem->GetText()), wxFont::GetDefaultEncoding(), pSubMenu->m_macMenuId);
- UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding() , pos, pSubMenu->m_macMenuId);
+ UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), wxStripMenuCodes(pItem->GetText()), wxFont::GetDefaultEncoding(), pos, pSubMenu->m_macMenuId);
+
// if we're already attached to the menubar, we must update it
if ( IsAttached() && GetMenuBar()->IsAttached() )
// if we're already attached to the menubar, we must update it
if ( IsAttached() && GetMenuBar()->IsAttached() )
// we need to find the items position in the child list
size_t pos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
// we need to find the items position in the child list
size_t pos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
if ( IsAttached() && GetMenuBar()->IsAttached() )
::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
if ( IsAttached() && GetMenuBar()->IsAttached() )
// ---------------------------------------------------------------------------
// other
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// other
// ---------------------------------------------------------------------------
-// before it can be displayed , also hide special menu items like preferences
-// that are handled by the OS
+// before it can be displayed, also hide special menu items
+// like preferences that are handled by the OS
void wxMenu::MacBeforeDisplay( bool isSubMenu )
{
wxMenuItem* previousItem = NULL ;
size_t pos ;
wxMenuItemList::compatibility_iterator node;
wxMenuItem *item;
void wxMenu::MacBeforeDisplay( bool isSubMenu )
{
wxMenuItem* previousItem = NULL ;
size_t pos ;
wxMenuItemList::compatibility_iterator node;
wxMenuItem *item;
for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
{
item = (wxMenuItem *)node->GetData();
for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
{
item = (wxMenuItem *)node->GetData();
// what we do here is to hide the special items which are
// shown in the application menu anyhow -- it doesn't make
// sense to show them in their normal place as well
// what we do here is to hide the special items which are
// shown in the application menu anyhow -- it doesn't make
// sense to show them in their normal place as well
for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
{
item = (wxMenuItem *)node->GetData();
for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
{
item = (wxMenuItem *)node->GetData();
wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
{
Init();
wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
{
Init();
::SetMenuBar( menubar ) ;
DisposeMenuBar( menubar ) ;
MenuHandle appleMenu = NULL ;
::SetMenuBar( menubar ) ;
DisposeMenuBar( menubar ) ;
MenuHandle appleMenu = NULL ;
if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
{
for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
{
for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
// Unlike preferences which may or may not exist, the Quit item should be always
// enabled unless it is added by the application and then disabled, otherwise
// a program would be required to add an item with wxID_EXIT in order to get the
// Unlike preferences which may or may not exist, the Quit item should be always
// enabled unless it is added by the application and then disabled, otherwise
// a program would be required to add an item with wxID_EXIT in order to get the
for (size_t i = 0; i < m_menus.GetCount(); i++, menuIter = menuIter->GetNext())
{
wxMenuItemList::compatibility_iterator node;
for (size_t i = 0; i < m_menus.GetCount(); i++, menuIter = menuIter->GetNext())
{
wxMenuItemList::compatibility_iterator node;
- UMAAppendMenuItem(mh, item->GetText() , wxFont::GetDefaultEncoding(), entry);
+ UMAAppendMenuItem(mh, wxStripMenuCodes(item->GetText()) , wxFont::GetDefaultEncoding(), entry);
SetMenuItemCommandID( mh , CountMenuItems(mh) , wxIdToMacCommand ( item->GetId() ) ) ;
SetMenuItemRefCon( mh , CountMenuItems(mh) , (UInt32)item ) ;
}
SetMenuItemCommandID( mh , CountMenuItems(mh) , wxIdToMacCommand ( item->GetId() ) ) ;
SetMenuItemRefCon( mh , CountMenuItems(mh) , (UInt32)item ) ;
}
- UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , aboutMenuItem->GetText() , wxFont::GetDefaultEncoding() );
+ UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , wxStripMenuCodes ( aboutMenuItem->GetText() ) , wxFont::GetDefaultEncoding() );
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , kHICommandAbout ) ;
SetMenuItemRefCon(GetMenuHandle( kwxMacAppleMenuId ) , 1 , (UInt32)aboutMenuItem ) ;
UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
}
}
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , kHICommandAbout ) ;
SetMenuItemRefCon(GetMenuHandle( kwxMacAppleMenuId ) , 1 , (UInt32)aboutMenuItem ) ;
UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
}
}
void wxMenuBar::EnableTop(size_t pos, bool enable)
{
wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
void wxMenuBar::EnableTop(size_t pos, bool enable)
{
wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
// ---------------------------------------------------------------------------
// wxMenuBar construction
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// wxMenuBar construction
// ---------------------------------------------------------------------------
{
menuOld->MacAfterDisplay( false ) ;
::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
{
menuOld->MacAfterDisplay( false ) ;
::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
- {
- menu->MacBeforeDisplay( false ) ;
- UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ;
- if ( pos == m_menus.GetCount() - 1)
- {
- ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
- }
- else
- {
- ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , _wxMenuAt(m_menus, pos+1)->MacGetMenuId() ) ;
- }
- }
+
+ menu->MacBeforeDisplay( false ) ;
+ UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ;
+ if ( pos == m_menus.GetCount() - 1)
+ ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
+ else
+ ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , _wxMenuAt(m_menus, pos + 1)->MacGetMenuId() ) ;
bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
{
WXHMENU submenu = menu ? menu->GetHMenu() : 0;
bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
{
WXHMENU submenu = menu ? menu->GetHMenu() : 0;
static void wxMenubarUnsetInvokingWindow( wxMenu *menu )
{
menu->SetInvokingWindow( (wxWindow*) NULL );
static void wxMenubarUnsetInvokingWindow( wxMenu *menu )
{
menu->SetInvokingWindow( (wxWindow*) NULL );
while (node)
{
wxMenuItem *menuitem = node->GetData();
if (menuitem->IsSubMenu())
wxMenubarUnsetInvokingWindow( menuitem->GetSubMenu() );
while (node)
{
wxMenuItem *menuitem = node->GetData();
if (menuitem->IsSubMenu())
wxMenubarUnsetInvokingWindow( menuitem->GetSubMenu() );
static void wxMenubarSetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
static void wxMenubarSetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
if (menuitem->IsSubMenu())
wxMenubarSetInvokingWindow( menuitem->GetSubMenu() , win );
if (menuitem->IsSubMenu())
wxMenubarSetInvokingWindow( menuitem->GetSubMenu() , win );
// ---------------------------------------------------------------------------
// wxMenuBar searching for menu items
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// wxMenuBar searching for menu items
// ---------------------------------------------------------------------------