diff --git a/src/gui/util.cpp b/src/gui/util.cpp index cda379c8..07605b21 100644 --- a/src/gui/util.cpp +++ b/src/gui/util.cpp @@ -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[] = diff --git a/src/gui/util.hpp b/src/gui/util.hpp index af3cf5f4..db8c3ce2 100644 --- a/src/gui/util.hpp +++ b/src/gui/util.hpp @@ -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); diff --git a/src/gui/value/symbol.cpp b/src/gui/value/symbol.cpp index d6608a63..98129aaa 100644 --- a/src/gui/value/symbol.cpp +++ b/src/gui/value/symbol.cpp @@ -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)));