- dc.SetClippingRegion(rect);
- dc.DrawText(text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1);
+ wxRect clip_rect = rect;
+ clip_rect.width -= 3; // text offset
+ clip_rect.width -= 2; // button padding
+ if (pane.HasCloseButton())
+ clip_rect.width -= m_button_size;
+ if (pane.HasPinButton())
+ clip_rect.width -= m_button_size;
+ if (pane.HasMaximizeButton())
+ clip_rect.width -= m_button_size;
+
+ wxString draw_text = ChopText(dc, text, clip_rect.width);
+
+ dc.SetClippingRegion(clip_rect);
+ dc.DrawText(draw_text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1);