]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/tooltip.cpp
fix unused vars for watcom
[wxWidgets.git] / src / mac / tooltip.cpp
index 317fe723fdbb36e64855ab0e1d5e5455190eb3c5..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 ) 
@@ -190,7 +194,10 @@ void wxMacToolTip::Setup( WindowRef win  , wxString text , wxPoint localPosition
        m_mark++ ;
        Clear() ;
        m_position = localPosition ;
-       m_label = wxMacMakeMacStringFromPC( text ) ;
+    if( wxApp::s_macDefaultEncodingIsPC )
+        m_label = wxMacMakeMacStringFromPC( text ) ;
+       else
+        m_label = text ;
     m_window =win;
        s_ToolTipWindowRef = m_window ;
        m_backpict = NULL ;
@@ -219,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 ;
@@ -427,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) ) ;
@@ -440,6 +472,7 @@ void wxMacToolTip::Clear()
                KillPicture(m_backpict);
                m_backpict = NULL ;
        }
+#endif
 }
 
 #endif