void ModernDockArt::DrawCaption(wxDC& dc, wxWindow* WXUNUSED(window), const wxString& text, const wxRect& rect, wxAuiPaneInfo& pane) { dc.SetPen(*wxTRANSPARENT_PEN); DrawCaptionBackground(dc, rect, (pane.state & wxAuiPaneInfo::optionActive)?true:false); // Active captions are drawn with bold text if (pane.state & wxAuiPaneInfo::optionActive) m_caption_font.SetWeight(wxFONTWEIGHT_BOLD); else m_caption_font.SetWeight(wxFONTWEIGHT_NORMAL); dc.SetFont(m_caption_font); dc.SetTextForeground(m_inactive_caption_text_colour); wxCoord w,h; dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h); dc.SetClippingRegion(rect); dc.DrawText(text, rect.x+m_caption_text_indent, rect.y+(rect.height/2)-(h/2)-1); dc.DestroyClippingRegion(); }
void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window), const wxString& text, const wxRect& rect, wxAuiPaneInfo& pane) { dc.SetPen(*wxTRANSPARENT_PEN); dc.SetFont(m_captionFont); DrawCaptionBackground(dc, rect, (pane.state & wxAuiPaneInfo::optionActive)?true:false); int caption_offset = 0; if ( pane.icon.IsOk() ) { DrawIcon(dc, rect, pane); caption_offset += pane.icon.GetWidth() + 3; } if (pane.state & wxAuiPaneInfo::optionActive) dc.SetTextForeground(m_activeCaptionTextColour); else dc.SetTextForeground(m_inactiveCaptionTextColour); wxCoord w,h; dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h); wxRect clip_rect = rect; clip_rect.width -= 3; // text offset clip_rect.width -= 2; // button padding if (pane.HasCloseButton()) clip_rect.width -= m_buttonSize; if (pane.HasPinButton()) clip_rect.width -= m_buttonSize; if (pane.HasMaximizeButton()) clip_rect.width -= m_buttonSize; wxString draw_text = wxAuiChopText(dc, text, clip_rect.width); dc.SetClippingRegion(clip_rect); dc.DrawText(draw_text, rect.x+3 + caption_offset, rect.y+(rect.height/2)-(h/2)-1); dc.DestroyClippingRegion(); }