Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

925 lines
47 KiB

  1. //---------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //
  4. // File : uxtheme.h
  5. // Version: 1.0
  6. //---------------------------------------------------------------------------
  7. #ifndef _UXTHEME_H_
  8. #define _UXTHEME_H_
  9. //---------------------------------------------------------------------------
  10. #include <commctrl.h>
  11. //---------------------------------------------------------------------------
  12. //#if (_WIN32_WINNT >= 0x0500) // only available on XP
  13. //---------------------------------------------------------------------------
  14. // Define API decoration for direct importing of DLL references.
  15. #ifndef THEMEAPI
  16. #if !defined(_UXTHEME_)
  17. #define THEMEAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  18. #define THEMEAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  19. #else
  20. #define THEMEAPI STDAPI
  21. #define THEMEAPI_(type) STDAPI_(type)
  22. #endif
  23. #endif // THEMEAPI
  24. //---------------------------------------------------------------------------
  25. typedef HANDLE HTHEME; // handle to a section of theme data for class
  26. //---------------------------------------------------------------------------
  27. // NOTE: PartId's and StateId's used in the theme API are defined in the
  28. // hdr file <tmschema.h> using the TM_PART and TM_STATE macros. For
  29. // example, "TM_PART(BP, PUSHBUTTON)" defines the PartId "BP_PUSHBUTTON".
  30. //---------------------------------------------------------------------------
  31. // OpenThemeData() - Open the theme data for the specified HWND and
  32. // semi-colon separated list of class names.
  33. //
  34. // OpenThemeData() will try each class name, one at
  35. // a time, and use the first matching theme info
  36. // found. If a match is found, a theme handle
  37. // to the data is returned. If no match is found,
  38. // a "NULL" handle is returned.
  39. //
  40. // When the window is destroyed or a WM_THEMECHANGED
  41. // msg is received, "CloseThemeData()" should be
  42. // called to close the theme handle.
  43. //
  44. // hwnd - window handle of the control/window to be themed
  45. //
  46. // pszClassList - class name (or list of names) to match to theme data
  47. // section. if the list contains more than one name,
  48. // the names are tested one at a time for a match.
  49. // If a match is found, OpenThemeData() returns a
  50. // theme handle associated with the matching class.
  51. // This param is a list (instead of just a single
  52. // class name) to provide the class an opportunity
  53. // to get the "best" match between the class and
  54. // the current theme. For example, a button might
  55. // pass L"OkButton, Button" if its ID=ID_OK. If
  56. // the current theme has an entry for OkButton,
  57. // that will be used. Otherwise, we fall back on
  58. // the normal Button entry.
  59. //---------------------------------------------------------------------------
  60. THEMEAPI_(HTHEME) OpenThemeData(HWND hwnd, LPCWSTR pszClassList);
  61. //---------------------------------------------------------------------------
  62. // CloseTHemeData() - closes the theme data handle. This should be done
  63. // when the window being themed is destroyed or
  64. // whenever a WM_THEMECHANGED msg is received
  65. // (followed by an attempt to create a new Theme data
  66. // handle).
  67. //
  68. // hTheme - open theme data handle (returned from prior call
  69. // to OpenThemeData() API).
  70. //---------------------------------------------------------------------------
  71. THEMEAPI CloseThemeData(HTHEME hTheme);
  72. //---------------------------------------------------------------------------
  73. // functions for basic drawing support
  74. //---------------------------------------------------------------------------
  75. // The following methods are the theme-aware drawing services.
  76. // Controls/Windows are defined in drawable "parts" by their author: a
  77. // parent part and 0 or more child parts. Each of the parts can be
  78. // described in "states" (ex: disabled, hot, pressed).
  79. //---------------------------------------------------------------------------
  80. // For the list of all themed classes and the definition of all
  81. // parts and states, see the file "tmschmea.h".
  82. //---------------------------------------------------------------------------
  83. // Each of the below methods takes a "iPartId" param to specify the
  84. // part and a "iStateId" to specify the state of the part.
  85. // "iStateId=0" refers to the root part. "iPartId" = "0" refers to
  86. // the root class.
  87. //-----------------------------------------------------------------------
  88. // Note: draw operations are always scaled to fit (and not to exceed)
  89. // the specified "Rect".
  90. //-----------------------------------------------------------------------
  91. //------------------------------------------------------------------------
  92. // DrawThemeBackground()
  93. // - draws the theme-specified border and fill for
  94. // the "iPartId" and "iStateId". This could be
  95. // based on a bitmap file, a border and fill, or
  96. // other image description.
  97. //
  98. // hTheme - theme data handle
  99. // hdc - HDC to draw into
  100. // iPartId - part number to draw
  101. // iStateId - state number (of the part) to draw
  102. // pRect - defines the size/location of the part
  103. // pClipRect - optional clipping rect (don't draw outside it)
  104. //------------------------------------------------------------------------
  105. THEMEAPI DrawThemeBackground(HTHEME hTheme, HDC hdc,
  106. int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
  107. //---------------------------------------------------------------------------
  108. //----- DrawThemeText() flags ----
  109. #define DTT_GRAYED 0x1 // draw a grayed-out string
  110. //-------------------------------------------------------------------------
  111. // DrawThemeText() - draws the text using the theme-specified
  112. // color and font for the "iPartId" and
  113. // "iStateId".
  114. //
  115. // hTheme - theme data handle
  116. // hdc - HDC to draw into
  117. // iPartId - part number to draw
  118. // iStateId - state number (of the part) to draw
  119. // pszText - actual text to draw
  120. // dwCharCount - number of chars to draw (-1 for all)
  121. // dwTextFlags - same as DrawText() "uFormat" param
  122. // dwTextFlags2 - additional drawing options
  123. // pRect - defines the size/location of the part
  124. //-------------------------------------------------------------------------
  125. THEMEAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId,
  126. int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,
  127. DWORD dwTextFlags2, const RECT *pRect);
  128. //-------------------------------------------------------------------------
  129. // GetThemeBackgroundContentRect()
  130. // - gets the size of the content for the theme-defined
  131. // background. This is usually the area inside
  132. // the borders or Margins.
  133. //
  134. // hTheme - theme data handle
  135. // hdc - (optional) device content to be used for drawing
  136. // iPartId - part number to draw
  137. // iStateId - state number (of the part) to draw
  138. // pBoundingRect - the outer RECT of the part being drawn
  139. // pContentRect - RECT to receive the content area
  140. //-------------------------------------------------------------------------
  141. THEMEAPI GetThemeBackgroundContentRect(HTHEME hTheme, OPTIONAL HDC hdc,
  142. int iPartId, int iStateId, const RECT *pBoundingRect,
  143. OUT RECT *pContentRect);
  144. //-------------------------------------------------------------------------
  145. // GetThemeBackgroundExtent() - calculates the size/location of the theme-
  146. // specified background based on the
  147. // "pContentRect".
  148. //
  149. // hTheme - theme data handle
  150. // hdc - (optional) device content to be used for drawing
  151. // iPartId - part number to draw
  152. // iStateId - state number (of the part) to draw
  153. // pContentRect - RECT that defines the content area
  154. // pBoundingRect - RECT to receive the overall size/location of part
  155. //-------------------------------------------------------------------------
  156. THEMEAPI GetThemeBackgroundExtent(HTHEME hTheme, OPTIONAL HDC hdc,
  157. int iPartId, int iStateId, const RECT *pContentRect,
  158. OUT RECT *pExtentRect);
  159. //-------------------------------------------------------------------------
  160. typedef enum THEMESIZE
  161. {
  162. TS_MIN, // minimum size
  163. TS_TRUE, // size without stretching
  164. TS_DRAW, // size that theme mgr will use to draw part
  165. };
  166. //-------------------------------------------------------------------------
  167. // GetThemePartSize() - returns the specified size of the theme part
  168. //
  169. // hTheme - theme data handle
  170. // hdc - HDC to select font into & measure against
  171. // iPartId - part number to retrieve size for
  172. // iStateId - state number (of the part)
  173. // prc - (optional) rect for part drawing destination
  174. // eSize - the type of size to be retreived
  175. // psz - receives the specified size of the part
  176. //-------------------------------------------------------------------------
  177. THEMEAPI GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
  178. OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz);
  179. //-------------------------------------------------------------------------
  180. // GetThemeTextExtent() - calculates the size/location of the specified
  181. // text when rendered in the Theme Font.
  182. //
  183. // hTheme - theme data handle
  184. // hdc - HDC to select font & measure into
  185. // iPartId - part number to draw
  186. // iStateId - state number (of the part)
  187. // pszText - the text to be measured
  188. // dwCharCount - number of chars to draw (-1 for all)
  189. // dwTextFlags - same as DrawText() "uFormat" param
  190. // pszBoundingRect - optional: to control layout of text
  191. // pszExtentRect - receives the RECT for text size/location
  192. //-------------------------------------------------------------------------
  193. THEMEAPI GetThemeTextExtent(HTHEME hTheme, HDC hdc,
  194. int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,
  195. DWORD dwTextFlags, OPTIONAL const RECT *pBoundingRect,
  196. OUT RECT *pExtentRect);
  197. //-------------------------------------------------------------------------
  198. // GetThemeTextMetrics()
  199. // - returns info about the theme-specified font
  200. // for the part/state passed in.
  201. //
  202. // hTheme - theme data handle
  203. // hdc - optional: HDC for screen context
  204. // iPartId - part number to draw
  205. // iStateId - state number (of the part)
  206. // ptm - receives the font info
  207. //-------------------------------------------------------------------------
  208. THEMEAPI GetThemeTextMetrics(HTHEME hTheme, OPTIONAL HDC hdc,
  209. int iPartId, int iStateId, OUT TEXTMETRIC* ptm);
  210. //-------------------------------------------------------------------------
  211. // GetThemeBackgroundRegion()
  212. // - computes the region for a regular or partially
  213. // transparent theme-specified background that is
  214. // bound by the specified "pRect".
  215. // If the rectangle is empty, sets the HRGN to NULL
  216. // and return S_FALSE.
  217. //
  218. // hTheme - theme data handle
  219. // hdc - optional HDC to draw into (DPI scaling)
  220. // iPartId - part number to draw
  221. // iStateId - state number (of the part)
  222. // pRect - the RECT used to draw the part
  223. // pRegion - receives handle to calculated region
  224. //-------------------------------------------------------------------------
  225. THEMEAPI GetThemeBackgroundRegion(HTHEME hTheme, OPTIONAL HDC hdc,
  226. int iPartId, int iStateId, const RECT *pRect, OUT HRGN *pRegion);
  227. //-------------------------------------------------------------------------
  228. //----- HitTestThemeBackground, HitTestThemeBackgroundRegion flags ----
  229. // Theme background segment hit test flag (default). possible return values are:
  230. // HTCLIENT: hit test succeeded in the middle background segment
  231. // HTTOP, HTLEFT, HTTOPLEFT, etc: // hit test succeeded in the the respective theme background segment.
  232. #define HTTB_BACKGROUNDSEG 0x0000
  233. // Fixed border hit test option. possible return values are:
  234. // HTCLIENT: hit test succeeded in the middle background segment
  235. // HTBORDER: hit test succeeded in any other background segment
  236. #define HTTB_FIXEDBORDER 0x0002 // Return code may be either HTCLIENT or HTBORDER.
  237. // Caption hit test option. Possible return values are:
  238. // HTCAPTION: hit test succeeded in the top, top left, or top right background segments
  239. // HTNOWHERE or another return code, depending on absence or presence of accompanying flags, resp.
  240. #define HTTB_CAPTION 0x0004
  241. // Resizing border hit test flags. Possible return values are:
  242. // HTCLIENT: hit test succeeded in middle background segment
  243. // HTTOP, HTTOPLEFT, HTLEFT, HTRIGHT, etc: hit test succeeded in the respective system resizing zone
  244. // HTBORDER: hit test failed in middle segment and resizing zones, but succeeded in a background border segment
  245. #define HTTB_RESIZINGBORDER_LEFT 0x0010 // Hit test left resizing border,
  246. #define HTTB_RESIZINGBORDER_TOP 0x0020 // Hit test top resizing border
  247. #define HTTB_RESIZINGBORDER_RIGHT 0x0040 // Hit test right resizing border
  248. #define HTTB_RESIZINGBORDER_BOTTOM 0x0080 // Hit test bottom resizing border
  249. #define HTTB_RESIZINGBORDER (HTTB_RESIZINGBORDER_LEFT|HTTB_RESIZINGBORDER_TOP|\
  250. HTTB_RESIZINGBORDER_RIGHT|HTTB_RESIZINGBORDER_BOTTOM)
  251. // Resizing border is specified as a template, not just window edges.
  252. // This option is mutually exclusive with HTTB_SYSTEMSIZINGWIDTH; HTTB_SIZINGTEMPLATE takes precedence
  253. #define HTTB_SIZINGTEMPLATE 0x0100
  254. // Use system resizing border width rather than theme content margins.
  255. // This option is mutually exclusive with HTTB_SIZINGTEMPLATE, which takes precedence.
  256. #define HTTB_SYSTEMSIZINGMARGINS 0x0200
  257. //-------------------------------------------------------------------------
  258. // HitTestThemeBackground()
  259. // - returns a HitTestCode (a subset of the values
  260. // returned by WM_NCHITTEST) for the point "ptTest"
  261. // within the theme-specified background
  262. // (bound by pRect). "pRect" and "ptTest" should
  263. // both be in the same coordinate system
  264. // (client, screen, etc).
  265. //
  266. // hTheme - theme data handle
  267. // hdc - HDC to draw into
  268. // iPartId - part number to test against
  269. // iStateId - state number (of the part)
  270. // pRect - the RECT used to draw the part
  271. // hrgn - optional region to use; must be in same coordinates as
  272. // - pRect and pTest.
  273. // ptTest - the hit point to be tested
  274. // dwOptions - HTTB_xxx constants
  275. // pwHitTestCode - receives the returned hit test code - one of:
  276. //
  277. // HTNOWHERE, HTLEFT, HTTOPLEFT, HTBOTTOMLEFT,
  278. // HTRIGHT, HTTOPRIGHT, HTBOTTOMRIGHT,
  279. // HTTOP, HTBOTTOM, HTCLIENT
  280. //-------------------------------------------------------------------------
  281. THEMEAPI HitTestThemeBackground(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId,
  282. int iStateId, DWORD dwOptions, const RECT *pRect, OPTIONAL HRGN hrgn,
  283. POINT ptTest, OUT WORD *pwHitTestCode);
  284. //------------------------------------------------------------------------
  285. // DrawThemeEdge() - Similar to the DrawEdge() API, but uses part colors
  286. // and is high-DPI aware
  287. // hTheme - theme data handle
  288. // hdc - HDC to draw into
  289. // iPartId - part number to draw
  290. // iStateId - state number of part
  291. // pDestRect - the RECT used to draw the line(s)
  292. // uEdge - Same as DrawEdge() API
  293. // uFlags - Same as DrawEdge() API
  294. // pContentRect - Receives the interior rect if (uFlags & BF_ADJUST)
  295. //------------------------------------------------------------------------
  296. THEMEAPI DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
  297. const RECT *pDestRect, UINT uEdge, UINT uFlags, OPTIONAL OUT RECT *pContentRect);
  298. //------------------------------------------------------------------------
  299. // DrawThemeIcon() - draws an image within an imagelist based on
  300. // a (possible) theme-defined effect.
  301. //
  302. // hTheme - theme data handle
  303. // hdc - HDC to draw into
  304. // iPartId - part number to draw
  305. // iStateId - state number of part
  306. // pRect - the RECT to draw the image within
  307. // himl - handle to IMAGELIST
  308. // iImageIndex - index into IMAGELIST (which icon to draw)
  309. //------------------------------------------------------------------------
  310. THEMEAPI DrawThemeIcon(HTHEME hTheme, HDC hdc, int iPartId,
  311. int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex);
  312. //---------------------------------------------------------------------------
  313. // IsThemePartDefined() - returns TRUE if the theme has defined parameters
  314. // for the specified "iPartId" and "iStateId".
  315. //
  316. // hTheme - theme data handle
  317. // iPartId - part number to find definition for
  318. // iStateId - state number of part
  319. //---------------------------------------------------------------------------
  320. THEMEAPI_(BOOL) IsThemePartDefined(HTHEME hTheme, int iPartId,
  321. int iStateId);
  322. //---------------------------------------------------------------------------
  323. // IsThemeBackgroundPartiallyTransparent()
  324. // - returns TRUE if the theme specified background for
  325. // the part/state has transparent pieces or
  326. // alpha-blended pieces.
  327. //
  328. // hTheme - theme data handle
  329. // iPartId - part number
  330. // iStateId - state number of part
  331. //---------------------------------------------------------------------------
  332. THEMEAPI_(BOOL) IsThemeBackgroundPartiallyTransparent(HTHEME hTheme,
  333. int iPartId, int iStateId);
  334. //---------------------------------------------------------------------------
  335. // lower-level theme information services
  336. //---------------------------------------------------------------------------
  337. // The following methods are getter routines for each of the Theme Data types.
  338. // Controls/Windows are defined in drawable "parts" by their author: a
  339. // parent part and 0 or more child parts. Each of the parts can be
  340. // described in "states" (ex: disabled, hot, pressed).
  341. //---------------------------------------------------------------------------
  342. // Each of the below methods takes a "iPartId" param to specify the
  343. // part and a "iStateId" to specify the state of the part.
  344. // "iStateId=0" refers to the root part. "iPartId" = "0" refers to
  345. // the root class.
  346. //-----------------------------------------------------------------------
  347. // Each method also take a "iPropId" param because multiple instances of
  348. // the same primitive type can be defined in the theme schema.
  349. //-----------------------------------------------------------------------
  350. //-----------------------------------------------------------------------
  351. // GetThemeColor() - Get the value for the specified COLOR property
  352. //
  353. // hTheme - theme data handle
  354. // iPartId - part number
  355. // iStateId - state number of part
  356. // iPropId - the property number to get the value for
  357. // pColor - receives the value of the property
  358. //-----------------------------------------------------------------------
  359. THEMEAPI GetThemeColor(HTHEME hTheme, int iPartId,
  360. int iStateId, int iPropId, OUT COLORREF *pColor);
  361. //-----------------------------------------------------------------------
  362. // GetThemeMetric() - Get the value for the specified metric/size
  363. // property
  364. //
  365. // hTheme - theme data handle
  366. // hdc - (optional) hdc to be drawn into (DPI scaling)
  367. // iPartId - part number
  368. // iStateId - state number of part
  369. // iPropId - the property number to get the value for
  370. // piVal - receives the value of the property
  371. //-----------------------------------------------------------------------
  372. THEMEAPI GetThemeMetric(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId,
  373. int iStateId, int iPropId, OUT int *piVal);
  374. //-----------------------------------------------------------------------
  375. // GetThemeString() - Get the value for the specified string property
  376. //
  377. // hTheme - theme data handle
  378. // iPartId - part number
  379. // iStateId - state number of part
  380. // iPropId - the property number to get the value for
  381. // pszBuff - receives the string property value
  382. // cchMaxBuffChars - max. number of chars allowed in pszBuff
  383. //-----------------------------------------------------------------------
  384. THEMEAPI GetThemeString(HTHEME hTheme, int iPartId,
  385. int iStateId, int iPropId, OUT LPWSTR pszBuff, int cchMaxBuffChars);
  386. //-----------------------------------------------------------------------
  387. // GetThemeBool() - Get the value for the specified BOOL property
  388. //
  389. // hTheme - theme data handle
  390. // iPartId - part number
  391. // iStateId - state number of part
  392. // iPropId - the property number to get the value for
  393. // pfVal - receives the value of the property
  394. //-----------------------------------------------------------------------
  395. THEMEAPI GetThemeBool(HTHEME hTheme, int iPartId,
  396. int iStateId, int iPropId, OUT BOOL *pfVal);
  397. //-----------------------------------------------------------------------
  398. // GetThemeInt() - Get the value for the specified int property
  399. //
  400. // hTheme - theme data handle
  401. // iPartId - part number
  402. // iStateId - state number of part
  403. // iPropId - the property number to get the value for
  404. // piVal - receives the value of the property
  405. //-----------------------------------------------------------------------
  406. THEMEAPI GetThemeInt(HTHEME hTheme, int iPartId,
  407. int iStateId, int iPropId, OUT int *piVal);
  408. //-----------------------------------------------------------------------
  409. // GetThemeEnumValue() - Get the value for the specified ENUM property
  410. //
  411. // hTheme - theme data handle
  412. // iPartId - part number
  413. // iStateId - state number of part
  414. // iPropId - the property number to get the value for
  415. // piVal - receives the value of the enum (cast to int*)
  416. //-----------------------------------------------------------------------
  417. THEMEAPI GetThemeEnumValue(HTHEME hTheme, int iPartId,
  418. int iStateId, int iPropId, OUT int *piVal);
  419. //-----------------------------------------------------------------------
  420. // GetThemePosition() - Get the value for the specified position
  421. // property
  422. //
  423. // hTheme - theme data handle
  424. // iPartId - part number
  425. // iStateId - state number of part
  426. // iPropId - the property number to get the value for
  427. // pPoint - receives the value of the position property
  428. //-----------------------------------------------------------------------
  429. THEMEAPI GetThemePosition(HTHEME hTheme, int iPartId,
  430. int iStateId, int iPropId, OUT POINT *pPoint);
  431. //-----------------------------------------------------------------------
  432. // GetThemeFont() - Get the value for the specified font property
  433. //
  434. // hTheme - theme data handle
  435. // hdc - (optional) hdc to be drawn to (DPI scaling)
  436. // iPartId - part number
  437. // iStateId - state number of part
  438. // iPropId - the property number to get the value for
  439. // pFont - receives the value of the LOGFONT property
  440. // (scaled for the current logical screen dpi)
  441. //-----------------------------------------------------------------------
  442. THEMEAPI GetThemeFont(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId,
  443. int iStateId, int iPropId, OUT LOGFONT *pFont);
  444. //-----------------------------------------------------------------------
  445. // GetThemeRect() - Get the value for the specified RECT property
  446. //
  447. // hTheme - theme data handle
  448. // iPartId - part number
  449. // iStateId - state number of part
  450. // iPropId - the property number to get the value for
  451. // pRect - receives the value of the RECT property
  452. //-----------------------------------------------------------------------
  453. THEMEAPI GetThemeRect(HTHEME hTheme, int iPartId,
  454. int iStateId, int iPropId, OUT RECT *pRect);
  455. //-----------------------------------------------------------------------
  456. typedef struct _MARGINS
  457. {
  458. int cxLeftWidth; // width of left border that retains its size
  459. int cxRightWidth; // width of right border that retains its size
  460. int cyTopHeight; // height of top border that retains its size
  461. int cyBottomHeight; // height of bottom border that retains its size
  462. } MARGINS, *PMARGINS;
  463. //-----------------------------------------------------------------------
  464. // GetThemeMargins() - Get the value for the specified MARGINS property
  465. //
  466. // hTheme - theme data handle
  467. // hdc - (optional) hdc to be used for drawing
  468. // iPartId - part number
  469. // iStateId - state number of part
  470. // iPropId - the property number to get the value for
  471. // prc - RECT for area to be drawn into
  472. // pMargins - receives the value of the MARGINS property
  473. //-----------------------------------------------------------------------
  474. THEMEAPI GetThemeMargins(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId,
  475. int iStateId, int iPropId, OPTIONAL RECT *prc, OUT MARGINS *pMargins);
  476. //-----------------------------------------------------------------------
  477. #define MAX_INTLIST_COUNT 10
  478. typedef struct _INTLIST
  479. {
  480. int iValueCount; // number of values in iValues
  481. int iValues[MAX_INTLIST_COUNT];
  482. } INTLIST, *PINTLIST;
  483. //-----------------------------------------------------------------------
  484. // GetThemeIntList() - Get the value for the specified INTLIST struct
  485. //
  486. // hTheme - theme data handle
  487. // iPartId - part number
  488. // iStateId - state number of part
  489. // iPropId - the property number to get the value for
  490. // pIntList - receives the value of the INTLIST property
  491. //-----------------------------------------------------------------------
  492. THEMEAPI GetThemeIntList(HTHEME hTheme, int iPartId,
  493. int iStateId, int iPropId, OUT INTLIST *pIntList);
  494. //-----------------------------------------------------------------------
  495. typedef enum PROPERTYORIGIN
  496. {
  497. PO_STATE, // property was found in the state section
  498. PO_PART, // property was found in the part section
  499. PO_CLASS, // property was found in the class section
  500. PO_GLOBAL, // property was found in [globals] section
  501. PO_NOTFOUND // property was not found
  502. };
  503. //-----------------------------------------------------------------------
  504. // GetThemePropertyOrigin()
  505. // - searches for the specified theme property
  506. // and sets "pOrigin" to indicate where it was
  507. // found (or not found)
  508. //
  509. // hTheme - theme data handle
  510. // iPartId - part number
  511. // iStateId - state number of part
  512. // iPropId - the property number to search for
  513. // pOrigin - receives the value of the property origin
  514. //-----------------------------------------------------------------------
  515. THEMEAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId,
  516. int iStateId, int iPropId, OUT enum PROPERTYORIGIN *pOrigin);
  517. //---------------------------------------------------------------------------
  518. // SetWindowTheme()
  519. // - redirects an existing Window to use a different
  520. // section of the current theme information than its
  521. // class normally asks for.
  522. //
  523. // hwnd - the handle of the window (cannot be NULL)
  524. //
  525. // pszSubAppName - app (group) name to use in place of the calling
  526. // app's name. If NULL, the actual calling app
  527. // name will be used.
  528. //
  529. // pszSubIdList - semicolon separated list of class Id names to
  530. // use in place of actual list passed by the
  531. // window's class. if NULL, the id list from the
  532. // calling class is used.
  533. //---------------------------------------------------------------------------
  534. // The Theme Manager will remember the "pszSubAppName" and the
  535. // "pszSubIdList" associations thru the lifetime of the window (even
  536. // if themes are subsequently changed). The window is sent a
  537. // "WM_THEMECHANGED" msg at the end of this call, so that the new
  538. // theme can be found and applied.
  539. //---------------------------------------------------------------------------
  540. // When "pszSubAppName" or "pszSubIdList" are NULL, the Theme Manager
  541. // removes the previously remember association. To turn off theme-ing for
  542. // the specified window, you can pass an empty string (L"") so it
  543. // won't match any section entries.
  544. //---------------------------------------------------------------------------
  545. THEMEAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,
  546. LPCWSTR pszSubIdList);
  547. //---------------------------------------------------------------------------
  548. // GetThemeFilename() - Get the value for the specified FILENAME property.
  549. //
  550. // hTheme - theme data handle
  551. // iPartId - part number
  552. // iStateId - state number of part
  553. // iPropId - the property number to search for
  554. // pszThemeFileName - output buffer to receive the filename
  555. // cchMaxBuffChars - the size of the return buffer, in chars
  556. //---------------------------------------------------------------------------
  557. THEMEAPI GetThemeFilename(HTHEME hTheme, int iPartId,
  558. int iStateId, int iPropId, OUT LPWSTR pszThemeFileName, int cchMaxBuffChars);
  559. //---------------------------------------------------------------------------
  560. // GetThemeSysColor() - Get the value of the specified System color.
  561. //
  562. // hTheme - the theme data handle. if non-NULL, will return
  563. // color from [SysMetrics] section of theme.
  564. // if NULL, will return the global system color.
  565. //
  566. // iColorId - the system color index defined in winuser.h
  567. //---------------------------------------------------------------------------
  568. THEMEAPI_(COLORREF) GetThemeSysColor(HTHEME hTheme, int iColorId);
  569. //---------------------------------------------------------------------------
  570. // GetThemeSysColorBrush()
  571. // - Get the brush for the specified System color.
  572. //
  573. // hTheme - the theme data handle. if non-NULL, will return
  574. // brush matching color from [SysMetrics] section of
  575. // theme. if NULL, will return the brush matching
  576. // global system color.
  577. //
  578. // iColorId - the system color index defined in winuser.h
  579. //---------------------------------------------------------------------------
  580. THEMEAPI_(HBRUSH) GetThemeSysColorBrush(HTHEME hTheme, int iColorId);
  581. //---------------------------------------------------------------------------
  582. // GetThemeSysBool() - Get the boolean value of specified System metric.
  583. //
  584. // hTheme - the theme data handle. if non-NULL, will return
  585. // BOOL from [SysMetrics] section of theme.
  586. // if NULL, will return the specified system boolean.
  587. //
  588. // iBoolId - the TMT_XXX BOOL number (first BOOL
  589. // is TMT_FLATMENUS)
  590. //---------------------------------------------------------------------------
  591. THEMEAPI_(BOOL) GetThemeSysBool(HTHEME hTheme, int iBoolId);
  592. //---------------------------------------------------------------------------
  593. // GetThemeSysSize() - Get the value of the specified System size metric.
  594. // (scaled for the current logical screen dpi)
  595. //
  596. // hTheme - the theme data handle. if non-NULL, will return
  597. // size from [SysMetrics] section of theme.
  598. // if NULL, will return the global system metric.
  599. //
  600. // iSizeId - the following values are supported when
  601. // hTheme is non-NULL:
  602. //
  603. // SM_CXBORDER (border width)
  604. // SM_CXVSCROLL (scrollbar width)
  605. // SM_CYHSCROLL (scrollbar height)
  606. // SM_CXSIZE (caption width)
  607. // SM_CYSIZE (caption height)
  608. // SM_CXSMSIZE (small caption width)
  609. // SM_CYSMSIZE (small caption height)
  610. // SM_CXMENUSIZE (menubar width)
  611. // SM_CYMENUSIZE (menubar height)
  612. //
  613. // when hTheme is NULL, iSizeId is passed directly
  614. // to the GetSystemMetrics() function
  615. //---------------------------------------------------------------------------
  616. THEMEAPI_(int) GetThemeSysSize(HTHEME hTheme, int iSizeId);
  617. //---------------------------------------------------------------------------
  618. // GetThemeSysFont() - Get the LOGFONT for the specified System font.
  619. //
  620. // hTheme - the theme data handle. if non-NULL, will return
  621. // font from [SysMetrics] section of theme.
  622. // if NULL, will return the specified system font.
  623. //
  624. // iFontId - the TMT_XXX font number (first font
  625. // is TMT_CAPTIONFONT)
  626. //
  627. // plf - ptr to LOGFONT to receive the font value.
  628. // (scaled for the current logical screen dpi)
  629. //---------------------------------------------------------------------------
  630. THEMEAPI GetThemeSysFont(HTHEME hTheme, int iFontId, OUT LOGFONT *plf);
  631. //---------------------------------------------------------------------------
  632. // GetThemeSysString() - Get the value of specified System string metric.
  633. //
  634. // hTheme - the theme data handle (required)
  635. //
  636. // iStringId - must be one of the following values:
  637. //
  638. // TMT_CSSNAME
  639. // TMT_XMLNAME
  640. //
  641. // pszStringBuff - the buffer to receive the string value
  642. //
  643. // cchMaxStringChars - max. number of chars that pszStringBuff can hold
  644. //---------------------------------------------------------------------------
  645. THEMEAPI GetThemeSysString(HTHEME hTheme, int iStringId,
  646. OUT LPWSTR pszStringBuff, int cchMaxStringChars);
  647. //---------------------------------------------------------------------------
  648. // GetThemeSysInt() - Get the value of specified System int.
  649. //
  650. // hTheme - the theme data handle (required)
  651. //
  652. // iIntId - must be one of the following values:
  653. //
  654. // TMT_DPIX
  655. // TMT_DPIY
  656. // TMT_MINCOLORDEPTH
  657. //
  658. // piValue - ptr to int to receive value
  659. //---------------------------------------------------------------------------
  660. THEMEAPI GetThemeSysInt(HTHEME hTheme, int iIntId, int *piValue);
  661. //---------------------------------------------------------------------------
  662. // IsThemeActive() - can be used to test if a system theme is active
  663. // for the current user session.
  664. //
  665. // use the API "IsAppThemed()" to test if a theme is
  666. // active for the calling process.
  667. //---------------------------------------------------------------------------
  668. THEMEAPI_(BOOL) IsThemeActive();
  669. //---------------------------------------------------------------------------
  670. // IsAppThemed() - returns TRUE if a theme is active and available to
  671. // the current process
  672. //---------------------------------------------------------------------------
  673. THEMEAPI_(BOOL) IsAppThemed();
  674. //---------------------------------------------------------------------------
  675. // GetWindowTheme() - if window is themed, returns its most recent
  676. // HTHEME from OpenThemeData() - otherwise, returns
  677. // NULL.
  678. //
  679. // hwnd - the window to get the HTHEME of
  680. //---------------------------------------------------------------------------
  681. THEMEAPI_(HTHEME) GetWindowTheme(HWND hwnd);
  682. //---------------------------------------------------------------------------
  683. // EnableThemeDialogTexture()
  684. //
  685. // - Enables/disables dialog background theme. This method can be used to
  686. // tailor dialog compatibility with child windows and controls that
  687. // may or may not coordinate the rendering of their client area backgrounds
  688. // with that of their parent dialog in a manner that supports seamless
  689. // background texturing.
  690. //
  691. // hdlg - the window handle of the target dialog
  692. // dwFlags - ETDT_ENABLE to enable the theme-defined dialog background texturing,
  693. // ETDT_DISABLE to disable background texturing,
  694. // ETDT_ENABLETAB to enable the theme-defined background
  695. // texturing using the Tab texture
  696. //---------------------------------------------------------------------------
  697. #define ETDT_DISABLE 0x00000001
  698. #define ETDT_ENABLE 0x00000002
  699. #define ETDT_USETABTEXTURE 0x00000004
  700. #define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
  701. THEMEAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags);
  702. //---------------------------------------------------------------------------
  703. // IsThemeDialogTextureEnabled()
  704. //
  705. // - Reports whether the dialog supports background texturing.
  706. //
  707. // hdlg - the window handle of the target dialog
  708. //---------------------------------------------------------------------------
  709. THEMEAPI_(BOOL) IsThemeDialogTextureEnabled(HWND hwnd);
  710. //---------------------------------------------------------------------------
  711. //---- flags to control theming within an app ----
  712. #define STAP_ALLOW_NONCLIENT (1 << 0)
  713. #define STAP_ALLOW_CONTROLS (1 << 1)
  714. #define STAP_ALLOW_WEBCONTENT (1 << 2)
  715. //---------------------------------------------------------------------------
  716. // GetThemeAppProperties()
  717. // - returns the app property flags that control theming
  718. //---------------------------------------------------------------------------
  719. THEMEAPI_(DWORD) GetThemeAppProperties();
  720. //---------------------------------------------------------------------------
  721. // SetThemeAppProperties()
  722. // - sets the flags that control theming within the app
  723. //
  724. // dwFlags - the flag values to be set
  725. //---------------------------------------------------------------------------
  726. THEMEAPI_(void) SetThemeAppProperties(DWORD dwFlags);
  727. //---------------------------------------------------------------------------
  728. // GetCurrentThemeName()
  729. // - Get the name of the current theme in-use.
  730. // Optionally, return the ColorScheme name and the
  731. // Size name of the theme.
  732. //
  733. // pszThemeFileName - receives the theme path & filename
  734. // cchMaxNameChars - max chars allowed in pszNameBuff
  735. //
  736. // pszColorBuff - (optional) receives the canonical color scheme name
  737. // (not the display name)
  738. // cchMaxColorChars - max chars allowed in pszColorBuff
  739. //
  740. // pszSizeBuff - (optional) receives the canonical size name
  741. // (not the display name)
  742. // cchMaxSizeChars - max chars allowed in pszSizeBuff
  743. //---------------------------------------------------------------------------
  744. THEMEAPI GetCurrentThemeName(
  745. OUT LPWSTR pszThemeFileName, int cchMaxNameChars,
  746. OUT OPTIONAL LPWSTR pszColorBuff, int cchMaxColorChars,
  747. OUT OPTIONAL LPWSTR pszSizeBuff, int cchMaxSizeChars);
  748. //---------------------------------------------------------------------------
  749. // GetThemeDocumentationProperty()
  750. // - Get the value for the specified property name from
  751. // the [documentation] section of the themes.ini file
  752. // for the specified theme. If the property has been
  753. // localized in the theme files string table, the
  754. // localized version of the property value is returned.
  755. //
  756. // pszThemeFileName - filename of the theme file to query
  757. // pszPropertyName - name of the string property to retreive a value for
  758. // pszValueBuff - receives the property string value
  759. // cchMaxValChars - max chars allowed in pszValueBuff
  760. //---------------------------------------------------------------------------
  761. #define SZ_THDOCPROP_DISPLAYNAME L"DisplayName"
  762. #define SZ_THDOCPROP_CANONICALNAME L"ThemeName"
  763. #define SZ_THDOCPROP_TOOLTIP L"ToolTip"
  764. #define SZ_THDOCPROP_AUTHOR L"author"
  765. THEMEAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
  766. LPCWSTR pszPropertyName, OUT LPWSTR pszValueBuff, int cchMaxValChars);
  767. //---------------------------------------------------------------------------
  768. // Theme API Error Handling
  769. //
  770. // All functions in the Theme API not returning an HRESULT (THEMEAPI_)
  771. // use the WIN32 function "SetLastError()" to record any call failures.
  772. //
  773. // To retreive the error code of the last failure on the
  774. // current thread for these type of API's, use the WIN32 function
  775. // "GetLastError()".
  776. //
  777. // All Theme API error codes (HRESULT's and GetLastError() values)
  778. // should be normal win32 errors which can be formatted into
  779. // strings using the Win32 API FormatMessage().
  780. //---------------------------------------------------------------------------
  781. //---------------------------------------------------------------------------
  782. // DrawThemeParentBackground()
  783. // - used by partially-transparent or alpha-blended
  784. // child controls to draw the part of their parent
  785. // that they appear in front of.
  786. //
  787. // hwnd - handle of the child control
  788. // hdc - hdc of the child control
  789. // prc - (optional) rect that defines the area to be
  790. // drawn (CHILD coordinates)
  791. //---------------------------------------------------------------------------
  792. THEMEAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, OPTIONAL RECT* prc);
  793. //---------------------------------------------------------------------------
  794. // EnableTheming() - enables or disables themeing for the current user
  795. // in the current and future sessions.
  796. //
  797. // fEnable - if FALSE, disable theming & turn themes off.
  798. // - if TRUE, enable themeing and, if user previously
  799. // had a theme active, make it active now.
  800. //---------------------------------------------------------------------------
  801. THEMEAPI EnableTheming(BOOL fEnable);
  802. //------------------------------------------------------------------------
  803. //---- bits used in dwFlags of DTBGOPTS ----
  804. #define DTBG_CLIPRECT 0x00000001 // rcClip has been specified
  805. #define DTBG_DRAWSOLID 0x00000002 // draw transparent/alpha images as solid
  806. #define DTBG_OMITBORDER 0x00000004 // don't draw border of part
  807. #define DTBG_OMITCONTENT 0x00000008 // don't draw content area of part
  808. #define DTBG_COMPUTINGREGION 0x00000010 // TRUE if calling to compute region
  809. #define DTBG_MIRRORDC 0x00000020 // assume the hdc is mirrorred and
  810. // flip images as appropriate (currently
  811. // only supported for bgtype=imagefile)
  812. //------------------------------------------------------------------------
  813. typedef struct _DTBGOPTS
  814. {
  815. DWORD dwSize; // size of the struct
  816. DWORD dwFlags; // which options have been specified
  817. RECT rcClip; // clipping rectangle
  818. }
  819. DTBGOPTS, *PDTBGOPTS;
  820. //------------------------------------------------------------------------
  821. // DrawThemeBackgroundEx()
  822. // - draws the theme-specified border and fill for
  823. // the "iPartId" and "iStateId". This could be
  824. // based on a bitmap file, a border and fill, or
  825. // other image description. NOTE: This will be
  826. // merged back into DrawThemeBackground() after
  827. // BETA 2.
  828. //
  829. // hTheme - theme data handle
  830. // hdc - HDC to draw into
  831. // iPartId - part number to draw
  832. // iStateId - state number (of the part) to draw
  833. // pRect - defines the size/location of the part
  834. // pOptions - ptr to optional params
  835. //------------------------------------------------------------------------
  836. THEMEAPI DrawThemeBackgroundEx(HTHEME hTheme, HDC hdc,
  837. int iPartId, int iStateId, const RECT *pRect, OPTIONAL const DTBGOPTS *pOptions);
  838. //---------------------------------------------------------------------------
  839. //#endif /* (_WIN32_WINNT >= 0x0500) *//
  840. //---------------------------------------------------------------------------
  841. #endif // _UXTHEME_H_
  842. //---------------------------------------------------------------------------