]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/stattext.cpp
Various fixes for Textctrl and Popup Menus.
[wxWidgets.git] / src / mac / carbon / stattext.cpp
index 62e095f5facee3cee3bdeaa3fedb4d5ad7b83c50..2982b7c5c4be9b726a936966abb1003832fb3409 100644 (file)
@@ -20,6 +20,7 @@
 #include "wx/dc.h"
 #include "wx/dcclient.h"
 #include "wx/utils.h"
 #include "wx/dc.h"
 #include "wx/dcclient.h"
 #include "wx/utils.h"
+#include "wx/settings.h"
 
 #include <stdio.h>
 
 
 #include <stdio.h>
 
@@ -128,65 +129,31 @@ void wxStaticText::OnDraw( wxDC &dc )
     if (m_width <= 0 || m_height <= 0)
         return;
 
     if (m_width <= 0 || m_height <= 0)
         return;
 
-     wxString paragraph;
-    int i = 0 ;
-    wxString text = m_label;
-    
-    int major,minor;
-    wxGetOsVersion( &major, &minor );
-
-    PrepareDC(dc);
-    
-    bool doClear = true ;
-    WindowRef window = GetMacRootWindow() ;
-    if ( window )
-    {
-        wxWindow* win = wxFindWinFromMacWindow( window ) ;
-        if ( win )
-        {
-            wxWindow* parent = GetParent() ;
-            while ( parent )
-            {
-                if( parent->MacGetWindowData() )
-                {
-                    break ;
-                }
-                
-                if (major < 10)
-                {
-                if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ||  parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
-                {
-                    if ( ((wxControl*)parent)->GetMacControl() ) {
-                        Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover
-                        if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress )
-                        {
-                          DrawThemeTabPane ( &rect, kThemeStateActive);
-                          doClear = false ;
-                        }
-                    }
-                    break ;
-                }
-                }
-                
-                parent = parent->GetParent() ;
-            } 
-        }
-    }
-    
-    if ( (major < 10) && doClear )
-        dc.Clear() ;
-        
-    while (i < text.Length())
-    {
-      paragraph += text[i];
-      
-    if (text[i] == 13 || text[i] == 10)
-        DrawParagraph(dc, paragraph);
-        
+  if ( !IsWindowHilited( (WindowRef) MacGetRootWindow() ) && 
+    ( GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE ) 
+      || GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) ) )
+  {
+    dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
+  }
+  else
+  {
+    dc.SetTextForeground( GetForegroundColour() ) ;
+  }
+  
+  wxString paragraph;
+  int i = 0 ;
+  wxString text = m_label;
+       while (i < text.Length())
+       {
+         paragraph += text[i];
+         
+       if (text[i] == 13 || text[i] == 10)
+           DrawParagraph(dc, paragraph);
+           
     ++i;
   }
   if (paragraph.Length() > 0)
     ++i;
   }
   if (paragraph.Length() > 0)
-      DrawParagraph(dc, paragraph);
+         DrawParagraph(dc, paragraph);
 }
 
 void wxStaticText::OnPaint( wxPaintEvent &event ) 
 }
 
 void wxStaticText::OnPaint( wxPaintEvent &event ) 
@@ -248,13 +215,11 @@ wxSize wxStaticText::DoGetBestSize() const
 
 void wxStaticText::SetLabel(const wxString& st )
 {
 
 void wxStaticText::SetLabel(const wxString& st )
 {
-    SetTitle( st ) ;
-    m_label = st ;
-    if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
-        SetSize( GetBestSize() ) ;
+       SetTitle( st ) ;
+       m_label = st ;
+       if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
+               SetSize( GetBestSize() ) ;
 
 
-    Refresh() ; 
-    MacUpdateImmediately() ;
-//    wxClientDC dc(this);
-//    OnDraw( dc ) ;
+       Refresh() ;     
+       Update() ;
 }
 }