]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/tooltip.cpp
fix unused vars for watcom
[wxWidgets.git] / src / mac / tooltip.cpp
index 2fbce9c667ec4c2f00a789b3cfedfd26e0120fff..5d072cb098cf8a45ad64630dabe311c1e63700a9 100644 (file)
@@ -50,6 +50,9 @@ class wxMacToolTip
                bool            m_shown ;
                long            m_mark ;
                wxMacToolTipTimer* m_timer ;
+#ifdef TARGET_CARBON
+               CFStringRef m_helpTextRef ;
+#endif
 } ;
 
 class wxMacToolTipTimer : public wxTimer
@@ -183,6 +186,7 @@ wxMacToolTip::wxMacToolTip()
        m_mark = 0 ;
        m_shown = false ;
     m_timer = NULL ;
+    m_helpTextRef = NULL ;
 }
 
 void wxMacToolTip::Setup( WindowRef win  , wxString text , wxPoint localPosition ) 
@@ -222,21 +226,39 @@ void wxMacToolTip::Draw()
                
        if ( m_window == s_ToolTipWindowRef )
        {
+               m_shown = true ;
 #if TARGET_CARBON
-/*
          if ( HMDisplayTag != (void*) kUnresolvedCFragSymbolAddress )
          {
-           HMDisplayTag( 
+               HMHelpContentRec tag ;
+               tag.version = kMacHelpVersion;
+               SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
+        GrafPtr port ;
+        GetPort( &port ) ;
+        SetPortWindowPort(m_window) ;
+               LocalToGlobal( (Point *) &tag.absHotRect.top );
+               LocalToGlobal( (Point *) &tag.absHotRect.bottom );
+               SetPort( port );
+               if( m_helpTextRef )
+               {
+                       CFRelease( m_helpTextRef ) ;
+                       m_helpTextRef = NULL ;
+               }
+               m_helpTextRef = wxMacCreateCFString(m_label) ;
+               tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
+               tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
+               tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
+               tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
+               tag.tagSide = kHMDefaultSide;
+               HMDisplayTag( &tag );
          }
          else
-*/
 #endif
          {
                wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
 #if TARGET_CARBON      
                bool useDrawThemeText =  ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
 #endif         
-               m_shown = true ;
 
         FontFamilyID fontId ;
         Str255 fontName ;
@@ -430,7 +452,14 @@ void wxMacToolTip::Clear()
        }
        if ( !m_shown )
                return ;
-                
+#if TARGET_CARBON
+       HMHideTag() ;
+       if( m_helpTextRef )
+       {
+               CFRelease( m_helpTextRef ) ;
+               m_helpTextRef = NULL ;
+       }
+#else           
        if ( m_window == s_ToolTipWindowRef && m_backpict )
        {
                wxMacPortStateHelper help( (GrafPtr) GetWindowPort(m_window) ) ;
@@ -443,6 +472,7 @@ void wxMacToolTip::Clear()
                KillPicture(m_backpict);
                m_backpict = NULL ;
        }
+#endif
 }
 
 #endif