draw fancy windows explorer style selection rectangles

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1567 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-12-07 23:01:19 +00:00
parent 46bb971350
commit 70471251e4
2 changed files with 29 additions and 0 deletions
+26
View File
@@ -338,3 +338,29 @@ void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e
}
#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
}
+3
View File
@@ -75,5 +75,8 @@ void draw_checkbox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e
/// Draws a radio button
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
#endif