no changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-10-29 20:42:34 +00:00
parent 0bfca7f379
commit 0ab495989d

View File

@@ -1766,7 +1766,8 @@ void wxListLineData::DrawTextFormatted( wxDC *dc,
dc->GetTextExtent(text, &w, &h); dc->GetTextExtent(text, &w, &h);
// if it can, draw it // if it can, draw it
if (w <= width) { if (w <= width)
{
m_owner->GetColumn(col, item); m_owner->GetColumn(col, item);
if (item.m_format == wxLIST_FORMAT_LEFT) if (item.m_format == wxLIST_FORMAT_LEFT)
dc->DrawText(text, x, y); dc->DrawText(text, x, y);
@@ -1774,17 +1775,17 @@ void wxListLineData::DrawTextFormatted( wxDC *dc,
dc->DrawText(text, x + width - w, y); dc->DrawText(text, x + width - w, y);
else if (item.m_format == wxLIST_FORMAT_CENTER) else if (item.m_format == wxLIST_FORMAT_CENTER)
dc->DrawText(text, x + ((width - w) / 2), y); dc->DrawText(text, x + ((width - w) / 2), y);
}
// otherwise, truncate and add an ellipsis if possible else // otherwise, truncate and add an ellipsis if possible
} else { {
// determine the base width // determine the base width
ellipsis = wxString(wxT("...")); ellipsis = wxString(wxT("..."));
dc->GetTextExtent(ellipsis, &base_w, &h); dc->GetTextExtent(ellipsis, &base_w, &h);
// continue until we have enough space or only one character left // continue until we have enough space or only one character left
drawntext = text.Left(text.Length() - 1); drawntext = text.Left(text.Length() - 1);
while (drawntext.Length() > 1) { while (drawntext.Length() > 1)
{
dc->GetTextExtent(drawntext, &w, &h); dc->GetTextExtent(drawntext, &w, &h);
if (w + base_w <= width) if (w + base_w <= width)
break; break;
@@ -1792,7 +1793,8 @@ void wxListLineData::DrawTextFormatted( wxDC *dc,
} }
// if still not enough space, remove ellipsis characters // if still not enough space, remove ellipsis characters
while (ellipsis.Length() > 0 && w + base_w > width) { while (ellipsis.Length() > 0 && w + base_w > width)
{
ellipsis = ellipsis.Left(ellipsis.Length() - 1); ellipsis = ellipsis.Left(ellipsis.Length() - 1);
dc->GetTextExtent(ellipsis, &base_w, &h); dc->GetTextExtent(ellipsis, &base_w, &h);
} }
@@ -1800,9 +1802,7 @@ void wxListLineData::DrawTextFormatted( wxDC *dc,
// now draw the text // now draw the text
dc->DrawText(drawntext, x, y); dc->DrawText(drawntext, x, y);
dc->DrawText(ellipsis, x + w, y); dc->DrawText(ellipsis, x + w, y);
} }
} }
bool wxListLineData::Highlight( bool on ) bool wxListLineData::Highlight( bool on )