#include "wx/log.h"
#include "wx/app.h"
#include "wx/utils.h"
+ #include "wx/frame.h"
+ #include "wx/menuitem.h"
#endif
-#include "wx/menuitem.h"
-#include "wx/window.h"
-#include "wx/log.h"
-#include "wx/frame.h"
-
#include "wx/mac/uma.h"
// other standard headers
// the (popup) menu title has this special id
static const int idMenuTitle = -3;
-const short kwxMacMenuBarResource = 1 ;
-const short kwxMacAppleMenuId = 1 ;
+static const short kwxMacAppleMenuId = 1 ;
// Find an item given the Macintosh Menu Reference
if ( pItem->IsSeparator() )
{
if ( pos == (size_t)-1 )
- MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
+ AppendMenuItemTextWithCFString( MAC_WXHMENU(m_hMenu),
+ CFSTR(""), kMenuItemAttrSeparator, 0,NULL);
else
- MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
+ InsertMenuItemTextWithCFString( MAC_WXHMENU(m_hMenu),
+ CFSTR(""), pos, kMenuItemAttrSeparator, 0);
}
else
{
}
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , wxIdToMacCommand ( pItem->GetId() ) ) ;
- SetMenuItemRefCon( MAC_WXHMENU(m_hMenu) , pos , (UInt32) pItem ) ;
+ SetMenuItemRefCon( MAC_WXHMENU(m_hMenu) , pos , (URefCon) pItem ) ;
pItem->UpdateItemText() ;
pItem->UpdateItemBitmap() ;
pItem->UpdateItemStatus() ;
if ( isSubMenu )
::DeleteMenu(MacGetMenuId());
- wxMenuItem* previousItem = NULL ;
wxMenuItemList::compatibility_iterator node;
wxMenuItem *item;
- int pos ;
- for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
+ for (node = GetMenuItems().GetFirst(); node; node = node->GetNext())
{
item = (wxMenuItem *)node->GetData();
wxMenu* subMenu = item->GetSubMenu() ;
{
// no need to undo hidings
}
-
- previousItem = item ;
}
}
::SetMenuBar( menubar ) ;
DisposeMenuBar( menubar ) ;
MenuHandle appleMenu = NULL ;
- char appleMenuTitle[3] = { 01 , kMenuAppleLogoFilledGlyph , 0 } ;
verify_noerr( CreateNewMenu( kwxMacAppleMenuId , 0 , &appleMenu ) ) ;
- verify_noerr( SetMenuTitle( appleMenu , (ConstStr255Param) appleMenuTitle ) );
+ verify_noerr( SetMenuTitleWithCFString( appleMenu , CFSTR( "\x14" ) ) );
// Add About/Preferences separator only on OS X
// KH/RN: Separator is always present on 10.3 but not on 10.2
// However, the change from 10.2 to 10.3 suggests it is preferred
#if TARGET_API_MAC_OSX
- MacInsertMenuItem( appleMenu , "\p-" , 0 ) ;
+ InsertMenuItemTextWithCFString( appleMenu,
+ CFSTR(""), 0, kMenuItemAttrSeparator, 0);
#endif
-
- MacInsertMenuItem( appleMenu , "\pAbout..." , 0 ) ;
+ InsertMenuItemTextWithCFString( appleMenu,
+ CFSTR("About..."), 0, 0, 0);
MacInsertMenu( appleMenu , 0 ) ;
// clean-up the help menu before adding new items
{
wxMenuItemList::compatibility_iterator node;
wxMenuItem *item;
- int pos ;
wxMenu* menu = menuIter->GetData() , *subMenu = NULL ;
if ( m_titles[i] == wxT("?") || m_titles[i] == wxT("&?") || m_titles[i] == wxApp::s_macHelpMenuTitleName )
{
- for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
+ for (node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext())
{
item = (wxMenuItem *)node->GetData();
subMenu = item->GetSubMenu() ;
if ( item->IsSeparator() )
{
if ( mh )
- MacAppendMenu(mh, "\p-" );
+ AppendMenuItemTextWithCFString( mh,
+ CFSTR(""), kMenuItemAttrSeparator, 0,NULL);
}
else
{
- wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
+ wxAcceleratorEntry*
+ entry = wxAcceleratorEntry::Create( item->GetText() ) ;
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
{
{
UMAAppendMenuItem(mh, wxStripMenuCodes(item->GetText()) , wxFont::GetDefaultEncoding(), entry);
SetMenuItemCommandID( mh , CountMenuItems(mh) , wxIdToMacCommand ( item->GetId() ) ) ;
- SetMenuItemRefCon( mh , CountMenuItems(mh) , (UInt32)item ) ;
+ SetMenuItemRefCon( mh , CountMenuItems(mh) , (URefCon) item ) ;
}
}
wxMenuItem *aboutMenuItem = FindItem(wxApp::s_macAboutMenuItemId , &aboutMenu) ;
if ( aboutMenuItem )
{
- wxAcceleratorEntry* entry = wxGetAccelFromString( aboutMenuItem->GetText() ) ;
+ wxAcceleratorEntry*
+ entry = wxAcceleratorEntry::Create( aboutMenuItem->GetText() ) ;
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 ) ;
+ SetMenuItemRefCon(GetMenuHandle( kwxMacAppleMenuId ) , 1 , (URefCon)aboutMenuItem ) ;
UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
}
}