From cd66beb3439485e49fac308f54dc10fe01c92895 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 27 Nov 2007 11:03:40 +0000 Subject: [PATCH] guard code for mac / quickdraw git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/uma.cpp | 110 ++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index d629632390..44c4420293 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -37,8 +37,6 @@ void UMACleanupToolbox() void UMAInitToolbox( UInt16 WXUNUSED(inMoreMastersCalls), bool WXUNUSED(isEmbedded) ) { - ::InitCursor(); - if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr) sUMASystemVersion = 0x0000 ; @@ -98,6 +96,8 @@ bool UMAGetProcessModeDoesActivateOnFGSwitch() // menu manager +#if wxMAC_USE_COCOA == 0 + MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding ) { wxString str = wxStripMenuCodes( title ) ; @@ -313,6 +313,10 @@ void UMAInsertMenuItem( MenuRef menu , const wxString& title, wxFontEncoding enc UMASetMenuItemShortcut( menu , item+1 , entry ) ; } +#endif + +#if wxMAC_USE_COCOA == 0 + void UMAShowWatchCursor() { SetThemeCursor(kThemeWatchCursor); @@ -323,8 +327,48 @@ void UMAShowArrowCursor() SetThemeCursor(kThemeArrowCursor); } +static OSStatus UMAGetHelpMenu( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex, + bool allowHelpMenuCreation); + +static OSStatus UMAGetHelpMenu( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex, + bool allowHelpMenuCreation) +{ + static bool s_createdHelpMenu = false ; + + if ( !s_createdHelpMenu && !allowHelpMenuCreation ) + { + return paramErr ; + } + + OSStatus status = HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ; + s_createdHelpMenu = ( status == noErr ) ; + return status ; +} + +OSStatus UMAGetHelpMenu( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex) +{ + return UMAGetHelpMenu( outHelpMenu , outFirstCustomItemIndex , true ); +} + +OSStatus UMAGetHelpMenuDontCreate( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex) +{ + return UMAGetHelpMenu( outHelpMenu , outFirstCustomItemIndex , false ); +} + +#endif + // window manager +#if wxMAC_USE_QUICKDRAW + GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) { wxASSERT( inWindowRef != NULL ) ; @@ -460,41 +504,25 @@ OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) #endif } -static OSStatus UMAGetHelpMenu( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex, - bool allowHelpMenuCreation); - -static OSStatus UMAGetHelpMenu( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex, - bool allowHelpMenuCreation) +Rect * UMAGetControlBoundsInWindowCoords( ControlRef theControl, Rect *bounds ) { - static bool s_createdHelpMenu = false ; - - if ( !s_createdHelpMenu && !allowHelpMenuCreation ) + GetControlBounds( theControl , bounds ) ; + + WindowRef tlwref = GetControlOwner( theControl ) ; + + wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ; + if ( tlwwx != NULL ) { - return paramErr ; + ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ; + HIPoint hiPoint = CGPointMake( 0 , 0 ) ; + HIViewConvertPoint( &hiPoint , HIViewGetSuperview(theControl) , rootControl ) ; + OffsetRect( bounds , (short) hiPoint.x , (short) hiPoint.y ) ; } - - OSStatus status = HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ; - s_createdHelpMenu = ( status == noErr ) ; - return status ; -} - -OSStatus UMAGetHelpMenu( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex) -{ - return UMAGetHelpMenu( outHelpMenu , outFirstCustomItemIndex , true ); + + return bounds ; } -OSStatus UMAGetHelpMenuDontCreate( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex) -{ - return UMAGetHelpMenu( outHelpMenu , outFirstCustomItemIndex , false ); -} +#endif #ifndef __LP64__ @@ -554,24 +582,6 @@ wxMacPortStateHelper::~wxMacPortStateHelper() #endif -Rect * UMAGetControlBoundsInWindowCoords( ControlRef theControl, Rect *bounds ) -{ - GetControlBounds( theControl , bounds ) ; - - WindowRef tlwref = GetControlOwner( theControl ) ; - - wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ; - if ( tlwwx != NULL ) - { - ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ; - HIPoint hiPoint = CGPointMake( 0 , 0 ) ; - HIViewConvertPoint( &hiPoint , HIViewGetSuperview(theControl) , rootControl ) ; - OffsetRect( bounds , (short) hiPoint.x , (short) hiPoint.y ) ; - } - - return bounds ; -} - size_t UMAPutBytesCFRefCallback( void *info, const void *bytes, size_t count ) { CFMutableDataRef data = (CFMutableDataRef) info; -- 2.45.2