ReactOS  0.4.14-dev-293-g2b39b42
theme.c
Go to the documentation of this file.
1 /*
2  * ReactOS Calc (Theming support)
3  *
4  * Copyright 2007-2017, Carlo Bramini
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "calc.h"
22 
23 #define GET_CB(name) \
24  calc_##name = (type_##name)GetProcAddress(hUxTheme, #name); \
25  if (calc_##name == NULL) calc_##name = dummy_##name;
26 
27 static HTHEME WINAPI
28 dummy_OpenThemeData(HWND hwnd, const WCHAR *pszClassList);
29 
30 static HRESULT WINAPI
32 
33 static HRESULT WINAPI
34 dummy_DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
35  const RECT *prc, const RECT *prcClip);
36 
37 static BOOL WINAPI
38 dummy_IsAppThemed(void);
39 
40 static BOOL WINAPI
42 
43 static BOOL WINAPI
44 dummy_IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId);
45 
46 static HRESULT WINAPI
48 
49 
56  dummy_IsThemeBackgroundPartiallyTransparent;
58  dummy_DrawThemeParentBackground;
59 
61 
62 static HTHEME WINAPI
63 dummy_OpenThemeData(HWND hwnd, const WCHAR* pszClassList)
64 {
65  return NULL;
66 }
67 
68 static HRESULT WINAPI
70 {
71  return E_NOTIMPL;
72 }
73 
74 static HRESULT WINAPI
75 dummy_DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
76  const RECT* prc, const RECT* prcClip)
77 {
78  return E_NOTIMPL;
79 }
80 
81 static BOOL WINAPI
83 {
84  return FALSE;
85 }
86 
87 static BOOL WINAPI
89 {
90  return FALSE;
91 }
92 
93 static BOOL WINAPI
94 dummy_IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
95 {
96  return FALSE;
97 }
98 
99 static HRESULT WINAPI
101 {
102  return E_NOTIMPL;
103 }
104 
106 {
107  hUxTheme = LoadLibrary(_T("UXTHEME"));
108  if (hUxTheme == NULL)
109  return;
110 
118 }
119 
120 void Theme_Stop(void)
121 {
122  if(hUxTheme == NULL)
123  return;
124 
126  hUxTheme = NULL;
127 }
void Theme_Start(HINSTANCE hInstance)
Definition: theme.c:105
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT(WINAPI * type_CloseThemeData)(HTHEME)
Definition: calc.h:80
type_CloseThemeData calc_CloseThemeData
Definition: theme.c:51
static BOOL WINAPI dummy_IsThemeActive(void)
Definition: theme.c:88
#define LoadLibrary
Definition: winbase.h:3686
static HRESULT WINAPI dummy_DrawThemeParentBackground(HWND hWnd, HDC hdc, RECT *prc)
Definition: theme.c:100
static HDC
Definition: imagelist.c:92
type_DrawThemeBackground calc_DrawThemeBackground
Definition: theme.c:52
HWND hWnd
Definition: settings.c:17
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
type_IsThemeBackgroundPartiallyTransparent calc_IsThemeBackgroundPartiallyTransparent
Definition: theme.c:55
static HRESULT WINAPI dummy_CloseThemeData(HTHEME hTheme)
Definition: theme.c:69
static HTHEME WINAPI dummy_OpenThemeData(HWND hwnd, const WCHAR *pszClassList)
Definition: theme.c:63
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: draw.c:1883
type_IsThemeActive calc_IsThemeActive
Definition: theme.c:54
HINSTANCE hInstance
Definition: charmap.c:20
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
#define GET_CB(name)
Definition: theme.c:23
BOOL(WINAPI * type_IsAppThemed)(void)
Definition: calc.h:82
HRESULT(WINAPI * type_DrawThemeParentBackground)(HWND, HDC, RECT *)
Definition: calc.h:85
smooth NULL
Definition: ftsmooth.c:416
HTHEME(WINAPI * type_OpenThemeData)(HWND, const WCHAR *)
Definition: calc.h:79
static BOOL WINAPI dummy_IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: theme.c:94
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:405
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define WINAPI
Definition: msvc.h:8
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HDC hdc
Definition: main.c:9
BOOL(WINAPI * type_IsThemeBackgroundPartiallyTransparent)(HTHEME, int, int)
Definition: calc.h:84
type_DrawThemeParentBackground calc_DrawThemeParentBackground
Definition: theme.c:57
static BOOL WINAPI dummy_IsAppThemed(void)
Definition: theme.c:82
#define E_NOTIMPL
Definition: ddrawi.h:99
type_OpenThemeData calc_OpenThemeData
Definition: theme.c:50
static HRESULT WINAPI dummy_DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *prc, const RECT *prcClip)
Definition: theme.c:75
type_IsAppThemed calc_IsAppThemed
Definition: theme.c:53
void Theme_Stop(void)
Definition: theme.c:120
BOOL(WINAPI * type_IsThemeActive)(void)
Definition: calc.h:83
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
HRESULT(WINAPI * type_DrawThemeBackground)(HTHEME, HDC, int, int, const RECT *, const RECT *)
Definition: calc.h:81
static HMODULE hUxTheme
Definition: theme.c:60
_Out_ LPRECT prc
Definition: ntgdi.h:1658
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950