switched to MacOS 8.5+ implementation for submenus

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2002-08-23 09:20:10 +00:00
parent 404dfcae70
commit 867e99f57d
4 changed files with 10 additions and 58 deletions

View File

@@ -70,7 +70,6 @@ void wxMenu::Init()
Str255 label; Str255 label;
wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_title , false ); wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_title , false );
m_macMenuId = s_macNextMenuId++; m_macMenuId = s_macNextMenuId++;
wxCHECK_RET( s_macNextMenuId < 236 , "menu ids > 235 cannot be used for submenus on mac" );
m_hMenu = ::NewMenu(m_macMenuId, label); m_hMenu = ::NewMenu(m_macMenuId, label);
if ( !m_hMenu ) if ( !m_hMenu )

View File

@@ -222,40 +222,17 @@ void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id ) void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id )
{ {
Str255 label ; MacAppendMenu(menu, l);
memcpy( label , l , l[0]+1 ) ; SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
// hardcoded adding of the submenu combination for mac
int theEnd = label[0] + 1;
if (theEnd > 251)
theEnd = 251; // mac allows only 255 characters
label[theEnd++] = '/';
label[theEnd++] = hMenuCmd;
label[theEnd++] = '!';
label[theEnd++] = id ;
label[theEnd] = 0x00;
label[0] = theEnd;
MacAppendMenu(menu, label);
} }
void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id ) void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id )
{ {
Str255 label ; MacInsertMenuItem(menu, l , item);
memcpy( label , l , l[0]+1 ) ; SetMenuItemHierarchicalID( menu , item , id ) ;
// hardcoded adding of the submenu combination for mac
int theEnd = label[0] + 1;
if (theEnd > 251)
theEnd = 251; // mac allows only 255 characters
label[theEnd++] = '/';
label[theEnd++] = hMenuCmd;
label[theEnd++] = '!';
label[theEnd++] = id;
label[theEnd] = 0x00;
label[0] = theEnd;
MacInsertMenuItem(menu, label , item);
} }
void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers ) void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers )
{ {
Str255 label ; Str255 label ;

View File

@@ -70,7 +70,6 @@ void wxMenu::Init()
Str255 label; Str255 label;
wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_title , false ); wxMenuItem::MacBuildMenuString( label, NULL , NULL , m_title , false );
m_macMenuId = s_macNextMenuId++; m_macMenuId = s_macNextMenuId++;
wxCHECK_RET( s_macNextMenuId < 236 , "menu ids > 235 cannot be used for submenus on mac" );
m_hMenu = ::NewMenu(m_macMenuId, label); m_hMenu = ::NewMenu(m_macMenuId, label);
if ( !m_hMenu ) if ( !m_hMenu )

View File

@@ -222,40 +222,17 @@ void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id ) void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id )
{ {
Str255 label ; MacAppendMenu(menu, l);
memcpy( label , l , l[0]+1 ) ; SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
// hardcoded adding of the submenu combination for mac
int theEnd = label[0] + 1;
if (theEnd > 251)
theEnd = 251; // mac allows only 255 characters
label[theEnd++] = '/';
label[theEnd++] = hMenuCmd;
label[theEnd++] = '!';
label[theEnd++] = id ;
label[theEnd] = 0x00;
label[0] = theEnd;
MacAppendMenu(menu, label);
} }
void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id ) void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id )
{ {
Str255 label ; MacInsertMenuItem(menu, l , item);
memcpy( label , l , l[0]+1 ) ; SetMenuItemHierarchicalID( menu , item , id ) ;
// hardcoded adding of the submenu combination for mac
int theEnd = label[0] + 1;
if (theEnd > 251)
theEnd = 251; // mac allows only 255 characters
label[theEnd++] = '/';
label[theEnd++] = hMenuCmd;
label[theEnd++] = '!';
label[theEnd++] = id;
label[theEnd] = 0x00;
label[0] = theEnd;
MacInsertMenuItem(menu, label , item);
} }
void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers ) void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers )
{ {
Str255 label ; Str255 label ;