- labelWidth += tw;
- y = rect.y + wxMax(0, (rect.height - (th+td)) / 2);
-#ifdef __WXGTK__
- y += 2; // No idea why.
-#endif
-
- // truncate and add an ellipsis (...) if the text is too wide.
- int targetWidth = rect.width - arrowSpace - bmpWidth - 2*margin;
- if ( tw > targetWidth )
- {
- int ellipsisWidth;
- dc.GetTextExtent( wxT("..."), &ellipsisWidth, NULL);
- do {
- label.Truncate( label.length() - 1 );
- dc.GetTextExtent( label, &tw, &th);
- } while (tw + ellipsisWidth > targetWidth && label.length() );
- label.append( wxT("...") );
- tw += ellipsisWidth;
- }
-
- switch (params->m_labelAlignment)
- {
- default:
- case wxALIGN_LEFT:
- x = rect.x + margin;
- break;
- case wxALIGN_CENTER:
- x = rect.x + wxMax(0, (rect.width - arrowSpace - tw - bmpWidth)/2);
- break;
- case wxALIGN_RIGHT:
- x = rect.x + wxMax(0, rect.width - arrowSpace - margin - tw - bmpWidth);
- break;
- }
-
- dc.DrawText(label, x, y);
- txtEnd = x + tw + 2;
- }
-
- // draw the bitmap if there is one
- if ( params && params->m_labelBitmap.Ok() )
- {
- int w, h, x, y;
- w = params->m_labelBitmap.GetWidth();
- h = params->m_labelBitmap.GetHeight();