]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/stattext.cpp
Smooth Aqua buttons in wxTreeCtrl.
[wxWidgets.git] / src / mac / stattext.cpp
index 6439400bf380e239c93a531b6b3fac5f8506e5c3..8f78cc60ff6cc093781ea700c108ad31d73a17db 100644 (file)
@@ -26,7 +26,7 @@
 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
 #endif
 
 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
 #endif
 
-#include <wx/mac/uma.h>
+#include "wx/mac/uma.h"
 
 BEGIN_EVENT_TABLE(wxStaticText, wxStaticTextBase)
     EVT_PAINT(wxStaticText::OnPaint)
 
 BEGIN_EVENT_TABLE(wxStaticText, wxStaticTextBase)
     EVT_PAINT(wxStaticText::OnPaint)
@@ -151,7 +151,7 @@ void wxStaticText::OnDraw( wxDC &dc )
                                if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ||  parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                {
                                        if ( ((wxControl*)parent)->GetMacControl() ) {
                                if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) ||  parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                                {
                                        if ( ((wxControl*)parent)->GetMacControl() ) {
-                                               Rect rect = { -32767 , -32767 , 32767 , 32767 } ;
+                                               Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover
                                                if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress )
                                                {
                                                  DrawThemeTabPane ( &rect, kThemeStateActive);
                                                if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress )
                                                {
                                                  DrawThemeTabPane ( &rect, kThemeStateActive);
@@ -189,14 +189,17 @@ void wxStaticText::OnPaint( wxPaintEvent &event )
 
 wxSize wxStaticText::DoGetBestSize() const
 {
 
 wxSize wxStaticText::DoGetBestSize() const
 {
-       int x , y  ;
-   int widthTextMax = 0, widthLine,
+       int x,y ;
+    int widthTextMax = 0, widthLine,
         heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
         heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
-
+        
     wxString curLine;
     wxString curLine;
-    for ( const wxChar *pc = m_label; ; pc++ ) {
-        if ( *pc == wxT('\n') || *pc == wxT('\0') ) {
-            if ( !curLine ) {
+    for ( const wxChar *pc = m_label; ; pc++ )
+    {
+        if ( *pc == wxT('\n') || *pc == wxT('\0') )
+        {
+            if ( !curLine )
+            {
                 // we can't use GetTextExtent - it will return 0 for both width
                 // and height and an empty line should count in height
                 // calculation
                 // we can't use GetTextExtent - it will return 0 for both width
                 // and height and an empty line should count in height
                 // calculation
@@ -206,12 +209,17 @@ wxSize wxStaticText::DoGetBestSize() const
                     GetTextExtent(_T("W"), NULL, &heightLineDefault);
 
                 heightTextTotal += heightLineDefault;
                     GetTextExtent(_T("W"), NULL, &heightLineDefault);
 
                 heightTextTotal += heightLineDefault;
+                
+                heightTextTotal++;  // FIXME: why is this necessary?
             }
             }
-            else {
+            else
+            {
                 GetTextExtent(curLine, &widthLine, &heightLine);
                 if ( widthLine > widthTextMax )
                     widthTextMax = widthLine;
                 heightTextTotal += heightLine;
                 GetTextExtent(curLine, &widthLine, &heightLine);
                 if ( widthLine > widthTextMax )
                     widthTextMax = widthLine;
                 heightTextTotal += heightLine;
+                
+                heightTextTotal++;  // FIXME: why is this necessary?
             }
 
             if ( *pc == wxT('\n') ) {
             }
 
             if ( *pc == wxT('\n') ) {