// create the menu
m_macMenuId = s_macNextMenuId++;
- m_hMenu = UMANewMenu(m_macMenuId, m_title);
+ m_hMenu = UMANewMenu(m_macMenuId, m_title, wxFont::GetDefaultEncoding() );
if ( !m_hMenu )
{
- wxLogLastError("UMANewMenu failed");
+ wxLogLastError(wxT("UMANewMenu failed"));
}
// if we have a title, insert it in the beginning of the menu
}
if ( pos == (size_t)-1 )
- UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
+ UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding() , pSubMenu->m_macMenuId);
else
- UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
+ UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding() , pos, pSubMenu->m_macMenuId);
pItem->UpdateItemBitmap() ;
pItem->UpdateItemStatus() ;
}
{
if ( pos == (size_t)-1 )
{
- UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") );
+ UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , wxFont::GetDefaultEncoding() );
pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
}
else
// MacOS counts menu items from 1 and inserts after, therefore having the
// same effect as wx 0 based and inserting before, we must correct pos
// after however for updates to be correct
- UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , pos);
+ UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a"), wxFont::GetDefaultEncoding(), pos);
pos += 1 ;
}
m_startRadioGroup = -1;
}
-bool wxMenu::DoAppend(wxMenuItem *item)
+wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{
- wxCHECK_MSG( item, FALSE, _T("NULL item in wxMenu::DoAppend") );
+ wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
bool check = FALSE;
if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) )
{
- return FALSE;
+ return NULL;
}
if ( check )
item->Check(TRUE);
}
- return TRUE;
+ return item;
}
-bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
+wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
{
- return wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos);
+ if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos))
+ return item;
+ else
+ return NULL;
}
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
void wxMenu::SetTitle(const wxString& label)
{
m_title = label ;
- UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
+ UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label , wxFont::GetDefaultEncoding() ) ;
}
bool wxMenu::ProcessCommand(wxCommandEvent & event)
{
bool processed = FALSE;
-#if WXWIN_COMPATIBILITY
- // Try a callback
- if (m_callback)
- {
- (void)(*(m_callback))(*this, event);
- processed = TRUE;
- }
-#endif WXWIN_COMPATIBILITY
-
// Try the menu's event handler
if ( !processed && GetEventHandler())
{
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
{
- UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() );
+ UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() , wxFont::GetDefaultEncoding() );
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
{
if ( mh )
{
- UMAAppendMenuItem(mh, item->GetText() , entry );
+ UMAAppendMenuItem(mh, item->GetText() , wxFont::GetDefaultEncoding(), entry);
SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
}
}
}
else
{
- UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
+ UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i], m_font.GetEncoding() ) ;
m_menus[i]->MacBeforeDisplay(false) ;
::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
}
::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
{
menu->MacBeforeDisplay( false ) ;
- UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+ UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ;
if ( pos == m_menus.GetCount() - 1)
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
m_titles.Insert(title, pos);
- UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+ UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ;
if ( IsAttached() && s_macInstalledMenuBar == this )
{
::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
}
- menu->Detach();
-
Refresh();
}
- m_titles.Remove(pos);
+ m_titles.RemoveAt(pos);
return menu;
}
m_titles.Add(title);
- UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+ UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ;
if ( IsAttached() )
{