ReactOS 0.4.15-dev-7934-g1dc8d80
theming.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "wine/debug.h"
Include dependency graph for theming.c:

Go to the source code of this file.

Classes

struct  ThemingSubclass
 

Macros

#define NUM_SUBCLASSES   (ARRAY_SIZE(subclasses))
 
#define MAKE_SUBCLASS_PROC(N)
 

Typedefs

typedef LRESULT(CALLBACKTHEMING_SUBCLASSPROC) (HWND, UINT, WPARAM, LPARAM, ULONG_PTR)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (theming)
 
LRESULT CALLBACK THEMING_DialogSubclassProc (extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc(HWND, extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc(UINT, extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc(WPARAM, extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc(LPARAM, ULONG_PTR)
 
void THEMING_Initialize (void)
 
void THEMING_Uninitialize (void)
 
LRESULT THEMING_CallOriginalClass (HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
void THEMING_SetSubclassData (HWND wnd, ULONG_PTR refData)
 

Variables

static const struct ThemingSubclass subclasses []
 
static WNDPROC originalProcs [NUM_SUBCLASSES]
 
static ATOM atRefDataProp
 
static ATOM atSubclassProp
 
static const WNDPROC subclassProcs [NUM_SUBCLASSES]
 

Macro Definition Documentation

◆ MAKE_SUBCLASS_PROC

#define MAKE_SUBCLASS_PROC (   N)
Value:
{ \
ULONG_PTR refData; \
SetPropW (wnd, (LPCWSTR)MAKEINTATOM(atSubclassProp), (HANDLE)N); \
TRACE ("%d; (%p, %x, %lx, %lx, %lx)\n", N, wnd, msg, wParam, lParam, \
refData); \
result = subclasses[N].subclassProc (wnd, msg, wParam, lParam, refData);\
TRACE ("result = %lx\n", result); \
return result; \
}
#define N
Definition: crc32.c:57
#define msg(x)
Definition: auth_time.c:54
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define CALLBACK
Definition: compat.h:35
#define ULONG_PTR
Definition: config.h:101
GLuint64EXT * result
Definition: glext.h:11304
static LRESULT CALLBACK subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR ref_data)
Definition: button.c:429
unsigned int UINT
Definition: ndis.h:50
static ATOM atSubclassProp
Definition: theming.c:64
static const struct ThemingSubclass subclasses[]
static ATOM atRefDataProp
Definition: theming.c:63
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKEINTATOM(i)
Definition: winbase.h:1463
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Definition at line 72 of file theming.c.

◆ NUM_SUBCLASSES

#define NUM_SUBCLASSES   (ARRAY_SIZE(subclasses))

Definition at line 60 of file theming.c.

Typedef Documentation

◆ THEMING_SUBCLASSPROC

typedef LRESULT(CALLBACK * THEMING_SUBCLASSPROC) (HWND, UINT, WPARAM, LPARAM, ULONG_PTR)

Definition at line 34 of file theming.c.

Function Documentation

◆ THEMING_CallOriginalClass()

LRESULT THEMING_CallOriginalClass ( HWND  wnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 208 of file theming.c.

209{
211 WNDPROC oldProc = originalProcs[subclass];
212 return CallWindowProcW (oldProc, wnd, msg, wParam, lParam);
213}
static WNDPROC originalProcs[NUM_SUBCLASSES]
Definition: theming.c:62
int32_t INT_PTR
Definition: typedefs.h:64
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by THEMING_ScrollbarSubclassProc().

◆ THEMING_DialogSubclassProc()

Definition at line 38 of file theming.c.

45 {'#','3','2','7','7','0',0};

◆ THEMING_Initialize()

void THEMING_Initialize ( void  )

Definition at line 108 of file theming.c.

110{
111 unsigned int i;
112 static const WCHAR subclassPropName[] =
113 { 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 };
114 static const WCHAR refDataPropName[] =
115 { 'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0 };
116#ifdef __REACTOS__ /* r73803 */
117 ULONG_PTR ulCookie;
118 BOOL ret, bActivated;
119#else
120 if (!IsThemeActive()) return;
121#endif
122
123 atSubclassProp = GlobalAddAtomW (subclassPropName);
124 atRefDataProp = GlobalAddAtomW (refDataPropName);
125
126 for (i = 0; i < NUM_SUBCLASSES; i++)
127 {
128 WNDCLASSEXW class;
129
130 class.cbSize = sizeof(class);
131
132#ifdef __REACTOS__ /* r73803 */
133 bActivated = ActivateActCtx(hActCtx5, &ulCookie);
134 ret = GetClassInfoExW (NULL, subclasses[i].className, &class);
135 if (bActivated)
136 DeactivateActCtx(0, ulCookie);
137
138 if (!ret)
139#else
140 if (!GetClassInfoExW (NULL, subclasses[i].className, &class))
141#endif
142 {
143 ERR("Could not retrieve information for class %s\n",
144 debugstr_w (subclasses[i].className));
145 continue;
146 }
147 originalProcs[i] = class.lpfnWndProc;
148 class.lpfnWndProc = subclassProcs[i];
149#ifdef __REACTOS__ /* r73803 */
150 class.style |= CS_GLOBALCLASS;
151 class.hInstance = COMCTL32_hModule;
152#endif
153
154 if (!class.lpfnWndProc)
155 {
156 ERR("Missing proc for class %s\n",
157 debugstr_w (subclasses[i].className));
158 continue;
159 }
160
161#ifdef __REACTOS__ /* r73803 */
162 bActivated = ActivateActCtx(hActCtx6, &ulCookie);
163#endif
164 if (!RegisterClassExW (&class))
165 {
166#ifdef __REACTOS__ /* r73803 */
167 WARN("Could not re-register class %s: %x\n",
168#else
169 ERR("Could not re-register class %s: %x\n",
170#endif
171 debugstr_w (subclasses[i].className), GetLastError ());
172 }
173 else
174 {
175 TRACE("Re-registered class %s\n",
176 debugstr_w (subclasses[i].className));
177 }
178
179#ifdef __REACTOS__ /* r73803 */
180 if (bActivated)
181 DeactivateActCtx(0, ulCookie);
182#endif
183 }
184}
#define WARN(fmt,...)
Definition: debug.h:112
#define ERR(fmt,...)
Definition: debug.h:110
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
#define NULL
Definition: types.h:112
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
UINT cbSize
Definition: winuser.h:3216
static const WNDPROC subclassProcs[NUM_SUBCLASSES]
Definition: theming.c:92
#define NUM_SUBCLASSES
Definition: theming.c:60
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define CS_GLOBALCLASS
Definition: winuser.h:652
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DllMain().

◆ THEMING_SetSubclassData()

void THEMING_SetSubclassData ( HWND  wnd,
ULONG_PTR  refData 
)

Definition at line 220 of file theming.c.

221{
223}
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)

◆ THEMING_Uninitialize()

void THEMING_Uninitialize ( void  )

Definition at line 191 of file theming.c.

192{
193 unsigned int i;
194
195 if (!atSubclassProp) return; /* not initialized */
196
197 for (i = 0; i < NUM_SUBCLASSES; i++)
198 {
199 UnregisterClassW (subclasses[i].className, NULL);
200 }
201}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by DllMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( theming  )

Variable Documentation

◆ atRefDataProp

ATOM atRefDataProp
static

Definition at line 63 of file theming.c.

Referenced by THEMING_Initialize(), and THEMING_SetSubclassData().

◆ atSubclassProp

ATOM atSubclassProp
static

Definition at line 64 of file theming.c.

Referenced by THEMING_CallOriginalClass(), THEMING_Initialize(), and THEMING_Uninitialize().

◆ originalProcs

WNDPROC originalProcs[NUM_SUBCLASSES]
static

Definition at line 62 of file theming.c.

Referenced by THEMING_CallOriginalClass(), and THEMING_Initialize().

◆ subclasses

const struct ThemingSubclass subclasses[]
static
Initial value:
= {
}
#define WC_SCROLLBARW
Definition: commctrl.h:4729
LRESULT CALLBACK THEMING_ScrollbarSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, ULONG_PTR dwRefData)
LRESULT CALLBACK THEMING_DialogSubclassProc(extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc(HWND, extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc(UINT, extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc(WPARAM, extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc(LPARAM, ULONG_PTR)
Definition: theming.c:38

Referenced by THEMING_Initialize(), and THEMING_Uninitialize().

◆ subclassProcs

const WNDPROC subclassProcs[NUM_SUBCLASSES]
static
Initial value:
= {
subclass_proc0,
subclass_proc1,
}

Definition at line 92 of file theming.c.

Referenced by THEMING_Initialize().