Corrected display for empty lines in text control.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
29e4a1901a
commit
b8c140b89f
@ -63,10 +63,20 @@ const wxString punct = " ,.-;:!?";
|
|||||||
|
|
||||||
void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
|
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 x = 0 ;
|
||||||
|
|
||||||
int i = 0 ;
|
int i = 0 ;
|
||||||
long width, height ;
|
|
||||||
bool linedrawn = true;
|
bool linedrawn = true;
|
||||||
while( paragraph.Length() > 0 )
|
while( paragraph.Length() > 0 )
|
||||||
{
|
{
|
||||||
@ -153,19 +163,19 @@ void wxStaticText::OnDraw( wxDC &dc )
|
|||||||
while (i < text.Length())
|
while (i < text.Length())
|
||||||
{
|
{
|
||||||
|
|
||||||
if (text[i] == 13 || text[i] == 10)
|
if (text[i] == 13 || text[i] == 10)
|
||||||
{
|
{
|
||||||
DrawParagraph(dc, paragraph,y);
|
DrawParagraph(dc, paragraph,y);
|
||||||
paragraph = "" ;
|
paragraph = "" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
paragraph += text[i];
|
paragraph += text[i];
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (paragraph.Length() > 0)
|
if (paragraph.Length() > 0)
|
||||||
DrawParagraph(dc, paragraph,y);
|
DrawParagraph(dc, paragraph,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStaticText::OnPaint( wxPaintEvent &event )
|
void wxStaticText::OnPaint( wxPaintEvent &event )
|
||||||
|
@ -63,10 +63,20 @@ const wxString punct = " ,.-;:!?";
|
|||||||
|
|
||||||
void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
|
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 x = 0 ;
|
||||||
|
|
||||||
int i = 0 ;
|
int i = 0 ;
|
||||||
long width, height ;
|
|
||||||
bool linedrawn = true;
|
bool linedrawn = true;
|
||||||
while( paragraph.Length() > 0 )
|
while( paragraph.Length() > 0 )
|
||||||
{
|
{
|
||||||
@ -153,19 +163,19 @@ void wxStaticText::OnDraw( wxDC &dc )
|
|||||||
while (i < text.Length())
|
while (i < text.Length())
|
||||||
{
|
{
|
||||||
|
|
||||||
if (text[i] == 13 || text[i] == 10)
|
if (text[i] == 13 || text[i] == 10)
|
||||||
{
|
{
|
||||||
DrawParagraph(dc, paragraph,y);
|
DrawParagraph(dc, paragraph,y);
|
||||||
paragraph = "" ;
|
paragraph = "" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
paragraph += text[i];
|
paragraph += text[i];
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (paragraph.Length() > 0)
|
if (paragraph.Length() > 0)
|
||||||
DrawParagraph(dc, paragraph,y);
|
DrawParagraph(dc, paragraph,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStaticText::OnPaint( wxPaintEvent &event )
|
void wxStaticText::OnPaint( wxPaintEvent &event )
|
||||||
|
Loading…
Reference in New Issue
Block a user