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

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