Commit 77983048 authored by twanvl's avatar twanvl

draw fancy windows explorer style selection rectangles

parent 98b0bf00
...@@ -338,3 +338,29 @@ void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e ...@@ -338,3 +338,29 @@ void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e
} }
#endif #endif
} }
void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool selected, bool focused, bool hot) {
#if wxUSE_UXTHEME && defined(__WXMSW__)
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
if (themeEngine && themeEngine->IsAppThemed()) {
wxUxThemeHandle hTheme(win, L"LISTVIEW");
RECT r;
r.left = rect.x;
r.top = rect.y;
r.right = rect.x + rect.width;
r.bottom = rect.y + rect.height;
if (hTheme) {
wxUxThemeEngine::Get()->SetWindowTheme((HWND)win->GetHWND(), L"Explorer", NULL);
wxUxThemeEngine::Get()->DrawThemeBackground(
(HTHEME)hTheme,
(HDC)dc.GetHDC(),
LVP_LISTITEM,
hot&&selected ? LISS_HOTSELECTED : hot ? LISS_HOT :selected&&focused ? LISS_SELECTED : selected ? LISS_SELECTEDNOTFOCUS : LISS_NORMAL,
&r,
NULL
);
return;
}
}
#endif
}
...@@ -75,5 +75,8 @@ void draw_checkbox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e ...@@ -75,5 +75,8 @@ void draw_checkbox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e
/// Draws a radio button /// Draws a radio button
void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool enabled = true); void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool enabled = true);
/// Draws a (fancy) selection rectangle
void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool selected = true, bool focused = true, bool hot = false);
// ----------------------------------------------------------------------------- : EOF // ----------------------------------------------------------------------------- : EOF
#endif #endif
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