| 1 | #pragma once |
| 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 3 | |
| 4 | |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | // forward declare |
| 10 | |
| 11 | typedef struct _THEME_CONTROL THEME_CONTROL; |
| 12 | typedef struct _THEME THEME; |
| 13 | |
| 14 | #define ReleaseTheme(p) if (p) { ThemeFree(p); p = NULL; } |
| 15 | |
| 16 | typedef HRESULT(CALLBACK *PFNTHM_EVALUATE_VARIABLE_CONDITION)( |
| 17 | __in_z LPCWSTR wzCondition, |
| 18 | __out BOOL* pf, |
| 19 | __in_opt LPVOID pvContext |
| 20 | ); |
| 21 | typedef HRESULT(CALLBACK *PFNTHM_FORMAT_VARIABLE_STRING)( |
| 22 | __in_z LPCWSTR wzFormat, |
| 23 | __inout LPWSTR* psczOut, |
| 24 | __in_opt LPVOID pvContext |
| 25 | ); |
| 26 | typedef HRESULT(CALLBACK *PFNTHM_GET_VARIABLE_NUMERIC)( |
| 27 | __in_z LPCWSTR wzVariable, |
| 28 | __out LONGLONG* pllValue, |
| 29 | __in_opt LPVOID pvContext |
| 30 | ); |
| 31 | typedef HRESULT(CALLBACK *PFNTHM_SET_VARIABLE_NUMERIC)( |
| 32 | __in_z LPCWSTR wzVariable, |
| 33 | __in LONGLONG llValue, |
| 34 | __in_opt LPVOID pvContext |
| 35 | ); |
| 36 | typedef HRESULT(CALLBACK *PFNTHM_GET_VARIABLE_STRING)( |
| 37 | __in_z LPCWSTR wzVariable, |
| 38 | __inout LPWSTR* psczValue, |
| 39 | __in_opt LPVOID pvContext |
| 40 | ); |
| 41 | typedef HRESULT(CALLBACK *PFNTHM_SET_VARIABLE_STRING)( |
| 42 | __in_z LPCWSTR wzVariable, |
| 43 | __in_z_opt LPCWSTR wzValue, |
| 44 | __in BOOL fFormatted, |
| 45 | __in_opt LPVOID pvContext |
| 46 | ); |
| 47 | |
| 48 | typedef enum THEME_ACTION_TYPE |
| 49 | { |
| 50 | THEME_ACTION_TYPE_BROWSE_DIRECTORY, |
| 51 | THEME_ACTION_TYPE_CHANGE_PAGE, |
| 52 | THEME_ACTION_TYPE_CLOSE_WINDOW, |
| 53 | } THEME_ACTION_TYPE; |
| 54 | |
| 55 | typedef enum THEME_CONTROL_DATA |
| 56 | { |
| 57 | THEME_CONTROL_DATA_HOVER = 1, |
| 58 | } THEME_CONTROL_DATA; |
| 59 | |
| 60 | typedef enum THEME_CONTROL_AUTOMATIC_BEHAVIOR_TYPE |
| 61 | { |
| 62 | THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL = 0x0, |
| 63 | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ENABLED = 0x1, |
| 64 | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VISIBLE = 0x2, |
| 65 | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ACTION = 0x4, |
| 66 | // For form controls like editboxes and checkboxes, |
| 67 | // the value will not be automatically persisted to a variable and |
| 68 | // the control's value will only be changed by the user. |
| 69 | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VALUE = 0x8, |
| 70 | // This has no effect on editboxes since their text is their value. |
| 71 | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_TEXT = 0x10, |
| 72 | } THEME_CONTROL_AUTOMATIC_BEHAVIOR_TYPE; |
| 73 | |
| 74 | typedef enum THEME_CONTROL_TYPE |
| 75 | { |
| 76 | THEME_CONTROL_TYPE_UNKNOWN, |
| 77 | THEME_CONTROL_TYPE_BILLBOARD, |
| 78 | THEME_CONTROL_TYPE_BUTTON, |
| 79 | THEME_CONTROL_TYPE_CHECKBOX, |
| 80 | THEME_CONTROL_TYPE_COMBOBOX, |
| 81 | THEME_CONTROL_TYPE_COMMANDLINK, |
| 82 | THEME_CONTROL_TYPE_EDITBOX, |
| 83 | THEME_CONTROL_TYPE_HYPERLINK, |
| 84 | THEME_CONTROL_TYPE_HYPERTEXT, |
| 85 | THEME_CONTROL_TYPE_IMAGE, |
| 86 | THEME_CONTROL_TYPE_LABEL, |
| 87 | THEME_CONTROL_TYPE_PANEL, |
| 88 | THEME_CONTROL_TYPE_PROGRESSBAR, |
| 89 | THEME_CONTROL_TYPE_RADIOBUTTON, |
| 90 | THEME_CONTROL_TYPE_RICHEDIT, |
| 91 | THEME_CONTROL_TYPE_STATIC, |
| 92 | THEME_CONTROL_TYPE_LISTVIEW, |
| 93 | THEME_CONTROL_TYPE_TREEVIEW, |
| 94 | THEME_CONTROL_TYPE_TAB, |
| 95 | } THEME_CONTROL_TYPE; |
| 96 | |
| 97 | typedef enum THEME_IMAGE_REFERENCE_TYPE |
| 98 | { |
| 99 | THEME_IMAGE_REFERENCE_TYPE_NONE, |
| 100 | THEME_IMAGE_REFERENCE_TYPE_PARTIAL, |
| 101 | THEME_IMAGE_REFERENCE_TYPE_COMPLETE, |
| 102 | } THEME_IMAGE_REFERENCE_TYPE; |
| 103 | |
| 104 | typedef enum THEME_SHOW_PAGE_REASON |
| 105 | { |
| 106 | THEME_SHOW_PAGE_REASON_DEFAULT, |
| 107 | THEME_SHOW_PAGE_REASON_CANCEL, |
| 108 | THEME_SHOW_PAGE_REASON_REFRESH, |
| 109 | } THEME_SHOW_PAGE_REASON; |
| 110 | |
| 111 | typedef enum THEME_WINDOW_INITIAL_POSITION |
| 112 | { |
| 113 | THEME_WINDOW_INITIAL_POSITION_DEFAULT, |
| 114 | THEME_WINDOW_INITIAL_POSITION_CENTER_MONITOR_FROM_COORDINATES, |
| 115 | } THEME_WINDOW_INITIAL_POSITION; |
| 116 | |
| 117 | // These messages are sent by thmutil to the parent window created in ThemeCreateParentWindow. |
| 118 | // thmutil reserves the last values of WM_USER's range. |
| 119 | typedef enum _WM_THMUTIL |
| 120 | { |
| 121 | // Sent while creating a control. |
| 122 | // wparam is THEME_LOADINGCONTROL_ARGS* and lparam is THEME_LOADINGCONTROL_RESULTS*. |
| 123 | // Return code is TRUE if it was processed. |
| 124 | WM_THMUTIL_LOADING_CONTROL = WM_APP - 1, |
| 125 | // Sent when WM_COMMAND is received for a control. |
| 126 | // wparam is THEME_CONTROLWMCOMMAND_ARGS* and lparam is THEME_CONTROLWMCOMMAND_RESULTS*. |
| 127 | // Return code is TRUE if it was processed. |
| 128 | WM_THMUTIL_CONTROL_WM_COMMAND = WM_APP - 2, |
| 129 | // Sent when WM_NOTIFY is received for a control. |
| 130 | // wparam is THEME_CONTROLWMNOTIFY_ARGS* and lparam is THEME_CONTROLWMNOTIFY_RESULTS*. |
| 131 | // Return code is TRUE to prevent further processing of the message. |
| 132 | WM_THMUTIL_CONTROL_WM_NOTIFY = WM_APP - 3, |
| 133 | // Sent after created a control. |
| 134 | // wparam is THEME_LOADEDCONTROL_ARGS* and lparam is THEME_LOADEDCONTROL_RESULTS*. |
| 135 | // Return code is TRUE if it was processed. |
| 136 | WM_THMUTIL_LOADED_CONTROL = WM_APP - 4, |
| 137 | } WM_THMUTIL; |
| 138 | |
| 139 | struct THEME_COLUMN |
| 140 | { |
| 141 | LPWSTR pszName; |
| 142 | UINT uStringId; |
| 143 | int nDefaultDpiBaseWidth; |
| 144 | int nBaseWidth; |
| 145 | int nWidth; |
| 146 | BOOL fExpands; |
| 147 | }; |
| 148 | |
| 149 | |
| 150 | struct THEME_IMAGE_REFERENCE |
| 151 | { |
| 152 | THEME_IMAGE_REFERENCE_TYPE type; |
| 153 | DWORD dwImageIndex; |
| 154 | DWORD dwImageInstanceIndex; |
| 155 | int nX; |
| 156 | int nY; |
| 157 | int nHeight; |
| 158 | int nWidth; |
| 159 | }; |
| 160 | |
| 161 | struct THEME_IMAGE_INSTANCE |
| 162 | { |
| 163 | Gdiplus::Bitmap* pBitmap; |
| 164 | }; |
| 165 | |
| 166 | struct THEME_IMAGE |
| 167 | { |
| 168 | LPWSTR sczId; |
| 169 | DWORD dwIndex; |
| 170 | |
| 171 | DWORD cImageInstances; |
| 172 | THEME_IMAGE_INSTANCE* rgImageInstances; |
| 173 | }; |
| 174 | |
| 175 | |
| 176 | struct THEME_TAB |
| 177 | { |
| 178 | LPWSTR pszName; |
| 179 | UINT uStringId; |
| 180 | }; |
| 181 | |
| 182 | struct THEME_ACTION |
| 183 | { |
| 184 | LPWSTR sczCondition; |
| 185 | THEME_ACTION_TYPE type; |
| 186 | union |
| 187 | { |
| 188 | struct |
| 189 | { |
| 190 | LPWSTR sczVariableName; |
| 191 | } BrowseDirectory; |
| 192 | struct |
| 193 | { |
| 194 | LPWSTR sczPageName; |
| 195 | BOOL fCancel; |
| 196 | } ChangePage; |
| 197 | }; |
| 198 | }; |
| 199 | |
| 200 | struct THEME_CONDITIONAL_TEXT |
| 201 | { |
| 202 | LPWSTR sczCondition; |
| 203 | LPWSTR sczText; |
| 204 | }; |
| 205 | |
| 206 | // THEME_ASSIGN_CONTROL_ID - Used to apply a specific id to a named control (usually |
| 207 | // to set the WM_COMMAND). |
| 208 | struct THEME_ASSIGN_CONTROL_ID |
| 209 | { |
| 210 | WORD wId; // id to apply to control |
| 211 | LPCWSTR wzName; // name of control to match |
| 212 | const THEME_CONTROL** ppControl; |
| 213 | DWORD dwAutomaticBehaviorType; // prevent declarative functionality from interfering with the application's imperative code |
| 214 | }; |
| 215 | |
| 216 | const WORD THEME_FIRST_ASSIGN_CONTROL_ID = 0x4000; // Recommended first control id to be assigned. |
| 217 | |
| 218 | typedef struct _THEME_CONTROL |
| 219 | { |
| 220 | THEME_CONTROL_TYPE type; |
| 221 | |
| 222 | WORD wId; |
| 223 | WORD wPageId; |
| 224 | |
| 225 | LPWSTR sczName; // optional name for control, used to apply control id and link the control to a variable. |
| 226 | LPWSTR sczText; |
| 227 | LPWSTR sczTooltip; |
| 228 | LPWSTR sczNote; // optional text for command link |
| 229 | int nDefaultDpiX; |
| 230 | int nDefaultDpiY; |
| 231 | int nDefaultDpiHeight; |
| 232 | int nDefaultDpiWidth; |
| 233 | int nX; |
| 234 | int nY; |
| 235 | int nHeight; |
| 236 | int nWidth; |
| 237 | UINT uStringId; |
| 238 | |
| 239 | LPWSTR sczEnableCondition; |
| 240 | LPWSTR sczVisibleCondition; |
| 241 | |
| 242 | BOOL fAutomaticEnabled; |
| 243 | BOOL fAutomaticVisible; |
| 244 | BOOL fAutomaticAction; |
| 245 | BOOL fAutomaticValue; |
| 246 | BOOL fAutomaticText; |
| 247 | |
| 248 | union |
| 249 | { |
| 250 | struct |
| 251 | { |
| 252 | THEME_IMAGE_REFERENCE rgImageRef[4]; |
| 253 | } Button; |
| 254 | struct |
| 255 | { |
| 256 | HBITMAP hImage; |
| 257 | HICON hIcon; |
| 258 | |
| 259 | DWORD cConditionalNotes; |
| 260 | THEME_CONDITIONAL_TEXT* rgConditionalNotes; |
| 261 | } CommandLink; |
| 262 | struct |
| 263 | { |
| 264 | THEME_IMAGE_REFERENCE imageRef; |
| 265 | } Image; |
| 266 | struct |
| 267 | { |
| 268 | // Don't free these; it's just a handle to the central image lists stored in THEME. The handle is freed once, there. |
| 269 | HIMAGELIST rghImageList[4]; |
| 270 | |
| 271 | THEME_COLUMN* ptcColumns; |
| 272 | DWORD cColumns; |
| 273 | } ListView; |
| 274 | struct |
| 275 | { |
| 276 | DWORD cImageRef; |
| 277 | THEME_IMAGE_REFERENCE* rgImageRef; |
| 278 | } ProgressBar; |
| 279 | }; |
| 280 | |
| 281 | DWORD dwStyle; |
| 282 | DWORD dwExtendedStyle; |
| 283 | DWORD dwInternalStyle; |
| 284 | |
| 285 | DWORD dwFontId; |
| 286 | |
| 287 | // child controls |
| 288 | DWORD cControls; |
| 289 | THEME_CONTROL* rgControls; |
| 290 | |
| 291 | // Used by billboard controls |
| 292 | WORD wBillboardInterval; |
| 293 | BOOL fBillboardLoops; |
| 294 | |
| 295 | // Used by button and command link controls |
| 296 | THEME_ACTION* rgActions; |
| 297 | DWORD cActions; |
| 298 | THEME_ACTION* pDefaultAction; |
| 299 | |
| 300 | // Used by hyperlink and owner-drawn button controls |
| 301 | DWORD dwFontHoverId; |
| 302 | DWORD dwFontSelectedId; |
| 303 | |
| 304 | // Used by radio button controls |
| 305 | BOOL fLastRadioButton; |
| 306 | LPWSTR sczValue; |
| 307 | LPWSTR sczVariable; |
| 308 | |
| 309 | // Used by tab controls |
| 310 | THEME_TAB *pttTabs; |
| 311 | DWORD cTabs; |
| 312 | |
| 313 | // Used by controls that have text |
| 314 | DWORD cConditionalText; |
| 315 | THEME_CONDITIONAL_TEXT* rgConditionalText; |
| 316 | |
| 317 | // state variables that should be ignored |
| 318 | HWND hWnd; |
| 319 | DWORD dwData; // type specific data |
| 320 | THEME* pTheme; |
| 321 | } THEME_CONTROL; |
| 322 | |
| 323 | |
| 324 | struct THEME_IMAGELIST |
| 325 | { |
| 326 | LPWSTR sczName; |
| 327 | |
| 328 | HIMAGELIST hImageList; |
| 329 | }; |
| 330 | |
| 331 | struct THEME_SAVEDVARIABLE |
| 332 | { |
| 333 | LPWSTR wzName; |
| 334 | LPWSTR sczValue; |
| 335 | }; |
| 336 | |
| 337 | struct THEME_PAGE |
| 338 | { |
| 339 | WORD wId; |
| 340 | LPWSTR sczName; |
| 341 | |
| 342 | DWORD cControlIndices; |
| 343 | |
| 344 | DWORD cSavedVariables; |
| 345 | THEME_SAVEDVARIABLE* rgSavedVariables; |
| 346 | }; |
| 347 | |
| 348 | struct THEME_FONT_INSTANCE |
| 349 | { |
| 350 | UINT nDpi; |
| 351 | HFONT hFont; |
| 352 | }; |
| 353 | |
| 354 | struct THEME_FONT |
| 355 | { |
| 356 | LPWSTR sczId; |
| 357 | DWORD dwIndex; |
| 358 | LONG lfHeight; |
| 359 | LONG lfWeight; |
| 360 | BYTE lfUnderline; |
| 361 | BYTE lfQuality; |
| 362 | LPWSTR sczFaceName; |
| 363 | |
| 364 | COLORREF crForeground; |
| 365 | HBRUSH hForeground; |
| 366 | COLORREF crBackground; |
| 367 | HBRUSH hBackground; |
| 368 | |
| 369 | DWORD cFontInstances; |
| 370 | THEME_FONT_INSTANCE* rgFontInstances; |
| 371 | }; |
| 372 | |
| 373 | |
| 374 | typedef struct _THEME |
| 375 | { |
| 376 | WORD wNextControlId; |
| 377 | |
| 378 | BOOL fAutoResize; |
| 379 | BOOL fForceResize; |
| 380 | |
| 381 | DWORD dwStyle; |
| 382 | DWORD dwFontId; |
| 383 | HANDLE hIcon; |
| 384 | LPWSTR sczCaption; |
| 385 | int nDefaultDpiHeight; |
| 386 | int nDefaultDpiMinimumHeight; |
| 387 | int nDefaultDpiWidth; |
| 388 | int nDefaultDpiMinimumWidth; |
| 389 | int nHeight; |
| 390 | int nMinimumHeight; |
| 391 | int nWidth; |
| 392 | int nMinimumWidth; |
| 393 | int nWindowHeight; |
| 394 | int nWindowWidth; |
| 395 | UINT uStringId; |
| 396 | |
| 397 | DWORD dwSourceImageInstanceIndex; |
| 398 | THEME_IMAGE_REFERENCE windowImageRef; |
| 399 | |
| 400 | DWORD cFonts; |
| 401 | THEME_FONT* rgFonts; |
| 402 | |
| 403 | DWORD cImages; |
| 404 | THEME_IMAGE* rgImages; |
| 405 | |
| 406 | DWORD cStandaloneImages; |
| 407 | THEME_IMAGE_INSTANCE* rgStandaloneImages; |
| 408 | |
| 409 | DWORD cPages; |
| 410 | THEME_PAGE* rgPages; |
| 411 | |
| 412 | DWORD cImageLists; |
| 413 | THEME_IMAGELIST* rgImageLists; |
| 414 | |
| 415 | DWORD cControls; |
| 416 | THEME_CONTROL* rgControls; |
| 417 | |
| 418 | // internal state variables -- do not use outside ThmUtil.cpp |
| 419 | STRINGDICT_HANDLE sdhFontDictionary; |
| 420 | STRINGDICT_HANDLE sdhImageDictionary; |
| 421 | HWND hwndParent; // parent for loaded controls |
| 422 | HWND hwndHover; // current hwnd hovered over |
| 423 | DWORD dwCurrentPageId; |
| 424 | HWND hwndTooltip; |
| 425 | |
| 426 | UINT nDpi; |
| 427 | |
| 428 | // callback functions |
| 429 | PFNTHM_EVALUATE_VARIABLE_CONDITION pfnEvaluateCondition; |
| 430 | PFNTHM_FORMAT_VARIABLE_STRING pfnFormatString; |
| 431 | PFNTHM_GET_VARIABLE_NUMERIC pfnGetNumericVariable; |
| 432 | PFNTHM_SET_VARIABLE_NUMERIC pfnSetNumericVariable; |
| 433 | PFNTHM_GET_VARIABLE_STRING pfnGetStringVariable; |
| 434 | PFNTHM_SET_VARIABLE_STRING pfnSetStringVariable; |
| 435 | |
| 436 | LPVOID pvVariableContext; |
| 437 | } THEME; |
| 438 | |
| 439 | typedef struct _THEME_CONTROLWMCOMMAND_ARGS |
| 440 | { |
| 441 | DWORD cbSize; |
| 442 | WPARAM wParam; |
| 443 | const THEME_CONTROL* pThemeControl; |
| 444 | } THEME_CONTROLWMCOMMAND_ARGS; |
| 445 | |
| 446 | typedef struct _THEME_CONTROLWMCOMMAND_RESULTS |
| 447 | { |
| 448 | DWORD cbSize; |
| 449 | LRESULT lResult; |
| 450 | } THEME_CONTROLWMCOMMAND_RESULTS; |
| 451 | |
| 452 | typedef struct _THEME_CONTROLWMNOTIFY_ARGS |
| 453 | { |
| 454 | DWORD cbSize; |
| 455 | LPNMHDR lParam; |
| 456 | const THEME_CONTROL* pThemeControl; |
| 457 | } THEME_CONTROLWMNOTIFY_ARGS; |
| 458 | |
| 459 | typedef struct _THEME_CONTROLWMNOTIFY_RESULTS |
| 460 | { |
| 461 | DWORD cbSize; |
| 462 | LRESULT lResult; |
| 463 | } THEME_CONTROLWMNOTIFY_RESULTS; |
| 464 | |
| 465 | typedef struct _THEME_LOADEDCONTROL_ARGS |
| 466 | { |
| 467 | DWORD cbSize; |
| 468 | const THEME_CONTROL* pThemeControl; |
| 469 | } THEME_LOADEDCONTROL_ARGS; |
| 470 | |
| 471 | typedef struct _THEME_LOADEDCONTROL_RESULTS |
| 472 | { |
| 473 | DWORD cbSize; |
| 474 | HRESULT hr; |
| 475 | } THEME_LOADEDCONTROL_RESULTS; |
| 476 | |
| 477 | typedef struct _THEME_LOADINGCONTROL_ARGS |
| 478 | { |
| 479 | DWORD cbSize; |
| 480 | const THEME_CONTROL* pThemeControl; |
| 481 | } THEME_LOADINGCONTROL_ARGS; |
| 482 | |
| 483 | typedef struct _THEME_LOADINGCONTROL_RESULTS |
| 484 | { |
| 485 | DWORD cbSize; |
| 486 | HRESULT hr; |
| 487 | |
| 488 | // Used to apply a specific id to the control (usually used for WM_COMMAND). |
| 489 | // If assigning an id, it is recommended to start with THEME_FIRST_ASSIGN_CONTROL_ID to avoid collisions with well known ids such as IDOK and IDCANCEL. |
| 490 | // The values [100, THEME_FIRST_ASSIGN_CONTROL_ID) are reserved for thmutil. |
| 491 | // Due to this value being packed into 16 bits for many system window messages, this is restricted to a WORD. |
| 492 | WORD wId; |
| 493 | // Used to prevent declarative functionality from interfering with the application's imperative code. |
| 494 | DWORD dwAutomaticBehaviorType; |
| 495 | } THEME_LOADINGCONTROL_RESULTS; |
| 496 | |
| 497 | |
| 498 | /******************************************************************** |
| 499 | ThemeInitialize - initialized theme management. |
| 500 | |
| 501 | *******************************************************************/ |
| 502 | HRESULT DAPI ThemeInitialize( |
| 503 | __in_opt HMODULE hModule |
| 504 | ); |
| 505 | |
| 506 | /******************************************************************** |
| 507 | ThemeUninitialize - uninitialize theme management. |
| 508 | |
| 509 | *******************************************************************/ |
| 510 | void DAPI ThemeUninitialize(); |
| 511 | |
| 512 | /******************************************************************** |
| 513 | ThemeLoadFromFile - loads a theme from a loose file. |
| 514 | |
| 515 | *******************************************************************/ |
| 516 | HRESULT DAPI ThemeLoadFromFile( |
| 517 | __in_z LPCWSTR wzThemeFile, |
| 518 | __out THEME** ppTheme |
| 519 | ); |
| 520 | |
| 521 | /******************************************************************** |
| 522 | ThemeLoadFromResource - loads a theme from a module's data resource. |
| 523 | |
| 524 | NOTE: The resource data must be UTF-8 encoded. |
| 525 | *******************************************************************/ |
| 526 | HRESULT DAPI ThemeLoadFromResource( |
| 527 | __in_opt HMODULE hModule, |
| 528 | __in_z LPCSTR szResource, |
| 529 | __out THEME** ppTheme |
| 530 | ); |
| 531 | |
| 532 | /******************************************************************** |
| 533 | ThemeFree - frees any memory associated with a theme. |
| 534 | |
| 535 | *******************************************************************/ |
| 536 | void DAPI ThemeFree( |
| 537 | __in THEME* pTheme |
| 538 | ); |
| 539 | |
| 540 | /******************************************************************** |
| 541 | ThemeRegisterVariableCallbacks - registers a context and callbacks |
| 542 | for working with variables. |
| 543 | |
| 544 | *******************************************************************/ |
| 545 | HRESULT DAPI ThemeRegisterVariableCallbacks( |
| 546 | __in THEME* pTheme, |
| 547 | __in_opt PFNTHM_EVALUATE_VARIABLE_CONDITION pfnEvaluateCondition, |
| 548 | __in_opt PFNTHM_FORMAT_VARIABLE_STRING pfnFormatString, |
| 549 | __in_opt PFNTHM_GET_VARIABLE_NUMERIC pfnGetNumericVariable, |
| 550 | __in_opt PFNTHM_SET_VARIABLE_NUMERIC pfnSetNumericVariable, |
| 551 | __in_opt PFNTHM_GET_VARIABLE_STRING pfnGetStringVariable, |
| 552 | __in_opt PFNTHM_SET_VARIABLE_STRING pfnSetStringVariable, |
| 553 | __in_opt LPVOID pvContext |
| 554 | ); |
| 555 | |
| 556 | /******************************************************************** |
| 557 | ThemeInitializeWindowClass - sets defaults for the window class |
| 558 | from the given theme. |
| 559 | |
| 560 | *******************************************************************/ |
| 561 | void DAPI ThemeInitializeWindowClass( |
| 562 | __in THEME* pTheme, |
| 563 | __in WNDCLASSW* pWndClass, |
| 564 | __in WNDPROC pfnWndProc, |
| 565 | __in HINSTANCE hInstance, |
| 566 | __in LPCWSTR wzClassName |
| 567 | ); |
| 568 | |
| 569 | /******************************************************************** |
| 570 | ThemeCreateParentWindow - creates a parent window for the theme. |
| 571 | |
| 572 | *******************************************************************/ |
| 573 | HRESULT DAPI ThemeCreateParentWindow( |
| 574 | __in THEME* pTheme, |
| 575 | __in DWORD dwExStyle, |
| 576 | __in LPCWSTR szClassName, |
| 577 | __in LPCWSTR szWindowName, |
| 578 | __in DWORD dwStyle, |
| 579 | __in int x, |
| 580 | __in int y, |
| 581 | __in_opt HWND hwndParent, |
| 582 | __in_opt HINSTANCE hInstance, |
| 583 | __in_opt LPVOID lpParam, |
| 584 | __in THEME_WINDOW_INITIAL_POSITION initialPosition, |
| 585 | __out_opt HWND* phWnd |
| 586 | ); |
| 587 | |
| 588 | /******************************************************************** |
| 589 | ThemeLocalize - Localizes all of the strings in the theme. |
| 590 | |
| 591 | *******************************************************************/ |
| 592 | HRESULT DAPI ThemeLocalize( |
| 593 | __in THEME *pTheme, |
| 594 | __in const WIX_LOCALIZATION *pLocStringSet |
| 595 | ); |
| 596 | |
| 597 | HRESULT DAPI ThemeLoadStrings( |
| 598 | __in THEME* pTheme, |
| 599 | __in HMODULE hResModule |
| 600 | ); |
| 601 | |
| 602 | /******************************************************************** |
| 603 | ThemeLoadRichEditFromFile - Attach a richedit control to a RTF file. |
| 604 | |
| 605 | *******************************************************************/ |
| 606 | HRESULT DAPI ThemeLoadRichEditFromFile( |
| 607 | __in const THEME_CONTROL* pThemeControl, |
| 608 | __in_z LPCWSTR wzFileName, |
| 609 | __in HMODULE hModule |
| 610 | ); |
| 611 | |
| 612 | /******************************************************************** |
| 613 | ThemeLoadRichEditFromResource - Attach a richedit control to resource data. |
| 614 | |
| 615 | *******************************************************************/ |
| 616 | HRESULT DAPI ThemeLoadRichEditFromResource( |
| 617 | __in const THEME_CONTROL* pThemeControl, |
| 618 | __in_z LPCSTR szResourceName, |
| 619 | __in HMODULE hModule |
| 620 | ); |
| 621 | |
| 622 | /******************************************************************** |
| 623 | ThemeHandleKeyboardMessage - will translate the message using the active |
| 624 | accelerator table. |
| 625 | |
| 626 | *******************************************************************/ |
| 627 | BOOL DAPI ThemeHandleKeyboardMessage( |
| 628 | __in_opt THEME* pTheme, |
| 629 | __in HWND hWnd, |
| 630 | __in MSG* pMsg |
| 631 | ); |
| 632 | |
| 633 | /******************************************************************** |
| 634 | ThemeDefWindowProc - replacement for DefWindowProc() when using theme. |
| 635 | |
| 636 | *******************************************************************/ |
| 637 | LRESULT CALLBACK ThemeDefWindowProc( |
| 638 | __in_opt THEME* pTheme, |
| 639 | __in HWND hWnd, |
| 640 | __in UINT uMsg, |
| 641 | __in WPARAM wParam, |
| 642 | __in LPARAM lParam |
| 643 | ); |
| 644 | |
| 645 | /******************************************************************** |
| 646 | ThemeGetPageIds - gets the page ids for the theme via page names. |
| 647 | |
| 648 | *******************************************************************/ |
| 649 | void DAPI ThemeGetPageIds( |
| 650 | __in const THEME* pTheme, |
| 651 | __in_ecount(cGetPages) LPCWSTR* rgwzFindNames, |
| 652 | __inout_ecount(cGetPages) DWORD* rgdwPageIds, |
| 653 | __in DWORD cGetPages |
| 654 | ); |
| 655 | |
| 656 | /******************************************************************** |
| 657 | ThemeGetPage - gets a theme page by id. |
| 658 | |
| 659 | *******************************************************************/ |
| 660 | THEME_PAGE* DAPI ThemeGetPage( |
| 661 | __in const THEME* pTheme, |
| 662 | __in DWORD dwPage |
| 663 | ); |
| 664 | |
| 665 | /******************************************************************** |
| 666 | ThemeShowPage - shows or hides all of the controls in the page at one time. |
| 667 | |
| 668 | *******************************************************************/ |
| 669 | HRESULT DAPI ThemeShowPage( |
| 670 | __in THEME* pTheme, |
| 671 | __in DWORD dwPage, |
| 672 | __in int nCmdShow |
| 673 | ); |
| 674 | |
| 675 | /******************************************************************** |
| 676 | ThemeShowPageEx - shows or hides all of the controls in the page at one time. |
| 677 | When using variables, TSPR_CANCEL reverts any changes made. |
| 678 | TSPR_REFRESH forces reevaluation of conditions. |
| 679 | It is expected that the current page is hidden before |
| 680 | showing a new page. |
| 681 | |
| 682 | *******************************************************************/ |
| 683 | HRESULT DAPI ThemeShowPageEx( |
| 684 | __in THEME* pTheme, |
| 685 | __in DWORD dwPage, |
| 686 | __in int nCmdShow, |
| 687 | __in THEME_SHOW_PAGE_REASON reason |
| 688 | ); |
| 689 | |
| 690 | |
| 691 | /******************************************************************** |
| 692 | ThemeShowChild - shows a control's specified child control, hiding the rest. |
| 693 | |
| 694 | *******************************************************************/ |
| 695 | void DAPI ThemeShowChild( |
| 696 | __in THEME_CONTROL* pParentControl, |
| 697 | __in DWORD dwIndex |
| 698 | ); |
| 699 | |
| 700 | /******************************************************************** |
| 701 | ThemeControlExistsByHwnd - check if a control with the specified hWnd exists. |
| 702 | |
| 703 | *******************************************************************/ |
| 704 | BOOL DAPI ThemeControlExistsByHWnd( |
| 705 | __in const THEME* pTheme, |
| 706 | __in HWND hWnd, |
| 707 | __out_opt const THEME_CONTROL** ppThemeControl |
| 708 | ); |
| 709 | |
| 710 | /******************************************************************** |
| 711 | ThemeControlExistsById - check if a control with the specified id exists. |
| 712 | |
| 713 | *******************************************************************/ |
| 714 | BOOL DAPI ThemeControlExistsById( |
| 715 | __in const THEME* pTheme, |
| 716 | __in WORD wId, |
| 717 | __out_opt const THEME_CONTROL** ppThemeControl |
| 718 | ); |
| 719 | |
| 720 | /******************************************************************** |
| 721 | ThemeControlEnable - enables/disables a control. |
| 722 | |
| 723 | *******************************************************************/ |
| 724 | void DAPI ThemeControlEnable( |
| 725 | __in const THEME_CONTROL* pThemeControl, |
| 726 | __in BOOL fEnable |
| 727 | ); |
| 728 | |
| 729 | /******************************************************************** |
| 730 | ThemeControlEnabled - returns whether a control is enabled/disabled. |
| 731 | |
| 732 | *******************************************************************/ |
| 733 | BOOL DAPI ThemeControlEnabled( |
| 734 | __in const THEME_CONTROL* pThemeControl |
| 735 | ); |
| 736 | |
| 737 | /******************************************************************** |
| 738 | ThemeControlElevates - sets/removes the shield icon on a control. |
| 739 | |
| 740 | *******************************************************************/ |
| 741 | void DAPI ThemeControlElevates( |
| 742 | __in const THEME_CONTROL* pThemeControl, |
| 743 | __in BOOL fElevates |
| 744 | ); |
| 745 | |
| 746 | /******************************************************************** |
| 747 | ThemeShowControl - shows/hides a control. |
| 748 | |
| 749 | *******************************************************************/ |
| 750 | void DAPI ThemeShowControl( |
| 751 | __in const THEME_CONTROL* pThemeControl, |
| 752 | __in int nCmdShow |
| 753 | ); |
| 754 | |
| 755 | /******************************************************************** |
| 756 | ThemeShowControlEx - shows/hides a control with support for |
| 757 | conditional text and notes. |
| 758 | |
| 759 | *******************************************************************/ |
| 760 | void DAPI ThemeShowControlEx( |
| 761 | __in const THEME_CONTROL* pThemeControl, |
| 762 | __in int nCmdShow |
| 763 | ); |
| 764 | |
| 765 | /******************************************************************** |
| 766 | ThemeControlVisible - returns whether a control is visible. |
| 767 | |
| 768 | *******************************************************************/ |
| 769 | BOOL DAPI ThemeControlVisible( |
| 770 | __in const THEME_CONTROL* pThemeControl |
| 771 | ); |
| 772 | |
| 773 | /******************************************************************** |
| 774 | ThemeDrawBackground - draws the theme background. |
| 775 | |
| 776 | *******************************************************************/ |
| 777 | HRESULT DAPI ThemeDrawBackground( |
| 778 | __in THEME* pTheme, |
| 779 | __in PAINTSTRUCT* pps |
| 780 | ); |
| 781 | |
| 782 | /******************************************************************** |
| 783 | ThemeDrawControl - draw an owner drawn control. |
| 784 | |
| 785 | *******************************************************************/ |
| 786 | HRESULT DAPI ThemeDrawControl( |
| 787 | __in THEME* pTheme, |
| 788 | __in DRAWITEMSTRUCT* pdis |
| 789 | ); |
| 790 | |
| 791 | /******************************************************************** |
| 792 | ThemeIsControlChecked - gets whether a control is checked. Only |
| 793 | really useful for checkbox controls. |
| 794 | |
| 795 | *******************************************************************/ |
| 796 | BOOL DAPI ThemeIsControlChecked( |
| 797 | __in const THEME_CONTROL* pThemeControl |
| 798 | ); |
| 799 | |
| 800 | /******************************************************************** |
| 801 | ThemeSetProgressControl - sets the current percentage complete in a |
| 802 | progress bar control. |
| 803 | |
| 804 | *******************************************************************/ |
| 805 | HRESULT DAPI ThemeSetProgressControl( |
| 806 | __in const THEME_CONTROL* pThemeControl, |
| 807 | __in DWORD dwProgressPercentage |
| 808 | ); |
| 809 | |
| 810 | /******************************************************************** |
| 811 | ThemeSetProgressControlColor - sets the current color of a |
| 812 | progress bar control. |
| 813 | |
| 814 | *******************************************************************/ |
| 815 | HRESULT DAPI ThemeSetProgressControlColor( |
| 816 | __in const THEME_CONTROL* pThemeControl, |
| 817 | __in DWORD dwColorIndex |
| 818 | ); |
| 819 | |
| 820 | /******************************************************************** |
| 821 | ThemeSetTextControl - sets the text of a control. |
| 822 | |
| 823 | *******************************************************************/ |
| 824 | HRESULT DAPI ThemeSetTextControl( |
| 825 | __in const THEME_CONTROL* pThemeControl, |
| 826 | __in_z_opt LPCWSTR wzText |
| 827 | ); |
| 828 | |
| 829 | /******************************************************************** |
| 830 | ThemeSetTextControl - sets the text of a control and optionally |
| 831 | invalidates the control. |
| 832 | |
| 833 | *******************************************************************/ |
| 834 | HRESULT DAPI ThemeSetTextControlEx( |
| 835 | __in const THEME_CONTROL* pThemeControl, |
| 836 | __in BOOL fUpdate, |
| 837 | __in_z_opt LPCWSTR wzText |
| 838 | ); |
| 839 | |
| 840 | /******************************************************************** |
| 841 | ThemeGetTextControl - gets the text of a control. |
| 842 | |
| 843 | *******************************************************************/ |
| 844 | HRESULT DAPI ThemeGetTextControl( |
| 845 | __in const THEME_CONTROL* pThemeControl, |
| 846 | __inout_z LPWSTR* psczText |
| 847 | ); |
| 848 | |
| 849 | /******************************************************************** |
| 850 | ThemeUpdateCaption - updates the caption in the theme. |
| 851 | |
| 852 | *******************************************************************/ |
| 853 | HRESULT DAPI ThemeUpdateCaption( |
| 854 | __in THEME* pTheme, |
| 855 | __in_z LPCWSTR wzCaption |
| 856 | ); |
| 857 | |
| 858 | /******************************************************************** |
| 859 | ThemeSetFocus - set the focus to the control supplied or the next |
| 860 | enabled control if it is disabled. |
| 861 | |
| 862 | *******************************************************************/ |
| 863 | void DAPI ThemeSetFocus( |
| 864 | __in const THEME_CONTROL* pThemeControl |
| 865 | ); |
| 866 | |
| 867 | #ifdef __cplusplus |
| 868 | } |
| 869 | #endif |
| 870 |