fix so wxMenu::InsertItem actually inserts rather than overwrites
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -234,7 +234,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers);
|
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers);
|
||||||
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
|
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos+1 , pItem->GetId() ) ;
|
||||||
if ( pItem->GetBitmap().Ok() )
|
if ( pItem->GetBitmap().Ok() )
|
||||||
{
|
{
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
// since we have decided that we only support 8.6 upwards we are
|
// since we have decided that we only support 8.6 upwards we are
|
||||||
// checking for these minimum requirements in the startup code of
|
// checking for these minimum requirements in the startup code of
|
||||||
// the application so all wxWindows code can safely assume that appearance 1.1
|
// the application so all wxWindows code can safely assume that appearance 1.1
|
||||||
// windows manager, control manager, navigation services etc. are
|
// windows manager, control manager, navigation services etc. are
|
||||||
// present
|
// present
|
||||||
|
|
||||||
static bool sUMAHasAppearance = false ;
|
static bool sUMAHasAppearance = false ;
|
||||||
@@ -78,7 +78,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
|
|
||||||
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
|
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
|
||||||
sUMASystemVersion = 0x0000 ;
|
sUMASystemVersion = 0x0000 ;
|
||||||
|
|
||||||
long theAppearance ;
|
long theAppearance ;
|
||||||
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
|
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
{
|
{
|
||||||
sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
|
sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
// Call currently implicitely done : InitFloatingWindows() ;
|
// Call currently implicitely done : InitFloatingWindows() ;
|
||||||
#else
|
#else
|
||||||
@@ -118,7 +118,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
sUMAHasAquaLayout = true ;
|
sUMAHasAquaLayout = true ;
|
||||||
|
|
||||||
if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress )
|
if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress )
|
||||||
{
|
{
|
||||||
FontFamilyID fontId ;
|
FontFamilyID fontId ;
|
||||||
Str255 fontName ;
|
Str255 fontName ;
|
||||||
SInt16 fontSize ;
|
SInt16 fontSize ;
|
||||||
@@ -131,7 +131,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
{ fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } ,
|
{ fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } ,
|
||||||
} ;
|
} ;
|
||||||
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
|
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
|
||||||
#if 0 // TARGET_CARBON
|
#if 0 // TARGET_CARBON
|
||||||
--noOfFontDescriptions ;
|
--noOfFontDescriptions ;
|
||||||
#endif
|
#endif
|
||||||
// kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke
|
// kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke
|
||||||
@@ -159,12 +159,12 @@ Boolean CanUseATSUI()
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// process manager
|
// process manager
|
||||||
long UMAGetProcessMode()
|
long UMAGetProcessMode()
|
||||||
{
|
{
|
||||||
OSErr err ;
|
OSErr err ;
|
||||||
ProcessInfoRec processinfo;
|
ProcessInfoRec processinfo;
|
||||||
ProcessSerialNumber procno ;
|
ProcessSerialNumber procno ;
|
||||||
|
|
||||||
procno.highLongOfPSN = NULL ;
|
procno.highLongOfPSN = NULL ;
|
||||||
procno.lowLongOfPSN = kCurrentProcess ;
|
procno.lowLongOfPSN = kCurrentProcess ;
|
||||||
processinfo.processInfoLength = sizeof(ProcessInfoRec);
|
processinfo.processInfoLength = sizeof(ProcessInfoRec);
|
||||||
@@ -176,7 +176,7 @@ long UMAGetProcessMode()
|
|||||||
return processinfo.processMode ;
|
return processinfo.processMode ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMAGetProcessModeDoesActivateOnFGSwitch()
|
bool UMAGetProcessModeDoesActivateOnFGSwitch()
|
||||||
{
|
{
|
||||||
return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
|
return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ void UMASetMenuTitle( MenuRef menu , StringPtr title )
|
|||||||
const long headersize = 14 ;
|
const long headersize = 14 ;
|
||||||
int oldlen = (**menu).menuData[0] + 1;
|
int oldlen = (**menu).menuData[0] + 1;
|
||||||
int newlen = title[0] + 1 ;
|
int newlen = title[0] + 1 ;
|
||||||
|
|
||||||
if ( oldlen < newlen )
|
if ( oldlen < newlen )
|
||||||
{
|
{
|
||||||
// enlarge before adjusting
|
// enlarge before adjusting
|
||||||
@@ -218,23 +218,23 @@ UInt32 UMAMenuEvent( EventRecord *inEvent )
|
|||||||
return MenuEvent( inEvent ) ;
|
return MenuEvent( inEvent ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
|
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
|
||||||
{
|
{
|
||||||
EnableMenuItem( inMenu , inItem ) ;
|
EnableMenuItem( inMenu , inItem ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
|
void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
|
||||||
{
|
{
|
||||||
DisableMenuItem( inMenu , inItem ) ;
|
DisableMenuItem( inMenu , inItem ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id )
|
void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id )
|
||||||
{
|
{
|
||||||
MacAppendMenu(menu, l);
|
MacAppendMenu(menu, l);
|
||||||
SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
|
SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id )
|
void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id )
|
||||||
{
|
{
|
||||||
MacInsertMenuItem(menu, l , item);
|
MacInsertMenuItem(menu, l , item);
|
||||||
SetMenuItemHierarchicalID( menu , item , id ) ;
|
SetMenuItemHierarchicalID( menu , item , id ) ;
|
||||||
@@ -370,7 +370,7 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , SInt16 key , UI
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetItemCmd( menu, item , macKey );
|
SetItemCmd( menu, item , macKey );
|
||||||
SetMenuItemModifiers(menu, item , modifiers ) ;
|
SetMenuItemModifiers(menu, item , modifiers ) ;
|
||||||
|
|
||||||
@@ -379,18 +379,18 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , SInt16 key , UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers )
|
void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers )
|
||||||
{
|
{
|
||||||
MacAppendMenu(menu, "\pA");
|
MacAppendMenu(menu, "\pA");
|
||||||
SetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), l);
|
SetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), l);
|
||||||
UMASetMenuItemShortcut( menu , (SInt16) ::CountMenuItems(menu), key , modifiers ) ;
|
UMASetMenuItemShortcut( menu , (SInt16) ::CountMenuItems(menu), key , modifiers ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers )
|
void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers )
|
||||||
{
|
{
|
||||||
MacInsertMenuItem( menu , "\p" , item) ;
|
MacInsertMenuItem( menu , "\pA" , item) ;
|
||||||
SetMenuItemText(menu, item , l);
|
SetMenuItemText(menu, item+1 , l);
|
||||||
UMASetMenuItemShortcut( menu , item , key , modifiers ) ;
|
UMASetMenuItemShortcut( menu , item+1 , key , modifiers ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// quickdraw
|
// quickdraw
|
||||||
@@ -465,7 +465,7 @@ pascal QDGlobalsPtr GetQDGlobalsPtr (void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void UMAShowWatchCursor()
|
void UMAShowWatchCursor()
|
||||||
{
|
{
|
||||||
OSErr err = noErr;
|
OSErr err = noErr;
|
||||||
|
|
||||||
@@ -481,14 +481,14 @@ void UMAShowWatchCursor()
|
|||||||
// SetQDGlobalsArrow (*watchFob);
|
// SetQDGlobalsArrow (*watchFob);
|
||||||
// InitCursor ( );
|
// InitCursor ( );
|
||||||
// SetQDGlobalsArrow (&preservedArrow);
|
// SetQDGlobalsArrow (&preservedArrow);
|
||||||
SetCursor (*watchFob);
|
SetCursor (*watchFob);
|
||||||
#else
|
#else
|
||||||
SetCursor (*watchFob);
|
SetCursor (*watchFob);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAShowArrowCursor()
|
void UMAShowArrowCursor()
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
Cursor arrow;
|
Cursor arrow;
|
||||||
@@ -500,23 +500,23 @@ void UMAShowArrowCursor()
|
|||||||
|
|
||||||
// window manager
|
// window manager
|
||||||
|
|
||||||
GrafPtr UMAGetWindowPort( WindowRef inWindowRef )
|
GrafPtr UMAGetWindowPort( WindowRef inWindowRef )
|
||||||
{
|
{
|
||||||
wxASSERT( inWindowRef != NULL ) ;
|
wxASSERT( inWindowRef != NULL ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
return (GrafPtr) GetWindowPort( inWindowRef ) ;
|
return (GrafPtr) GetWindowPort( inWindowRef ) ;
|
||||||
#else
|
#else
|
||||||
return (GrafPtr) inWindowRef ;
|
return (GrafPtr) inWindowRef ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADisposeWindow( WindowRef inWindowRef )
|
void UMADisposeWindow( WindowRef inWindowRef )
|
||||||
{
|
{
|
||||||
wxASSERT( inWindowRef != NULL ) ;
|
wxASSERT( inWindowRef != NULL ) ;
|
||||||
DisposeWindow( inWindowRef ) ;
|
DisposeWindow( inWindowRef ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMASetWTitleC( WindowRef inWindowRef , const char *title )
|
void UMASetWTitleC( WindowRef inWindowRef , const char *title )
|
||||||
{
|
{
|
||||||
Str255 ptitle ;
|
Str255 ptitle ;
|
||||||
strncpy( (char*)ptitle , title , 96 ) ;
|
strncpy( (char*)ptitle , title , 96 ) ;
|
||||||
@@ -529,7 +529,7 @@ void UMASetWTitleC( WindowRef inWindowRef , const char *title )
|
|||||||
SetWTitle( inWindowRef , ptitle ) ;
|
SetWTitle( inWindowRef , ptitle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAGetWTitleC( WindowRef inWindowRef , char *title )
|
void UMAGetWTitleC( WindowRef inWindowRef , char *title )
|
||||||
{
|
{
|
||||||
GetWTitle( inWindowRef , (unsigned char*)title ) ;
|
GetWTitle( inWindowRef , (unsigned char*)title ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -541,7 +541,7 @@ void UMAGetWTitleC( WindowRef inWindowRef , char *title )
|
|||||||
|
|
||||||
// appearance additions
|
// appearance additions
|
||||||
|
|
||||||
void UMAActivateControl( ControlHandle inControl )
|
void UMAActivateControl( ControlHandle inControl )
|
||||||
{
|
{
|
||||||
// we have to add the control after again to the update rgn
|
// we have to add the control after again to the update rgn
|
||||||
// otherwise updates get lost
|
// otherwise updates get lost
|
||||||
@@ -559,7 +559,7 @@ void UMAActivateControl( ControlHandle inControl )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADrawControl( ControlHandle inControl )
|
void UMADrawControl( ControlHandle inControl )
|
||||||
{
|
{
|
||||||
WindowRef theWindow = GetControlOwner(inControl) ;
|
WindowRef theWindow = GetControlOwner(inControl) ;
|
||||||
RgnHandle updateRgn = NewRgn() ;
|
RgnHandle updateRgn = NewRgn() ;
|
||||||
@@ -572,7 +572,7 @@ void UMADrawControl( ControlHandle inControl )
|
|||||||
DisposeRgn( updateRgn ) ;
|
DisposeRgn( updateRgn ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAMoveControl( ControlHandle inControl , short x , short y )
|
void UMAMoveControl( ControlHandle inControl , short x , short y )
|
||||||
{
|
{
|
||||||
bool visible = IsControlVisible( inControl ) ;
|
bool visible = IsControlVisible( inControl ) ;
|
||||||
if ( visible ) {
|
if ( visible ) {
|
||||||
@@ -588,14 +588,14 @@ void UMAMoveControl( ControlHandle inControl , short x , short y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMASizeControl( ControlHandle inControl , short x , short y )
|
void UMASizeControl( ControlHandle inControl , short x , short y )
|
||||||
{
|
{
|
||||||
bool visible = IsControlVisible( inControl ) ;
|
bool visible = IsControlVisible( inControl ) ;
|
||||||
if ( visible ) {
|
if ( visible ) {
|
||||||
SetControlVisibility( inControl , false , false ) ;
|
SetControlVisibility( inControl , false , false ) ;
|
||||||
Rect ctrlBounds ;
|
Rect ctrlBounds ;
|
||||||
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
|
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
|
||||||
}
|
}
|
||||||
::SizeControl( inControl , x , y ) ;
|
::SizeControl( inControl , x , y ) ;
|
||||||
if ( visible ) {
|
if ( visible ) {
|
||||||
SetControlVisibility( inControl , true , false ) ;
|
SetControlVisibility( inControl , true , false ) ;
|
||||||
@@ -604,7 +604,7 @@ void UMASizeControl( ControlHandle inControl , short x , short y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADeactivateControl( ControlHandle inControl )
|
void UMADeactivateControl( ControlHandle inControl )
|
||||||
{
|
{
|
||||||
// we have to add the control after again to the update rgn
|
// we have to add the control after again to the update rgn
|
||||||
// otherwise updates get lost
|
// otherwise updates get lost
|
||||||
@@ -653,7 +653,7 @@ OSErr UMASetKeyboardFocus (WindowPtr inWindow,
|
|||||||
|
|
||||||
|
|
||||||
// events
|
// events
|
||||||
void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
|
void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
|
||||||
{
|
{
|
||||||
RgnHandle updateRgn = NewRgn() ;
|
RgnHandle updateRgn = NewRgn() ;
|
||||||
GetWindowUpdateRgn( inWindow , updateRgn ) ;
|
GetWindowUpdateRgn( inWindow , updateRgn ) ;
|
||||||
@@ -668,18 +668,18 @@ void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMAIsWindowFloating( WindowRef inWindow )
|
bool UMAIsWindowFloating( WindowRef inWindow )
|
||||||
{
|
{
|
||||||
WindowClass cl ;
|
WindowClass cl ;
|
||||||
|
|
||||||
GetWindowClass( inWindow , &cl ) ;
|
GetWindowClass( inWindow , &cl ) ;
|
||||||
return cl == kFloatingWindowClass ;
|
return cl == kFloatingWindowClass ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMAIsWindowModal( WindowRef inWindow )
|
bool UMAIsWindowModal( WindowRef inWindow )
|
||||||
{
|
{
|
||||||
WindowClass cl ;
|
WindowClass cl ;
|
||||||
|
|
||||||
GetWindowClass( inWindow , &cl ) ;
|
GetWindowClass( inWindow , &cl ) ;
|
||||||
return cl < kFloatingWindowClass ;
|
return cl < kFloatingWindowClass ;
|
||||||
}
|
}
|
||||||
@@ -704,11 +704,11 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
|||||||
UMAActivateControl( control ) ;
|
UMAActivateControl( control ) ;
|
||||||
else
|
else
|
||||||
UMADeactivateControl( control ) ;
|
UMADeactivateControl( control ) ;
|
||||||
}
|
}
|
||||||
SetPort( port ) ;
|
SetPort( port ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
|
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
|
||||||
{
|
{
|
||||||
return ::DrawThemePlacard( inRect , inState ) ;
|
return ::DrawThemePlacard( inRect , inState ) ;
|
||||||
}
|
}
|
||||||
@@ -740,7 +740,7 @@ OSStatus UMAGetHelpMenu(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport)
|
wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport)
|
||||||
{
|
{
|
||||||
m_clip = NULL ;
|
m_clip = NULL ;
|
||||||
Setup( newport ) ;
|
Setup( newport ) ;
|
||||||
@@ -761,7 +761,7 @@ void wxMacPortStateHelper::Setup( GrafPtr newport )
|
|||||||
m_textFont = GetPortTextFont( (CGrafPtr) newport);
|
m_textFont = GetPortTextFont( (CGrafPtr) newport);
|
||||||
m_textSize = GetPortTextSize( (CGrafPtr) newport);
|
m_textSize = GetPortTextSize( (CGrafPtr) newport);
|
||||||
m_textStyle = GetPortTextFace( (CGrafPtr) newport);
|
m_textStyle = GetPortTextFace( (CGrafPtr) newport);
|
||||||
m_textMode = GetPortTextMode( (CGrafPtr) newport);
|
m_textMode = GetPortTextMode( (CGrafPtr) newport);
|
||||||
GetThemeDrawingState( &m_drawingState ) ;
|
GetThemeDrawingState( &m_drawingState ) ;
|
||||||
m_currentPort = newport ;
|
m_currentPort = newport ;
|
||||||
}
|
}
|
||||||
@@ -798,7 +798,7 @@ OSStatus UMAPutScrap( Size size , OSType type , void *data )
|
|||||||
err = PutScrap( size , type , data ) ;
|
err = PutScrap( size , type , data ) ;
|
||||||
#else
|
#else
|
||||||
ScrapRef scrap;
|
ScrapRef scrap;
|
||||||
err = GetCurrentScrap (&scrap);
|
err = GetCurrentScrap (&scrap);
|
||||||
if ( !err )
|
if ( !err )
|
||||||
{
|
{
|
||||||
err = PutScrapFlavor (scrap, type , 0, size, data);
|
err = PutScrapFlavor (scrap, type , 0, size, data);
|
||||||
|
@@ -234,7 +234,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers);
|
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), label , pos,key,modifiers);
|
||||||
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
|
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos+1 , pItem->GetId() ) ;
|
||||||
if ( pItem->GetBitmap().Ok() )
|
if ( pItem->GetBitmap().Ok() )
|
||||||
{
|
{
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
// since we have decided that we only support 8.6 upwards we are
|
// since we have decided that we only support 8.6 upwards we are
|
||||||
// checking for these minimum requirements in the startup code of
|
// checking for these minimum requirements in the startup code of
|
||||||
// the application so all wxWindows code can safely assume that appearance 1.1
|
// the application so all wxWindows code can safely assume that appearance 1.1
|
||||||
// windows manager, control manager, navigation services etc. are
|
// windows manager, control manager, navigation services etc. are
|
||||||
// present
|
// present
|
||||||
|
|
||||||
static bool sUMAHasAppearance = false ;
|
static bool sUMAHasAppearance = false ;
|
||||||
@@ -78,7 +78,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
|
|
||||||
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
|
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
|
||||||
sUMASystemVersion = 0x0000 ;
|
sUMASystemVersion = 0x0000 ;
|
||||||
|
|
||||||
long theAppearance ;
|
long theAppearance ;
|
||||||
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
|
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
{
|
{
|
||||||
sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
|
sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
// Call currently implicitely done : InitFloatingWindows() ;
|
// Call currently implicitely done : InitFloatingWindows() ;
|
||||||
#else
|
#else
|
||||||
@@ -118,7 +118,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
sUMAHasAquaLayout = true ;
|
sUMAHasAquaLayout = true ;
|
||||||
|
|
||||||
if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress )
|
if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress )
|
||||||
{
|
{
|
||||||
FontFamilyID fontId ;
|
FontFamilyID fontId ;
|
||||||
Str255 fontName ;
|
Str255 fontName ;
|
||||||
SInt16 fontSize ;
|
SInt16 fontSize ;
|
||||||
@@ -131,7 +131,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
{ fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } ,
|
{ fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } ,
|
||||||
} ;
|
} ;
|
||||||
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
|
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
|
||||||
#if 0 // TARGET_CARBON
|
#if 0 // TARGET_CARBON
|
||||||
--noOfFontDescriptions ;
|
--noOfFontDescriptions ;
|
||||||
#endif
|
#endif
|
||||||
// kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke
|
// kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke
|
||||||
@@ -159,12 +159,12 @@ Boolean CanUseATSUI()
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// process manager
|
// process manager
|
||||||
long UMAGetProcessMode()
|
long UMAGetProcessMode()
|
||||||
{
|
{
|
||||||
OSErr err ;
|
OSErr err ;
|
||||||
ProcessInfoRec processinfo;
|
ProcessInfoRec processinfo;
|
||||||
ProcessSerialNumber procno ;
|
ProcessSerialNumber procno ;
|
||||||
|
|
||||||
procno.highLongOfPSN = NULL ;
|
procno.highLongOfPSN = NULL ;
|
||||||
procno.lowLongOfPSN = kCurrentProcess ;
|
procno.lowLongOfPSN = kCurrentProcess ;
|
||||||
processinfo.processInfoLength = sizeof(ProcessInfoRec);
|
processinfo.processInfoLength = sizeof(ProcessInfoRec);
|
||||||
@@ -176,7 +176,7 @@ long UMAGetProcessMode()
|
|||||||
return processinfo.processMode ;
|
return processinfo.processMode ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMAGetProcessModeDoesActivateOnFGSwitch()
|
bool UMAGetProcessModeDoesActivateOnFGSwitch()
|
||||||
{
|
{
|
||||||
return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
|
return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ void UMASetMenuTitle( MenuRef menu , StringPtr title )
|
|||||||
const long headersize = 14 ;
|
const long headersize = 14 ;
|
||||||
int oldlen = (**menu).menuData[0] + 1;
|
int oldlen = (**menu).menuData[0] + 1;
|
||||||
int newlen = title[0] + 1 ;
|
int newlen = title[0] + 1 ;
|
||||||
|
|
||||||
if ( oldlen < newlen )
|
if ( oldlen < newlen )
|
||||||
{
|
{
|
||||||
// enlarge before adjusting
|
// enlarge before adjusting
|
||||||
@@ -218,23 +218,23 @@ UInt32 UMAMenuEvent( EventRecord *inEvent )
|
|||||||
return MenuEvent( inEvent ) ;
|
return MenuEvent( inEvent ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
|
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
|
||||||
{
|
{
|
||||||
EnableMenuItem( inMenu , inItem ) ;
|
EnableMenuItem( inMenu , inItem ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
|
void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
|
||||||
{
|
{
|
||||||
DisableMenuItem( inMenu , inItem ) ;
|
DisableMenuItem( inMenu , inItem ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id )
|
void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id )
|
||||||
{
|
{
|
||||||
MacAppendMenu(menu, l);
|
MacAppendMenu(menu, l);
|
||||||
SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
|
SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id )
|
void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id )
|
||||||
{
|
{
|
||||||
MacInsertMenuItem(menu, l , item);
|
MacInsertMenuItem(menu, l , item);
|
||||||
SetMenuItemHierarchicalID( menu , item , id ) ;
|
SetMenuItemHierarchicalID( menu , item , id ) ;
|
||||||
@@ -370,7 +370,7 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , SInt16 key , UI
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetItemCmd( menu, item , macKey );
|
SetItemCmd( menu, item , macKey );
|
||||||
SetMenuItemModifiers(menu, item , modifiers ) ;
|
SetMenuItemModifiers(menu, item , modifiers ) ;
|
||||||
|
|
||||||
@@ -379,18 +379,18 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , SInt16 key , UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers )
|
void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers )
|
||||||
{
|
{
|
||||||
MacAppendMenu(menu, "\pA");
|
MacAppendMenu(menu, "\pA");
|
||||||
SetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), l);
|
SetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), l);
|
||||||
UMASetMenuItemShortcut( menu , (SInt16) ::CountMenuItems(menu), key , modifiers ) ;
|
UMASetMenuItemShortcut( menu , (SInt16) ::CountMenuItems(menu), key , modifiers ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers )
|
void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers )
|
||||||
{
|
{
|
||||||
MacInsertMenuItem( menu , "\p" , item) ;
|
MacInsertMenuItem( menu , "\pA" , item) ;
|
||||||
SetMenuItemText(menu, item , l);
|
SetMenuItemText(menu, item+1 , l);
|
||||||
UMASetMenuItemShortcut( menu , item , key , modifiers ) ;
|
UMASetMenuItemShortcut( menu , item+1 , key , modifiers ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// quickdraw
|
// quickdraw
|
||||||
@@ -465,7 +465,7 @@ pascal QDGlobalsPtr GetQDGlobalsPtr (void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void UMAShowWatchCursor()
|
void UMAShowWatchCursor()
|
||||||
{
|
{
|
||||||
OSErr err = noErr;
|
OSErr err = noErr;
|
||||||
|
|
||||||
@@ -481,14 +481,14 @@ void UMAShowWatchCursor()
|
|||||||
// SetQDGlobalsArrow (*watchFob);
|
// SetQDGlobalsArrow (*watchFob);
|
||||||
// InitCursor ( );
|
// InitCursor ( );
|
||||||
// SetQDGlobalsArrow (&preservedArrow);
|
// SetQDGlobalsArrow (&preservedArrow);
|
||||||
SetCursor (*watchFob);
|
SetCursor (*watchFob);
|
||||||
#else
|
#else
|
||||||
SetCursor (*watchFob);
|
SetCursor (*watchFob);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAShowArrowCursor()
|
void UMAShowArrowCursor()
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
Cursor arrow;
|
Cursor arrow;
|
||||||
@@ -500,23 +500,23 @@ void UMAShowArrowCursor()
|
|||||||
|
|
||||||
// window manager
|
// window manager
|
||||||
|
|
||||||
GrafPtr UMAGetWindowPort( WindowRef inWindowRef )
|
GrafPtr UMAGetWindowPort( WindowRef inWindowRef )
|
||||||
{
|
{
|
||||||
wxASSERT( inWindowRef != NULL ) ;
|
wxASSERT( inWindowRef != NULL ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
return (GrafPtr) GetWindowPort( inWindowRef ) ;
|
return (GrafPtr) GetWindowPort( inWindowRef ) ;
|
||||||
#else
|
#else
|
||||||
return (GrafPtr) inWindowRef ;
|
return (GrafPtr) inWindowRef ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADisposeWindow( WindowRef inWindowRef )
|
void UMADisposeWindow( WindowRef inWindowRef )
|
||||||
{
|
{
|
||||||
wxASSERT( inWindowRef != NULL ) ;
|
wxASSERT( inWindowRef != NULL ) ;
|
||||||
DisposeWindow( inWindowRef ) ;
|
DisposeWindow( inWindowRef ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMASetWTitleC( WindowRef inWindowRef , const char *title )
|
void UMASetWTitleC( WindowRef inWindowRef , const char *title )
|
||||||
{
|
{
|
||||||
Str255 ptitle ;
|
Str255 ptitle ;
|
||||||
strncpy( (char*)ptitle , title , 96 ) ;
|
strncpy( (char*)ptitle , title , 96 ) ;
|
||||||
@@ -529,7 +529,7 @@ void UMASetWTitleC( WindowRef inWindowRef , const char *title )
|
|||||||
SetWTitle( inWindowRef , ptitle ) ;
|
SetWTitle( inWindowRef , ptitle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAGetWTitleC( WindowRef inWindowRef , char *title )
|
void UMAGetWTitleC( WindowRef inWindowRef , char *title )
|
||||||
{
|
{
|
||||||
GetWTitle( inWindowRef , (unsigned char*)title ) ;
|
GetWTitle( inWindowRef , (unsigned char*)title ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -541,7 +541,7 @@ void UMAGetWTitleC( WindowRef inWindowRef , char *title )
|
|||||||
|
|
||||||
// appearance additions
|
// appearance additions
|
||||||
|
|
||||||
void UMAActivateControl( ControlHandle inControl )
|
void UMAActivateControl( ControlHandle inControl )
|
||||||
{
|
{
|
||||||
// we have to add the control after again to the update rgn
|
// we have to add the control after again to the update rgn
|
||||||
// otherwise updates get lost
|
// otherwise updates get lost
|
||||||
@@ -559,7 +559,7 @@ void UMAActivateControl( ControlHandle inControl )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADrawControl( ControlHandle inControl )
|
void UMADrawControl( ControlHandle inControl )
|
||||||
{
|
{
|
||||||
WindowRef theWindow = GetControlOwner(inControl) ;
|
WindowRef theWindow = GetControlOwner(inControl) ;
|
||||||
RgnHandle updateRgn = NewRgn() ;
|
RgnHandle updateRgn = NewRgn() ;
|
||||||
@@ -572,7 +572,7 @@ void UMADrawControl( ControlHandle inControl )
|
|||||||
DisposeRgn( updateRgn ) ;
|
DisposeRgn( updateRgn ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAMoveControl( ControlHandle inControl , short x , short y )
|
void UMAMoveControl( ControlHandle inControl , short x , short y )
|
||||||
{
|
{
|
||||||
bool visible = IsControlVisible( inControl ) ;
|
bool visible = IsControlVisible( inControl ) ;
|
||||||
if ( visible ) {
|
if ( visible ) {
|
||||||
@@ -588,14 +588,14 @@ void UMAMoveControl( ControlHandle inControl , short x , short y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMASizeControl( ControlHandle inControl , short x , short y )
|
void UMASizeControl( ControlHandle inControl , short x , short y )
|
||||||
{
|
{
|
||||||
bool visible = IsControlVisible( inControl ) ;
|
bool visible = IsControlVisible( inControl ) ;
|
||||||
if ( visible ) {
|
if ( visible ) {
|
||||||
SetControlVisibility( inControl , false , false ) ;
|
SetControlVisibility( inControl , false , false ) ;
|
||||||
Rect ctrlBounds ;
|
Rect ctrlBounds ;
|
||||||
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
|
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
|
||||||
}
|
}
|
||||||
::SizeControl( inControl , x , y ) ;
|
::SizeControl( inControl , x , y ) ;
|
||||||
if ( visible ) {
|
if ( visible ) {
|
||||||
SetControlVisibility( inControl , true , false ) ;
|
SetControlVisibility( inControl , true , false ) ;
|
||||||
@@ -604,7 +604,7 @@ void UMASizeControl( ControlHandle inControl , short x , short y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADeactivateControl( ControlHandle inControl )
|
void UMADeactivateControl( ControlHandle inControl )
|
||||||
{
|
{
|
||||||
// we have to add the control after again to the update rgn
|
// we have to add the control after again to the update rgn
|
||||||
// otherwise updates get lost
|
// otherwise updates get lost
|
||||||
@@ -653,7 +653,7 @@ OSErr UMASetKeyboardFocus (WindowPtr inWindow,
|
|||||||
|
|
||||||
|
|
||||||
// events
|
// events
|
||||||
void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
|
void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
|
||||||
{
|
{
|
||||||
RgnHandle updateRgn = NewRgn() ;
|
RgnHandle updateRgn = NewRgn() ;
|
||||||
GetWindowUpdateRgn( inWindow , updateRgn ) ;
|
GetWindowUpdateRgn( inWindow , updateRgn ) ;
|
||||||
@@ -668,18 +668,18 @@ void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMAIsWindowFloating( WindowRef inWindow )
|
bool UMAIsWindowFloating( WindowRef inWindow )
|
||||||
{
|
{
|
||||||
WindowClass cl ;
|
WindowClass cl ;
|
||||||
|
|
||||||
GetWindowClass( inWindow , &cl ) ;
|
GetWindowClass( inWindow , &cl ) ;
|
||||||
return cl == kFloatingWindowClass ;
|
return cl == kFloatingWindowClass ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UMAIsWindowModal( WindowRef inWindow )
|
bool UMAIsWindowModal( WindowRef inWindow )
|
||||||
{
|
{
|
||||||
WindowClass cl ;
|
WindowClass cl ;
|
||||||
|
|
||||||
GetWindowClass( inWindow , &cl ) ;
|
GetWindowClass( inWindow , &cl ) ;
|
||||||
return cl < kFloatingWindowClass ;
|
return cl < kFloatingWindowClass ;
|
||||||
}
|
}
|
||||||
@@ -704,11 +704,11 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
|
|||||||
UMAActivateControl( control ) ;
|
UMAActivateControl( control ) ;
|
||||||
else
|
else
|
||||||
UMADeactivateControl( control ) ;
|
UMADeactivateControl( control ) ;
|
||||||
}
|
}
|
||||||
SetPort( port ) ;
|
SetPort( port ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
|
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
|
||||||
{
|
{
|
||||||
return ::DrawThemePlacard( inRect , inState ) ;
|
return ::DrawThemePlacard( inRect , inState ) ;
|
||||||
}
|
}
|
||||||
@@ -740,7 +740,7 @@ OSStatus UMAGetHelpMenu(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport)
|
wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport)
|
||||||
{
|
{
|
||||||
m_clip = NULL ;
|
m_clip = NULL ;
|
||||||
Setup( newport ) ;
|
Setup( newport ) ;
|
||||||
@@ -761,7 +761,7 @@ void wxMacPortStateHelper::Setup( GrafPtr newport )
|
|||||||
m_textFont = GetPortTextFont( (CGrafPtr) newport);
|
m_textFont = GetPortTextFont( (CGrafPtr) newport);
|
||||||
m_textSize = GetPortTextSize( (CGrafPtr) newport);
|
m_textSize = GetPortTextSize( (CGrafPtr) newport);
|
||||||
m_textStyle = GetPortTextFace( (CGrafPtr) newport);
|
m_textStyle = GetPortTextFace( (CGrafPtr) newport);
|
||||||
m_textMode = GetPortTextMode( (CGrafPtr) newport);
|
m_textMode = GetPortTextMode( (CGrafPtr) newport);
|
||||||
GetThemeDrawingState( &m_drawingState ) ;
|
GetThemeDrawingState( &m_drawingState ) ;
|
||||||
m_currentPort = newport ;
|
m_currentPort = newport ;
|
||||||
}
|
}
|
||||||
@@ -798,7 +798,7 @@ OSStatus UMAPutScrap( Size size , OSType type , void *data )
|
|||||||
err = PutScrap( size , type , data ) ;
|
err = PutScrap( size , type , data ) ;
|
||||||
#else
|
#else
|
||||||
ScrapRef scrap;
|
ScrapRef scrap;
|
||||||
err = GetCurrentScrap (&scrap);
|
err = GetCurrentScrap (&scrap);
|
||||||
if ( !err )
|
if ( !err )
|
||||||
{
|
{
|
||||||
err = PutScrapFlavor (scrap, type , 0, size, data);
|
err = PutScrapFlavor (scrap, type , 0, size, data);
|
||||||
|
Reference in New Issue
Block a user