summaryrefslogtreecommitdiff
path: root/wx+/font_size.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2016-03-16 21:34:59 +0100
committerDaniel Wilhelm <daniel@wili.li>2016-03-16 21:34:59 +0100
commit339ed7f63798fb5ccab05fa7fb9d0d95743c9c89 (patch)
tree214819f601b69bfd32507ca59047dd4d68ed5632 /wx+/font_size.h
parent7.9 (diff)
downloadFreeFileSync-339ed7f63798fb5ccab05fa7fb9d0d95743c9c89.tar.gz
FreeFileSync-339ed7f63798fb5ccab05fa7fb9d0d95743c9c89.tar.bz2
FreeFileSync-339ed7f63798fb5ccab05fa7fb9d0d95743c9c89.zip
8.0
Diffstat (limited to 'wx+/font_size.h')
-rw-r--r--wx+/font_size.h43
1 files changed, 19 insertions, 24 deletions
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 <zen/basic_math.h>
#include <wx/window.h>
-#ifdef ZEN_WIN
- #include <zen/dll.h>
+#include <zen/scope_guard.h>
+#ifdef ZEN_WIN_VISTA_AND_LATER
+ #include <zen/win.h>
#include <Uxtheme.h>
#include <vsstyle.h> //TEXT_MAININSTRUCTION
- #include <vssym32.h> //TMT_COLOR
+ #include <vssym32.h> //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<OpenThemeDataFun> openThemeData (L"UxTheme.dll", "OpenThemeData"); //available with Windows XP and later
- const SysDllFun<CloseThemeDataFun> closeThemeData(L"UxTheme.dll", "CloseThemeData");
- const SysDllFun<GetThemeColorFun> 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));
bgstack15