mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 05:57:00 -04:00
Fix uxtheme stuff on windows
This commit is contained in:
+25
-31
@@ -246,18 +246,17 @@ void draw3DBorder(DC& dc, int x1, int y1, int x2, int y2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, bool enabled) {
|
void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, bool enabled) {
|
||||||
#if wxUSE_UXTHEME && defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
#if wxUSE_UXTHEME && defined(__WXMSW__)
|
||||||
RECT r;
|
RECT r;
|
||||||
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
|
if (wxUxThemeIsActive()) {
|
||||||
if (themeEngine && themeEngine->IsAppThemed()) {
|
HTHEME hTheme = (HTHEME)::OpenThemeData(GetHwndOf(win), L"EDIT");
|
||||||
wxUxThemeHandle hTheme(win, L"EDIT");
|
|
||||||
r.left = rect.x -1;
|
|
||||||
r.top = rect.y -1;
|
|
||||||
r.right = rect.x + rect.width + 1;
|
|
||||||
r.bottom = rect.y + rect.height + 1;
|
|
||||||
if (hTheme) {
|
if (hTheme) {
|
||||||
wxUxThemeEngine::Get()->DrawThemeBackground(
|
r.left = rect.x -1;
|
||||||
(HTHEME)hTheme,
|
r.top = rect.y -1;
|
||||||
|
r.right = rect.x + rect.width + 1;
|
||||||
|
r.bottom = rect.y + rect.height + 1;
|
||||||
|
::DrawThemeBackground(
|
||||||
|
hTheme,
|
||||||
(HDC)dc.GetHDC(),
|
(HDC)dc.GetHDC(),
|
||||||
EP_EDITTEXT,
|
EP_EDITTEXT,
|
||||||
!enabled ? ETS_DISABLED : focused ? ETS_NORMAL : ETS_NORMAL,
|
!enabled ? ETS_DISABLED : focused ? ETS_NORMAL : ETS_NORMAL,
|
||||||
@@ -274,7 +273,7 @@ void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, boo
|
|||||||
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
dc.DrawRectangle(rect);
|
dc.DrawRectangle(rect);
|
||||||
// draw the border
|
// draw the border
|
||||||
#if defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
#if defined(__WXMSW__)
|
||||||
r.left = rect.x - 2;
|
r.left = rect.x - 2;
|
||||||
r.top = rect.y - 2;
|
r.top = rect.y - 2;
|
||||||
r.right = rect.x + rect.width + 2;
|
r.right = rect.x + rect.width + 2;
|
||||||
@@ -361,7 +360,7 @@ void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool selected, bool focused, bool hot) {
|
void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool selected, bool focused, bool hot) {
|
||||||
#if wxUSE_UXTHEME && defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
#if wxUSE_UXTHEME && defined(__WXMSW__)
|
||||||
#if !defined(NTDDI_LONGHORN) || NTDDI_VERSION < NTDDI_LONGHORN
|
#if !defined(NTDDI_LONGHORN) || NTDDI_VERSION < NTDDI_LONGHORN
|
||||||
#define LISS_NORMAL LIS_NORMAL
|
#define LISS_NORMAL LIS_NORMAL
|
||||||
#define LISS_SELECTED LIS_SELECTED
|
#define LISS_SELECTED LIS_SELECTED
|
||||||
@@ -369,35 +368,30 @@ void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool sele
|
|||||||
#define LISS_HOT LISS_NORMAL
|
#define LISS_HOT LISS_NORMAL
|
||||||
#define LISS_HOTSELECTED LISS_SELECTED
|
#define LISS_HOTSELECTED LISS_SELECTED
|
||||||
#endif
|
#endif
|
||||||
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
|
HTHEME hTheme = (HTHEME)::OpenThemeData(GetHwndOf(win), L"LISTVIEW");
|
||||||
if (themeEngine && themeEngine->IsAppThemed()) {
|
if (hTheme) {
|
||||||
wxUxThemeHandle hTheme(win, L"LISTVIEW");
|
|
||||||
RECT r;
|
RECT r;
|
||||||
r.left = rect.x;
|
r.left = rect.x;
|
||||||
r.top = rect.y;
|
r.top = rect.y;
|
||||||
r.right = rect.x + rect.width;
|
r.right = rect.x + rect.width;
|
||||||
r.bottom = rect.y + rect.height;
|
r.bottom = rect.y + rect.height;
|
||||||
if (hTheme) {
|
::DrawThemeBackground(
|
||||||
//themeEngine->SetWindowTheme((HWND)win->GetHWND(), L"Explorer", NULL);
|
hTheme,
|
||||||
themeEngine->DrawThemeBackground(
|
(HDC)dc.GetHDC(),
|
||||||
(HTHEME)hTheme,
|
LVP_LISTITEM,
|
||||||
(HDC)dc.GetHDC(),
|
hot&&selected ? LISS_HOTSELECTED : hot ? LISS_HOT :selected&&focused ? LISS_SELECTED : selected ? LISS_SELECTEDNOTFOCUS : LISS_NORMAL,
|
||||||
LVP_LISTITEM,
|
&r,
|
||||||
hot&&selected ? LISS_HOTSELECTED : hot ? LISS_HOT :selected&&focused ? LISS_SELECTED : selected ? LISS_SELECTEDNOTFOCUS : LISS_NORMAL,
|
NULL
|
||||||
&r,
|
);
|
||||||
NULL
|
return;
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable_themed_selection_rectangle(Window* win) {
|
void enable_themed_selection_rectangle(Window* win) {
|
||||||
#if wxUSE_UXTHEME && defined(__WXMSW__) && TODO_FIX_THEME_ENGINE
|
#if wxUSE_UXTHEME && defined(__WXMSW__)
|
||||||
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
|
if (wxUxThemeIsActive()) {
|
||||||
if (themeEngine && themeEngine->IsAppThemed()) {
|
::SetWindowTheme((HWND)win->GetHWND(), L"Explorer", NULL);
|
||||||
themeEngine->SetWindowTheme((HWND)win->GetHWND(), L"Explorer", NULL);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user