summaryrefslogtreecommitdiff
path: root/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-10-27 15:29:19 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-11-01 16:34:09 -0500
commitdce1c97c7d3e76c18e4f80d4ffe288d2933a74bc (patch)
tree68dc0653ee1a6fe962d82dac2159c8ab00a95808 /src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
parentbad2e93524f376cfeb76d5231d4b08510bdad033 (diff)
downloadwix-dce1c97c7d3e76c18e4f80d4ffe288d2933a74bc.tar.gz
wix-dce1c97c7d3e76c18e4f80d4ffe288d2933a74bc.tar.bz2
wix-dce1c97c7d3e76c18e4f80d4ffe288d2933a74bc.zip
Make thmutil automatically load controls during window creation.
Add control loaded event.
Diffstat (limited to 'src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp')
-rw-r--r--src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp103
1 files changed, 55 insertions, 48 deletions
diff --git a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
index a5bcba3e..8304403a 100644
--- a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
+++ b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
@@ -230,18 +230,14 @@ private:
230 return lres; 230 return lres;
231 } 231 }
232 232
233 case WM_CREATE:
234 if (!pBaf->OnCreate(hWnd))
235 {
236 return -1;
237 }
238 break;
239
240 case WM_THMUTIL_LOADING_CONTROL: 233 case WM_THMUTIL_LOADING_CONTROL:
241 return pBaf->OnThemeLoadingControl(reinterpret_cast<THEME_LOADINGCONTROL_ARGS*>(wParam), reinterpret_cast<THEME_LOADINGCONTROL_RESULTS*>(lParam)); 234 return pBaf->OnThemeLoadingControl(reinterpret_cast<THEME_LOADINGCONTROL_ARGS*>(wParam), reinterpret_cast<THEME_LOADINGCONTROL_RESULTS*>(lParam));
242 235
236 case WM_THMUTIL_LOADED_CONTROL:
237 return pBaf->OnThemeLoadedControl(hWnd, reinterpret_cast<THEME_LOADEDCONTROL_ARGS*>(wParam), reinterpret_cast<THEME_LOADEDCONTROL_RESULTS*>(lParam));
238
243 case WM_TIMER: 239 case WM_TIMER:
244 if (!lParam && pBaf) 240 if (!lParam && BAFTHMUTILTESTING_CONTROL_PROGRESSBAR_IMAGE == wParam && pBaf)
245 { 241 {
246 pBaf->UpdateProgressBarProgress(); 242 pBaf->UpdateProgressBarProgress();
247 243
@@ -253,33 +249,14 @@ private:
253 return ThemeDefWindowProc(pBaf ? pBaf->m_pBafTheme : NULL, hWnd, uMsg, wParam, lParam); 249 return ThemeDefWindowProc(pBaf ? pBaf->m_pBafTheme : NULL, hWnd, uMsg, wParam, lParam);
254 } 250 }
255 251
256 BOOL OnCreate( 252 HRESULT OnCreatedListView(
257 __in HWND hWnd 253 __in HWND hWndListView
258 ) 254 )
259 { 255 {
260 HRESULT hr = S_OK; 256 HRESULT hr = S_OK;
261 LVITEMW lvitem = { }; 257 LVITEMW lvitem = { };
262 LVGROUP lvgroup = { }; 258 LVGROUP lvgroup = { };
263 static UINT puColumns[] = { 0, 1, 2 }; 259 static UINT puColumns[] = { 0, 1, 2 };
264 HWND hwndTopLeft = NULL;
265 HWND hwndTopRight = NULL;
266 HWND hwndBottomLeft = NULL;
267 HWND hwndBottomRight = NULL;
268
269 hr = ThemeLoadControls(m_pBafTheme);
270 BalExitOnFailure(hr, "Failed to load theme controls.");
271
272 hwndTopLeft = ::GetDlgItem(m_pBafTheme->hwndParent, BAFTHMUTILTESTING_CONTROL_LISTVIEW_TOP_LEFT);
273 BalExitOnNull(hwndTopLeft, hr, E_INVALIDSTATE, "Failed to get top left list view hWnd.");
274
275 hwndTopRight = ::GetDlgItem(m_pBafTheme->hwndParent, BAFTHMUTILTESTING_CONTROL_LISTVIEW_TOP_RIGHT);
276 BalExitOnNull(hwndTopRight, hr, E_INVALIDSTATE, "Failed to get top right list view hWnd.");
277
278 hwndBottomLeft = ::GetDlgItem(m_pBafTheme->hwndParent, BAFTHMUTILTESTING_CONTROL_LISTVIEW_BOTTOM_LEFT);
279 BalExitOnNull(hwndBottomLeft, hr, E_INVALIDSTATE, "Failed to get bottom left list view hWnd.");
280
281 hwndBottomRight = ::GetDlgItem(m_pBafTheme->hwndParent, BAFTHMUTILTESTING_CONTROL_LISTVIEW_BOTTOM_RIGHT);
282 BalExitOnNull(hwndBottomRight, hr, E_INVALIDSTATE, "Failed to get bottom right list view hWnd.");
283 260
284 lvgroup.cbSize = sizeof(LVGROUP); 261 lvgroup.cbSize = sizeof(LVGROUP);
285 lvgroup.mask = LVGF_GROUPID | LVGF_TITLEIMAGE | LVGF_DESCRIPTIONTOP | LVGF_HEADER; 262 lvgroup.mask = LVGF_GROUPID | LVGF_TITLEIMAGE | LVGF_DESCRIPTIONTOP | LVGF_HEADER;
@@ -295,10 +272,7 @@ private:
295 hr = StrAllocFormatted(&lvgroup.pszHeader, L"Header_%d", i); 272 hr = StrAllocFormatted(&lvgroup.pszHeader, L"Header_%d", i);
296 BalExitOnFailure(hr, "Failed to alloc list view group header."); 273 BalExitOnFailure(hr, "Failed to alloc list view group header.");
297 274
298 ListView_InsertGroup(hwndTopLeft, -1, &lvgroup); 275 ListView_InsertGroup(hWndListView, -1, &lvgroup);
299 ListView_InsertGroup(hwndTopRight, -1, &lvgroup);
300 ListView_InsertGroup(hwndBottomLeft, -1, &lvgroup);
301 ListView_InsertGroup(hwndBottomRight, -1, &lvgroup);
302 276
303 lvitem.mask = LVIF_COLUMNS | LVIF_GROUPID | LVIF_IMAGE | LVIF_TEXT; 277 lvitem.mask = LVIF_COLUMNS | LVIF_GROUPID | LVIF_IMAGE | LVIF_TEXT;
304 lvitem.iItem = i; 278 lvitem.iItem = i;
@@ -312,10 +286,7 @@ private:
312 lvitem.cColumns = countof(puColumns); 286 lvitem.cColumns = countof(puColumns);
313 lvitem.puColumns = puColumns; 287 lvitem.puColumns = puColumns;
314 288
315 ListView_InsertItem(hwndTopLeft, &lvitem); 289 ListView_InsertItem(hWndListView, &lvitem);
316 ListView_InsertItem(hwndTopRight, &lvitem);
317 ListView_InsertItem(hwndBottomLeft, &lvitem);
318 ListView_InsertItem(hwndBottomRight, &lvitem);
319 290
320 for (int j = 0; j < 3; ++j) 291 for (int j = 0; j < 3; ++j)
321 { 292 {
@@ -325,23 +296,16 @@ private:
325 hr = StrAllocFormatted(&lvitem.pszText, L"%d_%d", j, i); 296 hr = StrAllocFormatted(&lvitem.pszText, L"%d_%d", j, i);
326 BalExitOnFailure(hr, "Failed to alloc list view subitem text."); 297 BalExitOnFailure(hr, "Failed to alloc list view subitem text.");
327 298
328 ListView_InsertItem(hwndTopLeft, &lvitem); 299 ListView_InsertItem(hWndListView, &lvitem);
329 ListView_InsertItem(hwndTopRight, &lvitem);
330 ListView_InsertItem(hwndBottomLeft, &lvitem);
331 ListView_InsertItem(hwndBottomRight, &lvitem);
332 } 300 }
333 } 301 }
334 302
335 ListView_EnableGroupView(hwndTopRight, TRUE);
336
337 ::SetTimer(hWnd, BAFTHMUTILTESTING_CONTROL_PROGRESSBAR_IMAGE, 500, NULL);
338
339 LExit: 303 LExit:
340 ReleaseStr(lvgroup.pszDescriptionTop); 304 ReleaseStr(lvgroup.pszDescriptionTop);
341 ReleaseStr(lvgroup.pszHeader); 305 ReleaseStr(lvgroup.pszHeader);
342 ReleaseStr(lvitem.pszText); 306 ReleaseStr(lvitem.pszText);
343 307
344 return SUCCEEDED(hr); 308 return hr;
345 } 309 }
346 310
347 BOOL OnThemeLoadingControl( 311 BOOL OnThemeLoadingControl(
@@ -349,17 +313,60 @@ private:
349 __in THEME_LOADINGCONTROL_RESULTS* pResults 313 __in THEME_LOADINGCONTROL_RESULTS* pResults
350 ) 314 )
351 { 315 {
316 HRESULT hr = S_OK;
317 BOOL fProcessed = FALSE;
318
352 for (DWORD iAssignControl = 0; iAssignControl < countof(vrgInitControls); ++iAssignControl) 319 for (DWORD iAssignControl = 0; iAssignControl < countof(vrgInitControls); ++iAssignControl)
353 { 320 {
354 if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, pArgs->pThemeControl->sczName, -1, vrgInitControls[iAssignControl].wzName, -1)) 321 if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, pArgs->pThemeControl->sczName, -1, vrgInitControls[iAssignControl].wzName, -1))
355 { 322 {
323 fProcessed = TRUE;
356 pResults->wId = vrgInitControls[iAssignControl].wId; 324 pResults->wId = vrgInitControls[iAssignControl].wId;
357 break; 325 break;
358 } 326 }
359 } 327 }
360 328
361 pResults->hr = S_OK; 329 pResults->hr = hr;
362 return TRUE; 330 return fProcessed || FAILED(hr);
331 }
332
333 BOOL OnThemeLoadedControl(
334 __in HWND hWndParent,
335 __in const THEME_LOADEDCONTROL_ARGS* pArgs,
336 __in THEME_LOADEDCONTROL_RESULTS* pResults
337 )
338 {
339 HRESULT hr = S_OK;
340 BOOL fProcessed = FALSE;
341
342 switch (pArgs->pThemeControl->wId)
343 {
344 case BAFTHMUTILTESTING_CONTROL_LISTVIEW_TOP_LEFT:
345 case BAFTHMUTILTESTING_CONTROL_LISTVIEW_TOP_RIGHT:
346 case BAFTHMUTILTESTING_CONTROL_LISTVIEW_BOTTOM_LEFT:
347 case BAFTHMUTILTESTING_CONTROL_LISTVIEW_BOTTOM_RIGHT:
348 fProcessed = TRUE;
349
350 hr = OnCreatedListView(pArgs->pThemeControl->hWnd);
351 ExitOnFailure(hr, "Failed to populate list view.");
352
353 if (BAFTHMUTILTESTING_CONTROL_LISTVIEW_TOP_RIGHT == pArgs->pThemeControl->wId)
354 {
355 ListView_EnableGroupView(pArgs->pThemeControl->hWnd, TRUE);
356 }
357
358 break;
359
360 case BAFTHMUTILTESTING_CONTROL_PROGRESSBAR_STANDARD:
361 fProcessed = TRUE;
362
363 ::SetTimer(hWndParent, BAFTHMUTILTESTING_CONTROL_PROGRESSBAR_IMAGE, 500, NULL);
364 break;
365 }
366
367 LExit:
368 pResults->hr = hr;
369 return fProcessed || FAILED(hr);
363 } 370 }
364 371
365 void UpdateProgressBarProgress() 372 void UpdateProgressBarProgress()