diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-10-27 14:42:32 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-11-01 16:34:09 -0500 |
commit | bad2e93524f376cfeb76d5231d4b08510bdad033 (patch) | |
tree | b201ec4b1495a0af4805ea6b0bc4fce9f8bde7b7 /src/samples | |
parent | 8fa040da9d0d3826f5ffda6bcbec4f53abd97452 (diff) | |
download | wix-bad2e93524f376cfeb76d5231d4b08510bdad033.tar.gz wix-bad2e93524f376cfeb76d5231d4b08510bdad033.tar.bz2 wix-bad2e93524f376cfeb76d5231d4b08510bdad033.zip |
Add more thmutil window messages to simplify handling control events.
Diffstat (limited to 'src/samples')
-rw-r--r-- | src/samples/thmviewer/thmviewer.cpp | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/src/samples/thmviewer/thmviewer.cpp b/src/samples/thmviewer/thmviewer.cpp index cffa3851..e593d6ad 100644 --- a/src/samples/thmviewer/thmviewer.cpp +++ b/src/samples/thmviewer/thmviewer.cpp | |||
@@ -52,6 +52,10 @@ static BOOL OnThemeLoadingControl( | |||
52 | __in const THEME_LOADINGCONTROL_ARGS* pArgs, | 52 | __in const THEME_LOADINGCONTROL_ARGS* pArgs, |
53 | __in THEME_LOADINGCONTROL_RESULTS* pResults | 53 | __in THEME_LOADINGCONTROL_RESULTS* pResults |
54 | ); | 54 | ); |
55 | static BOOL OnThemeControlWmNotify( | ||
56 | __in const THEME_CONTROLWMNOTIFY_ARGS* pArgs, | ||
57 | __in THEME_CONTROLWMNOTIFY_RESULTS* pResults | ||
58 | ); | ||
55 | static void CALLBACK ThmviewerTraceError( | 59 | static void CALLBACK ThmviewerTraceError( |
56 | __in_z LPCSTR szFile, | 60 | __in_z LPCSTR szFile, |
57 | __in int iLine, | 61 | __in int iLine, |
@@ -377,32 +381,11 @@ static LRESULT CALLBACK MainWndProc( | |||
377 | ::PostQuitMessage(0); | 381 | ::PostQuitMessage(0); |
378 | break; | 382 | break; |
379 | 383 | ||
380 | case WM_NOTIFY: | ||
381 | { | ||
382 | NMHDR* pnmhdr = reinterpret_cast<NMHDR*>(lParam); | ||
383 | switch (pnmhdr->code) | ||
384 | { | ||
385 | case TVN_SELCHANGEDW: | ||
386 | { | ||
387 | NMTREEVIEWW* ptv = reinterpret_cast<NMTREEVIEWW*>(lParam); | ||
388 | ::PostThreadMessageW(vdwDisplayThreadId, WM_THMVWR_SHOWPAGE, SW_HIDE, ptv->itemOld.lParam); | ||
389 | ::PostThreadMessageW(vdwDisplayThreadId, WM_THMVWR_SHOWPAGE, SW_SHOW, ptv->itemNew.lParam); | ||
390 | } | ||
391 | break; | ||
392 | |||
393 | //case NM_DBLCLK: | ||
394 | // TVITEM item = { }; | ||
395 | // item.mask = TVIF_PARAM; | ||
396 | // item.hItem = TreeView_GetSelection(pnmhdr->hwndFrom); | ||
397 | // TreeView_GetItem(pnmhdr->hwndFrom, &item); | ||
398 | // ::PostThreadMessageW(vdwDisplayThreadId, WM_THMVWR_SHOWPAGE, SW_SHOW, item.lParam); | ||
399 | // return 1; | ||
400 | } | ||
401 | } | ||
402 | break; | ||
403 | |||
404 | case WM_THMUTIL_LOADING_CONTROL: | 384 | case WM_THMUTIL_LOADING_CONTROL: |
405 | return OnThemeLoadingControl(reinterpret_cast<THEME_LOADINGCONTROL_ARGS*>(wParam), reinterpret_cast<THEME_LOADINGCONTROL_RESULTS*>(lParam)); | 385 | return OnThemeLoadingControl(reinterpret_cast<THEME_LOADINGCONTROL_ARGS*>(wParam), reinterpret_cast<THEME_LOADINGCONTROL_RESULTS*>(lParam)); |
386 | |||
387 | case WM_THMUTIL_CONTROL_WM_NOTIFY: | ||
388 | return OnThemeControlWmNotify(reinterpret_cast<THEME_CONTROLWMNOTIFY_ARGS*>(wParam), reinterpret_cast<THEME_CONTROLWMNOTIFY_RESULTS*>(lParam)); | ||
406 | } | 389 | } |
407 | 390 | ||
408 | return ThemeDefWindowProc(vpTheme, hWnd, uMsg, wParam, lParam); | 391 | return ThemeDefWindowProc(vpTheme, hWnd, uMsg, wParam, lParam); |
@@ -558,3 +541,29 @@ static BOOL OnThemeLoadingControl( | |||
558 | pResults->hr = S_OK; | 541 | pResults->hr = S_OK; |
559 | return TRUE; | 542 | return TRUE; |
560 | } | 543 | } |
544 | |||
545 | static BOOL OnThemeControlWmNotify( | ||
546 | __in const THEME_CONTROLWMNOTIFY_ARGS* pArgs, | ||
547 | __in THEME_CONTROLWMNOTIFY_RESULTS* /*pResults*/ | ||
548 | ) | ||
549 | { | ||
550 | BOOL fProcessed = FALSE; | ||
551 | |||
552 | switch (pArgs->lParam->code) | ||
553 | { | ||
554 | case TVN_SELCHANGEDW: | ||
555 | switch (pArgs->pThemeControl->wId) | ||
556 | { | ||
557 | case THMVWR_CONTROL_TREE: | ||
558 | NMTREEVIEWW* ptv = reinterpret_cast<NMTREEVIEWW*>(pArgs->lParam); | ||
559 | ::PostThreadMessageW(vdwDisplayThreadId, WM_THMVWR_SHOWPAGE, SW_HIDE, ptv->itemOld.lParam); | ||
560 | ::PostThreadMessageW(vdwDisplayThreadId, WM_THMVWR_SHOWPAGE, SW_SHOW, ptv->itemNew.lParam); | ||
561 | |||
562 | fProcessed = TRUE; | ||
563 | break; | ||
564 | } | ||
565 | break; | ||
566 | } | ||
567 | |||
568 | return fProcessed; | ||
569 | } | ||