diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 7776a1a1ed..6a5e81119e 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1751,12 +1751,12 @@ void wxListLineData::DrawInReportMode( wxDC *dc, } } -void wxListLineData::DrawTextFormatted( wxDC *dc, - const wxString &text, - int col, - int x, - int y, - int width ) +void wxListLineData::DrawTextFormatted(wxDC *dc, + const wxString &text, + int col, + int x, + int y, + 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,17 +1793,16 @@ void wxListLineData::DrawTextFormatted( wxDC *dc, } // if still not enough space, remove ellipsis characters - while (ellipsis.Length() > 0 && w + base_w > width) { - ellipsis = ellipsis.Left(ellipsis.Length() - 1); - dc->GetTextExtent(ellipsis, &base_w, &h); + while (ellipsis.Length() > 0 && w + base_w > width) + { + ellipsis = ellipsis.Left(ellipsis.Length() - 1); + dc->GetTextExtent(ellipsis, &base_w, &h); } // now draw the text dc->DrawText(drawntext, x, y); dc->DrawText(ellipsis, x + w, y); - } - } bool wxListLineData::Highlight( bool on )