Commit bdaa8083 authored by twanvl's avatar twanvl

draw_control_box instead of draw_control_border

parent 0230317c
......@@ -36,18 +36,14 @@ void NativeLookEditor::drawViewer(RotatedDC& dc, ValueViewer& v) {
if (!shouldDraw(v)) return;
ValueEditor* e = v.getEditor();
if (!e || e->drawLabel()) {
// draw background
// draw control border and box
Style& s = *v.getStyle();
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
dc.DrawRectangle(s.getInternalRect().grow(1));
draw_control_box(this, dc.getDC(), dc.trRectStraight(s.getInternalRect().grow(1)), current_editor == e, e != nullptr);
// draw label
dc.SetFont(*wxNORMAL_FONT);
// TODO : tr using stylesheet or using game?
dc.DrawText(tr(getStylePackage(), s.fieldP->name, capitalize_sentence),
RealPoint(margin_left - s.left, 1));
// draw 3D border
draw_control_border(this, dc.getDC(), dc.trRectStraight(s.getInternalRect().grow(1)));
}
// draw viewer
v.draw(dc);
......
......@@ -19,7 +19,7 @@ DECLARE_POINTER_TYPE(ExportTemplate);
/// A data editor with a platform native look
class NativeLookEditor : public DataEditor {
public:
NativeLookEditor(Window* parent, int id, long style = 0);
NativeLookEditor(Window* parent, int id, long style = wxBORDER_THEME);
/// Uses a native look
virtual bool nativeLook() const { return true; }
......
......@@ -194,6 +194,18 @@ wxBitmap load_resource_tool_image(const String& name) {
#endif
}
#if defined(_UNICODE) && defined(_MSC_VER) && _MSC_VER >= 1400
// manifest to use new-style controls in Windows Vista / Windows 7
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
// ----------------------------------------------------------------------------- : Platform look
// Draw a basic 3D border
......@@ -212,7 +224,7 @@ void draw3DBorder(DC& dc, int x1, int y1, int x2, int y2) {
dc.DrawLine(x2+1, y1-1, x2+1, y2+2);
}
void draw_control_border(Window* win, DC& dc, const wxRect& rect) {
void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, bool enabled) {
#if wxUSE_UXTHEME && defined(__WXMSW__)
RECT r;
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
......@@ -227,19 +239,28 @@ void draw_control_border(Window* win, DC& dc, const wxRect& rect) {
(HTHEME)hTheme,
(HDC)dc.GetHDC(),
EP_EDITTEXT,
ETS_NORMAL,
!enabled ? ETS_DISABLED : focused ? ETS_NORMAL : ETS_NORMAL,
&r,
NULL
);
return;
}
}
#endif
// otherwise, draw a standard border
// clear the background
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
dc.DrawRectangle(rect);
// draw the border
#if defined(__WXMSW__)
r.left = rect.x - 2;
r.top = rect.y - 2;
r.right = rect.x + rect.width + 2;
r.bottom = rect.y + rect.height + 2;
DrawEdge((HDC)dc.GetHDC(), &r, EDGE_SUNKEN, BF_RECT);
#else
// draw a 3D border
draw3DBorder(dc, rect.x - 1, rect.y - 1, rect.x + rect.width, rect.y + rect.height);
#endif
}
......
......@@ -56,9 +56,9 @@ wxBitmap load_resource_tool_image(const String& name);
// ----------------------------------------------------------------------------- : Platform look
/// Draws a border for a control *around* a rect
/// Draws a box for a control *around* a rect
/** Based on wxRendererXP::DrawComboBoxDropButton */
void draw_control_border(Window* win, DC& dc, const wxRect& rect);
void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, bool enabled = true);
/// 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);
......
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