]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/stattext.cpp
Compilation fixes for wxPython's wxWizard, added wxRegionFromPoints
[wxWidgets.git] / src / mac / carbon / stattext.cpp
index c31530e181e3256210fa313cd44f50917efceda1..5509db4dddea933a0b659ce26fed1884933ade79 100644 (file)
@@ -51,7 +51,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
         m_windowId = id;
 
     m_windowStyle = style;
-    m_label = label ;
+    m_label = wxStripMenuCodes(label) ;
 
     bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
     SetBestSize( size ) ;
@@ -63,10 +63,19 @@ const wxString punct = " ,.-;:!?";
 
 void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
 {
+    long width, height ;
+  
+    if (paragraph.Length() == 0)
+    {
+        // empty line
+        dc.GetTextExtent( "H", &width, &height );
+        y += height;
+        
+        return;
+    }
+
   int x = 0 ;
 
-  int i = 0 ;
-  long width, height ;
   bool linedrawn = true;
   while( paragraph.Length() > 0 )
   {
@@ -147,25 +156,25 @@ void wxStaticText::OnDraw( wxDC &dc )
   }
 
   wxString paragraph;
-  int i = 0 ;
+  size_t i = 0 ;
   wxString text = m_label;
   int y = 0 ;
   while (i < text.Length())
   {
 
-       if (text[i] == 13 || text[i] == 10)
-       {
-           DrawParagraph(dc, paragraph,y);
-           paragraph = "" ;
-       }
-       else
-       {
+    if (text[i] == 13 || text[i] == 10)
+    {
+        DrawParagraph(dc, paragraph,y);
+        paragraph = "" ;
+    }
+    else
+    {
         paragraph += text[i];
     }
     ++i;
   }
   if (paragraph.Length() > 0)
-         DrawParagraph(dc, paragraph,y);
+      DrawParagraph(dc, paragraph,y);
 }
 
 void wxStaticText::OnPaint( wxPaintEvent &event )