]> git.saurik.com Git - wxWidgets.git/commitdiff
Corrected display for empty lines in text control.
authorRobert Roebling <robert@roebling.de>
Sun, 14 Jul 2002 17:08:19 +0000 (17:08 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 14 Jul 2002 17:08:19 +0000 (17:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/stattext.cpp
src/mac/stattext.cpp

index c31530e181e3256210fa313cd44f50917efceda1..ac2dc2e4d081f8b2144bcd6e38081c8279003978 100644 (file)
@@ -63,10 +63,20 @@ 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 )
   {
@@ -153,19 +163,19 @@ void wxStaticText::OnDraw( wxDC &dc )
   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 )
index c31530e181e3256210fa313cd44f50917efceda1..ac2dc2e4d081f8b2144bcd6e38081c8279003978 100644 (file)
@@ -63,10 +63,20 @@ 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 )
   {
@@ -153,19 +163,19 @@ void wxStaticText::OnDraw( wxDC &dc )
   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 )