wxControlRenderer(wxWindow *control, wxDC& dc, wxRenderer *renderer);
// operations
- void DrawLabel(const wxBitmap& bitmap = wxNullBitmap,
- wxCoord marginX = 0, wxCoord marginY = 0);
+ void DrawLabel();
+ void DrawButtonLabel(const wxBitmap& bitmap = wxNullBitmap,
+ wxCoord marginX = 0, wxCoord marginY = 0);
#if wxUSE_LISTBOX
void DrawItems(const wxListBox *listbox,
size_t itemFirst, size_t itemLast);
renderer->DrawButtonBorder();
}
- renderer->DrawLabel(m_bitmap, m_marginBmpX, m_marginBmpY);
+ renderer->DrawButtonLabel(m_bitmap, m_marginBmpX, m_marginBmpY);
}
bool wxButton::DoDrawBackground(wxDC& dc)
m_rect.height = size.y;
}
-void wxControlRenderer::DrawLabel(const wxBitmap& bitmap,
- wxCoord marginX, wxCoord marginY)
+void wxControlRenderer::DrawLabel()
+{
+ m_dc.SetBackgroundMode(wxTRANSPARENT);
+ m_dc.SetFont(m_window->GetFont());
+ m_dc.SetTextForeground(m_window->GetForegroundColour());
+
+ wxString label = m_window->GetLabel();
+ if ( !label.empty() )
+ {
+ wxControl *ctrl = wxStaticCast(m_window, wxControl);
+
+ m_renderer->DrawLabel(m_dc,
+ label,
+ m_rect,
+ m_window->GetStateFlags(),
+ ctrl->GetAlignment(),
+ ctrl->GetAccelIndex());
+ }
+}
+
+void wxControlRenderer::DrawButtonLabel(const wxBitmap& bitmap,
+ wxCoord marginX, wxCoord marginY)
{
m_dc.SetBackgroundMode(wxTRANSPARENT);
m_dc.SetFont(m_window->GetFont());