]> git.saurik.com Git - wxWidgets.git/commitdiff
guard code for mac / quickdraw
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 27 Nov 2007 11:03:40 +0000 (11:03 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 27 Nov 2007 11:03:40 +0000 (11:03 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/uma.cpp

index d62963239085980134153e2d99caf50d484ff1f2..44c44202937357e87d5813e7d8847dee33be35da 100644 (file)
@@ -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;