1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! theming API
7 use ctypes::{c_float, c_int, c_void};
8 use shared::minwindef::{BOOL, BYTE, DWORD, HINSTANCE, HRGN, LPARAM, UINT, ULONG, WORD};
9 use shared::windef::{COLORREF, HBITMAP, HBRUSH, HDC, HWND, LPCRECT, LPRECT, POINT, RECT, SIZE};
10 use um::commctrl::HIMAGELIST;
11 use um::wingdi::{BLENDFUNCTION, LOGFONTW, RGBQUAD, TEXTMETRICW};
12 use um::winnt::{HANDLE, HRESULT, LONG, LPCWSTR, LPWSTR, PVOID, VOID};
13 pub type HTHEME = HANDLE;
14 //pub const MAX_THEMECOLOR: u32 = 64;
15 //pub const MAX_THEMESIZE: u32 = 64;
16 extern "system" {
BeginPanningFeedback( hwnd: HWND, ) -> BOOL17 pub fn BeginPanningFeedback(
18 hwnd: HWND,
19 ) -> BOOL;
UpdatePanningFeedback( hwnd: HWND, lTotalOverpanOffsetX: LONG, lTotalOverpanOffsetY: LONG, fInInertia: BOOL, ) -> BOOL20 pub fn UpdatePanningFeedback(
21 hwnd: HWND,
22 lTotalOverpanOffsetX: LONG,
23 lTotalOverpanOffsetY: LONG,
24 fInInertia: BOOL,
25 ) -> BOOL;
EndPanningFeedback( hwnd: HWND, fAnimateBack: BOOL, ) -> BOOL26 pub fn EndPanningFeedback(
27 hwnd: HWND,
28 fAnimateBack: BOOL,
29 ) -> BOOL;
30 }
31 ENUM!{enum TA_PROPERTY {
32 TAP_FLAGS = 0,
33 TAP_TRANSFORMCOUNT = 1,
34 TAP_STAGGERDELAY = 2,
35 TAP_STAGGERDELAYCAP = 3,
36 TAP_STAGGERDELAYFACTOR = 4,
37 TAP_ZORDER = 5,
38 }}
39 ENUM!{enum TA_PROPERTY_FLAG {
40 TAPF_NONE = 0x0,
41 TAPF_HASSTAGGER = 0x1,
42 TAPF_ISRTLAWARE = 0x2,
43 TAPF_ALLOWCOLLECTION = 0x4,
44 TAPF_HASBACKGROUND = 0x8,
45 TAPF_HASPERSPECTIVE = 0x10,
46 }}
47 extern "system" {
GetThemeAnimationProperty( hTheme: HTHEME, iStoryboardId: c_int, iTargetId: c_int, eProperty: TA_PROPERTY, pvProperty: *mut VOID, cbSize: DWORD, pcbSizeOut: *mut DWORD, ) -> HRESULT48 pub fn GetThemeAnimationProperty(
49 hTheme: HTHEME,
50 iStoryboardId: c_int,
51 iTargetId: c_int,
52 eProperty: TA_PROPERTY,
53 pvProperty: *mut VOID,
54 cbSize: DWORD,
55 pcbSizeOut: *mut DWORD,
56 ) -> HRESULT;
57 }
58 ENUM!{enum TA_TRANSFORM_TYPE {
59 TATT_TRANSLATE_2D = 0,
60 TATT_SCALE_2D = 1,
61 TATT_OPACITY = 2,
62 TATT_CLIP = 3,
63 }}
64 ENUM!{enum TA_TRANSFORM_FLAG {
65 TATF_NONE = 0x0,
66 TATF_TARGETVALUES_USER = 0x1,
67 TATF_HASINITIALVALUES = 0x2,
68 TATF_HASORIGINVALUES = 0x4,
69 }}
70 STRUCT!{struct TA_TRANSFORM {
71 eTransformType: TA_TRANSFORM_TYPE,
72 dwTimingFunctionId: DWORD,
73 dwStartTime: DWORD,
74 dwDurationTime: DWORD,
75 eFlags: TA_TRANSFORM_FLAG,
76 }}
77 pub type PTA_TRANSFORM = *mut TA_TRANSFORM;
78 STRUCT!{struct TA_TRANSFORM_2D {
79 header: TA_TRANSFORM,
80 rX: c_float,
81 rY: c_float,
82 rInitialX: c_float,
83 rInitialY: c_float,
84 rOriginX: c_float,
85 rOriginY: c_float,
86 }}
87 pub type PTA_TRANSFORM_2D = *mut TA_TRANSFORM_2D;
88 STRUCT!{struct TA_TRANSFORM_OPACITY {
89 header: TA_TRANSFORM,
90 rOpacity: c_float,
91 rInitialOpacity: c_float,
92 }}
93 pub type PTA_TRANSFORM_OPACITY = *mut TA_TRANSFORM_OPACITY;
94 STRUCT!{struct TA_TRANSFORM_CLIP {
95 header: TA_TRANSFORM,
96 rLeft: c_float,
97 rTop: c_float,
98 rRight: c_float,
99 rBottom: c_float,
100 rInitialLeft: c_float,
101 rInitialTop: c_float,
102 rInitialRight: c_float,
103 rInitialBottom: c_float,
104 }}
105 pub type PTA_TRANSFORM_CLIP = *mut TA_TRANSFORM_CLIP;
106 extern "system" {
GetThemeAnimationTransform( hTheme: HTHEME, iStoryboardId: c_int, iTargetId: c_int, dwTransformIndex: DWORD, pTransform: *mut TA_TRANSFORM, cbSize: DWORD, pcbSizeOut: *mut DWORD, ) -> HRESULT107 pub fn GetThemeAnimationTransform(
108 hTheme: HTHEME,
109 iStoryboardId: c_int,
110 iTargetId: c_int,
111 dwTransformIndex: DWORD,
112 pTransform: *mut TA_TRANSFORM,
113 cbSize: DWORD,
114 pcbSizeOut: *mut DWORD,
115 ) -> HRESULT;
116 }
117 ENUM!{enum TA_TIMINGFUNCTION_TYPE {
118 TTFT_UNDEFINED = 0,
119 TTFT_CUBIC_BEZIER = 1,
120 }}
121 STRUCT!{struct TA_TIMINGFUNCTION {
122 eTimingFunctionType: TA_TIMINGFUNCTION_TYPE,
123 }}
124 pub type PTA_TIMINGFUNCTION = *mut TA_TIMINGFUNCTION;
125 STRUCT!{struct TA_CUBIC_BEZIER {
126 header: TA_TIMINGFUNCTION,
127 rX0: c_float,
128 rY0: c_float,
129 rX1: c_float,
130 rY1: c_float,
131 }}
132 pub type PTA_CUBIC_BEZIER = *mut TA_CUBIC_BEZIER;
133 extern "system" {
GetThemeTimingFunction( hTheme: HTHEME, iTimingFunctionId: c_int, pTimingFunction: *mut TA_TIMINGFUNCTION, cbSize: DWORD, pcbSizeOut: *mut DWORD, ) -> HRESULT134 pub fn GetThemeTimingFunction(
135 hTheme: HTHEME,
136 iTimingFunctionId: c_int,
137 pTimingFunction: *mut TA_TIMINGFUNCTION,
138 cbSize: DWORD,
139 pcbSizeOut: *mut DWORD,
140 ) -> HRESULT;
OpenThemeData( hwnd: HWND, pszClassList: LPCWSTR, ) -> HTHEME141 pub fn OpenThemeData(
142 hwnd: HWND,
143 pszClassList: LPCWSTR,
144 ) -> HTHEME;
145 }
146 pub const OTD_FORCE_RECT_SIZING: DWORD = 0x00000001;
147 pub const OTD_NONCLIENT: DWORD = 0x00000002;
148 pub const OTD_VALIDBITS: DWORD = OTD_FORCE_RECT_SIZING | OTD_NONCLIENT;
149 extern "system" {
OpenThemeDataForDpi( hwnd: HWND, pszClassList: LPCWSTR, dpi: UINT, ) -> HTHEME150 pub fn OpenThemeDataForDpi(
151 hwnd: HWND,
152 pszClassList: LPCWSTR,
153 dpi: UINT,
154 ) -> HTHEME;
OpenThemeDataEx( hwnd: HWND, pszClassList: LPCWSTR, dwFlags: DWORD, ) -> HTHEME155 pub fn OpenThemeDataEx(
156 hwnd: HWND,
157 pszClassList: LPCWSTR,
158 dwFlags: DWORD,
159 ) -> HTHEME;
CloseThemeData( hTheme: HTHEME, ) -> HRESULT160 pub fn CloseThemeData(
161 hTheme: HTHEME,
162 ) -> HRESULT;
DrawThemeBackground( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pRect: LPCRECT, pClipRect: LPCRECT, ) -> HRESULT163 pub fn DrawThemeBackground(
164 hTheme: HTHEME,
165 hdc: HDC,
166 iPartId: c_int,
167 iStateId: c_int,
168 pRect: LPCRECT,
169 pClipRect: LPCRECT,
170 ) -> HRESULT;
171 }
172 pub const DTBG_CLIPRECT: DWORD = 0x00000001;
173 pub const DTBG_DRAWSOLID: DWORD = 0x00000002;
174 pub const DTBG_OMITBORDER: DWORD = 0x00000004;
175 pub const DTBG_OMITCONTENT: DWORD = 0x00000008;
176 pub const DTBG_COMPUTINGREGION: DWORD = 0x00000010;
177 pub const DTBG_MIRRORDC: DWORD = 0x00000020;
178 pub const DTBG_NOMIRROR: DWORD = 0x00000040;
179 pub const DTBG_VALIDBITS: DWORD = DTBG_CLIPRECT | DTBG_DRAWSOLID | DTBG_OMITBORDER
180 | DTBG_OMITCONTENT | DTBG_COMPUTINGREGION | DTBG_MIRRORDC | DTBG_NOMIRROR;
181 STRUCT!{struct DTBGOPTS {
182 dwSize: DWORD,
183 dwFlags: DWORD,
184 rcClip: RECT,
185 }}
186 pub type PDTBGOPTS = *mut DTBGOPTS;
187 extern "system" {
DrawThemeBackgroundEx( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pRect: LPCRECT, pOptions: *const DTBGOPTS, ) -> HRESULT188 pub fn DrawThemeBackgroundEx(
189 hTheme: HTHEME,
190 hdc: HDC,
191 iPartId: c_int,
192 iStateId: c_int,
193 pRect: LPCRECT,
194 pOptions: *const DTBGOPTS,
195 ) -> HRESULT;
196 }
197 //pub const DTT_GRAYED: u32 = 0x00000001;
198 //pub const DTT_FLAGS2VALIDBITS: u32 = DTT_GRAYED;
199 extern "system" {
DrawThemeText( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pszText: LPCWSTR, cchText: c_int, dwTextFlags: DWORD, dwTextFlags2: DWORD, pRect: LPCRECT, ) -> HRESULT200 pub fn DrawThemeText(
201 hTheme: HTHEME,
202 hdc: HDC,
203 iPartId: c_int,
204 iStateId: c_int,
205 pszText: LPCWSTR,
206 cchText: c_int,
207 dwTextFlags: DWORD,
208 dwTextFlags2: DWORD,
209 pRect: LPCRECT,
210 ) -> HRESULT;
GetThemeBackgroundContentRect( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pBoundingRect: LPCRECT, pContentRect: LPRECT, ) -> HRESULT211 pub fn GetThemeBackgroundContentRect(
212 hTheme: HTHEME,
213 hdc: HDC,
214 iPartId: c_int,
215 iStateId: c_int,
216 pBoundingRect: LPCRECT,
217 pContentRect: LPRECT,
218 ) -> HRESULT;
GetThemeBackgroundExtent( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pContentRect: LPCRECT, pExtentRect: LPRECT, ) -> HRESULT219 pub fn GetThemeBackgroundExtent(
220 hTheme: HTHEME,
221 hdc: HDC,
222 iPartId: c_int,
223 iStateId: c_int,
224 pContentRect: LPCRECT,
225 pExtentRect: LPRECT,
226 ) -> HRESULT;
GetThemeBackgroundRegion( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pRect: LPCRECT, pRegion: *mut HRGN, ) -> HRESULT227 pub fn GetThemeBackgroundRegion(
228 hTheme: HTHEME,
229 hdc: HDC,
230 iPartId: c_int,
231 iStateId: c_int,
232 pRect: LPCRECT,
233 pRegion: *mut HRGN,
234 ) -> HRESULT;
235 }
236 ENUM!{enum THEMESIZE {
237 TS_MIN = 0,
238 TS_TRUE = 1,
239 TS_DRAW = 2,
240 }}
241 extern "system" {
GetThemePartSize( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, prc: LPCRECT, eSize: THEMESIZE, psz: *mut SIZE, ) -> HRESULT242 pub fn GetThemePartSize(
243 hTheme: HTHEME,
244 hdc: HDC,
245 iPartId: c_int,
246 iStateId: c_int,
247 prc: LPCRECT,
248 eSize: THEMESIZE,
249 psz: *mut SIZE,
250 ) -> HRESULT;
GetThemeTextExtent( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pszText: LPCWSTR, cchCharCount: c_int, dwTextFlags: DWORD, pBoundingRect: LPCRECT, pExtentRect: LPRECT, ) -> HRESULT251 pub fn GetThemeTextExtent(
252 hTheme: HTHEME,
253 hdc: HDC,
254 iPartId: c_int,
255 iStateId: c_int,
256 pszText: LPCWSTR,
257 cchCharCount: c_int,
258 dwTextFlags: DWORD,
259 pBoundingRect: LPCRECT,
260 pExtentRect: LPRECT,
261 ) -> HRESULT;
GetThemeTextMetrics( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, ptm: *mut TEXTMETRICW, ) -> HRESULT262 pub fn GetThemeTextMetrics(
263 hTheme: HTHEME,
264 hdc: HDC,
265 iPartId: c_int,
266 iStateId: c_int,
267 ptm: *mut TEXTMETRICW,
268 ) -> HRESULT;
269 }
270 pub const HTTB_BACKGROUNDSEG: DWORD = 0x00000000;
271 pub const HTTB_FIXEDBORDER: DWORD = 0x00000002;
272 pub const HTTB_CAPTION: DWORD = 0x00000004;
273 pub const HTTB_RESIZINGBORDER_LEFT: DWORD = 0x00000010;
274 pub const HTTB_RESIZINGBORDER_TOP: DWORD = 0x00000020;
275 pub const HTTB_RESIZINGBORDER_RIGHT: DWORD = 0x00000040;
276 pub const HTTB_RESIZINGBORDER_BOTTOM: DWORD = 0x00000080;
277 pub const HTTB_RESIZINGBORDER: DWORD = HTTB_RESIZINGBORDER_LEFT | HTTB_RESIZINGBORDER_TOP
278 | HTTB_RESIZINGBORDER_RIGHT | HTTB_RESIZINGBORDER_BOTTOM;
279 pub const HTTB_SIZINGTEMPLATE: DWORD = 0x00000100;
280 pub const HTTB_SYSTEMSIZINGMARGINS: DWORD = 0x00000200;
281 extern "system" {
HitTestThemeBackground( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, dwOptions: DWORD, pRect: LPCRECT, hrgn: HRGN, ptTest: POINT, pwHitTestCode: *mut WORD, ) -> HRESULT282 pub fn HitTestThemeBackground(
283 hTheme: HTHEME,
284 hdc: HDC,
285 iPartId: c_int,
286 iStateId: c_int,
287 dwOptions: DWORD,
288 pRect: LPCRECT,
289 hrgn: HRGN,
290 ptTest: POINT,
291 pwHitTestCode: *mut WORD,
292 ) -> HRESULT;
DrawThemeEdge( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pDestRect: LPCRECT, uEdge: UINT, uFlags: UINT, pContentRect: LPRECT, ) -> HRESULT293 pub fn DrawThemeEdge(
294 hTheme: HTHEME,
295 hdc: HDC,
296 iPartId: c_int,
297 iStateId: c_int,
298 pDestRect: LPCRECT,
299 uEdge: UINT,
300 uFlags: UINT,
301 pContentRect: LPRECT,
302 ) -> HRESULT;
DrawThemeIcon( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pRect: LPCRECT, himl: HIMAGELIST, iImageIndex: c_int, ) -> HRESULT303 pub fn DrawThemeIcon(
304 hTheme: HTHEME,
305 hdc: HDC,
306 iPartId: c_int,
307 iStateId: c_int,
308 pRect: LPCRECT,
309 himl: HIMAGELIST,
310 iImageIndex: c_int,
311 ) -> HRESULT;
IsThemePartDefined( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, ) -> BOOL312 pub fn IsThemePartDefined(
313 hTheme: HTHEME,
314 iPartId: c_int,
315 iStateId: c_int,
316 ) -> BOOL;
IsThemeBackgroundPartiallyTransparent( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, ) -> BOOL317 pub fn IsThemeBackgroundPartiallyTransparent(
318 hTheme: HTHEME,
319 iPartId: c_int,
320 iStateId: c_int,
321 ) -> BOOL;
GetThemeColor( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, pColor: *mut COLORREF, ) -> HRESULT322 pub fn GetThemeColor(
323 hTheme: HTHEME,
324 iPartId: c_int,
325 iStateId: c_int,
326 iPropId: c_int,
327 pColor: *mut COLORREF,
328 ) -> HRESULT;
GetThemeMetric( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, iPropId: c_int, piVal: *mut c_int, ) -> HRESULT329 pub fn GetThemeMetric(
330 hTheme: HTHEME,
331 hdc: HDC,
332 iPartId: c_int,
333 iStateId: c_int,
334 iPropId: c_int,
335 piVal: *mut c_int,
336 ) -> HRESULT;
GetThemeString( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, pszBuff: LPWSTR, cchMaxBuffChars: c_int, ) -> HRESULT337 pub fn GetThemeString(
338 hTheme: HTHEME,
339 iPartId: c_int,
340 iStateId: c_int,
341 iPropId: c_int,
342 pszBuff: LPWSTR,
343 cchMaxBuffChars: c_int,
344 ) -> HRESULT;
GetThemeBool( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, pfVal: *mut BOOL, ) -> HRESULT345 pub fn GetThemeBool(
346 hTheme: HTHEME,
347 iPartId: c_int,
348 iStateId: c_int,
349 iPropId: c_int,
350 pfVal: *mut BOOL,
351 ) -> HRESULT;
GetThemeInt( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, piVal: *mut c_int, ) -> HRESULT352 pub fn GetThemeInt(
353 hTheme: HTHEME,
354 iPartId: c_int,
355 iStateId: c_int,
356 iPropId: c_int,
357 piVal: *mut c_int,
358 ) -> HRESULT;
GetThemeEnumValue( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, piVal: *mut c_int, ) -> HRESULT359 pub fn GetThemeEnumValue(
360 hTheme: HTHEME,
361 iPartId: c_int,
362 iStateId: c_int,
363 iPropId: c_int,
364 piVal: *mut c_int,
365 ) -> HRESULT;
GetThemePosition( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, pPoint: *mut POINT, ) -> HRESULT366 pub fn GetThemePosition(
367 hTheme: HTHEME,
368 iPartId: c_int,
369 iStateId: c_int,
370 iPropId: c_int,
371 pPoint: *mut POINT,
372 ) -> HRESULT;
GetThemeFont( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, iPropId: c_int, pFont: *mut LOGFONTW, ) -> HRESULT373 pub fn GetThemeFont(
374 hTheme: HTHEME,
375 hdc: HDC,
376 iPartId: c_int,
377 iStateId: c_int,
378 iPropId: c_int,
379 pFont: *mut LOGFONTW,
380 ) -> HRESULT;
GetThemeRect( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, pRect: LPRECT, ) -> HRESULT381 pub fn GetThemeRect(
382 hTheme: HTHEME,
383 iPartId: c_int,
384 iStateId: c_int,
385 iPropId: c_int,
386 pRect: LPRECT,
387 ) -> HRESULT;
388 }
389 STRUCT!{struct MARGINS {
390 cxLeftWidth: c_int,
391 cxRightWidth: c_int,
392 cyTopHeight: c_int,
393 cyBottomHeight: c_int,
394 }}
395 pub type PMARGINS = *mut MARGINS;
396 extern "system" {
GetThemeMargins( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, iPropId: c_int, prc: LPCRECT, pMargins: *mut MARGINS, ) -> HRESULT397 pub fn GetThemeMargins(
398 hTheme: HTHEME,
399 hdc: HDC,
400 iPartId: c_int,
401 iStateId: c_int,
402 iPropId: c_int,
403 prc: LPCRECT,
404 pMargins: *mut MARGINS,
405 ) -> HRESULT;
406 }
407 pub const MAX_INTLIST_COUNT: usize = 402;
408 STRUCT!{struct INTLIST {
409 iValueCount: c_int,
410 iValues: [c_int; MAX_INTLIST_COUNT],
411 }}
412 pub type PINTLIST = *mut INTLIST;
413 extern "system" {
GetThemeIntList( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, pIntList: *mut INTLIST, ) -> HRESULT414 pub fn GetThemeIntList(
415 hTheme: HTHEME,
416 iPartId: c_int,
417 iStateId: c_int,
418 iPropId: c_int,
419 pIntList: *mut INTLIST,
420 ) -> HRESULT;
421 }
422 ENUM!{enum PROPERTYORIGIN {
423 PO_STATE = 0,
424 PO_PART = 1,
425 PO_CLASS = 2,
426 PO_GLOBAL = 3,
427 PO_NOTFOUND = 4,
428 }}
429 extern "system" {
GetThemePropertyOrigin( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, pOrigin: *mut PROPERTYORIGIN, ) -> HRESULT430 pub fn GetThemePropertyOrigin(
431 hTheme: HTHEME,
432 iPartId: c_int,
433 iStateId: c_int,
434 iPropId: c_int,
435 pOrigin: *mut PROPERTYORIGIN,
436 ) -> HRESULT;
SetWindowTheme( hwnd: HWND, pszSubAppName: LPCWSTR, pszSubIdList: LPCWSTR, ) -> HRESULT437 pub fn SetWindowTheme(
438 hwnd: HWND,
439 pszSubAppName: LPCWSTR,
440 pszSubIdList: LPCWSTR,
441 ) -> HRESULT;
GetThemeFilename( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, pszThemeFileName: LPWSTR, cchMaxBuffChars: c_int, ) -> HRESULT442 pub fn GetThemeFilename(
443 hTheme: HTHEME,
444 iPartId: c_int,
445 iStateId: c_int,
446 iPropId: c_int,
447 pszThemeFileName: LPWSTR,
448 cchMaxBuffChars: c_int,
449 ) -> HRESULT;
GetThemeSysColor( hTheme: HTHEME, iColorId: c_int, ) -> COLORREF450 pub fn GetThemeSysColor(
451 hTheme: HTHEME,
452 iColorId: c_int,
453 ) -> COLORREF;
GetThemeSysColorBrush( hTheme: HTHEME, iColorId: c_int, ) -> HBRUSH454 pub fn GetThemeSysColorBrush(
455 hTheme: HTHEME,
456 iColorId: c_int,
457 ) -> HBRUSH;
GetThemeSysBool( hTheme: HTHEME, iBoolId: c_int, ) -> BOOL458 pub fn GetThemeSysBool(
459 hTheme: HTHEME,
460 iBoolId: c_int,
461 ) -> BOOL;
GetThemeSysSize( hTheme: HTHEME, iSizeId: c_int, ) -> c_int462 pub fn GetThemeSysSize(
463 hTheme: HTHEME,
464 iSizeId: c_int,
465 ) -> c_int;
GetThemeSysFont( hTheme: HTHEME, iFontId: c_int, plf: *mut LOGFONTW, ) -> HRESULT466 pub fn GetThemeSysFont(
467 hTheme: HTHEME,
468 iFontId: c_int,
469 plf: *mut LOGFONTW,
470 ) -> HRESULT;
GetThemeSysString( hTheme: HTHEME, iStringId: c_int, pszStringBuff: LPWSTR, cchMaxStringChars: c_int, ) -> HRESULT471 pub fn GetThemeSysString(
472 hTheme: HTHEME,
473 iStringId: c_int,
474 pszStringBuff: LPWSTR,
475 cchMaxStringChars: c_int,
476 ) -> HRESULT;
GetThemeSysInt( hTheme: HTHEME, iIntId: c_int, piValue: *mut c_int, ) -> HRESULT477 pub fn GetThemeSysInt(
478 hTheme: HTHEME,
479 iIntId: c_int,
480 piValue: *mut c_int,
481 ) -> HRESULT;
IsThemeActive() -> BOOL482 pub fn IsThemeActive() -> BOOL;
IsAppThemed() -> BOOL483 pub fn IsAppThemed() -> BOOL;
GetWindowTheme( hwnd: HWND, ) -> HTHEME484 pub fn GetWindowTheme(
485 hwnd: HWND,
486 ) -> HTHEME;
487 }
488 pub const ETDT_DISABLE: DWORD = 0x00000001;
489 pub const ETDT_ENABLE: DWORD = 0x00000002;
490 pub const ETDT_USETABTEXTURE: DWORD = 0x00000004;
491 pub const ETDT_ENABLETAB: DWORD = ETDT_ENABLE | ETDT_USETABTEXTURE;
492 pub const ETDT_USEAEROWIZARDTABTEXTURE: DWORD = 0x00000008;
493 pub const ETDT_ENABLEAEROWIZARDTAB: DWORD = ETDT_ENABLE | ETDT_USEAEROWIZARDTABTEXTURE;
494 pub const ETDT_VALIDBITS: DWORD = ETDT_DISABLE | ETDT_ENABLE | ETDT_USETABTEXTURE
495 | ETDT_USEAEROWIZARDTABTEXTURE;
496 extern "system" {
EnableThemeDialogTexture( hwnd: HWND, dwFlags: DWORD, ) -> HRESULT497 pub fn EnableThemeDialogTexture(
498 hwnd: HWND,
499 dwFlags: DWORD,
500 ) -> HRESULT;
IsThemeDialogTextureEnabled( hwnd: HWND, ) -> BOOL501 pub fn IsThemeDialogTextureEnabled(
502 hwnd: HWND,
503 ) -> BOOL;
504 }
505 pub const STAP_ALLOW_NONCLIENT: DWORD = 1 << 0;
506 pub const STAP_ALLOW_CONTROLS: DWORD = 1 << 1;
507 pub const STAP_ALLOW_WEBCONTENT: DWORD = 1 << 2;
508 pub const STAP_VALIDBITS: DWORD = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS
509 | STAP_ALLOW_WEBCONTENT;
510 extern "system" {
GetThemeAppProperties() -> DWORD511 pub fn GetThemeAppProperties() -> DWORD;
SetThemeAppProperties( dwFlags: DWORD, )512 pub fn SetThemeAppProperties(
513 dwFlags: DWORD,
514 );
GetCurrentThemeName( pszThemeFileName: LPWSTR, cchMaxNameChars: c_int, pszColorBuff: LPWSTR, cchMaxColorChars: c_int, pszSizeBuff: LPWSTR, cchMaxSizeChars: c_int, ) -> HRESULT515 pub fn GetCurrentThemeName(
516 pszThemeFileName: LPWSTR,
517 cchMaxNameChars: c_int,
518 pszColorBuff: LPWSTR,
519 cchMaxColorChars: c_int,
520 pszSizeBuff: LPWSTR,
521 cchMaxSizeChars: c_int,
522 ) -> HRESULT;
523 }
524 pub const SZ_THDOCPROP_DISPLAYNAME: &'static str = "DisplayName";
525 pub const SZ_THDOCPROP_CANONICALNAME: &'static str = "ThemeName";
526 pub const SZ_THDOCPROP_TOOLTIP: &'static str = "ToolTip";
527 pub const SZ_THDOCPROP_AUTHOR: &'static str = "author";
528 extern "system" {
GetThemeDocumentationProperty( pszThemeName: LPCWSTR, pszPropertyName: LPCWSTR, pszValueBuff: LPWSTR, cchMaxValChars: c_int, ) -> HRESULT529 pub fn GetThemeDocumentationProperty(
530 pszThemeName: LPCWSTR,
531 pszPropertyName: LPCWSTR,
532 pszValueBuff: LPWSTR,
533 cchMaxValChars: c_int,
534 ) -> HRESULT;
DrawThemeParentBackground( hwnd: HWND, hdc: HDC, prc: *const RECT, ) -> HRESULT535 pub fn DrawThemeParentBackground(
536 hwnd: HWND,
537 hdc: HDC,
538 prc: *const RECT,
539 ) -> HRESULT;
EnableTheming( fEnable: BOOL, ) -> HRESULT540 pub fn EnableTheming(
541 fEnable: BOOL,
542 ) -> HRESULT;
543 }
544 pub const GBF_DIRECT: ULONG = 0x00000001;
545 pub const GBF_COPY: ULONG = 0x00000002;
546 pub const GBF_VALIDBITS: ULONG = GBF_DIRECT | GBF_COPY;
547 pub const DTPB_WINDOWDC: DWORD = 0x00000001;
548 pub const DTPB_USECTLCOLORSTATIC: DWORD = 0x00000002;
549 pub const DTPB_USEERASEBKGND: DWORD = 0x00000004;
550 extern "system" {
DrawThemeParentBackgroundEx( hwnd: HWND, hdc: HDC, dwFlags: DWORD, prc: *const RECT, ) -> HRESULT551 pub fn DrawThemeParentBackgroundEx(
552 hwnd: HWND,
553 hdc: HDC,
554 dwFlags: DWORD,
555 prc: *const RECT,
556 ) -> HRESULT;
557 }
558 ENUM!{enum WINDOWTHEMEATTRIBUTETYPE {
559 WTA_NONCLIENT = 1,
560 }}
561 STRUCT!{struct WTA_OPTIONS {
562 dwFlags: DWORD,
563 dwMask: DWORD,
564 }}
565 pub type PWTA_OPTIONS = *mut WTA_OPTIONS;
566 pub const WTNCA_NODRAWCAPTION: DWORD = 0x00000001;
567 pub const WTNCA_NODRAWICON: DWORD = 0x00000002;
568 pub const WTNCA_NOSYSMENU: DWORD = 0x00000004;
569 pub const WTNCA_NOMIRRORHELP: DWORD = 0x00000008;
570 pub const WTNCA_VALIDBITS: DWORD = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON | WTNCA_NOSYSMENU
571 | WTNCA_NOMIRRORHELP;
572 extern "system" {
SetWindowThemeAttribute( hwnd: HWND, eAttribute: WINDOWTHEMEATTRIBUTETYPE, pvAttribute: PVOID, cbAttribute: DWORD, ) -> HRESULT573 pub fn SetWindowThemeAttribute(
574 hwnd: HWND,
575 eAttribute: WINDOWTHEMEATTRIBUTETYPE,
576 pvAttribute: PVOID,
577 cbAttribute: DWORD,
578 ) -> HRESULT;
579 }
580 #[inline]
SetWindowThemeNonClientAttributes( hwnd: HWND, dwMask: DWORD, dwAttributes: DWORD, ) -> HRESULT581 pub unsafe fn SetWindowThemeNonClientAttributes(
582 hwnd: HWND,
583 dwMask: DWORD,
584 dwAttributes: DWORD,
585 ) -> HRESULT {
586 use core::mem::{size_of, zeroed};
587 let mut wta: WTA_OPTIONS = zeroed();
588 wta.dwFlags = dwAttributes;
589 wta.dwMask = dwMask;
590 SetWindowThemeAttribute(
591 hwnd,
592 WTA_NONCLIENT,
593 &mut wta as *mut WTA_OPTIONS as *mut c_void,
594 size_of::<WTA_OPTIONS>() as u32,
595 )
596 }
597 FN!{stdcall DTT_CALLBACK_PROC(
598 hdc: HDC,
599 pszText: LPWSTR,
600 cchText: c_int,
601 prc: LPRECT,
602 dwFlags: UINT,
603 lParam: LPARAM,
604 ) -> c_int}
605 pub const DTT_TEXTCOLOR: DWORD = 1 << 0;
606 pub const DTT_BORDERCOLOR: DWORD = 1 << 1;
607 pub const DTT_SHADOWCOLOR: DWORD = 1 << 2;
608 pub const DTT_SHADOWTYPE: DWORD = 1 << 3;
609 pub const DTT_SHADOWOFFSET: DWORD = 1 << 4;
610 pub const DTT_BORDERSIZE: DWORD = 1 << 5;
611 pub const DTT_FONTPROP: DWORD = 1 << 6;
612 pub const DTT_COLORPROP: DWORD = 1 << 7;
613 pub const DTT_STATEID: DWORD = 1 << 8;
614 pub const DTT_CALCRECT: DWORD = 1 << 9;
615 pub const DTT_APPLYOVERLAY: DWORD = 1 << 10;
616 pub const DTT_GLOWSIZE: DWORD = 1 << 11;
617 pub const DTT_CALLBACK: DWORD = 1 << 12;
618 pub const DTT_COMPOSITED: DWORD = 1 << 13;
619 pub const DTT_VALIDBITS: DWORD = DTT_TEXTCOLOR | DTT_BORDERCOLOR | DTT_SHADOWCOLOR
620 | DTT_SHADOWTYPE | DTT_SHADOWOFFSET | DTT_BORDERSIZE | DTT_FONTPROP | DTT_COLORPROP
621 | DTT_STATEID | DTT_CALCRECT | DTT_APPLYOVERLAY | DTT_GLOWSIZE | DTT_COMPOSITED;
622 STRUCT!{struct DTTOPTS {
623 dwSize: DWORD,
624 dwFlags: DWORD,
625 crText: COLORREF,
626 crBorder: COLORREF,
627 crShadow: COLORREF,
628 iTextShadowType: c_int,
629 ptShadowOffset: POINT,
630 iBorderSize: c_int,
631 iFontPropId: c_int,
632 iColorPropId: c_int,
633 iStateId: c_int,
634 fApplyOverlay: BOOL,
635 iGlowSize: c_int,
636 pfnDrawTextCallback: DTT_CALLBACK_PROC,
637 lParam: LPARAM,
638 }}
639 pub type PDTTOPTS = *mut DTTOPTS;
640 extern "system" {
DrawThemeTextEx( hTheme: HTHEME, hdc: HDC, iPartId: c_int, iStateId: c_int, pszText: LPCWSTR, cchText: c_int, dwTextFlags: DWORD, pRect: LPRECT, pOptions: *const DTTOPTS, ) -> HRESULT641 pub fn DrawThemeTextEx(
642 hTheme: HTHEME,
643 hdc: HDC,
644 iPartId: c_int,
645 iStateId: c_int,
646 pszText: LPCWSTR,
647 cchText: c_int,
648 dwTextFlags: DWORD,
649 pRect: LPRECT,
650 pOptions: *const DTTOPTS,
651 ) -> HRESULT;
GetThemeBitmap( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, dwFlags: ULONG, phBitmap: *mut HBITMAP, ) -> HRESULT652 pub fn GetThemeBitmap(
653 hTheme: HTHEME,
654 iPartId: c_int,
655 iStateId: c_int,
656 iPropId: c_int,
657 dwFlags: ULONG,
658 phBitmap: *mut HBITMAP,
659 ) -> HRESULT;
GetThemeStream( hTheme: HTHEME, iPartId: c_int, iStateId: c_int, iPropId: c_int, ppvStream: *mut *mut VOID, pcbStream: *mut DWORD, hInst: HINSTANCE, ) -> HRESULT660 pub fn GetThemeStream(
661 hTheme: HTHEME,
662 iPartId: c_int,
663 iStateId: c_int,
664 iPropId: c_int,
665 ppvStream: *mut *mut VOID,
666 pcbStream: *mut DWORD,
667 hInst: HINSTANCE,
668 ) -> HRESULT;
BufferedPaintInit() -> HRESULT669 pub fn BufferedPaintInit() -> HRESULT;
BufferedPaintUnInit() -> HRESULT670 pub fn BufferedPaintUnInit() -> HRESULT;
671 }
672 pub type HPAINTBUFFER = HANDLE;
673 ENUM!{enum BP_BUFFERFORMAT {
674 BPBF_COMPATIBLEBITMAP = 0,
675 BPBF_DIB = 1,
676 BPBF_TOPDOWNDIB = 2,
677 BPBF_TOPDOWNMONODIB = 3,
678 }}
679 pub const BPBF_COMPOSITED: BP_BUFFERFORMAT = BPBF_TOPDOWNDIB;
680 ENUM!{enum BP_ANIMATIONSTYLE {
681 BPAS_NONE = 0,
682 BPAS_LINEAR = 1,
683 BPAS_CUBIC = 2,
684 BPAS_SINE = 3,
685 }}
686 STRUCT!{struct BP_ANIMATIONPARAMS {
687 cbSize: DWORD,
688 dwFlags: DWORD,
689 style: BP_ANIMATIONSTYLE,
690 dwDuration: DWORD,
691 }}
692 pub type PBP_ANIMATIONPARAMS = *mut BP_ANIMATIONPARAMS;
693 pub const BPPF_ERASE: DWORD = 0x0001;
694 pub const BPPF_NOCLIP: DWORD = 0x0002;
695 pub const BPPF_NONCLIENT: DWORD = 0x0004;
696 STRUCT!{struct BP_PAINTPARAMS {
697 cbSize: DWORD,
698 dwFlags: DWORD,
699 prcExclude: *const RECT,
700 pBlendFunction: *const BLENDFUNCTION,
701 }}
702 pub type PBP_PAINTPARAMS = *mut BP_PAINTPARAMS;
703 extern "system" {
BeginBufferedPaint( hdcTarget: HDC, prcTarget: *const RECT, dwFormat: BP_BUFFERFORMAT, pPaintParams: *mut BP_PAINTPARAMS, phdc: *mut HDC, ) -> HPAINTBUFFER704 pub fn BeginBufferedPaint(
705 hdcTarget: HDC,
706 prcTarget: *const RECT,
707 dwFormat: BP_BUFFERFORMAT,
708 pPaintParams: *mut BP_PAINTPARAMS,
709 phdc: *mut HDC,
710 ) -> HPAINTBUFFER;
EndBufferedPaint( hBufferedPaint: HPAINTBUFFER, fUpdateTarget: BOOL, ) -> HRESULT711 pub fn EndBufferedPaint(
712 hBufferedPaint: HPAINTBUFFER,
713 fUpdateTarget: BOOL,
714 ) -> HRESULT;
GetBufferedPaintTargetRect( hBufferedPaint: HPAINTBUFFER, prc: *mut RECT, ) -> HRESULT715 pub fn GetBufferedPaintTargetRect(
716 hBufferedPaint: HPAINTBUFFER,
717 prc: *mut RECT,
718 ) -> HRESULT;
GetBufferedPaintTargetDC( hBufferedPaint: HPAINTBUFFER, ) -> HDC719 pub fn GetBufferedPaintTargetDC(
720 hBufferedPaint: HPAINTBUFFER,
721 ) -> HDC;
GetBufferedPaintDC( hBufferedPaint: HPAINTBUFFER, ) -> HDC722 pub fn GetBufferedPaintDC(
723 hBufferedPaint: HPAINTBUFFER,
724 ) -> HDC;
GetBufferedPaintBits( hBufferedPaint: HPAINTBUFFER, ppbBuffer: *mut *mut RGBQUAD, pcxRow: *mut c_int, ) -> HRESULT725 pub fn GetBufferedPaintBits(
726 hBufferedPaint: HPAINTBUFFER,
727 ppbBuffer: *mut *mut RGBQUAD,
728 pcxRow: *mut c_int,
729 ) -> HRESULT;
BufferedPaintClear( hBufferedPaint: HPAINTBUFFER, prc: *const RECT, ) -> HRESULT730 pub fn BufferedPaintClear(
731 hBufferedPaint: HPAINTBUFFER,
732 prc: *const RECT,
733 ) -> HRESULT;
BufferedPaintSetAlpha( hBufferedPaint: HPAINTBUFFER, prc: *const RECT, alpha: BYTE, ) -> HRESULT734 pub fn BufferedPaintSetAlpha(
735 hBufferedPaint: HPAINTBUFFER,
736 prc: *const RECT,
737 alpha: BYTE,
738 ) -> HRESULT;
BufferedPaintStopAllAnimations( hwnd: HWND, ) -> HRESULT739 pub fn BufferedPaintStopAllAnimations(
740 hwnd: HWND,
741 ) -> HRESULT;
742 }
743 pub type HANIMATIONBUFFER = HANDLE;
744 extern "system" {
BeginBufferedAnimation( hwnd: HWND, hdcTarget: HDC, prcTarget: *const RECT, dwFormat: BP_BUFFERFORMAT, pPaintParams: *mut BP_PAINTPARAMS, pAnimationParams: *mut BP_ANIMATIONPARAMS, phdcFrom: *mut HDC, phdcTo: *mut HDC, ) -> HANIMATIONBUFFER745 pub fn BeginBufferedAnimation(
746 hwnd: HWND,
747 hdcTarget: HDC,
748 prcTarget: *const RECT,
749 dwFormat: BP_BUFFERFORMAT,
750 pPaintParams: *mut BP_PAINTPARAMS,
751 pAnimationParams: *mut BP_ANIMATIONPARAMS,
752 phdcFrom: *mut HDC,
753 phdcTo: *mut HDC,
754 ) -> HANIMATIONBUFFER;
EndBufferedAnimation( hbpAnimation: HANIMATIONBUFFER, fUpdateTarget: BOOL, ) -> HRESULT755 pub fn EndBufferedAnimation(
756 hbpAnimation: HANIMATIONBUFFER,
757 fUpdateTarget: BOOL,
758 ) -> HRESULT;
BufferedPaintRenderAnimation( hwnd: HWND, hdcTarget: HDC, ) -> BOOL759 pub fn BufferedPaintRenderAnimation(
760 hwnd: HWND,
761 hdcTarget: HDC,
762 ) -> BOOL;
IsCompositionActive() -> BOOL763 pub fn IsCompositionActive() -> BOOL;
GetThemeTransitionDuration( hTheme: HTHEME, iPartId: c_int, iStateIdFrom: c_int, iStateIdTo: c_int, iPropId: c_int, pdwDuration: *mut DWORD, ) -> HRESULT764 pub fn GetThemeTransitionDuration(
765 hTheme: HTHEME,
766 iPartId: c_int,
767 iStateIdFrom: c_int,
768 iStateIdTo: c_int,
769 iPropId: c_int,
770 pdwDuration: *mut DWORD,
771 ) -> HRESULT;
772 }
773