]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/stattext.cpp
corrected update upon activate
[wxWidgets.git] / src / mac / stattext.cpp
index 06d6fe9c3c1ec67031bb0c4a0af1fa889f3b17b4..26f16be64248b34d6bdc7434da57249b9c8a3824 100644 (file)
 
 #include "wx/app.h"
 #include "wx/stattext.h"
+#include "wx/notebook.h"
+#include "wx/tabctrl.h"
+#include "wx/dc.h"
+#include "wx/dcclient.h"
 
 #include <stdio.h>
 
@@ -59,8 +63,42 @@ void wxStaticText::OnDraw( wxDC &dc )
         return;
 
     PrepareDC(dc);
-    dc.Clear() ;
     
+    bool doClear = true ;
+       WindowRef window = GetMacRootWindow() ;
+       if ( window )
+       {
+               wxWindow* win = wxFindWinFromMacWindow( window ) ;
+               if ( win )
+               {
+                       wxWindow* parent = GetParent() ;
+                       while ( parent )
+                       {
+                               if( parent->MacGetWindowData() )
+                               {
+                                       break ;
+                               }
+                               
+                               if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ||  parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+                               {
+                                       if ( ((wxControl*)parent)->GetMacControl() ) {
+                                               Rect rect = { -32767 , -32767 , 32767 , 32767 } ;
+                                               if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress )
+                                               {
+                                                 DrawThemeTabPane ( &rect, kThemeStateActive);
+                                                 doClear = false ;
+                                               }
+                                       }
+                                       break ;
+                               }
+                               
+                               parent = parent->GetParent() ;
+                       } 
+               }
+       }
+       if ( doClear )
+               dc.Clear() ;
+               
     int x = 0 ;
     int y = 0 ;
     wxString text = m_label ;
@@ -257,7 +295,9 @@ void wxStaticText::SetLabel(const wxString& st )
        m_label = st ;
        if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
                SetSizeOrDefault() ;
-       
-    wxClientDC dc(this);
-    OnDraw( dc ) ;
+
+       Refresh() ;     
+       MacUpdateImmediately() ;
+//    wxClientDC dc(this);
+//    OnDraw( dc ) ;
 }