]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/tooltip.cpp
disable Darwin GCC precompiled headers by default also for wxBase
[wxWidgets.git] / src / mac / tooltip.cpp
index 64ea19f58cbf29f9077e9716ae5a89f361e5bb92..5f71f00425c6c708e261d04175d1b9c1b8848516 100644 (file)
@@ -201,10 +201,12 @@ void wxMacToolTip::Setup( WindowRef win  , wxString text , wxPoint localPosition
 
 wxMacToolTip::~wxMacToolTip() 
 {
-    if ( m_timer )
+    if ( m_timer ) {
         delete m_timer ;
-       if ( m_backpict ) 
-               Clear() ;
+        m_timer = NULL;
+    }
+    if ( m_backpict ) 
+        Clear() ;
 }
 
 const short kTipBorder = 2 ;
@@ -228,9 +230,9 @@ void wxMacToolTip::Draw()
 #endif
          {
                wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
+#if TARGET_CARBON      
                bool useDrawThemeText =  ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-               
+#endif         
                m_shown = true ;
 
         FontFamilyID fontId ;
@@ -280,27 +282,38 @@ void wxMacToolTip::Draw()
                m_rect.left = m_position.x + kTipOffset;
                m_rect.top = m_position.y + kTipOffset;
                m_rect.right = m_rect.left + width + 2 * kTipBorder;
+#if TARGET_CARBON      
                if ( useDrawThemeText )
                    m_rect.right += kTipBorder ;
+#endif
                m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
                ClipRect( &m_rect ) ;
                BackColor( whiteColor ) ;
                ForeColor(blackColor ) ;
+                GWorldPtr port ;               
+                NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
+                CGrafPtr    origPort ;
+                GDHandle    origDevice ;
+    
+                GetGWorld( &origPort , &origDevice ) ;
+                SetGWorld( port , NULL ) ;
+           
                m_backpict = OpenPicture(&m_rect);
 
                CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
-                                  GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
+                                  GetPortBitMapForCopyBits(port), 
                                   &m_rect, 
                                   &m_rect, 
                                   srcCopy, 
                                   NULL);
-
-               ClosePicture();
-        PenNormal() ;
+                ClosePicture();
+                SetGWorld( origPort , origDevice ) ;
+               DisposeGWorld( port ) ;
+                PenNormal() ;
 
                RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
                BackColor( whiteColor ) ;
-        RGBForeColor( &tooltipbackground ) ;
+                RGBForeColor( &tooltipbackground ) ;
 
                PaintRect( &m_rect ) ;
                ForeColor(blackColor ) ;
@@ -316,6 +329,7 @@ void wxMacToolTip::Draw()
                {
                        if( text[i] == 13 || text[i] == 10)
                        {
+#if TARGET_CARBON
                if ( useDrawThemeText )
                {
                    Rect frame ;
@@ -335,6 +349,7 @@ void wxMacToolTip::Draw()
                                    height += lineh ;
                }
                 else
+#endif
                 {
                                    ::DrawText( text , laststop , i - laststop ) ;
                                    height += lineh ;
@@ -344,6 +359,7 @@ void wxMacToolTip::Draw()
                        }
                        i++ ;
                }
+#if TARGET_CARBON
         if ( useDrawThemeText )
         {
             Rect frame ;
@@ -362,6 +378,7 @@ void wxMacToolTip::Draw()
             CFRelease( mString ) ;
         }
         else
+#endif
         {
                    ::DrawText( text , laststop , i - laststop ) ;
                }