From 339ed7f63798fb5ccab05fa7fb9d0d95743c9c89 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Wed, 16 Mar 2016 21:34:59 +0100 Subject: 8.0 --- wx+/font_size.h | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'wx+/font_size.h') diff --git a/wx+/font_size.h b/wx+/font_size.h index 2858afb6..03f3c62b 100644 --- a/wx+/font_size.h +++ b/wx+/font_size.h @@ -9,11 +9,12 @@ #include #include -#ifdef ZEN_WIN - #include +#include +#ifdef ZEN_WIN_VISTA_AND_LATER + #include #include #include //TEXT_MAININSTRUCTION - #include //TMT_COLOR + #include //TMT_TEXTCOLOR #endif @@ -49,28 +50,22 @@ void setMainInstructionFont(wxWindow& control) #ifdef ZEN_WIN //http://msdn.microsoft.com/de-DE/library/windows/desktop/aa974176#fonts font.SetPointSize(wxNORMAL_FONT->GetPointSize() * 4 / 3); //integer round down +#ifdef ZEN_WIN_VISTA_AND_LATER //get main instruction color: don't hard-code, respect accessibility! - typedef HTHEME (WINAPI* OpenThemeDataFun )(HWND hwnd, LPCWSTR pszClassList); - typedef HRESULT (WINAPI* CloseThemeDataFun)(HTHEME hTheme); - typedef HRESULT (WINAPI* GetThemeColorFun )(HTHEME hTheme, int iPartId, int iStateId, int iPropId, COLORREF *pColor); - - const SysDllFun openThemeData (L"UxTheme.dll", "OpenThemeData"); //available with Windows XP and later - const SysDllFun closeThemeData(L"UxTheme.dll", "CloseThemeData"); - const SysDllFun getThemeColor (L"UxTheme.dll", "GetThemeColor"); - if (openThemeData && closeThemeData && getThemeColor) - if (HTHEME hTheme = openThemeData(NULL, //__in HWND hwnd, - L"TEXTSTYLE")) //__in LPCWSTR pszClassList - { - ZEN_ON_SCOPE_EXIT(closeThemeData(hTheme)); - - COLORREF cr = {}; - if (getThemeColor(hTheme, //_In_ HTHEME hTheme, - TEXT_MAININSTRUCTION, // _In_ int iPartId, - 0, // _In_ int iStateId, - TMT_TEXTCOLOR, // _In_ int iPropId, - &cr) == S_OK) // _Out_ COLORREF *pColor - control.SetForegroundColour(wxColor(cr)); - } + if (HTHEME hTheme = ::OpenThemeData(NULL, //__in HWND hwnd, + L"TEXTSTYLE")) //__in LPCWSTR pszClassList + { + ZEN_ON_SCOPE_EXIT(::CloseThemeData(hTheme)); + + COLORREF cr = {}; + if (::GetThemeColor(hTheme, //_In_ HTHEME hTheme, + TEXT_MAININSTRUCTION, // _In_ int iPartId, + 0, // _In_ int iStateId, + TMT_TEXTCOLOR, // _In_ int iPropId, + &cr) == S_OK) // _Out_ COLORREF *pColor + control.SetForegroundColour(wxColor(cr)); + } +#endif #elif defined ZEN_LINUX //https://developer.gnome.org/hig-book/3.2/hig-book.html#alert-text font.SetPointSize(numeric::round(wxNORMAL_FONT->GetPointSize() * 12.0 / 11)); -- cgit