diff options
Diffstat (limited to 'plugins/LangMan/src')
-rw-r--r-- | plugins/LangMan/src/common.h | 1 | ||||
-rw-r--r-- | plugins/LangMan/src/options.cpp | 36 |
2 files changed, 10 insertions, 27 deletions
diff --git a/plugins/LangMan/src/common.h b/plugins/LangMan/src/common.h index cc0e8c041f..d3cd0a1397 100644 --- a/plugins/LangMan/src/common.h +++ b/plugins/LangMan/src/common.h @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <windows.h>
#include <ShlObj.h>
#include <vsstyle.h>
+#include <Uxtheme.h>
#include <newpluginapi.h>
#include <m_langpack.h>
diff --git a/plugins/LangMan/src/options.cpp b/plugins/LangMan/src/options.cpp index 2420509699..f7eaac87c7 100644 --- a/plugins/LangMan/src/options.cpp +++ b/plugins/LangMan/src/options.cpp @@ -39,12 +39,6 @@ static HIMAGELIST CreateRadioImages(COLORREF clrBk, COLORREF clrText) HBITMAP hbm, hbmPrev;
HIMAGELIST himl = NULL;
- /* the WinXP+ themed way */
- HTHEME (WINAPI *pfnOpenThemeData)(HWND, const WCHAR*);
- HTHEME (WINAPI *pfnCloseThemeData)(HTHEME);
- HRESULT (WINAPI *pfnDrawThemeBackground)(HTHEME, HDC, int, int, const RECT*, const RECT*);
- HMODULE hUxThemeDLL = LoadLibrary(_T("UXTHEME")); /* all ascii */
-
/* draw bitmap */
hdcScreen = GetDC(NULL);
if (hdcScreen!=NULL) {
@@ -57,27 +51,16 @@ static HIMAGELIST CreateRadioImages(COLORREF clrBk, COLORREF clrText) if (hbm!=NULL) {
hbmPrev = (HBITMAP)SelectObject(hdc, hbm);
if (hbmPrev!=NULL) { /* error on select? */
- /* the WinXP+ themed way */
- if (hUxThemeDLL!=NULL) {
- *(PROC*)&pfnOpenThemeData = GetProcAddress(hUxThemeDLL, "OpenThemeData");
- *(PROC*)&pfnCloseThemeData = GetProcAddress(hUxThemeDLL, "CloseThemeData");
- *(PROC*)&pfnDrawThemeBackground = GetProcAddress(hUxThemeDLL, "DrawThemeBackground");
- if (pfnOpenThemeData!=NULL && pfnCloseThemeData!=NULL && pfnDrawThemeBackground!=NULL) {
- HTHEME hTheme;
- hTheme = pfnOpenThemeData(NULL, L"Button");
- if (hTheme!=NULL) {
- SetRect(&rc, 0, 0, size.cx, size.cy);
- /* unchecked */
- if (!pfnDrawThemeBackground(hTheme, hdc, BP_RADIOBUTTON, RBS_UNCHECKEDNORMAL, &rc, NULL)) {
- /* checked */
- OffsetRect(&rc, size.cx, 0);
- if (!pfnDrawThemeBackground(hTheme, hdc, BP_RADIOBUTTON, RBS_CHECKEDNORMAL, &rc, NULL))
- himl = ImageList_Create(size.cx, size.cy, ILC_COLOR32|ILC_MASK, 3, 0);
- }
- pfnCloseThemeData(hTheme);
- }
- }
+ HTHEME hTheme = OpenThemeData(NULL, L"Button");
+ SetRect(&rc, 0, 0, size.cx, size.cy);
+ /* unchecked */
+ if (!DrawThemeBackground(hTheme, hdc, BP_RADIOBUTTON, RBS_UNCHECKEDNORMAL, &rc, NULL)) {
+ /* checked */
+ OffsetRect(&rc, size.cx, 0);
+ if (!DrawThemeBackground(hTheme, hdc, BP_RADIOBUTTON, RBS_CHECKEDNORMAL, &rc, NULL))
+ himl = ImageList_Create(size.cx, size.cy, ILC_COLOR32|ILC_MASK, 3, 0);
}
+ CloseThemeData(hTheme);
/* the classic way */
if (himl == NULL) {
register HDC hdcMono;
@@ -144,7 +127,6 @@ static HIMAGELIST CreateRadioImages(COLORREF clrBk, COLORREF clrText) ReleaseDC(NULL, hdcScreen);
}
- if (hUxThemeDLL!=NULL) FreeLibrary(hUxThemeDLL);
return himl;
}
|