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/SendScreenshotPlus/SendSS_10.vcxproj | 8 ++-- plugins/SendScreenshotPlus/SendSS_11.vcxproj | 8 ++-- plugins/SendScreenshotPlus/src/ctrl_button.cpp | 63 +++----------------------- plugins/SendScreenshotPlus/src/ctrl_button.h | 13 ------ plugins/SendScreenshotPlus/src/global.h | 2 + 5 files changed, 17 insertions(+), 77 deletions(-) (limited to 'plugins/SendScreenshotPlus') diff --git a/plugins/SendScreenshotPlus/SendSS_10.vcxproj b/plugins/SendScreenshotPlus/SendSS_10.vcxproj index f5b6eaf5d2..8e8310ac0b 100644 --- a/plugins/SendScreenshotPlus/SendSS_10.vcxproj +++ b/plugins/SendScreenshotPlus/SendSS_10.vcxproj @@ -82,7 +82,7 @@ Use - gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;%(AdditionalDependencies) + gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib @@ -109,7 +109,7 @@ Use - gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;%(AdditionalDependencies) + gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib @@ -132,7 +132,7 @@ Use - gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;%(AdditionalDependencies) + gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib @@ -158,7 +158,7 @@ Use - gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;%(AdditionalDependencies) + gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib diff --git a/plugins/SendScreenshotPlus/SendSS_11.vcxproj b/plugins/SendScreenshotPlus/SendSS_11.vcxproj index 3c124a614e..e353293c39 100644 --- a/plugins/SendScreenshotPlus/SendSS_11.vcxproj +++ b/plugins/SendScreenshotPlus/SendSS_11.vcxproj @@ -86,7 +86,7 @@ Use - gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;%(AdditionalDependencies) + gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib @@ -112,7 +112,7 @@ Use - gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;%(AdditionalDependencies) + gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib @@ -136,7 +136,7 @@ Use - gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;%(AdditionalDependencies) + gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib @@ -161,7 +161,7 @@ Use - gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;%(AdditionalDependencies) + gdiplus.lib;msimg32.lib;shlwapi.lib;comctl32.lib;UxTheme.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp index 7a3b2b5380..152e3b17db 100644 --- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp +++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp @@ -23,8 +23,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; @@ -47,53 +45,6 @@ typedef struct TMBCtrl{ // External theme methods and properties CRITICAL_SECTION csTips; HWND hwndToolTips = NULL; -HMODULE themeAPIHandle = NULL; - -// theme procedures -HANDLE (WINAPI *OpenThemeData)(HWND,LPCWSTR); -HRESULT (WINAPI *CloseThemeData)(HANDLE); -BOOL (WINAPI *IsThemeBackgroundPartiallyTransparent)(HANDLE,INT,INT); -HRESULT (WINAPI *DrawThemeParentBackground)(HWND,HDC,RECT *); -HRESULT (WINAPI *DrawThemeBackground)(HANDLE,HDC,INT,INT,const RECT *,const RECT *); -HRESULT (WINAPI *DrawThemeText)(HANDLE,HDC,INT,INT,LPCWSTR,INT,DWORD,DWORD,const RECT *); -HRESULT (WINAPI *GetThemeTextExtent)(HANDLE,HDC,INT,INT,LPCWSTR,INT,DWORD,OPTIONAL const RECT*, RECT *); -HRESULT (WINAPI *GetThemeBackgroundRegion)(HANDLE,HDC,INT,INT,const RECT *,HRGN *); - -/** - * name: ThemeSupport - * desc: Loads the uxtheme functions, if supported by the os - * param: none - * return: TRUE if themes are supported, FALSE if not - **/ -BOOLEAN __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"); - GetThemeBackgroundRegion = (HRESULT (WINAPI *)(HANDLE,HDC,INT,INT,const RECT *,HRGN *))MGPROC("GetThemeBackgroundRegion"); - } - } - // 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 @@ -101,7 +52,8 @@ BOOLEAN __fastcall ThemeSupport() { * param: ctl - BTNCTRL structure with the information about the theme to close * return: nothing **/ -static VOID __fastcall DestroyTheme(BTNCTRL *ctl) { +static VOID __fastcall DestroyTheme(BTNCTRL *ctl) +{ if (ctl->hThemeButton) { CloseThemeData(ctl->hThemeButton); ctl->hThemeButton = NULL; @@ -118,12 +70,11 @@ static VOID __fastcall DestroyTheme(BTNCTRL *ctl) { * param: ctl - BTNCTRL structure with the information about the theme to load * 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"); - } +static VOID __fastcall LoadTheme(BTNCTRL *ctl) +{ + DestroyTheme(ctl); + ctl->hThemeButton = OpenThemeData(ctl->hwnd,L"BUTTON"); + ctl->hThemeToolbar = OpenThemeData(ctl->hwnd,L"TOOLBAR"); } /** diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.h b/plugins/SendScreenshotPlus/src/ctrl_button.h index dc77334b05..0e4106460d 100644 --- a/plugins/SendScreenshotPlus/src/ctrl_button.h +++ b/plugins/SendScreenshotPlus/src/ctrl_button.h @@ -24,20 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _UINFOEX_BOTTONS_H_INCLUDED_ #define _UINFOEX_BOTTONS_H_INCLUDED_ 1 -// theme procedures -extern HANDLE (WINAPI *OpenThemeData)(HWND,LPCWSTR); -extern HRESULT (WINAPI *CloseThemeData)(HANDLE); -extern BOOL (WINAPI *IsThemeBackgroundPartiallyTransparent)(HANDLE,INT,INT); -extern HRESULT (WINAPI *DrawThemeParentBackground)(HWND,HDC,RECT *); -extern HRESULT (WINAPI *DrawThemeBackground)(HANDLE,HDC,INT,INT,const RECT *,const RECT *); -extern HRESULT (WINAPI *DrawThemeText)(HANDLE,HDC,INT,INT,LPCWSTR,INT,DWORD,DWORD,const RECT *); -extern HRESULT (WINAPI *GetThemeTextExtent)(HANDLE,HDC,INT,INT,LPCWSTR,INT,DWORD,OPTIONAL const RECT*, RECT *); -extern HRESULT (WINAPI *GetThemeBackgroundRegion)(HANDLE,HDC,INT,INT,const RECT *,HRGN *); - - VOID CtrlButtonLoadModule(); VOID CtrlButtonUnloadModule(); -BOOLEAN __fastcall ThemeSupport(); - #endif /* _UINFOEX_BOTTONS_H_INCLUDED_ */ \ No newline at end of file diff --git a/plugins/SendScreenshotPlus/src/global.h b/plugins/SendScreenshotPlus/src/global.h index cb1a374d0e..60a9cc05c6 100644 --- a/plugins/SendScreenshotPlus/src/global.h +++ b/plugins/SendScreenshotPlus/src/global.h @@ -40,6 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include + #include #include using namespace std; -- cgit v1.2.3