Commit 98b0bf00 authored by twanvl's avatar twanvl

use native themed push buttons

parent 28901f3b
......@@ -265,6 +265,23 @@ void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, boo
#endif
}
void draw_button(Window* win, DC& dc, const wxRect& rect, bool focused, bool down, bool enabled) {
#if 1
wxRendererNative& rn = wxRendererNative::GetDefault();
rn.DrawPushButton(win, dc, rect, (focused ? wxCONTROL_FOCUSED : 0) | (down ? wxCONTROL_PRESSED : 0) | (enabled ? 0 : wxCONTROL_DISABLED));
#else
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
dc.SetPen(wxSystemSettings::GetColour(down ? wxSYS_COLOUR_BTNSHADOW : wxSYS_COLOUR_BTNHIGHLIGHT));
dc.DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y);
dc.DrawLine(rect.x,rect.y,rect.x,rect.y+rect.height);
dc.SetPen(wxSystemSettings::GetColour(down ? wxSYS_COLOUR_BTNHIGHLIGHT : wxSYS_COLOUR_BTNSHADOW));
dc.DrawLine(rect.x+rect.width-1,rect.y,rect.x+rect.width-1,rect.y+rect.height);
dc.DrawLine(rect.x,rect.y+rect.height-1,rect.x+rect.width,rect.y+rect.height-1);
#endif
}
// portable, based on wxRendererGeneric::DrawComboBoxDropButton
void draw_menu_arrow(Window* win, DC& dc, const wxRect& rect, bool active) {
wxPoint pt[] =
......
......@@ -60,6 +60,9 @@ wxBitmap load_resource_tool_image(const String& name);
/** Based on wxRendererXP::DrawComboBoxDropButton */
void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, bool enabled = true);
/// Draw a (possibly themed) button
void draw_button(Window* win, DC& dc, const wxRect& rect, bool focused, bool down, bool enabled);
/// Draws an arrow for a menu item indicating it has a sub menu
void draw_menu_arrow(Window* win, DC& dc, const wxRect& rect, bool active);
......
......@@ -43,15 +43,7 @@ void SymbolValueEditor::drawButton(RotatedDC& dc, int button, const String& text
double x = style().width - width - (width + 1) * button;
double y = 0;
// draw button
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
dc.DrawRectangle(RealRect(x, y, width, height));
dc.SetPen(wxSystemSettings::GetColour(down ? wxSYS_COLOUR_BTNSHADOW : wxSYS_COLOUR_BTNHIGHLIGHT));
dc.DrawLine(RealPoint(x,y),RealPoint(x+width,y));
dc.DrawLine(RealPoint(x,y),RealPoint(x,y+height));
dc.SetPen(wxSystemSettings::GetColour(down ? wxSYS_COLOUR_BTNHIGHLIGHT : wxSYS_COLOUR_BTNSHADOW));
dc.DrawLine(RealPoint(x+width-1,y),RealPoint(x+width-1,y+height));
dc.DrawLine(RealPoint(x,y+height-1),RealPoint(x+width,y+height-1));
draw_button(&editor(), dc.getDC(), dc.trRectToBB(RealRect(x,y,width,height)), false, down, true);
// draw text
RealSize text_size = dc.GetTextExtent(text);
dc.DrawText(text, align_in_rect((Alignment)(ALIGN_BOTTOM | ALIGN_CENTER), text_size, RealRect(x, y, width,height*0.9)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment