From e0e9dd5f90f4f5be48a439b310802c4b7443db0b Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 20 Sep 2013 18:40:36 +0000 Subject: using Uxtheme git-svn-id: http://svn.miranda-ng.org/main/trunk@6141 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp | 9 +--- plugins/UserInfoEx/src/commonheaders.h | 1 + plugins/UserInfoEx/src/ctrl_button.cpp | 55 ++----------------------- plugins/UserInfoEx/src/dlg_propsheet.cpp | 4 +- 4 files changed, 7 insertions(+), 62 deletions(-) (limited to 'plugins/UserInfoEx/src') diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index c18583930d..0e82631427 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -302,14 +302,7 @@ void InitIcons() if (NULL == (dib = LoadResource(IDB_FLAGSPNG,_T("PNG")))) return; - if (IsWinVerXPPlus()) bitDest = bit = ILC_COLOR32; - else if (IsWinVer2000Plus()) bitDest = ILC_COLOR24; - else if (IsWinVerMEPlus()) bitDest = ILC_COLOR16; - /*else preset bitDest = ILC_COLOR8;*/ - - //we work always with 24bit if bitDest < xp+ - //coz we cannot perform paste operations between palettized images, - //unless both src and dst images use the same palette. + bitDest = bit = ILC_COLOR32; if (FIP->FI_GetBPP(dib) != bit) if (NULL == (dib = ConvertTo(dib, bit, 0))) return; diff --git a/plugins/UserInfoEx/src/commonheaders.h b/plugins/UserInfoEx/src/commonheaders.h index 85cc866c83..d5e67ba2f5 100644 --- a/plugins/UserInfoEx/src/commonheaders.h +++ b/plugins/UserInfoEx/src/commonheaders.h @@ -44,6 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include using namespace std; diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp index fd29e29f4c..b0ada2b385 100644 --- a/plugins/UserInfoEx/src/ctrl_button.cpp +++ b/plugins/UserInfoEx/src/ctrl_button.cpp @@ -25,8 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define BUTTON_POLLID 100 #define BUTTON_POLLDELAY 50 -#define MGPROC(x) GetProcAddress(themeAPIHandle,x) - typedef struct TMBCtrl{ HWND hwnd; HANDLE hThemeButton; @@ -49,51 +47,6 @@ typedef struct TMBCtrl{ // External theme methods and properties static CRITICAL_SECTION csTips; static HWND hwndToolTips = NULL; -static HMODULE themeAPIHandle = NULL; - -// theme procedures -static HANDLE (WINAPI *OpenThemeData)(HWND,LPCWSTR); -static HRESULT (WINAPI *CloseThemeData)(HANDLE); -static BOOL (WINAPI *IsThemeBackgroundPartiallyTransparent)(HANDLE,int,int); -static HRESULT (WINAPI *DrawThemeParentBackground)(HWND,HDC,RECT *); -static HRESULT (WINAPI *DrawThemeBackground)(HANDLE,HDC,int,int,const RECT *,const RECT *); -static HRESULT (WINAPI *DrawThemeText)(HANDLE,HDC,int,int,LPCWSTR,int,DWORD,DWORD,const RECT *); -static HRESULT (WINAPI *GetThemeTextExtent)(HANDLE,HDC,int,int,LPCWSTR,int,DWORD,OPTIONAL const RECT*, RECT *); - -/** - * name: ThemeSupport - * desc: Loads the uxtheme functions, if supported by the os - * param: none - * return: TRUE if themes are supported, FALSE if not - **/ -static BYTE __fastcall ThemeSupport() { - if (IsWinVerXPPlus()) { - if (!themeAPIHandle) { - themeAPIHandle = GetModuleHandleA("uxtheme"); - if (themeAPIHandle) { - OpenThemeData = (HANDLE (WINAPI *)(HWND,LPCWSTR))MGPROC("OpenThemeData"); - CloseThemeData = (HRESULT (WINAPI *)(HANDLE))MGPROC("CloseThemeData"); - IsThemeBackgroundPartiallyTransparent = (BOOL (WINAPI *)(HANDLE,int,int))MGPROC("IsThemeBackgroundPartiallyTransparent"); - DrawThemeParentBackground = (HRESULT (WINAPI *)(HWND,HDC,RECT *))MGPROC("DrawThemeParentBackground"); - DrawThemeBackground = (HRESULT (WINAPI *)(HANDLE,HDC,int,int,const RECT *,const RECT *))MGPROC("DrawThemeBackground"); - DrawThemeText = (HRESULT (WINAPI *)(HANDLE,HDC,int,int,LPCWSTR,int,DWORD,DWORD,const RECT *))MGPROC("DrawThemeText"); - GetThemeTextExtent = (HRESULT (WINAPI *)(HANDLE,HDC,int,int,LPCWSTR,int,DWORD,OPTIONAL const RECT*, RECT *))MGPROC("GetThemeTextExtent"); - } - } - // Make sure all of these methods are valid (i would hope either all or none work) - if (OpenThemeData - && CloseThemeData - && IsThemeBackgroundPartiallyTransparent - && DrawThemeParentBackground - && DrawThemeBackground - && DrawThemeText - && GetThemeTextExtent) - { - return TRUE; - } - } - return FALSE; -} /** * name: DestroyTheme @@ -119,11 +72,9 @@ static void __fastcall DestroyTheme(BTNCTRL *ctl) { * return: nothing **/ static void __fastcall LoadTheme(BTNCTRL *ctl) { - if (ThemeSupport()) { - DestroyTheme(ctl); - ctl->hThemeButton = OpenThemeData(ctl->hwnd,L"BUTTON"); - ctl->hThemeToolbar = OpenThemeData(ctl->hwnd,L"TOOLBAR"); - } + DestroyTheme(ctl); + ctl->hThemeButton = OpenThemeData(ctl->hwnd,L"BUTTON"); + ctl->hThemeToolbar = OpenThemeData(ctl->hwnd,L"TOOLBAR"); } /** diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 2775719a87..3582c99a10 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -284,7 +284,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) // create imagelist metrics.x = GetSystemMetrics(SM_CXSMICON); metrics.y = GetSystemMetrics(SM_CYSMICON); - if ((psh._hImages = ImageList_Create(metrics.x, metrics.y, (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 0, 1)) == NULL) { + if ((psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) == NULL) { MsgErr(NULL, LPGENT("Creating the imagelist failed!")); return 1; } @@ -585,7 +585,7 @@ void DlgContactInfoInitTreeIcons() metrics.x = GetSystemMetrics(SM_CXSMICON); metrics.y = GetSystemMetrics(SM_CYSMICON); - if (psh._hImages = ImageList_Create(metrics.x, metrics.y, (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 0, 1)) { + if (psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) { HICON hDefIcon = IcoLib_GetIcon(ICO_TREE_DEFAULT); if (!hDefIcon) { -- cgit v1.2.3