]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/stattext.cpp
applied Paul A. Thiessen's patches for correcting coordinates when having borders...
[wxWidgets.git] / src / mac / stattext.cpp
index 68e1453ba8fca3af63cf51fd52e0c9d3951b97c3..d364a2c5be144884be71c211258a59a4c2bce0bc 100644 (file)
 #include <stdio.h>
 
 #if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxStaticTextBase)
+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)
@@ -189,14 +189,17 @@ void wxStaticText::OnPaint( wxPaintEvent &event )
 
 wxSize wxStaticText::DoGetBestSize() const
 {
-       int x , y  ;
-   int widthTextMax = 0, widthLine,
+       int x,y ;
+    int widthTextMax = 0, widthLine,
         heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
-
+        
     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
@@ -206,12 +209,17 @@ wxSize wxStaticText::DoGetBestSize() const
                     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;
+                
+                heightTextTotal++;  // FIXME: why is this necessary?
             }
 
             if ( *pc == wxT('\n') ) {