diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-10-27 13:55:16 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-11-01 16:34:09 -0500 |
| commit | 8fa040da9d0d3826f5ffda6bcbec4f53abd97452 (patch) | |
| tree | a8a1094f3ac17bd6feed8a6f971c0d6008694345 /src/samples/thmviewer/thmviewer.cpp | |
| parent | 4917383e6f52f0e44f63c60a645f1dd7e8f8d5f9 (diff) | |
| download | wix-8fa040da9d0d3826f5ffda6bcbec4f53abd97452.tar.gz wix-8fa040da9d0d3826f5ffda6bcbec4f53abd97452.tar.bz2 wix-8fa040da9d0d3826f5ffda6bcbec4f53abd97452.zip | |
Allow more customization of control ids in thmutil.
Allow BAFunctions to set control ids.
Make sure control ids don't collide.
Diffstat (limited to 'src/samples/thmviewer/thmviewer.cpp')
| -rw-r--r-- | src/samples/thmviewer/thmviewer.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/samples/thmviewer/thmviewer.cpp b/src/samples/thmviewer/thmviewer.cpp index f83182d3..cffa3851 100644 --- a/src/samples/thmviewer/thmviewer.cpp +++ b/src/samples/thmviewer/thmviewer.cpp | |||
| @@ -14,10 +14,6 @@ enum THMVWR_CONTROL | |||
| 14 | THMVWR_CONTROL_TREE = THEME_FIRST_ASSIGN_CONTROL_ID, | 14 | THMVWR_CONTROL_TREE = THEME_FIRST_ASSIGN_CONTROL_ID, |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | static THEME_ASSIGN_CONTROL_ID vrgInitControls[] = { | ||
| 18 | { THMVWR_CONTROL_TREE, L"Tree" }, | ||
| 19 | }; | ||
| 20 | |||
| 21 | // Internal functions | 17 | // Internal functions |
| 22 | 18 | ||
| 23 | static HRESULT ProcessCommandLine( | 19 | static HRESULT ProcessCommandLine( |
| @@ -52,6 +48,10 @@ static void OnNewTheme( | |||
| 52 | __in HWND hWnd, | 48 | __in HWND hWnd, |
| 53 | __in HANDLE_THEME* pHandle | 49 | __in HANDLE_THEME* pHandle |
| 54 | ); | 50 | ); |
| 51 | static BOOL OnThemeLoadingControl( | ||
| 52 | __in const THEME_LOADINGCONTROL_ARGS* pArgs, | ||
| 53 | __in THEME_LOADINGCONTROL_RESULTS* pResults | ||
| 54 | ); | ||
| 55 | static void CALLBACK ThmviewerTraceError( | 55 | static void CALLBACK ThmviewerTraceError( |
| 56 | __in_z LPCSTR szFile, | 56 | __in_z LPCSTR szFile, |
| 57 | __in int iLine, | 57 | __in int iLine, |
| @@ -353,7 +353,7 @@ static LRESULT CALLBACK MainWndProc( | |||
| 353 | 353 | ||
| 354 | case WM_CREATE: | 354 | case WM_CREATE: |
| 355 | { | 355 | { |
| 356 | HRESULT hr = ThemeLoadControls(vpTheme, vrgInitControls, countof(vrgInitControls)); | 356 | HRESULT hr = ThemeLoadControls(vpTheme); |
| 357 | if (FAILED(hr)) | 357 | if (FAILED(hr)) |
| 358 | { | 358 | { |
| 359 | return -1; | 359 | return -1; |
| @@ -400,6 +400,9 @@ static LRESULT CALLBACK MainWndProc( | |||
| 400 | } | 400 | } |
| 401 | } | 401 | } |
| 402 | break; | 402 | break; |
| 403 | |||
| 404 | case WM_THMUTIL_LOADING_CONTROL: | ||
| 405 | return OnThemeLoadingControl(reinterpret_cast<THEME_LOADINGCONTROL_ARGS*>(wParam), reinterpret_cast<THEME_LOADINGCONTROL_RESULTS*>(lParam)); | ||
| 403 | } | 406 | } |
| 404 | 407 | ||
| 405 | return ThemeDefWindowProc(vpTheme, hWnd, uMsg, wParam, lParam); | 408 | return ThemeDefWindowProc(vpTheme, hWnd, uMsg, wParam, lParam); |
| @@ -541,3 +544,17 @@ static void OnNewTheme( | |||
| 541 | ThemeSendControlMessage(pTheme, THMVWR_CONTROL_TREE, TVM_SELECTITEM, TVGN_CARET, reinterpret_cast<LPARAM>(htiSelected)); | 544 | ThemeSendControlMessage(pTheme, THMVWR_CONTROL_TREE, TVM_SELECTITEM, TVGN_CARET, reinterpret_cast<LPARAM>(htiSelected)); |
| 542 | } | 545 | } |
| 543 | } | 546 | } |
| 547 | |||
| 548 | static BOOL OnThemeLoadingControl( | ||
| 549 | __in const THEME_LOADINGCONTROL_ARGS* pArgs, | ||
| 550 | __in THEME_LOADINGCONTROL_RESULTS* pResults | ||
| 551 | ) | ||
| 552 | { | ||
| 553 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, pArgs->pThemeControl->sczName, -1, L"Tree", -1)) | ||
| 554 | { | ||
| 555 | pResults->wId = THMVWR_CONTROL_TREE; | ||
| 556 | } | ||
| 557 | |||
| 558 | pResults->hr = S_OK; | ||
| 559 | return TRUE; | ||
| 560 | } | ||
