summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-09-20 18:40:36 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-09-20 18:40:36 +0000
commite0e9dd5f90f4f5be48a439b310802c4b7443db0b (patch)
tree2cf27bc13212a3b30e5ba3b051429e6d326c9f4e /plugins/SendScreenshotPlus/src
parentdb3809c5db0a3a1bf82ecd59a5523e8831c207dd (diff)
using Uxtheme
git-svn-id: http://svn.miranda-ng.org/main/trunk@6141 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src')
-rw-r--r--plugins/SendScreenshotPlus/src/ctrl_button.cpp63
-rw-r--r--plugins/SendScreenshotPlus/src/ctrl_button.h13
-rw-r--r--plugins/SendScreenshotPlus/src/global.h2
3 files changed, 9 insertions, 69 deletions
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 <Shlwapi.h>
#include <gdiplus.h>
#include <mapi.h>
+#include <UxTheme.h>
+
#include <map>
#include <string>
using namespace std;