Allow constructing wxUxThemeHandle from an HWND too

This is not used used yet, but will be soon for getting theme data of
the header control which is part of wxListCtrl but doesn't have any
corresponding wxWindow. It's also useful for using null HWND, which
must be used with the special "ItemsView" theme when using dark mode.
This commit is contained in:
Vadim Zeitlin 2022-12-07 22:59:41 +00:00
parent 8d3971ef6b
commit 4b0c691b09

View file

@ -169,9 +169,14 @@ WXDLLIMPEXP_CORE bool wxUxThemeIsActive();
class wxUxThemeHandle
{
public:
wxUxThemeHandle(const wxWindow *win, const wchar_t *classes)
wxUxThemeHandle(HWND hwnd, const wchar_t *classes) :
m_hTheme{::OpenThemeData(hwnd, classes)}
{
}
wxUxThemeHandle(const wxWindow *win, const wchar_t *classes) :
wxUxThemeHandle(GetHwndOf(win), classes)
{
m_hTheme = (HTHEME)::OpenThemeData(GetHwndOf(win), classes);
}
operator HTHEME() const { return m_hTheme; }