ReactOS 0.4.16-dev-306-g647d351
uxthemep.h File Reference
#include <stdarg.h>
#include "resource.h"
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <winnls.h>
#include <windowsx.h>
#include <undocuser.h>
#include <undocgdi.h>
#include <uxtheme.h>
#include <uxundoc.h>
#include <vfwmsgs.h>
#include <tmschema.h>
#include <ndk/ntndk.h>
#include <ndk/rtltypes.h>
#include <wine/debug.h>
Include dependency graph for uxthemep.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _THEME_PROPERTY
 
struct  _THEME_PARTSTATE
 
struct  _THEME_CLASS
 
struct  _THEME_IMAGE
 
struct  _THEME_FILE
 
struct  _UXTHEME_HANDLE
 
struct  _WND_DATA
 
struct  _DRAW_CONTEXT
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NTOS_MODE_USER
 
#define TMT_ENUM   200
 
#define MAX_THEME_APP_NAME   60
 
#define MAX_THEME_CLASS_NAME   60
 
#define MAX_THEME_VALUE_NAME   60
 
#define HT_ISBUTTON(ht)   ((ht) == HTMINBUTTON || (ht) == HTMAXBUTTON || (ht) == HTCLOSE || (ht) == HTHELP)
 
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
 
#define HAS_MENU(hwnd, style)   ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && GetMenu(hwnd))
 
#define BUTTON_GAP_SIZE   2
 
#define MENU_BAR_ITEMS_SPACE   (12)
 
#define SCROLL_TIMER   0 /* Scroll timer id */
 
#define SCROLL_ARROW_THUMB_OVERLAP   0
 
#define SCROLL_FIRST_DELAY   200
 
#define SCROLL_REPEAT_DELAY   50
 
#define SCROLL_MIN_THUMB   6
 
#define SCROLL_MIN_RECT   4
 
#define ALPHABLEND_NONE   0
 
#define ALPHABLEND_BINARY   1
 
#define ALPHABLEND_FULL   2
 

Typedefs

typedef struct _THEME_PROPERTY THEME_PROPERTY
 
typedef struct _THEME_PROPERTYPTHEME_PROPERTY
 
typedef struct _THEME_PARTSTATE THEME_PARTSTATE
 
typedef struct _THEME_PARTSTATEPTHEME_PARTSTATE
 
typedef struct _THEME_CLASS THEME_CLASS
 
typedef struct _THEME_CLASSPTHEME_CLASS
 
typedef struct _THEME_IMAGE THEME_IMAGE
 
typedef struct _THEME_IMAGEPTHEME_IMAGE
 
typedef struct _THEME_FILE THEME_FILE
 
typedef struct _THEME_FILEPTHEME_FILE
 
typedef struct _UXINI_FILEPUXINI_FILE
 
typedef struct _UXTHEME_HANDLE UXTHEME_HANDLE
 
typedef struct _UXTHEME_HANDLEPUXTHEME_HANDLE
 
typedef struct _WND_DATA WND_DATA
 
typedef struct _WND_DATAPWND_DATA
 
typedef struct _DRAW_CONTEXT DRAW_CONTEXT
 
typedef struct _DRAW_CONTEXTPDRAW_CONTEXT
 

Enumerations

enum  SCROLL_HITTEST {
  SCROLL_NOWHERE , SCROLL_TOP_ARROW , SCROLL_TOP_RECT , SCROLL_THUMB ,
  SCROLL_BOTTOM_RECT , SCROLL_BOTTOM_ARROW , SCROLL_NOWHERE , SCROLL_TOP_ARROW ,
  SCROLL_TOP_RECT , SCROLL_THUMB , SCROLL_BOTTOM_RECT , SCROLL_BOTTOM_ARROW
}
 
enum  CAPTIONBUTTON { CLOSEBUTTON , MAXBUTTON , MINBUTTON , HELPBUTTON }
 
enum  THEME_BUTTON_STATES {
  BUTTON_NORMAL = 1 , BUTTON_HOT , BUTTON_PRESSED , BUTTON_DISABLED ,
  BUTTON_INACTIVE , BUTTON_INACTIVE_HOT , BUTTON_INACTIVE_PRESSED , BUTTON_INACTIVE_DISABLED
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (uxtheme)
 
PTHEME_CLASS ValidateHandle (HTHEME hTheme)
 
HRESULT UXTHEME_LoadImage (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph, HBITMAP *hBmp, RECT *bmpRect, BOOL *hasImageAlpha)
 
BOOL MSSTYLES_LookupProperty (LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId)
 
BOOL MSSTYLES_LookupEnum (LPCWSTR pszValueName, int dwEnum, int *dwValue)
 
BOOL MSSTYLES_LookupPartState (LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId)
 
HRESULT MSSTYLES_OpenThemeFile (LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
 
HRESULT MSSTYLES_ReferenceTheme (PTHEME_FILE tf)
 
void MSSTYLES_CloseThemeFile (PTHEME_FILE tf)
 
void MSSTYLES_ParseThemeIni (PTHEME_FILE tf)
 
PTHEME_CLASS MSSTYLES_OpenThemeClass (PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassList)
 
HRESULT MSSTYLES_CloseThemeClass (PTHEME_CLASS tc)
 
PUXINI_FILE MSSTYLES_GetThemeIni (PTHEME_FILE tf)
 
PTHEME_PARTSTATE MSSTYLES_FindPartState (PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext)
 
PTHEME_PROPERTY MSSTYLES_FindProperty (PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId)
 
PTHEME_PROPERTY MSSTYLES_FindMetric (PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
 
HBITMAP MSSTYLES_LoadBitmap (PTHEME_CLASS tc, LPCWSTR lpFilename, BOOL *hasAlpha)
 
HRESULT MSSTYLES_GetPropertyBool (PTHEME_PROPERTY tp, BOOL *pfVal)
 
HRESULT MSSTYLES_GetPropertyColor (PTHEME_PROPERTY tp, COLORREF *pColor)
 
HRESULT MSSTYLES_GetPropertyFont (PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont)
 
HRESULT MSSTYLES_GetPropertyInt (PTHEME_PROPERTY tp, int *piVal)
 
HRESULT MSSTYLES_GetPropertyIntList (PTHEME_PROPERTY tp, INTLIST *pIntList)
 
HRESULT MSSTYLES_GetPropertyPosition (PTHEME_PROPERTY tp, POINT *pPoint)
 
HRESULT MSSTYLES_GetPropertyString (PTHEME_PROPERTY tp, LPWSTR pszBuff, int cchMaxBuffChars)
 
HRESULT MSSTYLES_GetPropertyRect (PTHEME_PROPERTY tp, RECT *pRect)
 
HRESULT MSSTYLES_GetPropertyMargins (PTHEME_PROPERTY tp, RECT *prc, MARGINS *pMargins)
 
PUXINI_FILE UXINI_LoadINI (HMODULE hTheme, LPCWSTR lpName)
 
void UXINI_CloseINI (PUXINI_FILE uf)
 
LPCWSTR UXINI_GetNextSection (PUXINI_FILE uf, DWORD *dwLen)
 
BOOL UXINI_FindSection (PUXINI_FILE uf, LPCWSTR lpName)
 
LPCWSTR UXINI_GetNextValue (PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen)
 
BOOL UXINI_FindValue (PUXINI_FILE uf, LPCWSTR lpName, LPCWSTR *lpValue, DWORD *dwValueLen)
 
LRESULT CALLBACK ThemeWndProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
 
void ThemeCalculateCaptionButtonsPos (HWND hWnd, HTHEME htheme)
 
LONG SCROLL_getObjectId (INT nBar)
 
void ThemeDrawScrollBarEx (PDRAW_CONTEXT pcontext, INT nBar, PSCROLLBARINFO psbi, POINT *pt)
 
void ThemeDrawScrollBar (PDRAW_CONTEXT pcontext, INT Bar, POINT *pt)
 
VOID NC_TrackScrollBar (HWND Wnd, WPARAM wParam, POINT Pt)
 
void ThemeInitDrawContext (PDRAW_CONTEXT pcontext, HWND hWnd, HRGN hRgn)
 
void ThemeCleanupDrawContext (PDRAW_CONTEXT pcontext)
 
PWND_DATA ThemeGetWndData (HWND hWnd)
 
HTHEME GetNCCaptionTheme (HWND hWnd, DWORD style)
 
HTHEME GetNCScrollbarTheme (HWND hWnd, DWORD style)
 
void UXTHEME_InitSystem (HINSTANCE hInst)
 
void UXTHEME_LoadTheme (BOOL bLoad)
 
BOOL CALLBACK UXTHEME_broadcast_theme_changed (HWND hWnd, LPARAM enable)
 

Variables

HINSTANCE hDllInst
 
ATOM atWindowTheme
 
ATOM atWndContext
 
BOOL g_bThemeHooksActive
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 9 of file uxthemep.h.

◆ ALPHABLEND_BINARY

#define ALPHABLEND_BINARY   1

Definition at line 285 of file uxthemep.h.

◆ ALPHABLEND_FULL

#define ALPHABLEND_FULL   2

Definition at line 287 of file uxthemep.h.

◆ ALPHABLEND_NONE

#define ALPHABLEND_NONE   0

Definition at line 283 of file uxthemep.h.

◆ BUTTON_GAP_SIZE

#define BUTTON_GAP_SIZE   2

Definition at line 240 of file uxthemep.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 10 of file uxthemep.h.

◆ HAS_MENU

#define HAS_MENU (   hwnd,
  style 
)    ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && GetMenu(hwnd))

Definition at line 238 of file uxthemep.h.

◆ HASSIZEGRIP

#define HASSIZEGRIP (   Style,
  ExStyle,
  ParentStyle,
  WindowRect,
  ParentClientRect 
)
Value:
((!(Style & WS_CHILD) && (Style & WS_THICKFRAME) && !(Style & WS_MAXIMIZE)) || \
((Style & WS_CHILD) && (ParentStyle & WS_THICKFRAME) && !(ParentStyle & WS_MAXIMIZE) && \
(WindowRect.right - WindowRect.left == ParentClientRect.right) && \
(WindowRect.bottom - WindowRect.top == ParentClientRect.bottom)))
const DWORD Style
Definition: appswitch.c:71
#define WS_CHILD
Definition: pedump.c:617
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_THICKFRAME
Definition: pedump.c:630

Definition at line 232 of file uxthemep.h.

◆ HT_ISBUTTON

#define HT_ISBUTTON (   ht)    ((ht) == HTMINBUTTON || (ht) == HTMAXBUTTON || (ht) == HTCLOSE || (ht) == HTHELP)

Definition at line 230 of file uxthemep.h.

◆ MAX_THEME_APP_NAME

#define MAX_THEME_APP_NAME   60

Definition at line 34 of file uxthemep.h.

◆ MAX_THEME_CLASS_NAME

#define MAX_THEME_CLASS_NAME   60

Definition at line 35 of file uxthemep.h.

◆ MAX_THEME_VALUE_NAME

#define MAX_THEME_VALUE_NAME   60

Definition at line 36 of file uxthemep.h.

◆ MENU_BAR_ITEMS_SPACE

#define MENU_BAR_ITEMS_SPACE   (12)

Definition at line 242 of file uxthemep.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 25 of file uxthemep.h.

◆ SCROLL_ARROW_THUMB_OVERLAP

#define SCROLL_ARROW_THUMB_OVERLAP   0

Definition at line 247 of file uxthemep.h.

◆ SCROLL_FIRST_DELAY

#define SCROLL_FIRST_DELAY   200

Definition at line 250 of file uxthemep.h.

◆ SCROLL_MIN_RECT

#define SCROLL_MIN_RECT   4

Definition at line 259 of file uxthemep.h.

◆ SCROLL_MIN_THUMB

#define SCROLL_MIN_THUMB   6

Definition at line 256 of file uxthemep.h.

◆ SCROLL_REPEAT_DELAY

#define SCROLL_REPEAT_DELAY   50

Definition at line 253 of file uxthemep.h.

◆ SCROLL_TIMER

#define SCROLL_TIMER   0 /* Scroll timer id */

Definition at line 244 of file uxthemep.h.

◆ TMT_ENUM

#define TMT_ENUM   200

Definition at line 32 of file uxthemep.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file uxthemep.h.

Typedef Documentation

◆ DRAW_CONTEXT

◆ PDRAW_CONTEXT

◆ PTHEME_CLASS

◆ PTHEME_FILE

◆ PTHEME_IMAGE

◆ PTHEME_PARTSTATE

◆ PTHEME_PROPERTY

◆ PUXINI_FILE

Definition at line 93 of file uxthemep.h.

◆ PUXTHEME_HANDLE

◆ PWND_DATA

◆ THEME_CLASS

◆ THEME_FILE

◆ THEME_IMAGE

◆ THEME_PARTSTATE

◆ THEME_PROPERTY

◆ UXTHEME_HANDLE

◆ WND_DATA

Enumeration Type Documentation

◆ CAPTIONBUTTON

Enumerator
CLOSEBUTTON 
MAXBUTTON 
MINBUTTON 
HELPBUTTON 

Definition at line 206 of file uxthemep.h.

207{
209 MAXBUTTON,
210 MINBUTTON,
CAPTIONBUTTON
Definition: uxthemep.h:207
@ CLOSEBUTTON
Definition: uxthemep.h:208
@ MAXBUTTON
Definition: uxthemep.h:209
@ HELPBUTTON
Definition: uxthemep.h:211
@ MINBUTTON
Definition: uxthemep.h:210

◆ SCROLL_HITTEST

Enumerator
SCROLL_NOWHERE 
SCROLL_TOP_ARROW 
SCROLL_TOP_RECT 
SCROLL_THUMB 
SCROLL_BOTTOM_RECT 
SCROLL_BOTTOM_ARROW 
SCROLL_NOWHERE 
SCROLL_TOP_ARROW 
SCROLL_TOP_RECT 
SCROLL_THUMB 
SCROLL_BOTTOM_RECT 
SCROLL_BOTTOM_ARROW 

Definition at line 154 of file uxthemep.h.

155{
156 SCROLL_NOWHERE, /* Outside the scroll bar */
157 SCROLL_TOP_ARROW, /* Top or left arrow */
158 SCROLL_TOP_RECT, /* Rectangle between the top arrow and the thumb */
159 SCROLL_THUMB, /* Thumb rectangle */
160 SCROLL_BOTTOM_RECT, /* Rectangle between the thumb and the bottom arrow */
161 SCROLL_BOTTOM_ARROW /* Bottom or right arrow */
162};
@ SCROLL_NOWHERE
Definition: uxthemep.h:156
@ SCROLL_THUMB
Definition: uxthemep.h:159
@ SCROLL_BOTTOM_RECT
Definition: uxthemep.h:160
@ SCROLL_TOP_RECT
Definition: uxthemep.h:158
@ SCROLL_TOP_ARROW
Definition: uxthemep.h:157
@ SCROLL_BOTTOM_ARROW
Definition: uxthemep.h:161

◆ THEME_BUTTON_STATES

Enumerator
BUTTON_NORMAL 
BUTTON_HOT 
BUTTON_PRESSED 
BUTTON_DISABLED 
BUTTON_INACTIVE 
BUTTON_INACTIVE_HOT 
BUTTON_INACTIVE_PRESSED 
BUTTON_INACTIVE_DISABLED 

Definition at line 219 of file uxthemep.h.

219 {
220 BUTTON_NORMAL = 1 ,
221 BUTTON_HOT ,
THEME_BUTTON_STATES
Definition: uxthemep.h:219
@ BUTTON_NORMAL
Definition: uxthemep.h:220
@ BUTTON_DISABLED
Definition: uxthemep.h:223
@ BUTTON_HOT
Definition: uxthemep.h:221
@ BUTTON_INACTIVE_DISABLED
Definition: uxthemep.h:227
@ BUTTON_PRESSED
Definition: uxthemep.h:222
@ BUTTON_INACTIVE
Definition: uxthemep.h:224
@ BUTTON_INACTIVE_HOT
Definition: uxthemep.h:225
@ BUTTON_INACTIVE_PRESSED
Definition: uxthemep.h:226

Function Documentation

◆ GetNCCaptionTheme()

HTHEME GetNCCaptionTheme ( HWND  hWnd,
DWORD  style 
)

Definition at line 88 of file themehooks.c.

89{
90 PWND_DATA pwndData;
91
92 /* We only get the theme for the window class if the window has a caption */
93 if((style & WS_CAPTION) != WS_CAPTION)
94 return NULL;
95
96 /* Get theme data for this window */
97 pwndData = ThemeGetWndData(hWnd);
98 if (pwndData == NULL)
99 return NULL;
100
101 if (!(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
102 {
103 if (pwndData->hthemeWindow)
104 {
105 CloseThemeData(pwndData->hthemeWindow);
106 pwndData->hthemeWindow = NULL;
107 }
108 return NULL;
109 }
110
111 /* If the theme data was not cached, open it now */
112 if (!pwndData->hthemeWindow)
113 pwndData->hthemeWindow = OpenThemeDataEx(hWnd, L"WINDOW", OTD_NONCLIENT);
114
115 return pwndData->hthemeWindow;
116}
Arabic default style
Definition: afstyles.h:94
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:819
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
#define L(x)
Definition: ntvdm.h:50
#define WS_CAPTION
Definition: pedump.c:624
HTHEME hthemeWindow
Definition: uxthemep.h:167
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17

Referenced by SetThemeRegion(), ThemeCalculateCaptionButtonsPosEx(), and ThemeInitDrawContext().

◆ GetNCScrollbarTheme()

HTHEME GetNCScrollbarTheme ( HWND  hWnd,
DWORD  style 
)

Definition at line 118 of file themehooks.c.

119{
120 PWND_DATA pwndData;
121
122 /* We only get the theme for the scrollbar class if the window has a scrollbar */
123 if((style & (WS_HSCROLL|WS_VSCROLL)) == 0)
124 return NULL;
125
126 /* Get theme data for this window */
127 pwndData = ThemeGetWndData(hWnd);
128 if (pwndData == NULL)
129 return NULL;
130
131 if (!(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
132 {
133 if (pwndData->hthemeScrollbar)
134 {
136 pwndData->hthemeScrollbar = NULL;
137 }
138 return NULL;
139 }
140
141 /* If the theme data was not cached, open it now */
142 if (!pwndData->hthemeScrollbar)
143 pwndData->hthemeScrollbar = OpenThemeDataEx(hWnd, L"SCROLLBAR", OTD_NONCLIENT);
144
145 return pwndData->hthemeScrollbar;
146}
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
HTHEME hthemeScrollbar
Definition: uxthemep.h:168

Referenced by ThemeInitDrawContext().

◆ MSSTYLES_CloseThemeClass()

HRESULT MSSTYLES_CloseThemeClass ( PTHEME_CLASS  tc)

Definition at line 822 of file msstyles.c.

823{
825 return S_OK;
826}
const GLfloat * tc
Definition: glext.h:8925
#define S_OK
Definition: intsafe.h:52
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

Referenced by CloseThemeData(), and OpenThemeDataInternal().

◆ MSSTYLES_CloseThemeFile()

void MSSTYLES_CloseThemeFile ( PTHEME_FILE  tf)

Definition at line 179 of file msstyles.c.

180{
181 if(tf) {
182
183 tf->dwRefCount--;
184 TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
185
186 if(!tf->dwRefCount) {
187 if(tf->hTheme) FreeLibrary(tf->hTheme);
188 if(tf->classes) {
189 while(tf->classes) {
190 PTHEME_CLASS pcls = tf->classes;
191 tf->classes = pcls->next;
192 while(pcls->partstate) {
193 PTHEME_PARTSTATE ps = pcls->partstate;
194
195 while(ps->properties) {
196 PTHEME_PROPERTY prop = ps->properties;
197 ps->properties = prop->next;
198 HeapFree(GetProcessHeap(), 0, prop);
199 }
200
201 pcls->partstate = ps->next;
202 HeapFree(GetProcessHeap(), 0, ps);
203 }
204 HeapFree(GetProcessHeap(), 0, pcls);
205 }
206 }
207 while (tf->images)
208 {
209 PTHEME_IMAGE img = tf->images;
210 tf->images = img->next;
211 DeleteObject (img->image);
213 }
215 }
216 }
217}
#define GetProcessHeap()
Definition: compat.h:736
#define FreeLibrary(x)
Definition: compat.h:748
#define HeapFree(x, y, z)
Definition: compat.h:735
pKey DeleteObject()
GLint GLvoid * img
Definition: gl.h:1956
HFONT tf
Definition: icontest.c:17
#define TRACE(s)
Definition: solgame.cpp:4
PTHEME_PARTSTATE partstate
Definition: uxthemep.h:64
struct _THEME_CLASS * next
Definition: uxthemep.h:67
struct _THEME_PARTSTATE * next
Definition: uxthemep.h:54
PTHEME_PROPERTY properties
Definition: uxthemep.h:52
struct _THEME_PROPERTY * next
Definition: uxthemep.h:46

Referenced by CheckThemeSignature(), CloseThemeFile(), EnumThemeColors(), EnumThemeSizes(), GetThemeDefaults(), GetThemeDocumentationProperty(), MSSTYLES_CloseThemeClass(), UXTHEME_LoadTheme(), and UXTHEME_SetActiveTheme().

◆ MSSTYLES_FindMetric()

PTHEME_PROPERTY MSSTYLES_FindMetric ( PTHEME_FILE  tf,
int  iPropertyPrimitive,
int  iPropertyId 
)

Definition at line 556 of file msstyles.c.

557{
558 return MSSTYLES_LFindProperty(tf->metrics, iPropertyPrimitive, iPropertyId);
559}
static PTHEME_PROPERTY MSSTYLES_LFindProperty(PTHEME_PROPERTY tp, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:506

Referenced by GetThemeSysBool(), GetThemeSysColor(), GetThemeSysFont(), GetThemeSysInt(), GetThemeSysSize(), GetThemeSysString(), and MSSTYLES_AddMetric().

◆ MSSTYLES_FindPartState()

PTHEME_PARTSTATE MSSTYLES_FindPartState ( PTHEME_CLASS  tc,
int  iPartId,
int  iStateId,
PTHEME_CLASS tcNext 
)

Definition at line 452 of file msstyles.c.

453{
454 PTHEME_PARTSTATE cur = tc->partstate;
455 while(cur) {
456 if(cur->iPartId == iPartId && cur->iStateId == iStateId) {
457 if(tcNext) *tcNext = tc->overrides;
458 return cur;
459 }
460 cur = cur->next;
461 }
462 if(tc->overrides) return MSSTYLES_FindPartState(tc->overrides, iPartId, iStateId, tcNext);
463 return NULL;
464}
FxCollectionEntry * cur
PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext)
Definition: msstyles.c:452
struct _THEME_CLASS * overrides
Definition: uxthemep.h:65

Referenced by IsThemePartDefined(), MSSTYLES_AddPartState(), MSSTYLES_FindPartState(), and MSSTYLES_FindProperty().

◆ MSSTYLES_FindProperty()

PTHEME_PROPERTY MSSTYLES_FindProperty ( PTHEME_CLASS  tc,
int  iPartId,
int  iStateId,
int  iPropertyPrimitive,
int  iPropertyId 
)

Definition at line 835 of file msstyles.c.

836{
840
841 TRACE("(%p, %d, %d, %d)\n", tc, iPartId, iStateId, iPropertyId);
842 /* Try and find an exact match on part & state */
843 while(next && (ps = MSSTYLES_FindPartState(next, iPartId, iStateId, &next))) {
844 if((tp = MSSTYLES_PSFindProperty(ps, iPropertyPrimitive, iPropertyId))) {
845 return tp;
846 }
847 }
848 /* If that fails, and we didn't already try it, search for just part */
849 if(iStateId != 0)
850 iStateId = 0;
851 /* As a last ditch attempt..go for just class */
852 else if(iPartId != 0)
853 iPartId = 0;
854 else
855 return NULL;
856
857 if((tp = MSSTYLES_FindProperty(tc, iPartId, iStateId, iPropertyPrimitive, iPropertyId)))
858 return tp;
859 return NULL;
860}
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:835
static PTHEME_PROPERTY MSSTYLES_PSFindProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:538
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by GetThemeBool(), GetThemeColor(), GetThemeEnumValue(), GetThemeFilename(), GetThemeFont(), GetThemeInt(), GetThemeIntList(), GetThemeMargins(), GetThemeMetric(), GetThemePosition(), GetThemePropertyOrigin(), GetThemeRect(), GetThemeString(), MSSTYLES_FindProperty(), and UXTHEME_SelectImage().

◆ MSSTYLES_GetPropertyBool()

HRESULT MSSTYLES_GetPropertyBool ( PTHEME_PROPERTY  tp,
BOOL pfVal 
)

Definition at line 994 of file msstyles.c.

995{
996 *pfVal = FALSE;
997 if(*tp->lpValue == 't' || *tp->lpValue == 'T')
998 *pfVal = TRUE;
999 return S_OK;
1000}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by GetThemeBool(), GetThemeMetric(), and GetThemeSysBool().

◆ MSSTYLES_GetPropertyColor()

HRESULT MSSTYLES_GetPropertyColor ( PTHEME_PROPERTY  tp,
COLORREF pColor 
)

Definition at line 1007 of file msstyles.c.

1008{
1009 LPCWSTR lpEnd;
1010 LPCWSTR lpCur;
1011 int red, green, blue;
1012
1013 lpCur = tp->lpValue;
1014 lpEnd = tp->lpValue + tp->dwValueLen;
1015
1016 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &red)) {
1017 TRACE("Could not parse color property\n");
1018 return E_PROP_ID_UNSUPPORTED;
1019 }
1020 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &green)) {
1021 TRACE("Could not parse color property\n");
1022 return E_PROP_ID_UNSUPPORTED;
1023 }
1024 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &blue)) {
1025 TRACE("Could not parse color property\n");
1026 return E_PROP_ID_UNSUPPORTED;
1027 }
1028 *pColor = RGB(red,green,blue);
1029 return S_OK;
1030}
#define RGB(r, g, b)
Definition: precomp.h:71
GLclampf green
Definition: gl.h:1740
GLclampf GLclampf blue
Definition: gl.h:1740
#define red
Definition: linetest.c:67
static BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value)
Definition: msstyles.c:945
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by GetThemeColor(), GetThemeMetric(), and GetThemeSysColor().

◆ MSSTYLES_GetPropertyFont()

HRESULT MSSTYLES_GetPropertyFont ( PTHEME_PROPERTY  tp,
HDC  hdc,
LOGFONTW pFont 
)

Definition at line 1077 of file msstyles.c.

1078{
1079 LPCWSTR lpCur = tp->lpValue;
1080 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1081 HRESULT hr;
1082
1083 ZeroMemory(pFont, sizeof(LOGFONTW));
1084 hr = MSSTYLES_GetFont (lpCur, lpEnd, &lpCur, pFont);
1085
1086 return hr;
1087}
static HRESULT MSSTYLES_GetFont(LPCWSTR lpCur, LPCWSTR lpEnd, LPCWSTR *lpValEnd, LOGFONTW *pFont)
Definition: msstyles.c:1037
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1737

Referenced by GetThemeFont(), and GetThemeSysFont().

◆ MSSTYLES_GetPropertyInt()

HRESULT MSSTYLES_GetPropertyInt ( PTHEME_PROPERTY  tp,
int piVal 
)

Definition at line 1094 of file msstyles.c.

1095{
1096 if(!MSSTYLES_GetNextInteger(tp->lpValue, (tp->lpValue + tp->dwValueLen), NULL, piVal)) {
1097 TRACE("Could not parse int property\n");
1098 return E_PROP_ID_UNSUPPORTED;
1099 }
1100 return S_OK;
1101}

Referenced by GetThemeInt(), GetThemeMetric(), GetThemeSysInt(), and GetThemeSysSize().

◆ MSSTYLES_GetPropertyIntList()

HRESULT MSSTYLES_GetPropertyIntList ( PTHEME_PROPERTY  tp,
INTLIST *  pIntList 
)

Definition at line 1108 of file msstyles.c.

1109{
1110 int i;
1111 LPCWSTR lpCur = tp->lpValue;
1112 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1113
1114 for(i=0; i < MAX_INTLIST_COUNT; i++) {
1115 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pIntList->iValues[i]))
1116 break;
1117 }
1118 pIntList->iValueCount = i;
1119 return S_OK;
1120}
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

Referenced by GetThemeIntList().

◆ MSSTYLES_GetPropertyMargins()

HRESULT MSSTYLES_GetPropertyMargins ( PTHEME_PROPERTY  tp,
RECT prc,
MARGINS pMargins 
)

Definition at line 1182 of file msstyles.c.

1183{
1184 LPCWSTR lpCur = tp->lpValue;
1185 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1186
1187 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxLeftWidth);
1188 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxRightWidth);
1189 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyTopHeight);
1190 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyBottomHeight)) {
1191 TRACE("Could not parse margins property\n");
1192 return E_PROP_ID_UNSUPPORTED;
1193 }
1194 return S_OK;
1195}
int cyBottomHeight
Definition: misc.c:283
int cyTopHeight
Definition: misc.c:282
int cxRightWidth
Definition: misc.c:281
int cxLeftWidth
Definition: misc.c:280

Referenced by GetThemeMargins().

◆ MSSTYLES_GetPropertyPosition()

HRESULT MSSTYLES_GetPropertyPosition ( PTHEME_PROPERTY  tp,
POINT pPoint 
)

Definition at line 1127 of file msstyles.c.

1128{
1129 int x,y;
1130 LPCWSTR lpCur = tp->lpValue;
1131 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1132
1133 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &x)) {
1134 TRACE("Could not parse position property\n");
1135 return E_PROP_ID_UNSUPPORTED;
1136 }
1137 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &y)) {
1138 TRACE("Could not parse position property\n");
1139 return E_PROP_ID_UNSUPPORTED;
1140 }
1141 pPoint->x = x;
1142 pPoint->y = y;
1143 return S_OK;
1144}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by GetThemePosition().

◆ MSSTYLES_GetPropertyRect()

HRESULT MSSTYLES_GetPropertyRect ( PTHEME_PROPERTY  tp,
RECT pRect 
)

Definition at line 1162 of file msstyles.c.

1163{
1164 LPCWSTR lpCur = tp->lpValue;
1165 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1166
1167 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pRect->left);
1168 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pRect->top);
1169 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pRect->right);
1170 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pRect->bottom)) {
1171 TRACE("Could not parse rect property\n");
1172 return E_PROP_ID_UNSUPPORTED;
1173 }
1174 return S_OK;
1175}
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306

Referenced by GetThemeRect().

◆ MSSTYLES_GetPropertyString()

HRESULT MSSTYLES_GetPropertyString ( PTHEME_PROPERTY  tp,
LPWSTR  pszBuff,
int  cchMaxBuffChars 
)

Definition at line 1151 of file msstyles.c.

1152{
1153 lstrcpynW(pszBuff, tp->lpValue, min(tp->dwValueLen+1, cchMaxBuffChars));
1154 return S_OK;
1155}
#define lstrcpynW
Definition: compat.h:738
#define min(a, b)
Definition: monoChain.cc:55

Referenced by GetThemeEnumValue(), GetThemeFilename(), GetThemeMetric(), GetThemeString(), and GetThemeSysString().

◆ MSSTYLES_GetThemeIni()

PUXINI_FILE MSSTYLES_GetThemeIni ( PTHEME_FILE  tf)

Definition at line 236 of file msstyles.c.

237{
238 return UXINI_LoadINI(tf->hTheme, szThemesIniResource);
239}
static const WCHAR szThemesIniResource[]
Definition: msstyles.c:33
PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName)
Definition: uxini.c:52

Referenced by GetThemeDocumentationProperty().

◆ MSSTYLES_LoadBitmap()

HBITMAP MSSTYLES_LoadBitmap ( PTHEME_CLASS  tc,
LPCWSTR  lpFilename,
BOOL hasAlpha 
)

Definition at line 896 of file msstyles.c.

897{
898 WCHAR szFile[MAX_PATH];
899 LPWSTR tmp;
901 lstrcpynW(szFile, lpFilename, sizeof(szFile)/sizeof(szFile[0]));
902 tmp = szFile;
903 do {
904 if(*tmp == '\\') *tmp = '_';
905 if(*tmp == '/') *tmp = '_';
906 if(*tmp == '.') *tmp = '_';
907 } while(*tmp++);
908
909 /* Try to locate in list of loaded images */
910 img = tc->tf->images;
911 while (img)
912 {
913 if (lstrcmpiW (szFile, img->name) == 0)
914 {
915 TRACE ("found %p %s: %p\n", img, debugstr_w (img->name), img->image);
916 *hasAlpha = img->hasAlpha;
917 return img->image;
918 }
919 img = img->next;
920 }
921 /* Not found? Load from resources */
922 img = HeapAlloc (GetProcessHeap(), 0, sizeof (THEME_IMAGE));
923#ifdef ENABLE_PNG_SUPPORT
924 if (MSSTYLES_TryLoadPng(tc->hTheme, szFile, TEXT(L"IMAGE"), &img->image)) // ...as PNG...
925 {
926 prepare_png_alpha(img->image, hasAlpha);
927 }
928 else // ...or, failing that, as BMP
929 {
930#endif /* ENABLE_PNG_SUPPORT */
931 img->image = LoadImageW(tc->hTheme, szFile, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
932 prepare_alpha (img->image, hasAlpha);
933#ifdef ENABLE_PNG_SUPPORT
934 }
935#endif /* ENABLE_PNG_SUPPORT */
936 img->hasAlpha = *hasAlpha;
937 /* ...and stow away for later reuse. */
938 lstrcpyW (img->name, szFile);
939 img->next = tc->tf->images;
940 tc->tf->images = img;
941 TRACE ("new %p %s: %p\n", img, debugstr_w (img->name), img->image);
942 return img->image;
943}
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:749
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
#define TEXT(s)
Definition: k32.h:26
#define debugstr_w
Definition: kernel32.h:32
static BOOL prepare_alpha(HBITMAP bmp, BOOL *hasAlpha)
Definition: msstyles.c:863
BOOL MSSTYLES_TryLoadPng(_In_ HINSTANCE hTheme, _In_ LPCWSTR szFile, _In_ LPCWSTR type, _Out_ HBITMAP *phBitmap)
Definition: pngsup.cpp:18
BOOL prepare_png_alpha(_In_ HBITMAP png, _Out_ BOOL *hasAlpha)
Definition: pngsup.cpp:60
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1101
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2255
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by UXTHEME_LoadImage(), and UXTHEME_SelectImage().

◆ MSSTYLES_LookupEnum()

BOOL MSSTYLES_LookupEnum ( LPCWSTR  pszValueName,
int  dwEnum,
int dwValue 
)

Definition at line 1126 of file stylemap.c.

1127{
1128 DWORD item = 0;
1129 /* Locate the enum block */
1130 while(*mapEnum[item].szValueName && mapEnum[item].dwEnum != dwEnum) item++;
1131 /* Now find the value in that block */
1132 while(*mapEnum[item].szValueName && mapEnum[item].dwEnum == dwEnum) {
1133 if(!lstrcmpiW(mapEnum[item].szValueName, pszValueName)) {
1134 if(dwValue) *dwValue = mapEnum[item].dwValue;
1135 return TRUE;
1136 }
1137 item++;
1138 }
1139 return FALSE;
1140}
unsigned long DWORD
Definition: ntddk_ex.h:95
static ATOM item
Definition: dde.c:856
static const MSSTYLES_ENUM_MAP mapEnum[]
Definition: stylemap.c:250

Referenced by GetThemeEnumValue(), and GetThemeMetric().

◆ MSSTYLES_LookupPartState()

BOOL MSSTYLES_LookupPartState ( LPCWSTR  pszClass,
LPCWSTR  pszPart,
LPCWSTR  pszState,
int iPartId,
int iStateId 
)

Definition at line 1038 of file stylemap.c.

1039{
1040 unsigned int i;
1041 const MSSTYLES_CLASS_MAP *map;
1042
1043 *iPartId = 0;
1044 *iStateId = 0;
1045 for(i=0; i<sizeof(mapClass)/sizeof(mapClass[0]); i++) {
1046 if(!lstrcmpiW(mapClass[i].pszClass, pszClass)) {
1047 map = mapClass[i].lpMap;
1048 if(pszPart) {
1049 do {
1050 if(map->dwStateID == 0 && !lstrcmpiW(map->szName, pszPart)) {
1051 *iPartId = map->dwPartID;
1052 break;
1053 }
1054 } while(*((++map)->szName));
1055 }
1056 if(pszState) {
1057 if(pszPart && *iPartId == 0) {
1058 break;
1059 }
1060 do {
1061 if(pszPart) {
1062 if(map->dwPartID == *iPartId && !lstrcmpiW(map->szName, pszState)) {
1063 *iStateId = map->dwStateID;
1064 break;
1065 }
1066 }
1067 else {
1068 if(!lstrcmpiW(map->szName, pszState)) {
1069 *iStateId = map->dwStateID;
1070 break;
1071 }
1072 }
1073 } while(*((++map)->szName));
1074 }
1075 break;
1076 }
1077 }
1078 if(pszPart && *iPartId == 0) {
1079 return FALSE;
1080 }
1081 if(pszState && *iStateId == 0) {
1082 return FALSE;
1083 }
1084 return TRUE;
1085}
Definition: _map.h:48
static const WCHAR szName[]
Definition: powrprof.c:45
const MSSTYLES_CLASS_MAP * lpMap
Definition: stylemap.c:42
static const MSSTYLES_CLASS_NAME mapClass[]
Definition: stylemap.c:1009

Referenced by MSSTYLES_ParseIniSectionName().

◆ MSSTYLES_LookupProperty()

BOOL MSSTYLES_LookupProperty ( LPCWSTR  pszPropertyName,
int dwPrimitive,
int dwId 
)

Definition at line 1100 of file stylemap.c.

1101{
1102 DWORD item = 0;
1103 do {
1104 if(!lstrcmpiW(mapProperty[item].szPropertyName, pszPropertyName)) {
1105 if(dwPrimitive) *dwPrimitive = mapProperty[item].dwPrimitiveType;
1106 if(dwId) *dwId = mapProperty[item].dwPropertyID;
1107 return TRUE;
1108 }
1109 } while(*mapProperty[++item].szPropertyName);
1110 return FALSE;
1111}
static const MSSTYLES_PROPERTY_MAP mapProperty[]
Definition: stylemap.c:50

Referenced by GetThemeDocumentationProperty(), and MSSTYLES_ParseThemeIni().

◆ MSSTYLES_OpenThemeClass()

PTHEME_CLASS MSSTYLES_OpenThemeClass ( PTHEME_FILE  tf,
LPCWSTR  pszAppName,
LPCWSTR  pszClassList 
)

Definition at line 756 of file msstyles.c.

757{
758 PTHEME_CLASS cls = NULL;
759#ifdef __REACTOS__
760 PTHEME_CLASS defaultCls = NULL;
761#endif
764 LPCWSTR end;
765 DWORD len;
766
767 if(!tf->classes) {
768 return NULL;
769 }
770
771 start = pszClassList;
772 while((end = strchrW(start, ';'))) {
773 len = end-start;
774 lstrcpynW(szClassName, start, min(len+1, sizeof(szClassName)/sizeof(szClassName[0])));
775 start = end+1;
776 cls = MSSTYLES_FindClass(tf, pszAppName, szClassName);
777 if(cls) break;
778#ifdef __REACTOS__
779 if (!defaultCls)
780 defaultCls = MSSTYLES_FindClass(tf, NULL, szClassName);
781#endif
782 }
783 if(!cls && *start) {
784 lstrcpynW(szClassName, start, sizeof(szClassName)/sizeof(szClassName[0]));
785 cls = MSSTYLES_FindClass(tf, pszAppName, szClassName);
786#ifdef __REACTOS__
787 if (!defaultCls)
788 defaultCls = MSSTYLES_FindClass(tf, NULL, szClassName);
789#endif
790 }
791 if(cls) {
792 TRACE("Opened app %s, class %s from list %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName), debugstr_w(pszClassList));
793 cls->tf = tf;
794 cls->tf->dwRefCount++;
795 TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
796 }
797#ifdef __REACTOS__
798 else if (defaultCls)
799 {
800 cls = defaultCls;
801 TRACE("Opened default class %s from list %s\n", debugstr_w(cls->szClassName), debugstr_w(pszClassList));
802 cls->tf = tf;
803 cls->tf->dwRefCount++;
804 TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
805 }
806#endif
807 return cls;
808}
static const WCHAR szClassName[]
Definition: clipbrd.c:11
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722
static PTHEME_CLASS MSSTYLES_FindClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName)
Definition: msstyles.c:392
#define strchrW(s, c)
Definition: unicode.h:40
struct _THEME_FILE * tf
Definition: uxthemep.h:61
WCHAR szAppName[MAX_THEME_APP_NAME]
Definition: uxthemep.h:62
WCHAR szClassName[MAX_THEME_CLASS_NAME]
Definition: uxthemep.h:63
#define MAX_THEME_CLASS_NAME
Definition: uxthemep.h:35

Referenced by OpenThemeDataInternal().

◆ MSSTYLES_OpenThemeFile()

HRESULT MSSTYLES_OpenThemeFile ( LPCWSTR  lpThemeFile,
LPCWSTR  pszColorName,
LPCWSTR  pszSizeName,
PTHEME_FILE tf 
)

Definition at line 54 of file msstyles.c.

55{
56 HMODULE hTheme;
57 HRSRC hrsc;
58 HRESULT hr = S_OK;
59 static const WCHAR szPackThemVersionResource[] = {
60 'P','A','C','K','T','H','E','M','_','V','E','R','S','I','O','N', '\0'
61 };
62 static const WCHAR szColorNamesResource[] = {
63 'C','O','L','O','R','N','A','M','E','S','\0'
64 };
65 static const WCHAR szSizeNamesResource[] = {
66 'S','I','Z','E','N','A','M','E','S','\0'
67 };
68
70 DWORD versize;
71 LPWSTR pszColors;
72 LPWSTR pszSelectedColor = NULL;
73 LPWSTR pszSizes;
74 LPWSTR pszSelectedSize = NULL;
75 LPWSTR tmp;
76
77 TRACE("Opening %s\n", debugstr_w(lpThemeFile));
78
79 hTheme = LoadLibraryExW(lpThemeFile, NULL, LOAD_LIBRARY_AS_DATAFILE);
80
81 /* Validate that this is really a theme */
82 if(!hTheme) {
84 goto invalid_theme;
85 }
86 if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szPackThemVersionResource))) {
87 TRACE("No version resource found\n");
89 goto invalid_theme;
90 }
91 if((versize = SizeofResource(hTheme, hrsc)) != 2)
92 {
93 TRACE("Version resource found, but wrong size: %d\n", versize);
95 goto invalid_theme;
96 }
97 version = *(WORD*)LoadResource(hTheme, hrsc);
99 {
100 TRACE("Version of theme file is unsupported: 0x%04x\n", version);
102 goto invalid_theme;
103 }
104
105 if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szColorNamesResource))) {
106 TRACE("Color names resource not found\n");
108 goto invalid_theme;
109 }
110 pszColors = LoadResource(hTheme, hrsc);
111
112 if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szSizeNamesResource))) {
113 TRACE("Size names resource not found\n");
115 goto invalid_theme;
116 }
117 pszSizes = LoadResource(hTheme, hrsc);
118
119 /* Validate requested color against what's available from the theme */
120 if(pszColorName) {
121 tmp = pszColors;
122 while(*tmp) {
123 if(!lstrcmpiW(pszColorName, tmp)) {
124 pszSelectedColor = tmp;
125 break;
126 }
127 tmp += lstrlenW(tmp)+1;
128 }
129 }
130 else
131 pszSelectedColor = pszColors; /* Use the default color */
132
133 /* Validate requested size against what's available from the theme */
134 if(pszSizeName) {
135 tmp = pszSizes;
136 while(*tmp) {
137 if(!lstrcmpiW(pszSizeName, tmp)) {
138 pszSelectedSize = tmp;
139 break;
140 }
141 tmp += lstrlenW(tmp)+1;
142 }
143 }
144 else
145 pszSelectedSize = pszSizes; /* Use the default size */
146
147 if(!pszSelectedColor || !pszSelectedSize) {
148 TRACE("Requested color/size (%s/%s) not found in theme\n",
149 debugstr_w(pszColorName), debugstr_w(pszSizeName));
151 goto invalid_theme;
152 }
153
155 (*tf)->hTheme = hTheme;
156
157 GetFullPathNameW(lpThemeFile, MAX_PATH, (*tf)->szThemeFile, NULL);
158
159 (*tf)->pszAvailColors = pszColors;
160 (*tf)->pszAvailSizes = pszSizes;
161 (*tf)->pszSelectedColor = pszSelectedColor;
162 (*tf)->pszSelectedSize = pszSelectedSize;
163 (*tf)->dwRefCount = 1;
164
165 TRACE("Theme %p refcount: %d\n", *tf, (*tf)->dwRefCount);
166
167 return S_OK;
168
169invalid_theme:
170 if(hTheme) FreeLibrary(hTheme);
171 return hr;
172}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
unsigned short WORD
Definition: ntddk_ex.h:93
#define MSSTYLES_VERSION
Definition: msstyles.c:31
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:368
#define ERROR_BAD_FORMAT
Definition: winerror.h:114
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by CheckThemeSignature(), EnumThemeColors(), EnumThemeSizes(), GetThemeDefaults(), GetThemeDocumentationProperty(), OpenThemeFile(), and UXTHEME_LoadTheme().

◆ MSSTYLES_ParseThemeIni()

void MSSTYLES_ParseThemeIni ( PTHEME_FILE  tf)

Definition at line 644 of file msstyles.c.

645{
646 static const WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'};
647 static const WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'};
648 PTHEME_CLASS cls;
649 PTHEME_CLASS globals;
654 WCHAR szPropertyName[MAX_THEME_VALUE_NAME];
655 int iPartId;
656 int iStateId;
657 int iPropertyPrimitive;
658 int iPropertyId;
659 DWORD dwLen;
661 DWORD dwValueLen;
662 LPCWSTR lpValue;
663
664 if(tf->classes)
665 return;
666
668
669 while((lpName=UXINI_GetNextSection(ini, &dwLen)))
670 {
671 if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpName, dwLen, szSysMetrics, -1) == CSTR_EQUAL)
672 {
673 while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen)))
674 {
675 lstrcpynW(szPropertyName, lpName, min(dwLen+1, sizeof(szPropertyName)/sizeof(szPropertyName[0])));
676 if(MSSTYLES_LookupProperty(szPropertyName, &iPropertyPrimitive, &iPropertyId))
677 {
678 /* Catch all metrics, including colors */
679 MSSTYLES_AddMetric(tf, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen);
680 }
681 else
682 {
683 TRACE("Unknown system metric %s\n", debugstr_w(szPropertyName));
684 }
685 }
686 continue;
687 }
688
689 if(MSSTYLES_ParseIniSectionName(lpName, dwLen, szAppName, szClassName, &iPartId, &iStateId))
690 {
691 BOOL isGlobal = FALSE;
692 if(!lstrcmpiW(szClassName, szGlobals))
693 {
694 isGlobal = TRUE;
695 }
697 ps = MSSTYLES_AddPartState(cls, iPartId, iStateId);
698
699 while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen)))
700 {
701 lstrcpynW(szPropertyName, lpName, min(dwLen+1, sizeof(szPropertyName)/sizeof(szPropertyName[0])));
702 if(MSSTYLES_LookupProperty(szPropertyName, &iPropertyPrimitive, &iPropertyId))
703 {
704 MSSTYLES_AddProperty(ps, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen, isGlobal);
705 }
706 else
707 {
708 TRACE("Unknown property %s\n", debugstr_w(szPropertyName));
709 }
710 }
711 }
712 }
713
714 /* App/Class combos override values defined by the base class, map these overrides */
715 globals = MSSTYLES_FindClass(tf, NULL, szGlobals);
716 cls = tf->classes;
717 while(cls)
718 {
719 if(*cls->szAppName)
720 {
722 if(!cls->overrides)
723 {
724 TRACE("No overrides found for app %s class %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName));
725 }
726 else
727 {
728 cls->overrides = globals;
729 }
730 }
731 else
732 {
733 /* Everything overrides globals..except globals */
734 if(cls != globals)
735 cls->overrides = globals;
736 }
737 cls = cls->next;
738 }
740
741 if(!tf->classes) {
742 ERR("Failed to parse theme ini\n");
743 }
744}
#define ERR(fmt,...)
Definition: precomp.h:57
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: locale.c:4014
unsigned int BOOL
Definition: ntddk_ex.h:94
static PTHEME_CLASS MSSTYLES_AddClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName)
Definition: msstyles.c:422
static PUXINI_FILE MSSTYLES_GetActiveThemeIni(PTHEME_FILE tf)
Definition: msstyles.c:246
static PTHEME_PARTSTATE MSSTYLES_AddPartState(PTHEME_CLASS tc, int iPartId, int iStateId)
Definition: msstyles.c:479
static BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR szAppName, LPWSTR szClassName, int *iPartId, int *iStateId)
Definition: msstyles.c:313
static PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen)
Definition: msstyles.c:617
static PTHEME_PROPERTY MSSTYLES_AddProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen, BOOL isGlobal)
Definition: msstyles.c:576
#define LOCALE_SYSTEM_DEFAULT
TCHAR szAppName[128]
Definition: solitaire.cpp:18
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId)
Definition: stylemap.c:1100
TConfig ini
Definition: tnconfig.cpp:45
LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen)
Definition: uxini.c:173
LPCWSTR UXINI_GetNextValue(PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen)
Definition: uxini.c:226
void UXINI_CloseINI(PUXINI_FILE uf)
Definition: uxini.c:83
#define MAX_THEME_VALUE_NAME
Definition: uxthemep.h:36
#define MAX_THEME_APP_NAME
Definition: uxthemep.h:34
_In_ LPCSTR lpName
Definition: winbase.h:2814
#define NORM_IGNORECASE
Definition: winnls.h:178
#define CSTR_EQUAL
Definition: winnls.h:458

Referenced by OpenThemeDataInternal(), and UXTHEME_SetActiveTheme().

◆ MSSTYLES_ReferenceTheme()

HRESULT MSSTYLES_ReferenceTheme ( PTHEME_FILE  tf)

Definition at line 224 of file msstyles.c.

225{
226 tf->dwRefCount++;
227 TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
228 return S_OK;
229}

Referenced by UXTHEME_SetActiveTheme().

◆ NC_TrackScrollBar()

VOID NC_TrackScrollBar ( HWND  Wnd,
WPARAM  wParam,
POINT  Pt 
)

Definition at line 674 of file ncscrollbar.c.

675{
676 INT scrollbar;
677
678 if ((wParam & 0xfff0) == SC_HSCROLL)
679 {
680 if ((wParam & 0x0f) != HTHSCROLL) return;
681 scrollbar = SB_HORZ;
682 }
683 else /* SC_VSCROLL */
684 {
685 if ((wParam & 0x0f) != HTVSCROLL) return;
686 scrollbar = SB_VERT;
687 }
688 SCROLL_TrackScrollBar( hwnd, scrollbar, pt );
689}
WPARAM wParam
Definition: combotst.c:138
#define pt(x, y)
Definition: drawing.c:79
static void SCROLL_TrackScrollBar(HWND hwnd, INT scrollbar, POINT pt)
Definition: ncscrollbar.c:636
int32_t INT
Definition: typedefs.h:58
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define SC_HSCROLL
Definition: winuser.h:2597
#define SB_VERT
Definition: winuser.h:553
#define HTVSCROLL
Definition: winuser.h:2485
#define HTHSCROLL
Definition: winuser.h:2484
#define SB_HORZ
Definition: winuser.h:552

Referenced by ThemeWndProc().

◆ SCROLL_getObjectId()

LONG SCROLL_getObjectId ( INT  nBar)

Definition at line 38 of file ncscrollbar.c.

39{
40 switch(nBar)
41 {
42 case SB_HORZ:
43 return OBJID_HSCROLL;
44 case SB_VERT:
45 return OBJID_VSCROLL;
46 default:
48 return 0;
49 }
50}
#define assert(x)
Definition: debug.h:53
#define OBJID_VSCROLL
Definition: winable.h:20
#define OBJID_HSCROLL
Definition: winable.h:21

Referenced by SCROLL_HandleScrollEvent(), and ThemeDrawScrollBar().

◆ ThemeCalculateCaptionButtonsPos()

void ThemeCalculateCaptionButtonsPos ( HWND  hWnd,
HTHEME  htheme 
)

Definition at line 270 of file nonclient.c.

271{
272 INT btnHeight;
273 WINDOWINFO wi = {sizeof(wi)};
274
275 if (!GetWindowInfo(hWnd, &wi))
276 return;
278
279 ThemeCalculateCaptionButtonsPosEx(&wi, hWnd, htheme, btnHeight);
280}
static void ThemeCalculateCaptionButtonsPosEx(WINDOWINFO *wi, HWND hWnd, HTHEME htheme, INT buttonHeight)
Definition: nonclient.c:215
DWORD dwExStyle
Definition: winuser.h:3773
#define SM_CYSIZE
Definition: winuser.h:995
BOOL WINAPI GetWindowInfo(_In_ HWND, _Inout_ PWINDOWINFO)
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SM_CYSMSIZE
Definition: winuser.h:1019
int WINAPI GetSystemMetrics(_In_ int)

Referenced by ThemePreWindowProc().

◆ ThemeCleanupDrawContext()

void ThemeCleanupDrawContext ( PDRAW_CONTEXT  pcontext)

Definition at line 182 of file nonclient.c.

183{
184 ReleaseDC(pcontext->hWnd ,pcontext->hDC);
185
186 if (pcontext->hRgn != NULL)
187 {
188 DeleteObject(pcontext->hRgn);
189 }
190}
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)

Referenced by DrawNCPreview(), SCROLL_HandleScrollEvent(), ThemeHandleButton(), ThemeHandleNcMouseLeave(), ThemeHandleNcMouseMove(), and ThemeHandleNCPaint().

◆ ThemeDrawScrollBar()

void ThemeDrawScrollBar ( PDRAW_CONTEXT  pcontext,
INT  Bar,
POINT pt 
)

Definition at line 318 of file ncscrollbar.c.

319{
320 SCROLLBARINFO sbi;
321
322 if (((nBar == SB_VERT) && !(pcontext->wi.dwStyle & WS_VSCROLL)) ||
323 ((nBar == SB_HORZ) && !(pcontext->wi.dwStyle & WS_HSCROLL)))
324 {
325 return;
326 }
327
328 sbi.cbSize = sizeof(sbi);
329 GetScrollBarInfo(pcontext->hWnd, SCROLL_getObjectId(nBar), &sbi);
330 ThemeDrawScrollBarEx(pcontext, nBar, &sbi, pt);
331}
LONG SCROLL_getObjectId(INT nBar)
Definition: ncscrollbar.c:38
void ThemeDrawScrollBarEx(PDRAW_CONTEXT pcontext, INT nBar, PSCROLLBARINFO psbi, POINT *pt)
Definition: ncscrollbar.c:276
WINDOWINFO wi
Definition: uxthemep.h:196
DWORD dwStyle
Definition: winuser.h:3772
BOOL WINAPI GetScrollBarInfo(_In_ HWND, _In_ LONG, _Inout_ PSCROLLBARINFO)

Referenced by ThemeHandleNcMouseLeave(), ThemeHandleNcMouseMove(), and ThemePaintWindow().

◆ ThemeDrawScrollBarEx()

void ThemeDrawScrollBarEx ( PDRAW_CONTEXT  pcontext,
INT  nBar,
PSCROLLBARINFO  psbi,
POINT pt 
)

Definition at line 276 of file ncscrollbar.c.

277{
278 SCROLLINFO si;
279 BOOL vertical;
280 enum SCROLL_HITTEST htHot = SCROLL_NOWHERE;
281 PWND_DATA pwndData;
282
283 if (!(pwndData = ThemeGetWndData(pcontext->hWnd)))
284 return;
285
286 if (pwndData->SCROLL_TrackingWin)
287 return;
288
289 /* Retrieve scrollbar info */
290 si.cbSize = sizeof(si);
291 si.fMask = SIF_ALL ;
292 GetScrollInfo(pcontext->hWnd, nBar, &si);
293 vertical = SCROLL_IsVertical(pcontext->hWnd, nBar);
296 {
297 psbi->xyThumbTop = 0;
298 }
299
300 /* The scrollbar rect is in screen coordinates */
301 OffsetRect(&psbi->rcScrollBar, -pcontext->wi.rcWindow.left, -pcontext->wi.rcWindow.top);
302
303 if(pt)
304 {
305 ScreenToWindow(pcontext->hWnd, pt);
306 htHot = SCROLL_HitTest(pcontext->hWnd, psbi, vertical, *pt, FALSE);
307 }
308
309 /* do not draw if the scrollbar rectangle is empty */
310 if(IsRectEmpty(&psbi->rcScrollBar)) return;
311
312 /* Draw the scrollbar */
313 SCROLL_DrawArrows( pcontext, psbi, vertical, 0, htHot );
314 SCROLL_DrawInterior( pcontext, psbi, psbi->xyThumbTop, vertical, 0, htHot );
315}
static void ScreenToWindow(HWND hWnd, POINT *pt)
Definition: ncscrollbar.c:16
static void SCROLL_DrawInterior(PDRAW_CONTEXT pcontext, SCROLLBARINFO *psbi, INT thumbPos, BOOL vertical, int htDown, int htHot)
Definition: ncscrollbar.c:182
static enum SCROLL_HITTEST SCROLL_HitTest(HWND hwnd, SCROLLBARINFO *psbi, BOOL vertical, POINT pt, BOOL bDragging)
Definition: ncscrollbar.c:87
static void SCROLL_DrawArrows(PDRAW_CONTEXT pcontext, SCROLLBARINFO *psbi, BOOL vertical, int htDown, int htHot)
Definition: ncscrollbar.c:147
static BOOL SCROLL_IsVertical(HWND hwnd, INT nBar)
Definition: ncscrollbar.c:24
#define SCROLL_NOWHERE
Definition: scrollbar.c:13
#define SCROLL_BOTTOM_ARROW
Definition: scrollbar.c:18
#define SCROLL_TOP_ARROW
Definition: scrollbar.c:14
HWND SCROLL_TrackingWin
Definition: uxthemep.h:182
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3757
RECT rcWindow
Definition: winuser.h:3770
SCROLL_HITTEST
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define SIF_ALL
Definition: winuser.h:1235
#define STATE_SYSTEM_UNAVAILABLE
Definition: winuser.h:2865
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI GetScrollInfo(_In_ HWND, _In_ int, _Inout_ LPSCROLLINFO)

Referenced by DrawWindowForNCPreview(), and ThemeDrawScrollBar().

◆ ThemeGetWndData()

PWND_DATA ThemeGetWndData ( HWND  hWnd)

Definition at line 17 of file themehooks.c.

18{
19 PWND_DATA pwndData;
20
22 if(pwndData == NULL)
23 {
24 pwndData = HeapAlloc(GetProcessHeap(),
26 sizeof(WND_DATA));
27 if(pwndData == NULL)
28 {
29 return NULL;
30 }
31
33 }
34
35 return pwndData;
36}
ATOM atWndContext
Definition: system.c:52
struct _WND_DATA * PWND_DATA
#define MAKEINTATOM(i)
Definition: winbase.h:1488
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)

Referenced by DefWndNCHitTest(), GetDiaogTextureBrush(), GetNCCaptionTheme(), GetNCScrollbarTheme(), OnPostWinPosChanged(), SCROLL_TrackScrollBar(), ThemeCalculateCaptionButtonsPosEx(), ThemeDrawCaptionButton(), ThemeDrawScrollBarEx(), ThemeGetScrollInfo(), ThemeHandleButton(), ThemeHandleNcMouseLeave(), ThemeHandleNcMouseMove(), ThemePreWindowProc(), ThemeSetScrollInfo(), and ThemeSetWindowRgn().

◆ ThemeInitDrawContext()

void ThemeInitDrawContext ( PDRAW_CONTEXT  pcontext,
HWND  hWnd,
HRGN  hRgn 
)

Definition at line 158 of file nonclient.c.

161{
162 pcontext->wi.cbSize = sizeof(pcontext->wi);
163 GetWindowInfo(hWnd, &pcontext->wi);
164 pcontext->hWnd = hWnd;
165 pcontext->Active = IsWindowActive(hWnd, pcontext->wi.dwExStyle);
166 pcontext->theme = GetNCCaptionTheme(hWnd, pcontext->wi.dwStyle);
167 pcontext->scrolltheme = GetNCScrollbarTheme(hWnd, pcontext->wi.dwStyle);
168
169 pcontext->CaptionHeight = pcontext->wi.cyWindowBorders;
171
172 if (hRgn <= (HRGN)1)
173 {
175 }
176 pcontext->hRgn = hRgn;
177
179}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
static BOOL IsWindowActive(HWND hWnd, DWORD ExStyle)
Definition: nonclient.c:16
static HRGN hRgn
Definition: mapping.c:33
HTHEME theme
Definition: uxthemep.h:193
HTHEME scrolltheme
Definition: uxthemep.h:194
int CaptionHeight
Definition: uxthemep.h:199
DWORD cbSize
Definition: winuser.h:3769
UINT cyWindowBorders
Definition: winuser.h:3776
HTHEME GetNCScrollbarTheme(HWND hWnd, DWORD style)
Definition: themehooks.c:118
HTHEME GetNCCaptionTheme(HWND hWnd, DWORD style)
Definition: themehooks.c:88
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:68
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
#define DCX_WINDOW
Definition: winuser.h:2116
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define DCX_INTERSECTRGN
Definition: winuser.h:2125
#define SM_CYSMCAPTION
Definition: winuser.h:1017
#define SM_CYCAPTION
Definition: winuser.h:966

Referenced by SCROLL_HandleScrollEvent(), ThemeHandleButton(), ThemeHandleNcMouseLeave(), ThemeHandleNcMouseMove(), and ThemeHandleNCPaint().

◆ ThemeWndProc()

LRESULT CALLBACK ThemeWndProc ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
WNDPROC  DefWndProc 
)

Definition at line 1015 of file nonclient.c.

1016{
1017 switch(Msg)
1018 {
1019 case WM_NCPAINT:
1020 return ThemeHandleNCPaint(hWnd, (HRGN)wParam);
1021 //
1022 // WM_NCUAHDRAWCAPTION : wParam are DC_* flags.
1023 //
1025 //
1026 // WM_NCUAHDRAWFRAME : wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1027 //
1028 case WM_NCUAHDRAWFRAME:
1029 case WM_NCACTIVATE:
1030
1032 return TRUE;
1033
1034 ThemeHandleNCPaint(hWnd, (HRGN)1);
1035 return TRUE;
1036 case WM_NCMOUSEMOVE:
1037 {
1038 POINT Point;
1042 }
1043 case WM_NCMOUSELEAVE:
1045 case WM_NCLBUTTONDOWN:
1046 switch (wParam)
1047 {
1048 case HTMINBUTTON:
1049 case HTMAXBUTTON:
1050 case HTCLOSE:
1051 {
1053 return 0;
1054 }
1055 default:
1056 return DefWndProc(hWnd, Msg, wParam, lParam);
1057 }
1058 case WM_NCHITTEST:
1059 {
1060 POINT Point;
1063 return DefWndNCHitTest(hWnd, Point);
1064 }
1065 case WM_SYSCOMMAND:
1066 {
1067 if ((wParam & 0xfff0) == SC_VSCROLL ||
1068 (wParam & 0xfff0) == SC_HSCROLL)
1069 {
1070 POINT Pt;
1071 Pt.x = (short)LOWORD(lParam);
1072 Pt.y = (short)HIWORD(lParam);
1074 return 0;
1075 }
1076 else
1077 {
1078 return DefWndProc(hWnd, Msg, wParam, lParam);
1079 }
1080 }
1081 default:
1082 return DefWndProc(hWnd, Msg, wParam, lParam);
1083 }
1084}
struct @1641 Msg[]
LPARAM lParam
Definition: combotst.c:139
static VOID ThemeHandleButton(HWND hWnd, WPARAM wParam)
Definition: nonclient.c:722
static LRESULT ThemeHandleNcMouseLeave(HWND hWnd)
Definition: nonclient.c:688
static LRESULT ThemeHandleNCPaint(HWND hWnd, HRGN hRgn)
Definition: nonclient.c:616
static LRESULT ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT *pt)
Definition: nonclient.c:633
static LRESULT DefWndNCHitTest(HWND hWnd, POINT Point)
Definition: nonclient.c:800
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
void NC_TrackScrollBar(HWND hwnd, WPARAM wParam, POINT pt)
Definition: ncscrollbar.c:674
#define LOWORD(l)
Definition: pedump.c:82
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:46
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:47
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define HTCLOSE
Definition: winuser.h:2502
#define WM_SYSCOMMAND
Definition: winuser.h:1744
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SC_VSCROLL
Definition: winuser.h:2596
#define WM_NCHITTEST
Definition: winuser.h:1689
#define HTMAXBUTTON
Definition: winuser.h:2487
#define WM_NCMOUSEMOVE
Definition: winuser.h:1694
#define WM_NCACTIVATE
Definition: winuser.h:1691
#define HTMINBUTTON
Definition: winuser.h:2486
#define WM_NCMOUSELEAVE
Definition: winuser.h:1845
#define GWL_STYLE
Definition: winuser.h:855
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1695
#define WM_NCPAINT
Definition: winuser.h:1690

Referenced by ThemeDefWindowProcA(), and ThemeDefWindowProcW().

◆ UXINI_CloseINI()

void UXINI_CloseINI ( PUXINI_FILE  uf)

Definition at line 83 of file uxini.c.

84{
85 HeapFree(GetProcessHeap(), 0, uf);
86}

Referenced by GetThemeDocumentationProperty(), and MSSTYLES_ParseThemeIni().

◆ UXINI_FindSection()

BOOL UXINI_FindSection ( PUXINI_FILE  uf,
LPCWSTR  lpName 
)

Definition at line 200 of file uxini.c.

201{
202 LPCWSTR lpSection;
203 DWORD dwLen;
204 while((lpSection = UXINI_GetNextSection(uf, &dwLen))) {
206 return TRUE;
207 }
208 }
209 return FALSE;
210}

Referenced by GetThemeDocumentationProperty().

◆ UXINI_FindValue()

BOOL UXINI_FindValue ( PUXINI_FILE  uf,
LPCWSTR  lpName,
LPCWSTR lpValue,
DWORD dwValueLen 
)

Definition at line 280 of file uxini.c.

281{
284
285 while((name = UXINI_GetNextValue(uf, &namelen, lpValue, dwValueLen))) {
287 return TRUE;
288 }
289 }
290 return FALSE;
291}
GLint namelen
Definition: glext.h:7232
Definition: name.c:39

Referenced by GetThemeDocumentationProperty().

◆ UXINI_GetNextSection()

LPCWSTR UXINI_GetNextSection ( PUXINI_FILE  uf,
DWORD dwLen 
)

Definition at line 173 of file uxini.c.

174{
175 LPCWSTR lpLine;
176 while((lpLine = UXINI_GetNextLine(uf, dwLen))) {
177 /* Assuming a ']' ending to the section name */
178 if(lpLine[0] == '[') {
179 lpLine++;
180 *dwLen -= 2;
181 break;
182 }
183 }
184 return lpLine;
185}
static LPCWSTR UXINI_GetNextLine(PUXINI_FILE uf, DWORD *dwLen)
Definition: uxini.c:129

Referenced by MSSTYLES_ParseThemeIni(), and UXINI_FindSection().

◆ UXINI_GetNextValue()

LPCWSTR UXINI_GetNextValue ( PUXINI_FILE  uf,
DWORD dwNameLen,
LPCWSTR lpValue,
DWORD dwValueLen 
)

Definition at line 226 of file uxini.c.

227{
228 LPCWSTR lpLine;
229 LPCWSTR lpLineEnd;
230 LPCWSTR name = NULL;
232 DWORD vallen = 0;
233 DWORD namelen = 0;
234 DWORD dwLen;
235 lpLine = UXINI_GetNextLine(uf, &dwLen);
236 if(!lpLine)
237 return NULL;
238 if(lpLine[0] == '[') {
239 UXINI_UnGetToLine(uf, lpLine);
240 return NULL;
241 }
242 lpLineEnd = lpLine + dwLen;
243
244 name = lpLine;
245 while(namelen < dwLen && *lpLine != '=') {
246 lpLine++;
247 namelen++;
248 }
249 if(*lpLine != '=') return NULL;
250 lpLine++;
251
252 /* Remove whitespace from end of name */
253 while(UXINI_isspace(name[namelen-1])) namelen--;
254 /* Remove whitespace from beginning of value */
255 while(UXINI_isspace(*lpLine) && lpLine < lpLineEnd) lpLine++;
256 value = lpLine;
257 vallen = dwLen-(value-name);
258
259 *dwNameLen = namelen;
260 *dwValueLen = vallen;
261 *lpValue = value;
262
263 return name;
264}
Definition: pdh_main.c:94
static void UXINI_UnGetToLine(PUXINI_FILE uf, LPCWSTR lpLine)
Definition: uxini.c:155
static BOOL UXINI_isspace(WCHAR c)
Definition: uxini.c:109

Referenced by MSSTYLES_ParseThemeIni(), and UXINI_FindValue().

◆ UXINI_LoadINI()

PUXINI_FILE UXINI_LoadINI ( HMODULE  hTheme,
LPCWSTR  lpName 
)

Definition at line 52 of file uxini.c.

52 {
53 HRSRC hrsc;
54 LPCWSTR lpThemesIni = NULL;
55 PUXINI_FILE uf;
56 DWORD dwIniSize;
57
58 TRACE("Loading resource INI %s\n", debugstr_w(lpName));
59
60 if((hrsc = FindResourceW(hTheme, lpName, szTextFileResource))) {
61 if(!(lpThemesIni = LoadResource(hTheme, hrsc))) {
62 TRACE("%s resource not found\n", debugstr_w(lpName));
63 return NULL;
64 }
65 }
66
67 dwIniSize = SizeofResource(hTheme, hrsc) / sizeof(WCHAR);
68 uf = HeapAlloc(GetProcessHeap(), 0, sizeof(UXINI_FILE));
69 uf->lpIni = lpThemesIni;
70 uf->lpCurLoc = lpThemesIni;
71 uf->lpEnd = lpThemesIni + dwIniSize;
72 return uf;
73}
LPCWSTR lpCurLoc
Definition: uxini.c:33
LPCWSTR lpEnd
Definition: uxini.c:34
LPCWSTR lpIni
Definition: uxini.c:32
static const WCHAR szTextFileResource[]
Definition: uxini.c:27

Referenced by MSSTYLES_GetActiveThemeIni(), and MSSTYLES_GetThemeIni().

◆ UXTHEME_broadcast_theme_changed()

BOOL CALLBACK UXTHEME_broadcast_theme_changed ( HWND  hWnd,
LPARAM  enable 
)

Definition at line 68 of file system.c.

69{
70 if (hWnd == NULL)
71 {
73 }
74 else
75 {
78 }
79 return TRUE;
80}
BOOL CALLBACK UXTHEME_broadcast_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:68
static BOOL CALLBACK UXTHEME_send_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:61
GLboolean enable
Definition: glext.h:11120
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)

Referenced by ApplyTheme(), EnableTheming(), SetWindowTheme(), ThemeHooksInstall(), ThemeHooksRemove(), and UXTHEME_broadcast_theme_changed().

◆ UXTHEME_InitSystem()

void UXTHEME_InitSystem ( HINSTANCE  hInst)

Definition at line 566 of file system.c.

567{
568 static const WCHAR szWindowTheme[] = {
569 'u','x','_','t','h','e','m','e','\0'
570 };
571 static const WCHAR szSubAppName[] = {
572 'u','x','_','s','u','b','a','p','p','\0'
573 };
574 static const WCHAR szSubIdList[] = {
575 'u','x','_','s','u','b','i','d','l','s','t','\0'
576 };
577 static const WCHAR szDialogThemeEnabled[] = {
578 'u','x','_','d','i','a','l','o','g','t','h','e','m','e','\0'
579 };
580
581 hDllInst = hInst;
582
583 atWindowTheme = GlobalAddAtomW(szWindowTheme);
584 atSubAppName = GlobalAddAtomW(szSubAppName);
585 atSubIdList = GlobalAddAtomW(szSubIdList);
586 atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled);
587 atWndContext = GlobalAddAtomW(L"ux_WndContext");
588
590 g_cHandles = 0;
591}
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
HINSTANCE hDllInst
Definition: system.c:45
int g_cHandles
Definition: system.c:57
RTL_HANDLE_TABLE g_UxThemeHandleTable
Definition: system.c:56
static ATOM atSubIdList
Definition: system.c:51
ATOM atWindowTheme
Definition: system.c:49
static ATOM atSubAppName
Definition: system.c:50
ATOM atDialogThemeEnabled
Definition: system.c:46
HINSTANCE hInst
Definition: dxdiag.c:13
NTSYSAPI VOID NTAPI RtlInitializeHandleTable(_In_ ULONG TableSize, _In_ ULONG HandleSize, _In_ PRTL_HANDLE_TABLE HandleTable)

Referenced by DllMain().

◆ UXTHEME_LoadImage()

HRESULT UXTHEME_LoadImage ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pRect,
BOOL  glyph,
HBITMAP hBmp,
RECT bmpRect,
BOOL hasImageAlpha 
)

Definition at line 230 of file draw.c.

232{
233 int imagelayout = IL_HORIZONTAL;
234 int imagecount = 1;
235 int imagenum;
236 BITMAP bmp;
239 PTHEME_CLASS pClass;
240
241 pClass = ValidateHandle(hTheme);
242 if (!pClass)
243 return E_HANDLE;
244
245 tp = UXTHEME_SelectImage(hTheme, hdc, iPartId, iStateId, pRect, glyph);
246 if(!tp) {
247 FIXME("Couldn't determine image for part/state %d/%d, invalid theme?\n", iPartId, iStateId);
249 }
250 lstrcpynW(szPath, tp->lpValue, min(tp->dwValueLen+1, sizeof(szPath)/sizeof(szPath[0])));
251 *hBmp = MSSTYLES_LoadBitmap(pClass, szPath, hasImageAlpha);
252 if(!*hBmp) {
253 TRACE("Failed to load bitmap %s\n", debugstr_w(szPath));
255 }
256
257 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGELAYOUT, &imagelayout);
258 GetThemeInt(hTheme, iPartId, iStateId, TMT_IMAGECOUNT, &imagecount);
259
260 imagenum = max (min (imagecount, iStateId), 1) - 1;
261 GetObjectW(*hBmp, sizeof(bmp), &bmp);
262
263 if(imagecount < 1) imagecount = 1;
264
265 if(imagelayout == IL_VERTICAL) {
266 int height = bmp.bmHeight/imagecount;
267 bmpRect->left = 0;
268 bmpRect->right = bmp.bmWidth;
269 bmpRect->top = imagenum * height;
270 bmpRect->bottom = bmpRect->top + height;
271 }
272 else {
273 int width = bmp.bmWidth/imagecount;
274 bmpRect->left = imagenum * width;
275 bmpRect->right = bmpRect->left + width;
276 bmpRect->top = 0;
277 bmpRect->bottom = bmp.bmHeight;
278 }
279 return S_OK;
280}
#define FIXME(fmt,...)
Definition: precomp.h:53
LPVOID FASTCALL ValidateHandle(HANDLE hObject, UINT uType)
Definition: utils.c:377
static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph)
Definition: draw.c:147
HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId, int iPropId, int *piVal)
Definition: property.c:126
HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId, int iPropId, int *piVal)
Definition: property.c:63
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
LPCWSTR szPath
Definition: env.c:37
BITMAP bmp
Definition: alphablend.c:62
HDC hdc
Definition: main.c:9
HBITMAP MSSTYLES_LoadBitmap(PTHEME_CLASS tc, LPCWSTR lpFilename, BOOL *hasAlpha)
Definition: msstyles.c:896
Definition: bl.h:1331
#define max(a, b)
Definition: svc.c:63
#define TMT_IMAGECOUNT
Definition: vssym32.h:272
#define TMT_IMAGELAYOUT
Definition: vssym32.h:363
@ IL_VERTICAL
Definition: vssym32.h:32
@ IL_HORIZONTAL
Definition: vssym32.h:33
#define E_HANDLE
Definition: winerror.h:2850
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)

Referenced by get_image_part_size(), GetDiaogTextureBrush(), IsThemeBackgroundPartiallyTransparent(), UXTHEME_DrawImageBackground(), and UXTHEME_DrawImageGlyph().

◆ UXTHEME_LoadTheme()

void UXTHEME_LoadTheme ( BOOL  bLoad)

Definition at line 183 of file system.c.

184{
185 HKEY hKey;
186 DWORD buffsize;
187 HRESULT hr;
188 WCHAR tmp[10];
190 WCHAR szCurrentTheme[MAX_PATH];
191 WCHAR szCurrentColor[64];
192 WCHAR szCurrentSize[64];
194
195 if ((bLoad != FALSE) && g_bThemeHooksActive)
196 {
197 /* Get current theme configuration */
199 TRACE("Loading theme config\n");
200 buffsize = sizeof(tmp);
201 if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) {
202 bThemeActive = (tmp[0] != '0');
203 }
204 else {
206 TRACE("Failed to get ThemeActive: %d\n", GetLastError());
207 }
208 buffsize = sizeof(szCurrentColor);
209 if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize))
210 szCurrentColor[0] = '\0';
211 buffsize = sizeof(szCurrentSize);
212 if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
213 szCurrentSize[0] = '\0';
214 if (query_reg_path (hKey, szDllName, szCurrentTheme))
215 szCurrentTheme[0] = '\0';
217 }
218 else
219 TRACE("Failed to open theme registry key\n");
220 }
221 else
222 {
224 }
225
226 if(bThemeActive)
227 {
228 if( bIsThemeActive(szCurrentTheme, szCurrentColor, szCurrentSize) )
229 {
230 TRACE("Tried to load active theme again\n");
231 return;
232 }
233
234 /* Make sure the theme requested is actually valid */
235 hr = MSSTYLES_OpenThemeFile(szCurrentTheme,
236 szCurrentColor[0]?szCurrentColor:NULL,
237 szCurrentSize[0]?szCurrentSize:NULL,
238 &pt);
239 if(FAILED(hr)) {
241 }
242 else {
243 TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme),
244 debugstr_w(szCurrentColor), debugstr_w(szCurrentSize));
245
248 }
249 }
250 if(!bThemeActive) {
252 TRACE("Theming not active\n");
253 }
254}
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
static BOOL bIsThemeActive(LPCWSTR pszTheme, LPCWSTR pszColor, LPCWSTR pszSize)
Definition: system.c:145
static const WCHAR szSizeName[]
Definition: system.c:39
static const WCHAR szThemeManager[]
Definition: system.c:31
static const WCHAR szDllName[]
Definition: system.c:41
static HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
Definition: system.c:132
static const WCHAR szThemeActive[]
Definition: system.c:38
static DWORD query_reg_path(HKEY hKey, LPCWSTR lpszValue, LPVOID pvData)
Definition: system.c:84
static const WCHAR szColorName[]
Definition: system.c:40
FxAutoRegKey hKey
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
static BOOL bThemeActive
Definition: scroll.c:29
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by ThemeInitApiHook(), and ThemePreWindowProc().

◆ ValidateHandle()

PTHEME_CLASS ValidateHandle ( HTHEME  hTheme)

Definition at line 717 of file system.c.

718{
719 PUXTHEME_HANDLE pHandle;
720
721 if (!g_bThemeHooksActive || !hTheme || hTheme == INVALID_HANDLE_VALUE)
722 return NULL;
723
725 {
726 ERR("Invalid handle 0x%x!\n", hTheme);
727 return NULL;
728 }
729
730 pHandle = hTheme;
731 return pHandle->pClass;
732}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
NTSYSAPI BOOLEAN NTAPI RtlIsValidHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
Definition: rtltypes.h:1247
PTHEME_CLASS pClass
Definition: uxthemep.h:98

Referenced by HitTestThemeBackground(), and IsThemePartDefined().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( uxtheme  )

Variable Documentation

◆ atWindowTheme

ATOM atWindowTheme
extern

Definition at line 49 of file system.c.

Referenced by GetWindowTheme(), OpenThemeDataInternal(), and UXTHEME_InitSystem().

◆ atWndContext

ATOM atWndContext
extern

◆ g_bThemeHooksActive

◆ hDllInst

HINSTANCE hDllInst
extern