1use ctypes::{c_float, c_int, c_void};
8use shared::minwindef::{BOOL, BYTE, DWORD, HINSTANCE, HRGN, LPARAM, UINT, ULONG, WORD};
9use shared::windef::{COLORREF, HBITMAP, HBRUSH, HDC, HWND, LPCRECT, LPRECT, POINT, RECT, SIZE};
10use um::commctrl::HIMAGELIST;
11use um::wingdi::{BLENDFUNCTION, LOGFONTW, RGBQUAD, TEXTMETRICW};
12use um::winnt::{HANDLE, HRESULT, LONG, LPCWSTR, LPWSTR, PVOID, VOID};
13pub type HTHEME = HANDLE;
14extern "system" {
17 pub fn BeginPanningFeedback(
18 hwnd: HWND,
19 ) -> BOOL;
20 pub fn UpdatePanningFeedback(
21 hwnd: HWND,
22 lTotalOverpanOffsetX: LONG,
23 lTotalOverpanOffsetY: LONG,
24 fInInertia: BOOL,
25 ) -> BOOL;
26 pub fn EndPanningFeedback(
27 hwnd: HWND,
28 fAnimateBack: BOOL,
29 ) -> BOOL;
30}
31ENUM!{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}}
39ENUM!{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}}
47extern "system" {
48 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}
58ENUM!{enum TA_TRANSFORM_TYPE {
59 TATT_TRANSLATE_2D = 0,
60 TATT_SCALE_2D = 1,
61 TATT_OPACITY = 2,
62 TATT_CLIP = 3,
63}}
64ENUM!{enum TA_TRANSFORM_FLAG {
65 TATF_NONE = 0x0,
66 TATF_TARGETVALUES_USER = 0x1,
67 TATF_HASINITIALVALUES = 0x2,
68 TATF_HASORIGINVALUES = 0x4,
69}}
70STRUCT!{struct TA_TRANSFORM {
71 eTransformType: TA_TRANSFORM_TYPE,
72 dwTimingFunctionId: DWORD,
73 dwStartTime: DWORD,
74 dwDurationTime: DWORD,
75 eFlags: TA_TRANSFORM_FLAG,
76}}
77pub type PTA_TRANSFORM = *mut TA_TRANSFORM;
78STRUCT!{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}}
87pub type PTA_TRANSFORM_2D = *mut TA_TRANSFORM_2D;
88STRUCT!{struct TA_TRANSFORM_OPACITY {
89 header: TA_TRANSFORM,
90 rOpacity: c_float,
91 rInitialOpacity: c_float,
92}}
93pub type PTA_TRANSFORM_OPACITY = *mut TA_TRANSFORM_OPACITY;
94STRUCT!{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}}
105pub type PTA_TRANSFORM_CLIP = *mut TA_TRANSFORM_CLIP;
106extern "system" {
107 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}
117ENUM!{enum TA_TIMINGFUNCTION_TYPE {
118 TTFT_UNDEFINED = 0,
119 TTFT_CUBIC_BEZIER = 1,
120}}
121STRUCT!{struct TA_TIMINGFUNCTION {
122 eTimingFunctionType: TA_TIMINGFUNCTION_TYPE,
123}}
124pub type PTA_TIMINGFUNCTION = *mut TA_TIMINGFUNCTION;
125STRUCT!{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}}
132pub type PTA_CUBIC_BEZIER = *mut TA_CUBIC_BEZIER;
133extern "system" {
134 pub fn GetThemeTimingFunction(
135 hTheme: HTHEME,
136 iTimingFunctionId: c_int,
137 pTimingFunction: *mut TA_TIMINGFUNCTION,
138 cbSize: DWORD,
139 pcbSizeOut: *mut DWORD,
140 ) -> HRESULT;
141 pub fn OpenThemeData(
142 hwnd: HWND,
143 pszClassList: LPCWSTR,
144 ) -> HTHEME;
145}
146pub const OTD_FORCE_RECT_SIZING: DWORD = 0x00000001;
147pub const OTD_NONCLIENT: DWORD = 0x00000002;
148pub const OTD_VALIDBITS: DWORD = OTD_FORCE_RECT_SIZING | OTD_NONCLIENT;
149extern "system" {
150 pub fn OpenThemeDataForDpi(
151 hwnd: HWND,
152 pszClassList: LPCWSTR,
153 dpi: UINT,
154 ) -> HTHEME;
155 pub fn OpenThemeDataEx(
156 hwnd: HWND,
157 pszClassList: LPCWSTR,
158 dwFlags: DWORD,
159 ) -> HTHEME;
160 pub fn CloseThemeData(
161 hTheme: HTHEME,
162 ) -> HRESULT;
163 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}
172pub const DTBG_CLIPRECT: DWORD = 0x00000001;
173pub const DTBG_DRAWSOLID: DWORD = 0x00000002;
174pub const DTBG_OMITBORDER: DWORD = 0x00000004;
175pub const DTBG_OMITCONTENT: DWORD = 0x00000008;
176pub const DTBG_COMPUTINGREGION: DWORD = 0x00000010;
177pub const DTBG_MIRRORDC: DWORD = 0x00000020;
178pub const DTBG_NOMIRROR: DWORD = 0x00000040;
179pub const DTBG_VALIDBITS: DWORD = DTBG_CLIPRECT | DTBG_DRAWSOLID | DTBG_OMITBORDER
180 | DTBG_OMITCONTENT | DTBG_COMPUTINGREGION | DTBG_MIRRORDC | DTBG_NOMIRROR;
181STRUCT!{struct DTBGOPTS {
182 dwSize: DWORD,
183 dwFlags: DWORD,
184 rcClip: RECT,
185}}
186pub type PDTBGOPTS = *mut DTBGOPTS;
187extern "system" {
188 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}
197extern "system" {
200 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;
211 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;
219 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;
227 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}
236ENUM!{enum THEMESIZE {
237 TS_MIN = 0,
238 TS_TRUE = 1,
239 TS_DRAW = 2,
240}}
241extern "system" {
242 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;
251 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;
262 pub fn GetThemeTextMetrics(
263 hTheme: HTHEME,
264 hdc: HDC,
265 iPartId: c_int,
266 iStateId: c_int,
267 ptm: *mut TEXTMETRICW,
268 ) -> HRESULT;
269}
270pub const HTTB_BACKGROUNDSEG: DWORD = 0x00000000;
271pub const HTTB_FIXEDBORDER: DWORD = 0x00000002;
272pub const HTTB_CAPTION: DWORD = 0x00000004;
273pub const HTTB_RESIZINGBORDER_LEFT: DWORD = 0x00000010;
274pub const HTTB_RESIZINGBORDER_TOP: DWORD = 0x00000020;
275pub const HTTB_RESIZINGBORDER_RIGHT: DWORD = 0x00000040;
276pub const HTTB_RESIZINGBORDER_BOTTOM: DWORD = 0x00000080;
277pub const HTTB_RESIZINGBORDER: DWORD = HTTB_RESIZINGBORDER_LEFT | HTTB_RESIZINGBORDER_TOP
278 | HTTB_RESIZINGBORDER_RIGHT | HTTB_RESIZINGBORDER_BOTTOM;
279pub const HTTB_SIZINGTEMPLATE: DWORD = 0x00000100;
280pub const HTTB_SYSTEMSIZINGMARGINS: DWORD = 0x00000200;
281extern "system" {
282 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;
293 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;
303 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;
312 pub fn IsThemePartDefined(
313 hTheme: HTHEME,
314 iPartId: c_int,
315 iStateId: c_int,
316 ) -> BOOL;
317 pub fn IsThemeBackgroundPartiallyTransparent(
318 hTheme: HTHEME,
319 iPartId: c_int,
320 iStateId: c_int,
321 ) -> BOOL;
322 pub fn GetThemeColor(
323 hTheme: HTHEME,
324 iPartId: c_int,
325 iStateId: c_int,
326 iPropId: c_int,
327 pColor: *mut COLORREF,
328 ) -> HRESULT;
329 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;
337 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;
345 pub fn GetThemeBool(
346 hTheme: HTHEME,
347 iPartId: c_int,
348 iStateId: c_int,
349 iPropId: c_int,
350 pfVal: *mut BOOL,
351 ) -> HRESULT;
352 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;
359 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;
366 pub fn GetThemePosition(
367 hTheme: HTHEME,
368 iPartId: c_int,
369 iStateId: c_int,
370 iPropId: c_int,
371 pPoint: *mut POINT,
372 ) -> HRESULT;
373 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;
381 pub fn GetThemeRect(
382 hTheme: HTHEME,
383 iPartId: c_int,
384 iStateId: c_int,
385 iPropId: c_int,
386 pRect: LPRECT,
387 ) -> HRESULT;
388}
389STRUCT!{struct MARGINS {
390 cxLeftWidth: c_int,
391 cxRightWidth: c_int,
392 cyTopHeight: c_int,
393 cyBottomHeight: c_int,
394}}
395pub type PMARGINS = *mut MARGINS;
396extern "system" {
397 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}
407pub const MAX_INTLIST_COUNT: usize = 402;
408STRUCT!{struct INTLIST {
409 iValueCount: c_int,
410 iValues: [c_int; MAX_INTLIST_COUNT],
411}}
412pub type PINTLIST = *mut INTLIST;
413extern "system" {
414 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}
422ENUM!{enum PROPERTYORIGIN {
423 PO_STATE = 0,
424 PO_PART = 1,
425 PO_CLASS = 2,
426 PO_GLOBAL = 3,
427 PO_NOTFOUND = 4,
428}}
429extern "system" {
430 pub fn GetThemePropertyOrigin(
431 hTheme: HTHEME,
432 iPartId: c_int,
433 iStateId: c_int,
434 iPropId: c_int,
435 pOrigin: *mut PROPERTYORIGIN,
436 ) -> HRESULT;
437 pub fn SetWindowTheme(
438 hwnd: HWND,
439 pszSubAppName: LPCWSTR,
440 pszSubIdList: LPCWSTR,
441 ) -> HRESULT;
442 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;
450 pub fn GetThemeSysColor(
451 hTheme: HTHEME,
452 iColorId: c_int,
453 ) -> COLORREF;
454 pub fn GetThemeSysColorBrush(
455 hTheme: HTHEME,
456 iColorId: c_int,
457 ) -> HBRUSH;
458 pub fn GetThemeSysBool(
459 hTheme: HTHEME,
460 iBoolId: c_int,
461 ) -> BOOL;
462 pub fn GetThemeSysSize(
463 hTheme: HTHEME,
464 iSizeId: c_int,
465 ) -> c_int;
466 pub fn GetThemeSysFont(
467 hTheme: HTHEME,
468 iFontId: c_int,
469 plf: *mut LOGFONTW,
470 ) -> HRESULT;
471 pub fn GetThemeSysString(
472 hTheme: HTHEME,
473 iStringId: c_int,
474 pszStringBuff: LPWSTR,
475 cchMaxStringChars: c_int,
476 ) -> HRESULT;
477 pub fn GetThemeSysInt(
478 hTheme: HTHEME,
479 iIntId: c_int,
480 piValue: *mut c_int,
481 ) -> HRESULT;
482 pub fn IsThemeActive() -> BOOL;
483 pub fn IsAppThemed() -> BOOL;
484 pub fn GetWindowTheme(
485 hwnd: HWND,
486 ) -> HTHEME;
487}
488pub const ETDT_DISABLE: DWORD = 0x00000001;
489pub const ETDT_ENABLE: DWORD = 0x00000002;
490pub const ETDT_USETABTEXTURE: DWORD = 0x00000004;
491pub const ETDT_ENABLETAB: DWORD = ETDT_ENABLE | ETDT_USETABTEXTURE;
492pub const ETDT_USEAEROWIZARDTABTEXTURE: DWORD = 0x00000008;
493pub const ETDT_ENABLEAEROWIZARDTAB: DWORD = ETDT_ENABLE | ETDT_USEAEROWIZARDTABTEXTURE;
494pub const ETDT_VALIDBITS: DWORD = ETDT_DISABLE | ETDT_ENABLE | ETDT_USETABTEXTURE
495 | ETDT_USEAEROWIZARDTABTEXTURE;
496extern "system" {
497 pub fn EnableThemeDialogTexture(
498 hwnd: HWND,
499 dwFlags: DWORD,
500 ) -> HRESULT;
501 pub fn IsThemeDialogTextureEnabled(
502 hwnd: HWND,
503 ) -> BOOL;
504}
505pub const STAP_ALLOW_NONCLIENT: DWORD = 1 << 0;
506pub const STAP_ALLOW_CONTROLS: DWORD = 1 << 1;
507pub const STAP_ALLOW_WEBCONTENT: DWORD = 1 << 2;
508pub const STAP_VALIDBITS: DWORD = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS
509 | STAP_ALLOW_WEBCONTENT;
510extern "system" {
511 pub fn GetThemeAppProperties() -> DWORD;
512 pub fn SetThemeAppProperties(
513 dwFlags: DWORD,
514 );
515 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}
524pub const SZ_THDOCPROP_DISPLAYNAME: &'static str = "DisplayName";
525pub const SZ_THDOCPROP_CANONICALNAME: &'static str = "ThemeName";
526pub const SZ_THDOCPROP_TOOLTIP: &'static str = "ToolTip";
527pub const SZ_THDOCPROP_AUTHOR: &'static str = "author";
528extern "system" {
529 pub fn GetThemeDocumentationProperty(
530 pszThemeName: LPCWSTR,
531 pszPropertyName: LPCWSTR,
532 pszValueBuff: LPWSTR,
533 cchMaxValChars: c_int,
534 ) -> HRESULT;
535 pub fn DrawThemeParentBackground(
536 hwnd: HWND,
537 hdc: HDC,
538 prc: *const RECT,
539 ) -> HRESULT;
540 pub fn EnableTheming(
541 fEnable: BOOL,
542 ) -> HRESULT;
543}
544pub const GBF_DIRECT: ULONG = 0x00000001;
545pub const GBF_COPY: ULONG = 0x00000002;
546pub const GBF_VALIDBITS: ULONG = GBF_DIRECT | GBF_COPY;
547pub const DTPB_WINDOWDC: DWORD = 0x00000001;
548pub const DTPB_USECTLCOLORSTATIC: DWORD = 0x00000002;
549pub const DTPB_USEERASEBKGND: DWORD = 0x00000004;
550extern "system" {
551 pub fn DrawThemeParentBackgroundEx(
552 hwnd: HWND,
553 hdc: HDC,
554 dwFlags: DWORD,
555 prc: *const RECT,
556 ) -> HRESULT;
557}
558ENUM!{enum WINDOWTHEMEATTRIBUTETYPE {
559 WTA_NONCLIENT = 1,
560}}
561STRUCT!{struct WTA_OPTIONS {
562 dwFlags: DWORD,
563 dwMask: DWORD,
564}}
565pub type PWTA_OPTIONS = *mut WTA_OPTIONS;
566pub const WTNCA_NODRAWCAPTION: DWORD = 0x00000001;
567pub const WTNCA_NODRAWICON: DWORD = 0x00000002;
568pub const WTNCA_NOSYSMENU: DWORD = 0x00000004;
569pub const WTNCA_NOMIRRORHELP: DWORD = 0x00000008;
570pub const WTNCA_VALIDBITS: DWORD = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON | WTNCA_NOSYSMENU
571 | WTNCA_NOMIRRORHELP;
572extern "system" {
573 pub fn SetWindowThemeAttribute(
574 hwnd: HWND,
575 eAttribute: WINDOWTHEMEATTRIBUTETYPE,
576 pvAttribute: PVOID,
577 cbAttribute: DWORD,
578 ) -> HRESULT;
579}
580#[inline]
581pub 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}
597FN!{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}
605pub const DTT_TEXTCOLOR: DWORD = 1 << 0;
606pub const DTT_BORDERCOLOR: DWORD = 1 << 1;
607pub const DTT_SHADOWCOLOR: DWORD = 1 << 2;
608pub const DTT_SHADOWTYPE: DWORD = 1 << 3;
609pub const DTT_SHADOWOFFSET: DWORD = 1 << 4;
610pub const DTT_BORDERSIZE: DWORD = 1 << 5;
611pub const DTT_FONTPROP: DWORD = 1 << 6;
612pub const DTT_COLORPROP: DWORD = 1 << 7;
613pub const DTT_STATEID: DWORD = 1 << 8;
614pub const DTT_CALCRECT: DWORD = 1 << 9;
615pub const DTT_APPLYOVERLAY: DWORD = 1 << 10;
616pub const DTT_GLOWSIZE: DWORD = 1 << 11;
617pub const DTT_CALLBACK: DWORD = 1 << 12;
618pub const DTT_COMPOSITED: DWORD = 1 << 13;
619pub 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;
622STRUCT!{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}}
639pub type PDTTOPTS = *mut DTTOPTS;
640extern "system" {
641 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;
652 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;
660 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;
669 pub fn BufferedPaintInit() -> HRESULT;
670 pub fn BufferedPaintUnInit() -> HRESULT;
671}
672pub type HPAINTBUFFER = HANDLE;
673ENUM!{enum BP_BUFFERFORMAT {
674 BPBF_COMPATIBLEBITMAP = 0,
675 BPBF_DIB = 1,
676 BPBF_TOPDOWNDIB = 2,
677 BPBF_TOPDOWNMONODIB = 3,
678}}
679pub const BPBF_COMPOSITED: BP_BUFFERFORMAT = BPBF_TOPDOWNDIB;
680ENUM!{enum BP_ANIMATIONSTYLE {
681 BPAS_NONE = 0,
682 BPAS_LINEAR = 1,
683 BPAS_CUBIC = 2,
684 BPAS_SINE = 3,
685}}
686STRUCT!{struct BP_ANIMATIONPARAMS {
687 cbSize: DWORD,
688 dwFlags: DWORD,
689 style: BP_ANIMATIONSTYLE,
690 dwDuration: DWORD,
691}}
692pub type PBP_ANIMATIONPARAMS = *mut BP_ANIMATIONPARAMS;
693pub const BPPF_ERASE: DWORD = 0x0001;
694pub const BPPF_NOCLIP: DWORD = 0x0002;
695pub const BPPF_NONCLIENT: DWORD = 0x0004;
696STRUCT!{struct BP_PAINTPARAMS {
697 cbSize: DWORD,
698 dwFlags: DWORD,
699 prcExclude: *const RECT,
700 pBlendFunction: *const BLENDFUNCTION,
701}}
702pub type PBP_PAINTPARAMS = *mut BP_PAINTPARAMS;
703extern "system" {
704 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;
711 pub fn EndBufferedPaint(
712 hBufferedPaint: HPAINTBUFFER,
713 fUpdateTarget: BOOL,
714 ) -> HRESULT;
715 pub fn GetBufferedPaintTargetRect(
716 hBufferedPaint: HPAINTBUFFER,
717 prc: *mut RECT,
718 ) -> HRESULT;
719 pub fn GetBufferedPaintTargetDC(
720 hBufferedPaint: HPAINTBUFFER,
721 ) -> HDC;
722 pub fn GetBufferedPaintDC(
723 hBufferedPaint: HPAINTBUFFER,
724 ) -> HDC;
725 pub fn GetBufferedPaintBits(
726 hBufferedPaint: HPAINTBUFFER,
727 ppbBuffer: *mut *mut RGBQUAD,
728 pcxRow: *mut c_int,
729 ) -> HRESULT;
730 pub fn BufferedPaintClear(
731 hBufferedPaint: HPAINTBUFFER,
732 prc: *const RECT,
733 ) -> HRESULT;
734 pub fn BufferedPaintSetAlpha(
735 hBufferedPaint: HPAINTBUFFER,
736 prc: *const RECT,
737 alpha: BYTE,
738 ) -> HRESULT;
739 pub fn BufferedPaintStopAllAnimations(
740 hwnd: HWND,
741 ) -> HRESULT;
742}
743pub type HANIMATIONBUFFER = HANDLE;
744extern "system" {
745 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;
755 pub fn EndBufferedAnimation(
756 hbpAnimation: HANIMATIONBUFFER,
757 fUpdateTarget: BOOL,
758 ) -> HRESULT;
759 pub fn BufferedPaintRenderAnimation(
760 hwnd: HWND,
761 hdcTarget: HDC,
762 ) -> BOOL;
763 pub fn IsCompositionActive() -> BOOL;
764 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}