ReactOS  0.4.13-dev-482-ge57f103
theme_dialog.c File Reference
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "comctl32.h"
#include "wine/debug.h"
Include dependency graph for theme_dialog.c:

Go to the source code of this file.

Functions

LRESULT CALLBACK THEMING_DialogSubclassProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, ULONG_PTR dwRefData)
 

Function Documentation

◆ THEMING_DialogSubclassProc()

LRESULT CALLBACK THEMING_DialogSubclassProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  dwRefData 
)

Definition at line 38 of file theme_dialog.c.

41 {
42  HTHEME theme = GetWindowTheme ( hWnd );
43  static const WCHAR themeClass[] = { 'W','i','n','d','o','w',0 };
44  BOOL themingActive = IsThemeDialogTextureEnabled (hWnd);
45  BOOL doTheming = themingActive && (theme != NULL);
47 
48  switch (msg)
49  {
50  case WM_CREATE:
52  theme = OpenThemeData( hWnd, themeClass );
53  return result;
54 
55  case WM_DESTROY:
56  CloseThemeData ( theme );
60 
61  case WM_THEMECHANGED:
62  CloseThemeData ( theme );
65  return 0;
66 
67  case WM_SYSCOLORCHANGE:
68  if (!doTheming) return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
69  /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
70  * which will do the repaint. */
71  break;
72 
73  case WM_ERASEBKGND:
74  if (!doTheming) return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
75  {
76  RECT rc;
78  if (!CallWindowProcW(dlgp, hWnd, msg, wParam, lParam))
79  {
80  /* Draw background*/
81  GetClientRect (hWnd, &rc);
82  if (IsThemePartDefined (theme, WP_DIALOG, 0))
83  /* Although there is a theme for the WINDOW class/DIALOG part,
84  * but I[res] haven't seen Windows using it yet... Even when
85  * dialog theming is activated, the good ol' BTNFACE
86  * background seems to be used. */
87 #if 0
88  DrawThemeBackground (theme, (HDC)wParam, WP_DIALOG, 0, &rc,
89  NULL);
90 #endif
92  else
93  /* We might have gotten a TAB theme class, so check if we can
94  * draw as a tab page. */
95  if (IsThemePartDefined (theme, TABP_BODY, 0))
96  DrawThemeBackground (theme, (HDC)wParam, TABP_BODY, 0, &rc,
97  NULL);
98  else
100  }
101  return 1;
102  }
103 
104  case WM_CTLCOLORSTATIC:
105  if (!doTheming) return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
106  {
109  if (!result)
110  {
111  /* Override defaults with more suitable values when themed */
112  HDC controlDC = (HDC)wParam;
113  HWND controlWnd = (HWND)lParam;
114  WCHAR controlClass[32];
115  RECT rc;
116 
117  GetClassNameW (controlWnd, controlClass, ARRAY_SIZE(controlClass));
118  if (lstrcmpiW (controlClass, WC_STATICW) == 0)
119  {
120  /* Static control - draw parent background and set text to
121  * transparent, so it looks right on tab pages. */
122  GetClientRect (controlWnd, &rc);
123  DrawThemeParentBackground (controlWnd, controlDC, &rc);
124  SetBkMode (controlDC, TRANSPARENT);
125 
126  /* Return NULL brush since we painted the BG already */
128  }
129  else
131 
132  }
133  return result;
134  }
135 
136  default:
137  /* Call old proc */
139  }
140  return 0;
141 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
#define TRUE
Definition: types.h:120
#define DWLP_DLGPROC
Definition: winuser.h:865
#define NULL_BRUSH
Definition: wingdi.h:900
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
HANDLE HWND
Definition: compat.h:13
BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
Definition: system.c:987
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
BOOL WINAPI IsThemeDialogTextureEnabled(HWND hwnd)
Definition: draw.c:56
#define GetWindowLongPtrW
Definition: winuser.h:4698
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
static const WCHAR themeClass[]
Definition: header.c:115
WPARAM wParam
Definition: combotst.c:138
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
#define TRANSPARENT
Definition: wingdi.h:949
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define ARRAY_SIZE(a)
Definition: main.h:24
#define WC_STATICW
Definition: commctrl.h:4651
#define msg(x)
Definition: auth_time.c:54
LRESULT THEMING_CallOriginalClass(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN
Definition: theming.c:208
#define WM_CREATE
Definition: winuser.h:1590
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_ERASEBKGND
Definition: winuser.h:1607
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
LPARAM lParam
Definition: combotst.c:139
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950