Move watermark and header bitmap loading code from

PROPSHEET_CreatePage into its own function PROPSHEET_LoadWizardBitmaps
and call this function from property sheet's dialog procedure.
oldstable
Eric Kohl 2004-08-09 19:48:04 +00:00 committed by Alexandre Julliard
parent 9cd9cfd2ed
commit bea0555890
1 changed files with 41 additions and 19 deletions

View File

@ -1529,29 +1529,19 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent,
(DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
pageWidth, pageHeight, padding.x, padding.y);
/* If there is a watermark, offset the dialog items */
if ( (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
(psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
((index == 0) || (index == psInfo->nPages - 1)) )
{
/* if PSH_USEHBMWATERMARK is not set, load the resource from pszbmWatermark
and put the HBITMAP in hbmWatermark. Thus all the rest of the code always
considers hbmWatermark as valid. */
if (!(psInfo->ppshheader.dwFlags & PSH_USEHBMWATERMARK))
{
((PropSheetInfo *)psInfo)->ppshheader.u4.hbmWatermark =
CreateMappedBitmap(ppshpage->hInstance, (INT)psInfo->ppshheader.u4.pszbmWatermark, 0, NULL, 0);
}
}
if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD) &&
psInfo->ppshheader.dwFlags & PSH_HEADER)
{
/* Same behavior as for watermarks */
if (!(psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER))
if ((ppshpage->dwFlags & PSP_USEHEADERTITLE) &&
(HIWORD(ppshpage->pszHeaderTitle) == 0))
{
((PropSheetInfo *)psInfo)->ppshheader.u5.hbmHeader =
CreateMappedBitmap(ppshpage->hInstance, (INT)psInfo->ppshheader.u5.pszbmHeader, 0, NULL, 0);
/* FIXME: load title string into ppshpage->pszHeaderTitle */
}
if ((ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) &&
(HIWORD(ppshpage->pszHeaderSubTitle) == 0))
{
/* FIXME: load title string into ppshpage->pszHeaderSubTitle */
}
hwndChild = GetDlgItem(hwndParent, IDC_SUNKEN_LINEHEADER);
@ -1585,6 +1575,36 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent,
return TRUE;
}
/******************************************************************************
* PROPSHEET_LoadWizardBitmaps
*
* Loads the watermark and header bitmaps for a wizard.
*/
static VOID PROPSHEET_LoadWizardBitmaps(PropSheetInfo *psInfo)
{
if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD))
{
/* if PSH_USEHBMWATERMARK is not set, load the resource from pszbmWatermark
and put the HBITMAP in hbmWatermark. Thus all the rest of the code always
considers hbmWatermark as valid. */
if ((psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
!(psInfo->ppshheader.dwFlags & PSH_USEHBMWATERMARK))
{
((PropSheetInfo *)psInfo)->ppshheader.u4.hbmWatermark =
CreateMappedBitmap(psInfo->ppshheader.hInstance, (INT)psInfo->ppshheader.u4.pszbmWatermark, 0, NULL, 0);
}
/* Same behavior as for watermarks */
if ((psInfo->ppshheader.dwFlags & PSH_HEADER) &&
!(psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER))
{
((PropSheetInfo *)psInfo)->ppshheader.u5.hbmHeader =
CreateMappedBitmap(psInfo->ppshheader.hInstance, (INT)psInfo->ppshheader.u5.pszbmHeader, 0, NULL, 0);
}
}
}
/******************************************************************************
* PROPSHEET_ShowPage
*
@ -3210,6 +3230,8 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
PROPSHEET_CreateTabControl(hwnd, psInfo);
PROPSHEET_LoadWizardBitmaps(psInfo);
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
{
ShowWindow(hwndTabCtrl, SW_HIDE);