1998-12-10 16:49:22 +01:00
|
|
|
/*
|
|
|
|
* Property Sheets
|
|
|
|
*
|
|
|
|
* Copyright 1998 Francis Beaudet
|
1999-04-22 11:24:47 +02:00
|
|
|
* Copyright 1999 Thuy Nguyen
|
2004-05-10 23:26:04 +02:00
|
|
|
* Copyright 2004 Maxime Bellenge
|
2004-09-14 03:06:44 +02:00
|
|
|
* Copyright 2004 Filip Navara
|
1998-12-10 16:49:22 +01:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
2004-09-14 03:06:44 +02:00
|
|
|
* This code was audited for completeness against the documented features
|
|
|
|
* of Comctl32.dll version 6.0 on Sep. 12, 2004, by Filip Navara.
|
|
|
|
*
|
|
|
|
* Unless otherwise noted, we believe this code to be complete, as per
|
|
|
|
* the specification mentioned above.
|
|
|
|
* If you discover missing features, or bugs, please note them below.
|
|
|
|
*
|
1998-12-10 16:49:22 +01:00
|
|
|
* TODO:
|
1999-09-19 14:14:38 +02:00
|
|
|
* - Tab order
|
2004-09-14 03:06:44 +02:00
|
|
|
* - Wizard 97 header resizing
|
|
|
|
* - Enforcing of minimal wizard size
|
|
|
|
* - Messages:
|
|
|
|
* o PSM_INSERTPAGE
|
|
|
|
* o PSM_RECALCPAGESIZES
|
|
|
|
* o PSM_SETHEADERSUBTITLE
|
|
|
|
* o PSM_SETHEADERTITLE
|
2004-09-20 21:13:36 +02:00
|
|
|
* o WM_HELP
|
|
|
|
* o WM_CONTEXTMENU
|
2004-09-14 03:06:44 +02:00
|
|
|
* - Notifications:
|
|
|
|
* o PSN_GETOBJECT
|
|
|
|
* o PSN_QUERYINITIALFOCUS
|
|
|
|
* o PSN_TRANSLATEACCELERATOR
|
|
|
|
* - Styles:
|
|
|
|
* o PSH_RTLREADING
|
|
|
|
* o PSH_STRETCHWATERMARK
|
|
|
|
* o PSH_USEPAGELANG
|
|
|
|
* o PSH_USEPSTARTPAGE
|
|
|
|
* - Page styles:
|
|
|
|
* o PSP_USEFUSIONCONTEXT
|
|
|
|
* o PSP_USEREFPARENT
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1999-04-22 11:24:47 +02:00
|
|
|
#include <string.h>
|
2002-10-23 22:19:22 +02:00
|
|
|
|
2003-01-07 21:36:20 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-03-16 11:53:11 +01:00
|
|
|
#include "winbase.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winnls.h"
|
1998-12-10 16:49:22 +01:00
|
|
|
#include "commctrl.h"
|
1999-02-11 17:22:12 +01:00
|
|
|
#include "prsht.h"
|
1999-05-22 12:52:31 +02:00
|
|
|
#include "comctl32.h"
|
2005-07-18 12:31:06 +02:00
|
|
|
#include "uxtheme.h"
|
1998-12-10 16:49:22 +01:00
|
|
|
|
2002-10-23 22:19:22 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "wine/unicode.h"
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Data structures
|
|
|
|
*/
|
2002-10-13 19:54:48 +02:00
|
|
|
#include "pshpack2.h"
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
WORD dlgVer;
|
|
|
|
WORD signature;
|
|
|
|
DWORD helpID;
|
|
|
|
DWORD exStyle;
|
|
|
|
DWORD style;
|
|
|
|
} MyDLGTEMPLATEEX;
|
|
|
|
|
2002-10-13 19:54:48 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD helpid;
|
|
|
|
DWORD exStyle;
|
|
|
|
DWORD style;
|
|
|
|
short x;
|
|
|
|
short y;
|
2002-11-25 03:45:19 +01:00
|
|
|
short cx;
|
2002-10-13 19:54:48 +02:00
|
|
|
short cy;
|
|
|
|
DWORD id;
|
|
|
|
} MyDLGITEMTEMPLATEEX;
|
|
|
|
#include "poppack.h"
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
typedef struct tagPropPageInfo
|
|
|
|
{
|
1999-05-01 12:27:05 +02:00
|
|
|
HPROPSHEETPAGE hpage; /* to keep track of pages not passed to PropertySheet */
|
1999-04-22 11:24:47 +02:00
|
|
|
HWND hwndPage;
|
|
|
|
BOOL isDirty;
|
|
|
|
LPCWSTR pszText;
|
|
|
|
BOOL hasHelp;
|
|
|
|
BOOL useCallback;
|
1999-11-28 22:01:47 +01:00
|
|
|
BOOL hasIcon;
|
1999-04-22 11:24:47 +02:00
|
|
|
} PropPageInfo;
|
|
|
|
|
|
|
|
typedef struct tagPropSheetInfo
|
|
|
|
{
|
2000-07-08 14:48:13 +02:00
|
|
|
HWND hwnd;
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEETHEADERW ppshheader;
|
2003-07-09 04:49:52 +02:00
|
|
|
BOOL unicode;
|
2002-01-29 18:14:53 +01:00
|
|
|
LPWSTR strPropertiesFor;
|
1999-05-01 12:27:05 +02:00
|
|
|
int nPages;
|
1999-04-22 11:24:47 +02:00
|
|
|
int active_page;
|
|
|
|
BOOL isModeless;
|
|
|
|
BOOL hasHelp;
|
|
|
|
BOOL hasApply;
|
2005-07-15 11:59:04 +02:00
|
|
|
BOOL hasFinish;
|
1999-04-22 11:24:47 +02:00
|
|
|
BOOL useCallback;
|
1999-11-28 22:01:47 +01:00
|
|
|
BOOL activeValid;
|
1999-04-22 11:24:47 +02:00
|
|
|
PropPageInfo* proppage;
|
2004-05-10 23:26:04 +02:00
|
|
|
HFONT hFont;
|
|
|
|
HFONT hFontBold;
|
1999-04-22 11:24:47 +02:00
|
|
|
int width;
|
|
|
|
int height;
|
1999-08-14 17:51:10 +02:00
|
|
|
HIMAGELIST hImageList;
|
2005-06-15 21:12:57 +02:00
|
|
|
BOOL ended;
|
2006-11-02 13:21:53 +01:00
|
|
|
INT result;
|
1999-04-22 11:24:47 +02:00
|
|
|
} PropSheetInfo;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
} PADDING_INFO;
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Defines and global variables
|
|
|
|
*/
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2006-05-05 15:59:20 +02:00
|
|
|
static const WCHAR PropSheetInfoStr[] =
|
2002-01-29 18:14:53 +01:00
|
|
|
{'P','r','o','p','e','r','t','y','S','h','e','e','t','I','n','f','o',0 };
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2003-07-09 04:49:52 +02:00
|
|
|
#define PSP_INTERNAL_UNICODE 0x80000000
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
#define MAX_CAPTION_LENGTH 255
|
1999-05-01 12:27:05 +02:00
|
|
|
#define MAX_TABTEXT_LENGTH 255
|
1999-11-28 22:01:47 +01:00
|
|
|
#define MAX_BUTTONTEXT_LENGTH 64
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
#define INTRNL_ANY_WIZARD (PSH_WIZARD | PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE)
|
|
|
|
|
2004-09-14 01:19:51 +02:00
|
|
|
/* Wizard metrics specified in DLUs */
|
|
|
|
#define WIZARD_PADDING 7
|
|
|
|
#define WIZARD_HEADER_HEIGHT 36
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Prototypes
|
|
|
|
*/
|
|
|
|
static PADDING_INFO PROPSHEET_GetPaddingInfo(HWND hwndDlg);
|
2002-01-29 18:14:53 +01:00
|
|
|
static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText);
|
1999-10-13 17:54:08 +02:00
|
|
|
static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg);
|
1999-04-22 11:24:47 +02:00
|
|
|
static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
|
|
|
|
int index,
|
2001-06-06 23:03:21 +02:00
|
|
|
int skipdir,
|
1999-04-22 11:24:47 +02:00
|
|
|
HPROPSHEETPAGE hpage);
|
1999-05-01 12:27:05 +02:00
|
|
|
static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, PropSheetInfo* psInfo);
|
2000-08-26 22:28:02 +02:00
|
|
|
static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo* psInfo);
|
2002-01-29 18:14:53 +01:00
|
|
|
static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2006-05-05 15:59:20 +02:00
|
|
|
static INT_PTR CALLBACK
|
1999-04-22 11:24:47 +02:00
|
|
|
PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(propsheet);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
#define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");}
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_UnImplementedFlags
|
|
|
|
*
|
|
|
|
* Document use of flags we don't implement yet.
|
|
|
|
*/
|
|
|
|
static VOID PROPSHEET_UnImplementedFlags(DWORD dwFlags)
|
|
|
|
{
|
|
|
|
CHAR string[256];
|
|
|
|
|
|
|
|
string[0] = '\0';
|
|
|
|
|
|
|
|
/*
|
|
|
|
* unhandled header flags:
|
|
|
|
* PSH_RTLREADING 0x00000800
|
|
|
|
* PSH_STRETCHWATERMARK 0x00040000
|
|
|
|
* PSH_USEPAGELANG 0x00200000
|
|
|
|
*/
|
|
|
|
|
|
|
|
add_flag(PSH_RTLREADING);
|
|
|
|
add_flag(PSH_STRETCHWATERMARK);
|
|
|
|
add_flag(PSH_USEPAGELANG);
|
|
|
|
if (string[0] != '\0')
|
|
|
|
FIXME("%s\n", string);
|
|
|
|
}
|
2002-04-02 21:16:08 +02:00
|
|
|
#undef add_flag
|
2002-01-29 18:14:53 +01:00
|
|
|
|
2002-06-13 21:10:28 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_GetPageRect
|
|
|
|
*
|
|
|
|
* Retrieve rect from tab control and map into the dialog for SetWindowPos
|
|
|
|
*/
|
2004-09-14 01:19:51 +02:00
|
|
|
static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg,
|
|
|
|
RECT *rc, LPCPROPSHEETPAGEW ppshpage)
|
2002-06-13 21:10:28 +02:00
|
|
|
{
|
2004-09-14 01:19:51 +02:00
|
|
|
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) {
|
|
|
|
HWND hwndChild;
|
|
|
|
RECT r;
|
|
|
|
|
|
|
|
if (((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_HEADER) &&
|
|
|
|
!(ppshpage->dwFlags & PSP_HIDEHEADER)) ||
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_WIZARD))
|
|
|
|
{
|
|
|
|
rc->left = rc->top = WIZARD_PADDING;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rc->left = rc->top = 0;
|
|
|
|
}
|
|
|
|
rc->right = psInfo->width - rc->left;
|
|
|
|
rc->bottom = psInfo->height - rc->top;
|
|
|
|
MapDialogRect(hwndDlg, rc);
|
2002-06-13 21:10:28 +02:00
|
|
|
|
2004-09-14 01:19:51 +02:00
|
|
|
if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_HEADER) &&
|
|
|
|
!(ppshpage->dwFlags & PSP_HIDEHEADER))
|
|
|
|
{
|
|
|
|
hwndChild = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER);
|
|
|
|
GetClientRect(hwndChild, &r);
|
|
|
|
MapWindowPoints(hwndChild, hwndDlg, (LPPOINT) &r, 2);
|
|
|
|
rc->top += r.bottom + 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
|
|
|
GetClientRect(hwndTabCtrl, rc);
|
|
|
|
SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)rc);
|
|
|
|
MapWindowPoints(hwndTabCtrl, hwndDlg, (LPPOINT)rc, 2);
|
|
|
|
}
|
2002-06-13 21:10:28 +02:00
|
|
|
}
|
|
|
|
|
2002-05-14 20:38:07 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_FindPageByResId
|
|
|
|
*
|
|
|
|
* Find page index corresponding to page resource id.
|
|
|
|
*/
|
2005-06-09 11:50:56 +02:00
|
|
|
static INT PROPSHEET_FindPageByResId(PropSheetInfo * psInfo, LRESULT resId)
|
2002-05-14 20:38:07 +02:00
|
|
|
{
|
|
|
|
INT i;
|
|
|
|
|
|
|
|
for (i = 0; i < psInfo->nPages; i++)
|
|
|
|
{
|
|
|
|
LPCPROPSHEETPAGEA lppsp = (LPCPROPSHEETPAGEA)psInfo->proppage[i].hpage;
|
|
|
|
|
|
|
|
/* Fixme: if resource ID is a string shall we use strcmp ??? */
|
|
|
|
if (lppsp->u.pszTemplate == (LPVOID)resId)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2002-05-14 05:48:48 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_AtoW
|
|
|
|
*
|
|
|
|
* Convert ASCII to Unicode since all data is saved as Unicode.
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_AtoW(LPCWSTR *tostr, LPCSTR frstr)
|
|
|
|
{
|
|
|
|
INT len;
|
2006-11-28 23:23:42 +01:00
|
|
|
WCHAR *to;
|
2002-05-14 05:48:48 +02:00
|
|
|
|
|
|
|
TRACE("<%s>\n", frstr);
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, frstr, -1, 0, 0);
|
2006-11-28 23:23:42 +01:00
|
|
|
to = Alloc(len * sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, frstr, -1, to, len);
|
|
|
|
*tostr = to;
|
2002-05-14 05:48:48 +02:00
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
2002-01-29 18:14:53 +01:00
|
|
|
* PROPSHEET_CollectSheetInfoA
|
1999-04-22 11:24:47 +02:00
|
|
|
*
|
|
|
|
* Collect relevant data.
|
|
|
|
*/
|
2002-01-29 18:14:53 +01:00
|
|
|
static BOOL PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfo * psInfo)
|
|
|
|
{
|
2000-07-08 14:48:13 +02:00
|
|
|
DWORD dwSize = min(lppsh->dwSize,sizeof(PROPSHEETHEADERA));
|
1999-04-22 11:24:47 +02:00
|
|
|
DWORD dwFlags = lppsh->dwFlags;
|
|
|
|
|
|
|
|
psInfo->hasHelp = dwFlags & PSH_HASHELP;
|
|
|
|
psInfo->hasApply = !(dwFlags & PSH_NOAPPLYNOW);
|
2005-07-15 11:59:04 +02:00
|
|
|
psInfo->hasFinish = dwFlags & PSH_WIZARDHASFINISH;
|
2003-01-03 04:06:42 +01:00
|
|
|
psInfo->useCallback = (dwFlags & PSH_USECALLBACK )&& (lppsh->pfnCallback);
|
1999-04-22 11:24:47 +02:00
|
|
|
psInfo->isModeless = dwFlags & PSH_MODELESS;
|
1999-11-28 22:01:47 +01:00
|
|
|
|
2000-07-08 14:48:13 +02:00
|
|
|
memcpy(&psInfo->ppshheader,lppsh,dwSize);
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%d\ndwFlags\t\t%08x\nhwndParent\t%p\nhInstance\t%p\npszCaption\t'%s'\nnPages\t\t%d\npfnCallback\t%p\n",
|
2002-01-29 18:14:53 +01:00
|
|
|
lppsh->dwSize, lppsh->dwFlags, lppsh->hwndParent, lppsh->hInstance,
|
|
|
|
debugstr_a(lppsh->pszCaption), lppsh->nPages, lppsh->pfnCallback);
|
|
|
|
|
|
|
|
PROPSHEET_UnImplementedFlags(lppsh->dwFlags);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
2003-10-02 06:26:53 +02:00
|
|
|
if (lppsh->dwFlags & INTRNL_ANY_WIZARD)
|
|
|
|
psInfo->ppshheader.pszCaption = NULL;
|
|
|
|
else
|
2001-07-24 23:45:22 +02:00
|
|
|
{
|
2003-10-02 06:26:53 +02:00
|
|
|
if (HIWORD(lppsh->pszCaption))
|
|
|
|
{
|
2004-07-21 23:17:59 +02:00
|
|
|
int len = MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, NULL, 0);
|
2006-11-28 23:23:42 +01:00
|
|
|
WCHAR *caption = Alloc( len*sizeof (WCHAR) );
|
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, caption, len);
|
|
|
|
psInfo->ppshheader.pszCaption = caption;
|
2003-10-02 06:26:53 +02:00
|
|
|
}
|
2001-07-24 23:45:22 +02:00
|
|
|
}
|
1999-05-01 12:27:05 +02:00
|
|
|
psInfo->nPages = lppsh->nPages;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
if (dwFlags & PSH_USEPSTARTPAGE)
|
|
|
|
{
|
2004-01-27 01:01:43 +01:00
|
|
|
TRACE("PSH_USEPSTARTPAGE is on\n");
|
1999-04-22 11:24:47 +02:00
|
|
|
psInfo->active_page = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
psInfo->active_page = lppsh->u2.nStartPage;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages)
|
|
|
|
psInfo->active_page = 0;
|
|
|
|
|
2006-11-02 13:21:53 +01:00
|
|
|
psInfo->result = 0;
|
1999-08-14 17:51:10 +02:00
|
|
|
psInfo->hImageList = 0;
|
1999-11-28 22:01:47 +01:00
|
|
|
psInfo->activeValid = FALSE;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2002-01-29 18:14:53 +01:00
|
|
|
* PROPSHEET_CollectSheetInfoW
|
|
|
|
*
|
|
|
|
* Collect relevant data.
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh,
|
|
|
|
PropSheetInfo * psInfo)
|
|
|
|
{
|
|
|
|
DWORD dwSize = min(lppsh->dwSize,sizeof(PROPSHEETHEADERW));
|
|
|
|
DWORD dwFlags = lppsh->dwFlags;
|
|
|
|
|
|
|
|
psInfo->hasHelp = dwFlags & PSH_HASHELP;
|
|
|
|
psInfo->hasApply = !(dwFlags & PSH_NOAPPLYNOW);
|
2005-07-15 11:59:04 +02:00
|
|
|
psInfo->hasFinish = dwFlags & PSH_WIZARDHASFINISH;
|
2003-01-03 04:06:42 +01:00
|
|
|
psInfo->useCallback = (dwFlags & PSH_USECALLBACK) && (lppsh->pfnCallback);
|
2002-01-29 18:14:53 +01:00
|
|
|
psInfo->isModeless = dwFlags & PSH_MODELESS;
|
|
|
|
|
|
|
|
memcpy(&psInfo->ppshheader,lppsh,dwSize);
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%d\ndwFlags\t\t%08x\nhwndParent\t%p\nhInstance\t%p\npszCaption\t'%s'\nnPages\t\t%d\npfnCallback\t%p\n",
|
2002-01-29 18:14:53 +01:00
|
|
|
lppsh->dwSize, lppsh->dwFlags, lppsh->hwndParent, lppsh->hInstance, debugstr_w(lppsh->pszCaption), lppsh->nPages, lppsh->pfnCallback);
|
|
|
|
|
|
|
|
PROPSHEET_UnImplementedFlags(lppsh->dwFlags);
|
|
|
|
|
2003-10-02 06:26:53 +02:00
|
|
|
if (lppsh->dwFlags & INTRNL_ANY_WIZARD)
|
|
|
|
psInfo->ppshheader.pszCaption = NULL;
|
|
|
|
else
|
2002-01-29 18:14:53 +01:00
|
|
|
{
|
2004-07-21 23:17:59 +02:00
|
|
|
if (HIWORD(lppsh->pszCaption))
|
2003-10-02 06:26:53 +02:00
|
|
|
{
|
|
|
|
int len = strlenW(lppsh->pszCaption);
|
2006-11-28 23:23:42 +01:00
|
|
|
WCHAR *caption = Alloc( (len+1)*sizeof(WCHAR) );
|
|
|
|
|
|
|
|
psInfo->ppshheader.pszCaption = strcpyW( caption, lppsh->pszCaption );
|
2003-10-02 06:26:53 +02:00
|
|
|
}
|
2002-01-29 18:14:53 +01:00
|
|
|
}
|
|
|
|
psInfo->nPages = lppsh->nPages;
|
|
|
|
|
|
|
|
if (dwFlags & PSH_USEPSTARTPAGE)
|
|
|
|
{
|
2004-01-27 01:01:43 +01:00
|
|
|
TRACE("PSH_USEPSTARTPAGE is on\n");
|
2002-01-29 18:14:53 +01:00
|
|
|
psInfo->active_page = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
psInfo->active_page = lppsh->u2.nStartPage;
|
|
|
|
|
|
|
|
if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages)
|
|
|
|
psInfo->active_page = 0;
|
|
|
|
|
2006-11-02 13:21:53 +01:00
|
|
|
psInfo->result = 0;
|
2002-01-29 18:14:53 +01:00
|
|
|
psInfo->hImageList = 0;
|
|
|
|
psInfo->activeValid = FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2002-05-14 05:48:48 +02:00
|
|
|
* PROPSHEET_CollectPageInfo
|
1999-04-22 11:24:47 +02:00
|
|
|
*
|
|
|
|
* Collect property sheet data.
|
|
|
|
* With code taken from DIALOG_ParseTemplate32.
|
|
|
|
*/
|
2006-05-05 15:59:20 +02:00
|
|
|
static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo * psInfo,
|
|
|
|
int index)
|
|
|
|
{
|
2006-11-28 23:23:42 +01:00
|
|
|
const DLGTEMPLATE* pTemplate;
|
2002-01-29 18:14:53 +01:00
|
|
|
const WORD* p;
|
|
|
|
DWORD dwFlags;
|
|
|
|
int width, height;
|
|
|
|
|
2005-08-27 11:59:09 +02:00
|
|
|
if (!lppsp)
|
|
|
|
return FALSE;
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
TRACE("\n");
|
|
|
|
psInfo->proppage[index].hpage = (HPROPSHEETPAGE)lppsp;
|
|
|
|
psInfo->proppage[index].hwndPage = 0;
|
|
|
|
psInfo->proppage[index].isDirty = FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process property page flags.
|
|
|
|
*/
|
|
|
|
dwFlags = lppsp->dwFlags;
|
|
|
|
psInfo->proppage[index].useCallback = (dwFlags & PSP_USECALLBACK) && (lppsp->pfnCallback);
|
|
|
|
psInfo->proppage[index].hasHelp = dwFlags & PSP_HASHELP;
|
|
|
|
psInfo->proppage[index].hasIcon = dwFlags & (PSP_USEHICON | PSP_USEICONID);
|
|
|
|
|
|
|
|
/* as soon as we have a page with the help flag, set the sheet flag on */
|
|
|
|
if (psInfo->proppage[index].hasHelp)
|
|
|
|
psInfo->hasHelp = TRUE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process page template.
|
|
|
|
*/
|
|
|
|
if (dwFlags & PSP_DLGINDIRECT)
|
2006-11-28 23:23:42 +01:00
|
|
|
pTemplate = lppsp->u.pResource;
|
2003-07-09 04:49:52 +02:00
|
|
|
else if(dwFlags & PSP_INTERNAL_UNICODE )
|
2002-01-29 18:14:53 +01:00
|
|
|
{
|
|
|
|
HRSRC hResource = FindResourceW(lppsp->hInstance,
|
|
|
|
lppsp->u.pszTemplate,
|
2003-09-10 05:56:47 +02:00
|
|
|
(LPWSTR)RT_DIALOG);
|
2002-01-29 18:14:53 +01:00
|
|
|
HGLOBAL hTemplate = LoadResource(lppsp->hInstance,
|
|
|
|
hResource);
|
|
|
|
pTemplate = (LPDLGTEMPLATEW)LockResource(hTemplate);
|
|
|
|
}
|
2003-07-09 04:49:52 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
HRSRC hResource = FindResourceA(lppsp->hInstance,
|
2006-08-30 20:40:52 +02:00
|
|
|
(LPCSTR)lppsp->u.pszTemplate,
|
2003-09-10 05:56:47 +02:00
|
|
|
(LPSTR)RT_DIALOG);
|
2003-07-09 04:49:52 +02:00
|
|
|
HGLOBAL hTemplate = LoadResource(lppsp->hInstance,
|
|
|
|
hResource);
|
|
|
|
pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);
|
|
|
|
}
|
2002-01-29 18:14:53 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Extract the size of the page and the caption.
|
|
|
|
*/
|
|
|
|
if (!pTemplate)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
p = (const WORD *)pTemplate;
|
|
|
|
|
2006-11-28 23:23:42 +01:00
|
|
|
if (((const MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF)
|
2002-01-29 18:14:53 +01:00
|
|
|
{
|
2002-11-25 03:45:19 +01:00
|
|
|
/* DLGTEMPLATEEX (not defined in any std. header file) */
|
2002-01-29 18:14:53 +01:00
|
|
|
|
|
|
|
p++; /* dlgVer */
|
|
|
|
p++; /* signature */
|
|
|
|
p += 2; /* help ID */
|
|
|
|
p += 2; /* ext style */
|
|
|
|
p += 2; /* style */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-25 03:45:19 +01:00
|
|
|
/* DLGTEMPLATE */
|
2002-01-29 18:14:53 +01:00
|
|
|
|
|
|
|
p += 2; /* style */
|
|
|
|
p += 2; /* ext style */
|
|
|
|
}
|
|
|
|
|
|
|
|
p++; /* nb items */
|
|
|
|
p++; /* x */
|
|
|
|
p++; /* y */
|
|
|
|
width = (WORD)*p; p++;
|
|
|
|
height = (WORD)*p; p++;
|
|
|
|
|
2004-09-14 01:19:51 +02:00
|
|
|
/* Special calculation for interior wizard pages so the largest page is
|
|
|
|
* calculated correctly. We need to add all the padding and space occupied
|
|
|
|
* by the header so the width and height sums up to the whole wizard client
|
|
|
|
* area. */
|
|
|
|
if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_HEADER) &&
|
|
|
|
!(dwFlags & PSP_HIDEHEADER))
|
|
|
|
{
|
|
|
|
height += 2 * WIZARD_PADDING + WIZARD_HEADER_HEIGHT;
|
|
|
|
width += 2 * WIZARD_PADDING;
|
|
|
|
}
|
|
|
|
if (psInfo->ppshheader.dwFlags & PSH_WIZARD)
|
|
|
|
{
|
|
|
|
height += 2 * WIZARD_PADDING;
|
|
|
|
width += 2 * WIZARD_PADDING;
|
|
|
|
}
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
/* remember the largest width and height */
|
|
|
|
if (width > psInfo->width)
|
|
|
|
psInfo->width = width;
|
|
|
|
|
|
|
|
if (height > psInfo->height)
|
|
|
|
psInfo->height = height;
|
|
|
|
|
|
|
|
/* menu */
|
|
|
|
switch ((WORD)*p)
|
|
|
|
{
|
|
|
|
case 0x0000:
|
|
|
|
p++;
|
|
|
|
break;
|
|
|
|
case 0xffff:
|
|
|
|
p += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
p += lstrlenW( (LPCWSTR)p ) + 1;
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2002-01-29 18:14:53 +01:00
|
|
|
|
|
|
|
/* class */
|
|
|
|
switch ((WORD)*p)
|
|
|
|
{
|
|
|
|
case 0x0000:
|
|
|
|
p++;
|
|
|
|
break;
|
|
|
|
case 0xffff:
|
|
|
|
p += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
p += lstrlenW( (LPCWSTR)p ) + 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract the caption */
|
|
|
|
psInfo->proppage[index].pszText = (LPCWSTR)p;
|
|
|
|
TRACE("Tab %d %s\n",index,debugstr_w((LPCWSTR)p));
|
|
|
|
p += lstrlenW((LPCWSTR)p) + 1;
|
|
|
|
|
|
|
|
if (dwFlags & PSP_USETITLE)
|
|
|
|
{
|
|
|
|
WCHAR szTitle[256];
|
|
|
|
const WCHAR *pTitle;
|
2004-04-20 02:34:52 +02:00
|
|
|
static const WCHAR pszNull[] = { '(','n','u','l','l',')',0 };
|
2006-11-28 23:23:42 +01:00
|
|
|
WCHAR *text;
|
2002-01-29 18:14:53 +01:00
|
|
|
int len;
|
|
|
|
|
|
|
|
if ( !HIWORD( lppsp->pszTitle ) )
|
|
|
|
{
|
2005-08-30 12:07:17 +02:00
|
|
|
if (!LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle,szTitle,sizeof(szTitle) ))
|
2002-01-29 18:14:53 +01:00
|
|
|
{
|
|
|
|
pTitle = pszNull;
|
|
|
|
FIXME("Could not load resource #%04x?\n",LOWORD(lppsp->pszTitle));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pTitle = szTitle;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pTitle = lppsp->pszTitle;
|
|
|
|
|
2002-05-29 00:41:19 +02:00
|
|
|
len = strlenW(pTitle);
|
2006-11-28 23:23:42 +01:00
|
|
|
text = Alloc( (len+1)*sizeof (WCHAR) );
|
|
|
|
psInfo->proppage[index].pszText = strcpyW( text, pTitle);
|
2002-01-29 18:14:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Build the image list for icons
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID))
|
2002-01-29 18:14:53 +01:00
|
|
|
{
|
|
|
|
HICON hIcon;
|
|
|
|
int icon_cx = GetSystemMetrics(SM_CXSMICON);
|
|
|
|
int icon_cy = GetSystemMetrics(SM_CYSMICON);
|
|
|
|
|
|
|
|
if (dwFlags & PSP_USEICONID)
|
2002-06-01 01:06:46 +02:00
|
|
|
hIcon = LoadImageW(lppsp->hInstance, lppsp->u2.pszIcon, IMAGE_ICON,
|
2002-01-29 18:14:53 +01:00
|
|
|
icon_cx, icon_cy, LR_DEFAULTCOLOR);
|
|
|
|
else
|
|
|
|
hIcon = lppsp->u2.hIcon;
|
|
|
|
|
|
|
|
if ( hIcon )
|
|
|
|
{
|
|
|
|
if (psInfo->hImageList == 0 )
|
|
|
|
psInfo->hImageList = ImageList_Create(icon_cx, icon_cy, ILC_COLOR, 1, 1);
|
|
|
|
|
|
|
|
ImageList_AddIcon(psInfo->hImageList, hIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
1999-11-28 22:01:47 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_CreateDialog
|
|
|
|
*
|
|
|
|
* Creates the actual property sheet.
|
|
|
|
*/
|
2006-10-11 20:18:02 +02:00
|
|
|
static INT_PTR PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
|
|
|
LRESULT ret;
|
|
|
|
LPCVOID template;
|
1999-09-04 13:09:20 +02:00
|
|
|
LPVOID temp = 0;
|
1999-04-25 20:31:35 +02:00
|
|
|
HRSRC hRes;
|
1999-09-04 13:09:20 +02:00
|
|
|
DWORD resSize;
|
1999-09-19 14:14:38 +02:00
|
|
|
WORD resID = IDD_PROPSHEET;
|
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("\n");
|
2002-01-29 18:14:53 +01:00
|
|
|
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
|
1999-09-19 14:14:38 +02:00
|
|
|
resID = IDD_WIZARD;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2003-07-09 04:49:52 +02:00
|
|
|
if( psInfo->unicode )
|
|
|
|
{
|
|
|
|
if(!(hRes = FindResourceW(COMCTL32_hModule,
|
2002-01-29 18:14:53 +01:00
|
|
|
MAKEINTRESOURCEW(resID),
|
2003-09-10 05:56:47 +02:00
|
|
|
(LPWSTR)RT_DIALOG)))
|
2003-07-09 04:49:52 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!(hRes = FindResourceA(COMCTL32_hModule,
|
|
|
|
MAKEINTRESOURCEA(resID),
|
2003-09-10 05:56:47 +02:00
|
|
|
(LPSTR)RT_DIALOG)))
|
2003-07-09 04:49:52 +02:00
|
|
|
return -1;
|
|
|
|
}
|
1999-04-25 20:31:35 +02:00
|
|
|
|
|
|
|
if(!(template = (LPVOID)LoadResource(COMCTL32_hModule, hRes)))
|
2003-03-07 21:29:58 +01:00
|
|
|
return -1;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
1999-09-04 13:09:20 +02:00
|
|
|
/*
|
|
|
|
* Make a copy of the dialog template.
|
|
|
|
*/
|
|
|
|
resSize = SizeofResource(COMCTL32_hModule, hRes);
|
|
|
|
|
2003-09-22 23:32:33 +02:00
|
|
|
temp = Alloc(resSize);
|
1999-09-04 13:09:20 +02:00
|
|
|
|
|
|
|
if (!temp)
|
2003-03-07 21:29:58 +01:00
|
|
|
return -1;
|
1999-09-04 13:09:20 +02:00
|
|
|
|
|
|
|
memcpy(temp, template, resSize);
|
|
|
|
|
2004-09-20 21:13:36 +02:00
|
|
|
if (psInfo->ppshheader.dwFlags & PSH_NOCONTEXTHELP)
|
|
|
|
{
|
|
|
|
if (((MyDLGTEMPLATEEX*)temp)->signature == 0xFFFF)
|
|
|
|
((MyDLGTEMPLATEEX*)temp)->style &= ~DS_CONTEXTHELP;
|
|
|
|
else
|
|
|
|
((DLGTEMPLATE*)temp)->style &= ~DS_CONTEXTHELP;
|
|
|
|
}
|
|
|
|
if ((psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_WIZARDCONTEXTHELP))
|
|
|
|
{
|
|
|
|
if (((MyDLGTEMPLATEEX*)temp)->signature == 0xFFFF)
|
|
|
|
((MyDLGTEMPLATEEX*)temp)->style |= DS_CONTEXTHELP;
|
|
|
|
else
|
|
|
|
((DLGTEMPLATE*)temp)->style |= DS_CONTEXTHELP;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
if (psInfo->useCallback)
|
2000-07-08 14:48:13 +02:00
|
|
|
(*(psInfo->ppshheader.pfnCallback))(0, PSCB_PRECREATE, (LPARAM)temp);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-09-20 21:13:36 +02:00
|
|
|
/* NOTE: MSDN states "Returns a positive value if successful, or -1
|
|
|
|
* otherwise for modal property sheets.", but this is wrong. The
|
|
|
|
* actual return value is either TRUE (success), FALSE (cancel) or
|
|
|
|
* -1 (error). */
|
2003-07-09 04:49:52 +02:00
|
|
|
if( psInfo->unicode )
|
|
|
|
{
|
2005-08-30 12:07:17 +02:00
|
|
|
ret = (INT_PTR)CreateDialogIndirectParamW(psInfo->ppshheader.hInstance,
|
2005-06-15 21:12:57 +02:00
|
|
|
(LPDLGTEMPLATEW) temp,
|
|
|
|
psInfo->ppshheader.hwndParent,
|
|
|
|
PROPSHEET_DialogProc,
|
|
|
|
(LPARAM)psInfo);
|
|
|
|
if ( !ret ) ret = -1;
|
2003-07-09 04:49:52 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-30 12:07:17 +02:00
|
|
|
ret = (INT_PTR)CreateDialogIndirectParamA(psInfo->ppshheader.hInstance,
|
2005-06-15 21:12:57 +02:00
|
|
|
(LPDLGTEMPLATEA) temp,
|
|
|
|
psInfo->ppshheader.hwndParent,
|
|
|
|
PROPSHEET_DialogProc,
|
|
|
|
(LPARAM)psInfo);
|
|
|
|
if ( !ret ) ret = -1;
|
2003-03-07 21:29:58 +01:00
|
|
|
}
|
2000-11-29 19:38:24 +01:00
|
|
|
|
2003-09-22 23:32:33 +02:00
|
|
|
Free(temp);
|
1999-09-04 13:09:20 +02:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-02-25 21:49:49 +01:00
|
|
|
* PROPSHEET_SizeMismatch
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
2000-02-25 21:49:49 +01:00
|
|
|
* Verify that the tab control and the "largest" property sheet page dlg. template
|
|
|
|
* match in size.
|
1999-04-22 11:24:47 +02:00
|
|
|
*/
|
2000-02-25 21:49:49 +01:00
|
|
|
static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
|
|
|
HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
|
|
|
RECT rcOrigTab, rcPage;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Original tab size.
|
|
|
|
*/
|
|
|
|
GetClientRect(hwndTabCtrl, &rcOrigTab);
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("orig tab %d %d %d %d\n", rcOrigTab.left, rcOrigTab.top,
|
1999-04-22 11:24:47 +02:00
|
|
|
rcOrigTab.right, rcOrigTab.bottom);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Biggest page size.
|
|
|
|
*/
|
2004-09-14 01:19:51 +02:00
|
|
|
rcPage.left = 0;
|
|
|
|
rcPage.top = 0;
|
1999-04-22 11:24:47 +02:00
|
|
|
rcPage.right = psInfo->width;
|
|
|
|
rcPage.bottom = psInfo->height;
|
|
|
|
|
|
|
|
MapDialogRect(hwndDlg, &rcPage);
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("biggest page %d %d %d %d\n", rcPage.left, rcPage.top,
|
1999-04-22 11:24:47 +02:00
|
|
|
rcPage.right, rcPage.bottom);
|
|
|
|
|
2000-02-25 21:49:49 +01:00
|
|
|
if ( (rcPage.right - rcPage.left) != (rcOrigTab.right - rcOrigTab.left) )
|
1999-04-22 11:24:47 +02:00
|
|
|
return TRUE;
|
2000-02-25 21:49:49 +01:00
|
|
|
if ( (rcPage.bottom - rcPage.top) != (rcOrigTab.bottom - rcOrigTab.top) )
|
1999-04-22 11:24:47 +02:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_AdjustSize
|
|
|
|
*
|
|
|
|
* Resizes the property sheet and the tab control to fit the largest page.
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo)
|
|
|
|
{
|
|
|
|
HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
|
|
|
HWND hwndButton = GetDlgItem(hwndDlg, IDOK);
|
2000-02-25 21:49:49 +01:00
|
|
|
RECT rc,tabRect;
|
1999-04-22 11:24:47 +02:00
|
|
|
int tabOffsetX, tabOffsetY, buttonHeight;
|
|
|
|
PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndDlg);
|
2000-11-29 19:38:24 +01:00
|
|
|
RECT units;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
/* Get the height of buttons */
|
|
|
|
GetClientRect(hwndButton, &rc);
|
|
|
|
buttonHeight = rc.bottom;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Biggest page size.
|
|
|
|
*/
|
2004-09-14 01:19:51 +02:00
|
|
|
rc.left = 0;
|
|
|
|
rc.top = 0;
|
1999-04-22 11:24:47 +02:00
|
|
|
rc.right = psInfo->width;
|
|
|
|
rc.bottom = psInfo->height;
|
|
|
|
|
|
|
|
MapDialogRect(hwndDlg, &rc);
|
|
|
|
|
2000-11-29 19:38:24 +01:00
|
|
|
/* retrieve the dialog units */
|
|
|
|
units.left = units.right = 4;
|
|
|
|
units.top = units.bottom = 8;
|
|
|
|
MapDialogRect(hwndDlg, &units);
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/*
|
|
|
|
* Resize the tab control.
|
|
|
|
*/
|
2000-02-25 21:49:49 +01:00
|
|
|
GetClientRect(hwndTabCtrl,&tabRect);
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)&tabRect);
|
2000-02-25 21:49:49 +01:00
|
|
|
|
|
|
|
if ((rc.bottom - rc.top) < (tabRect.bottom - tabRect.top))
|
|
|
|
{
|
|
|
|
rc.bottom = rc.top + tabRect.bottom - tabRect.top;
|
2000-11-29 19:38:24 +01:00
|
|
|
psInfo->height = MulDiv((rc.bottom - rc.top),8,units.top);
|
2000-02-25 21:49:49 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-25 21:49:49 +01:00
|
|
|
if ((rc.right - rc.left) < (tabRect.right - tabRect.left))
|
|
|
|
{
|
|
|
|
rc.right = rc.left + tabRect.right - tabRect.left;
|
2000-11-29 19:38:24 +01:00
|
|
|
psInfo->width = MulDiv((rc.right - rc.left),4,units.left);
|
2000-02-25 21:49:49 +01:00
|
|
|
}
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, TRUE, (LPARAM)&rc);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
tabOffsetX = -(rc.left);
|
|
|
|
tabOffsetY = -(rc.top);
|
|
|
|
|
|
|
|
rc.right -= rc.left;
|
|
|
|
rc.bottom -= rc.top;
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("setting tab %p, rc (0,0)-(%d,%d)\n",
|
2005-08-30 12:07:17 +02:00
|
|
|
hwndTabCtrl, rc.right, rc.bottom);
|
1999-04-22 11:24:47 +02:00
|
|
|
SetWindowPos(hwndTabCtrl, 0, 0, 0, rc.right, rc.bottom,
|
|
|
|
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
GetClientRect(hwndTabCtrl, &rc);
|
|
|
|
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("tab client rc %d %d %d %d\n",
|
1999-04-22 11:24:47 +02:00
|
|
|
rc.left, rc.top, rc.right, rc.bottom);
|
|
|
|
|
|
|
|
rc.right += ((padding.x * 2) + tabOffsetX);
|
|
|
|
rc.bottom += (buttonHeight + (3 * padding.y) + tabOffsetY);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Resize the property sheet.
|
|
|
|
*/
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("setting dialog %p, rc (0,0)-(%d,%d)\n",
|
2005-08-30 12:07:17 +02:00
|
|
|
hwndDlg, rc.right, rc.bottom);
|
1999-04-22 11:24:47 +02:00
|
|
|
SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom,
|
|
|
|
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_AdjustSizeWizard
|
|
|
|
*
|
|
|
|
* Resizes the property sheet to fit the largest page.
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, PropSheetInfo* psInfo)
|
|
|
|
{
|
|
|
|
HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE);
|
2004-09-14 01:19:51 +02:00
|
|
|
RECT rc, lineRect, dialogRect;
|
2000-11-29 19:38:24 +01:00
|
|
|
|
2004-09-14 01:19:51 +02:00
|
|
|
/* Biggest page size */
|
|
|
|
rc.left = 0;
|
|
|
|
rc.top = 0;
|
1999-09-19 14:14:38 +02:00
|
|
|
rc.right = psInfo->width;
|
|
|
|
rc.bottom = psInfo->height;
|
|
|
|
MapDialogRect(hwndDlg, &rc);
|
|
|
|
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("Biggest page %d %d %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2004-09-14 01:19:51 +02:00
|
|
|
/* Add space for the buttons row */
|
|
|
|
GetWindowRect(hwndLine, &lineRect);
|
|
|
|
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&lineRect, 2);
|
|
|
|
GetClientRect(hwndDlg, &dialogRect);
|
|
|
|
rc.bottom += dialogRect.bottom - lineRect.top - 1;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2004-09-14 01:19:51 +02:00
|
|
|
/* Convert the client coordinates to window coordinates */
|
|
|
|
AdjustWindowRect(&rc, GetWindowLongW(hwndDlg, GWL_STYLE), FALSE);
|
|
|
|
|
|
|
|
/* Resize the property sheet */
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("setting dialog %p, rc (0,0)-(%d,%d)\n",
|
2005-08-30 12:07:17 +02:00
|
|
|
hwndDlg, rc.right, rc.bottom);
|
2004-09-14 01:19:51 +02:00
|
|
|
SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
|
1999-09-19 14:14:38 +02:00
|
|
|
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
2004-09-14 01:19:51 +02:00
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_AdjustButtons
|
|
|
|
*
|
|
|
|
* Adjusts the buttons' positions.
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo)
|
|
|
|
{
|
|
|
|
HWND hwndButton = GetDlgItem(hwndParent, IDOK);
|
|
|
|
RECT rcSheet;
|
|
|
|
int x, y;
|
|
|
|
int num_buttons = 2;
|
|
|
|
int buttonWidth, buttonHeight;
|
|
|
|
PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndParent);
|
|
|
|
|
|
|
|
if (psInfo->hasApply)
|
|
|
|
num_buttons++;
|
|
|
|
|
|
|
|
if (psInfo->hasHelp)
|
|
|
|
num_buttons++;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Obtain the size of the buttons.
|
|
|
|
*/
|
|
|
|
GetClientRect(hwndButton, &rcSheet);
|
|
|
|
buttonWidth = rcSheet.right;
|
|
|
|
buttonHeight = rcSheet.bottom;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the size of the property sheet.
|
2002-06-01 01:06:46 +02:00
|
|
|
*/
|
1999-04-22 11:24:47 +02:00
|
|
|
GetClientRect(hwndParent, &rcSheet);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/*
|
1999-04-22 11:24:47 +02:00
|
|
|
* All buttons will be at this y coordinate.
|
|
|
|
*/
|
|
|
|
y = rcSheet.bottom - (padding.y + buttonHeight);
|
|
|
|
|
|
|
|
/*
|
2004-08-17 01:17:44 +02:00
|
|
|
* Position OK button and make it default.
|
1999-04-22 11:24:47 +02:00
|
|
|
*/
|
|
|
|
hwndButton = GetDlgItem(hwndParent, IDOK);
|
|
|
|
|
|
|
|
x = rcSheet.right - ((padding.x + buttonWidth) * num_buttons);
|
|
|
|
|
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
SendMessageW(hwndParent, DM_SETDEFID, IDOK, 0);
|
2004-08-17 01:17:44 +02:00
|
|
|
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/*
|
|
|
|
* Position Cancel button.
|
|
|
|
*/
|
|
|
|
hwndButton = GetDlgItem(hwndParent, IDCANCEL);
|
|
|
|
|
|
|
|
x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1));
|
|
|
|
|
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Position Apply button.
|
|
|
|
*/
|
|
|
|
hwndButton = GetDlgItem(hwndParent, IDC_APPLY_BUTTON);
|
|
|
|
|
|
|
|
if (psInfo->hasApply)
|
|
|
|
{
|
|
|
|
if (psInfo->hasHelp)
|
|
|
|
x = rcSheet.right - ((padding.x + buttonWidth) * 2);
|
|
|
|
else
|
|
|
|
x = rcSheet.right - (padding.x + buttonWidth);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
EnableWindow(hwndButton, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ShowWindow(hwndButton, SW_HIDE);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Position Help button.
|
|
|
|
*/
|
|
|
|
hwndButton = GetDlgItem(hwndParent, IDHELP);
|
|
|
|
|
|
|
|
if (psInfo->hasHelp)
|
|
|
|
{
|
|
|
|
x = rcSheet.right - (padding.x + buttonWidth);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ShowWindow(hwndButton, SW_HIDE);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_AdjustButtonsWizard
|
|
|
|
*
|
|
|
|
* Adjusts the buttons' positions.
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_AdjustButtonsWizard(HWND hwndParent,
|
|
|
|
PropSheetInfo* psInfo)
|
|
|
|
{
|
|
|
|
HWND hwndButton = GetDlgItem(hwndParent, IDCANCEL);
|
|
|
|
HWND hwndLine = GetDlgItem(hwndParent, IDC_SUNKEN_LINE);
|
2004-05-10 23:26:04 +02:00
|
|
|
HWND hwndLineHeader = GetDlgItem(hwndParent, IDC_SUNKEN_LINEHEADER);
|
1999-09-19 14:14:38 +02:00
|
|
|
RECT rcSheet;
|
|
|
|
int x, y;
|
|
|
|
int num_buttons = 3;
|
|
|
|
int buttonWidth, buttonHeight, lineHeight, lineWidth;
|
2000-08-26 22:28:02 +02:00
|
|
|
PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndParent, psInfo);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
if (psInfo->hasHelp)
|
|
|
|
num_buttons++;
|
2005-07-15 11:59:04 +02:00
|
|
|
if (psInfo->hasFinish)
|
|
|
|
num_buttons++;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Obtain the size of the buttons.
|
|
|
|
*/
|
|
|
|
GetClientRect(hwndButton, &rcSheet);
|
|
|
|
buttonWidth = rcSheet.right;
|
|
|
|
buttonHeight = rcSheet.bottom;
|
|
|
|
|
|
|
|
GetClientRect(hwndLine, &rcSheet);
|
|
|
|
lineHeight = rcSheet.bottom;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the size of the property sheet.
|
|
|
|
*/
|
|
|
|
GetClientRect(hwndParent, &rcSheet);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All buttons will be at this y coordinate.
|
|
|
|
*/
|
|
|
|
y = rcSheet.bottom - (padding.y + buttonHeight);
|
2005-07-15 11:59:04 +02:00
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/*
|
2005-07-15 11:59:04 +02:00
|
|
|
* Position the Back button.
|
1999-09-19 14:14:38 +02:00
|
|
|
*/
|
2005-07-15 11:59:04 +02:00
|
|
|
hwndButton = GetDlgItem(hwndParent, IDC_BACK_BUTTON);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2005-07-15 11:59:04 +02:00
|
|
|
x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1)) - buttonWidth;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
2005-07-15 11:59:04 +02:00
|
|
|
/*
|
|
|
|
* Position the Next button.
|
|
|
|
*/
|
|
|
|
hwndButton = GetDlgItem(hwndParent, IDC_NEXT_BUTTON);
|
|
|
|
|
|
|
|
x += buttonWidth;
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
/*
|
2005-07-15 11:59:04 +02:00
|
|
|
* Position the Finish button.
|
1999-09-19 14:14:38 +02:00
|
|
|
*/
|
2005-07-15 11:59:04 +02:00
|
|
|
hwndButton = GetDlgItem(hwndParent, IDC_FINISH_BUTTON);
|
|
|
|
|
|
|
|
if (psInfo->hasFinish)
|
|
|
|
x += padding.x + buttonWidth;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
2005-07-15 11:59:04 +02:00
|
|
|
if (!psInfo->hasFinish)
|
|
|
|
ShowWindow(hwndButton, SW_HIDE);
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/*
|
|
|
|
* Position the Cancel button.
|
|
|
|
*/
|
|
|
|
hwndButton = GetDlgItem(hwndParent, IDCANCEL);
|
|
|
|
|
2005-07-15 11:59:04 +02:00
|
|
|
x += padding.x + buttonWidth;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Position Help button.
|
|
|
|
*/
|
|
|
|
hwndButton = GetDlgItem(hwndParent, IDHELP);
|
|
|
|
|
|
|
|
if (psInfo->hasHelp)
|
|
|
|
{
|
2005-07-15 11:59:04 +02:00
|
|
|
x += padding.x + buttonWidth;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ShowWindow(hwndButton, SW_HIDE);
|
|
|
|
|
2004-09-14 01:19:51 +02:00
|
|
|
if (psInfo->ppshheader.dwFlags &
|
|
|
|
(PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE))
|
2004-05-10 23:26:04 +02:00
|
|
|
padding.x = 0;
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/*
|
|
|
|
* Position and resize the sunken line.
|
|
|
|
*/
|
|
|
|
x = padding.x;
|
|
|
|
y = rcSheet.bottom - ((padding.y * 2) + buttonHeight + lineHeight);
|
|
|
|
|
|
|
|
lineWidth = rcSheet.right - (padding.x * 2);
|
|
|
|
SetWindowPos(hwndLine, 0, x, y, lineWidth, 2,
|
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
|
2004-05-10 23:26:04 +02:00
|
|
|
/*
|
|
|
|
* Position and resize the header sunken line.
|
|
|
|
*/
|
|
|
|
|
|
|
|
SetWindowPos(hwndLineHeader, 0, 0, 0, rcSheet.right, 2,
|
|
|
|
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
|
|
|
|
if (!(psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)))
|
|
|
|
ShowWindow(hwndLineHeader, SW_HIDE);
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_GetPaddingInfo
|
|
|
|
*
|
|
|
|
* Returns the layout information.
|
|
|
|
*/
|
|
|
|
static PADDING_INFO PROPSHEET_GetPaddingInfo(HWND hwndDlg)
|
|
|
|
{
|
|
|
|
HWND hwndTab = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
|
|
|
RECT rcTab;
|
|
|
|
POINT tl;
|
|
|
|
PADDING_INFO padding;
|
|
|
|
|
|
|
|
GetWindowRect(hwndTab, &rcTab);
|
|
|
|
|
|
|
|
tl.x = rcTab.left;
|
|
|
|
tl.y = rcTab.top;
|
|
|
|
|
|
|
|
ScreenToClient(hwndDlg, &tl);
|
|
|
|
|
|
|
|
padding.x = tl.x;
|
|
|
|
padding.y = tl.y;
|
|
|
|
|
|
|
|
return padding;
|
|
|
|
}
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_GetPaddingInfoWizard
|
|
|
|
*
|
|
|
|
* Returns the layout information.
|
|
|
|
* Vertical spacing is the distance between the line and the buttons.
|
2000-08-26 22:28:02 +02:00
|
|
|
* Do NOT use the Help button to gather padding information when it isn't mapped
|
|
|
|
* (PSH_HASHELP), as app writers aren't forced to supply correct coordinates
|
|
|
|
* for it in this case !
|
|
|
|
* FIXME: I'm not sure about any other coordinate problems with these evil
|
|
|
|
* buttons. Fix it in case additional problems appear or maybe calculate
|
|
|
|
* a padding in a completely different way, as this is somewhat messy.
|
1999-09-19 14:14:38 +02:00
|
|
|
*/
|
2000-08-26 22:28:02 +02:00
|
|
|
static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo*
|
|
|
|
psInfo)
|
1999-09-19 14:14:38 +02:00
|
|
|
{
|
|
|
|
PADDING_INFO padding;
|
|
|
|
RECT rc;
|
|
|
|
HWND hwndControl;
|
2000-08-26 22:28:02 +02:00
|
|
|
INT idButton;
|
|
|
|
POINT ptButton, ptLine;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("\n");
|
2000-08-26 22:28:02 +02:00
|
|
|
if (psInfo->hasHelp)
|
|
|
|
{
|
|
|
|
idButton = IDHELP;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
|
2000-08-26 22:28:02 +02:00
|
|
|
{
|
|
|
|
idButton = IDC_NEXT_BUTTON;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* hopefully this is ok */
|
|
|
|
idButton = IDCANCEL;
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-26 22:28:02 +02:00
|
|
|
hwndControl = GetDlgItem(hwndDlg, idButton);
|
1999-09-19 14:14:38 +02:00
|
|
|
GetWindowRect(hwndControl, &rc);
|
|
|
|
|
2000-08-26 22:28:02 +02:00
|
|
|
ptButton.x = rc.left;
|
|
|
|
ptButton.y = rc.top;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2000-08-26 22:28:02 +02:00
|
|
|
ScreenToClient(hwndDlg, &ptButton);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
/* Line */
|
|
|
|
hwndControl = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE);
|
|
|
|
GetWindowRect(hwndControl, &rc);
|
|
|
|
|
2004-03-13 20:24:04 +01:00
|
|
|
ptLine.x = rc.left;
|
1999-09-19 14:14:38 +02:00
|
|
|
ptLine.y = rc.bottom;
|
|
|
|
|
|
|
|
ScreenToClient(hwndDlg, &ptLine);
|
|
|
|
|
2000-08-26 22:28:02 +02:00
|
|
|
padding.y = ptButton.y - ptLine.y;
|
|
|
|
|
|
|
|
if (padding.y < 0)
|
|
|
|
ERR("padding negative ! Please report this !\n");
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2000-08-26 22:28:02 +02:00
|
|
|
/* this is most probably not correct, but the best we have now */
|
|
|
|
padding.x = padding.y;
|
1999-09-19 14:14:38 +02:00
|
|
|
return padding;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_CreateTabControl
|
|
|
|
*
|
|
|
|
* Insert the tabs in the tab control.
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_CreateTabControl(HWND hwndParent,
|
|
|
|
PropSheetInfo * psInfo)
|
|
|
|
{
|
|
|
|
HWND hwndTabCtrl = GetDlgItem(hwndParent, IDC_TABCONTROL);
|
2002-01-29 18:14:53 +01:00
|
|
|
TCITEMW item;
|
1999-04-22 11:24:47 +02:00
|
|
|
int i, nTabs;
|
1999-11-28 22:01:47 +01:00
|
|
|
int iImage = 0;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("\n");
|
1999-04-22 11:24:47 +02:00
|
|
|
item.mask = TCIF_TEXT;
|
1999-05-01 12:27:05 +02:00
|
|
|
item.cchTextMax = MAX_TABTEXT_LENGTH;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2000-02-25 21:49:49 +01:00
|
|
|
nTabs = psInfo->nPages;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
1999-08-14 17:51:10 +02:00
|
|
|
/*
|
|
|
|
* Set the image list for icons.
|
|
|
|
*/
|
|
|
|
if (psInfo->hImageList)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
SendMessageW(hwndTabCtrl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
|
1999-08-14 17:51:10 +02:00
|
|
|
}
|
|
|
|
|
2004-03-13 20:24:04 +01:00
|
|
|
SendMessageW(GetDlgItem(hwndTabCtrl, IDC_TABCONTROL), WM_SETREDRAW, 0, 0);
|
1999-04-22 11:24:47 +02:00
|
|
|
for (i = 0; i < nTabs; i++)
|
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
if ( psInfo->proppage[i].hasIcon )
|
|
|
|
{
|
|
|
|
item.mask |= TCIF_IMAGE;
|
|
|
|
item.iImage = iImage++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
item.mask &= ~TCIF_IMAGE;
|
|
|
|
}
|
1999-08-14 17:51:10 +02:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
item.pszText = (LPWSTR) psInfo->proppage[i].pszText;
|
|
|
|
SendMessageW(hwndTabCtrl, TCM_INSERTITEMW, (WPARAM)i, (LPARAM)&item);
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
2004-03-13 20:24:04 +01:00
|
|
|
SendMessageW(GetDlgItem(hwndTabCtrl, IDC_TABCONTROL), WM_SETREDRAW, 1, 0);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-09-13 21:17:00 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_WizardSubclassProc
|
|
|
|
*
|
|
|
|
* Subclassing window procedure for wizard extrior pages to prevent drawing
|
|
|
|
* background and so drawing above the watermark.
|
|
|
|
*/
|
2005-06-09 11:50:56 +02:00
|
|
|
static LRESULT CALLBACK
|
2004-09-13 21:17:00 +02:00
|
|
|
PROPSHEET_WizardSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_ERASEBKGND:
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case WM_CTLCOLORSTATIC:
|
|
|
|
SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
|
|
|
|
return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
|
|
|
|
}
|
|
|
|
|
|
|
|
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
2002-10-13 19:54:48 +02:00
|
|
|
/*
|
|
|
|
* Get the size of an in-memory Template
|
|
|
|
*
|
|
|
|
*( Based on the code of PROPSHEET_CollectPageInfo)
|
2002-11-25 03:45:19 +01:00
|
|
|
* See also dialog.c/DIALOG_ParseTemplate32().
|
2002-10-13 19:54:48 +02:00
|
|
|
*/
|
|
|
|
|
2006-11-28 23:23:42 +01:00
|
|
|
static UINT GetTemplateSize(const DLGTEMPLATE* pTemplate)
|
2002-10-13 19:54:48 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
const WORD* p = (const WORD *)pTemplate;
|
2006-11-28 23:23:42 +01:00
|
|
|
BOOL istemplateex = (((const MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF);
|
2002-10-13 19:54:48 +02:00
|
|
|
WORD nrofitems;
|
2006-06-13 14:09:16 +02:00
|
|
|
UINT ret;
|
2002-10-13 19:54:48 +02:00
|
|
|
|
|
|
|
if (istemplateex)
|
|
|
|
{
|
2002-11-25 03:45:19 +01:00
|
|
|
/* DLGTEMPLATEEX (not defined in any std. header file) */
|
2002-10-13 19:54:48 +02:00
|
|
|
|
2002-11-25 03:45:19 +01:00
|
|
|
TRACE("is DLGTEMPLATEEX\n");
|
2002-10-13 19:54:48 +02:00
|
|
|
p++; /* dlgVer */
|
|
|
|
p++; /* signature */
|
|
|
|
p += 2; /* help ID */
|
|
|
|
p += 2; /* ext style */
|
|
|
|
p += 2; /* style */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-25 03:45:19 +01:00
|
|
|
/* DLGTEMPLATE */
|
2002-10-13 19:54:48 +02:00
|
|
|
|
2002-11-25 03:45:19 +01:00
|
|
|
TRACE("is DLGTEMPLATE\n");
|
2002-10-13 19:54:48 +02:00
|
|
|
p += 2; /* style */
|
|
|
|
p += 2; /* ext style */
|
|
|
|
}
|
|
|
|
|
|
|
|
nrofitems = (WORD)*p; p++; /* nb items */
|
|
|
|
p++; /* x */
|
|
|
|
p++; /* y */
|
|
|
|
p++; /* width */
|
|
|
|
p++; /* height */
|
|
|
|
|
|
|
|
/* menu */
|
|
|
|
switch ((WORD)*p)
|
|
|
|
{
|
|
|
|
case 0x0000:
|
|
|
|
p++;
|
|
|
|
break;
|
|
|
|
case 0xffff:
|
|
|
|
p += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TRACE("menu %s\n",debugstr_w((LPCWSTR)p));
|
|
|
|
p += lstrlenW( (LPCWSTR)p ) + 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* class */
|
|
|
|
switch ((WORD)*p)
|
|
|
|
{
|
|
|
|
case 0x0000:
|
|
|
|
p++;
|
|
|
|
break;
|
|
|
|
case 0xffff:
|
2002-11-25 03:45:19 +01:00
|
|
|
p += 2; /* 0xffff plus predefined window class ordinal value */
|
2002-10-13 19:54:48 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TRACE("class %s\n",debugstr_w((LPCWSTR)p));
|
|
|
|
p += lstrlenW( (LPCWSTR)p ) + 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-11-25 03:45:19 +01:00
|
|
|
/* title */
|
2002-10-13 19:54:48 +02:00
|
|
|
TRACE("title %s\n",debugstr_w((LPCWSTR)p));
|
|
|
|
p += lstrlenW((LPCWSTR)p) + 1;
|
|
|
|
|
2002-11-25 03:45:19 +01:00
|
|
|
/* font, if DS_SETFONT set */
|
2006-11-28 23:23:42 +01:00
|
|
|
if ((DS_SETFONT & ((istemplateex)? ((const MyDLGTEMPLATEEX*)pTemplate)->style :
|
2002-10-13 19:54:48 +02:00
|
|
|
pTemplate->style)))
|
|
|
|
{
|
|
|
|
p+=(istemplateex)?3:1;
|
|
|
|
TRACE("font %s\n",debugstr_w((LPCWSTR)p));
|
2002-11-25 03:45:19 +01:00
|
|
|
p += lstrlenW( (LPCWSTR)p ) + 1; /* the font name */
|
2002-10-13 19:54:48 +02:00
|
|
|
}
|
|
|
|
|
2002-11-25 03:45:19 +01:00
|
|
|
/* now process the DLGITEMTEMPLATE(EX) structs (plus custom data)
|
|
|
|
* that are following the DLGTEMPLATE(EX) data */
|
2002-10-13 19:54:48 +02:00
|
|
|
TRACE("%d items\n",nrofitems);
|
|
|
|
while (nrofitems > 0)
|
|
|
|
{
|
2005-08-30 12:07:17 +02:00
|
|
|
p = (WORD*)(((DWORD_PTR)p + 3) & ~3); /* DWORD align */
|
2002-10-13 19:54:48 +02:00
|
|
|
|
2002-11-25 03:45:19 +01:00
|
|
|
/* skip header */
|
2002-10-13 19:54:48 +02:00
|
|
|
p += (istemplateex ? sizeof(MyDLGITEMTEMPLATEEX) : sizeof(DLGITEMTEMPLATE))/sizeof(WORD);
|
|
|
|
|
2002-11-25 03:45:19 +01:00
|
|
|
/* check class */
|
2002-10-13 19:54:48 +02:00
|
|
|
switch ((WORD)*p)
|
|
|
|
{
|
|
|
|
case 0x0000:
|
|
|
|
p++;
|
|
|
|
break;
|
|
|
|
case 0xffff:
|
2006-11-28 23:23:42 +01:00
|
|
|
TRACE("class ordinal 0x%08x\n",*(const DWORD*)p);
|
2002-10-13 19:54:48 +02:00
|
|
|
p += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TRACE("class %s\n",debugstr_w((LPCWSTR)p));
|
|
|
|
p += lstrlenW( (LPCWSTR)p ) + 1;
|
|
|
|
break;
|
|
|
|
}
|
2002-11-25 03:45:19 +01:00
|
|
|
|
|
|
|
/* check title text */
|
2002-10-13 19:54:48 +02:00
|
|
|
switch ((WORD)*p)
|
|
|
|
{
|
|
|
|
case 0x0000:
|
|
|
|
p++;
|
|
|
|
break;
|
|
|
|
case 0xffff:
|
2006-11-28 23:23:42 +01:00
|
|
|
TRACE("text ordinal 0x%08x\n",*(const DWORD*)p);
|
2002-10-13 19:54:48 +02:00
|
|
|
p += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TRACE("text %s\n",debugstr_w((LPCWSTR)p));
|
|
|
|
p += lstrlenW( (LPCWSTR)p ) + 1;
|
|
|
|
break;
|
|
|
|
}
|
2004-08-26 20:11:43 +02:00
|
|
|
p += *p / sizeof(WORD) + 1; /* Skip extra data */
|
2002-10-13 19:54:48 +02:00
|
|
|
--nrofitems;
|
|
|
|
}
|
|
|
|
|
2006-11-28 23:23:42 +01:00
|
|
|
ret = (p - (const WORD*)pTemplate) * sizeof(WORD);
|
2006-06-13 14:09:16 +02:00
|
|
|
TRACE("%p %p size 0x%08x\n", p, pTemplate, ret);
|
|
|
|
return ret;
|
2002-10-13 19:54:48 +02:00
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_CreatePage
|
|
|
|
*
|
1999-05-01 12:27:05 +02:00
|
|
|
* Creates a page.
|
1999-04-22 11:24:47 +02:00
|
|
|
*/
|
2000-11-09 21:25:27 +01:00
|
|
|
static BOOL PROPSHEET_CreatePage(HWND hwndParent,
|
1999-04-22 11:24:47 +02:00
|
|
|
int index,
|
1999-05-01 12:27:05 +02:00
|
|
|
const PropSheetInfo * psInfo,
|
2002-01-29 18:14:53 +01:00
|
|
|
LPCPROPSHEETPAGEW ppshpage)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
|
|
|
DLGTEMPLATE* pTemplate;
|
|
|
|
HWND hwndPage;
|
2000-11-09 21:25:27 +01:00
|
|
|
DWORD resSize;
|
|
|
|
LPVOID temp = NULL;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE("index %d\n", index);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2002-05-14 20:38:07 +02:00
|
|
|
if (ppshpage == NULL)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
if (ppshpage->dwFlags & PSP_DLGINDIRECT)
|
2002-10-13 19:54:48 +02:00
|
|
|
{
|
|
|
|
pTemplate = (DLGTEMPLATE*)ppshpage->u.pResource;
|
|
|
|
resSize = GetTemplateSize(pTemplate);
|
|
|
|
}
|
2003-07-09 04:49:52 +02:00
|
|
|
else if(ppshpage->dwFlags & PSP_INTERNAL_UNICODE)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
2000-11-09 21:25:27 +01:00
|
|
|
HRSRC hResource;
|
|
|
|
HANDLE hTemplate;
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
hResource = FindResourceW(ppshpage->hInstance,
|
2000-09-19 04:43:00 +02:00
|
|
|
ppshpage->u.pszTemplate,
|
2003-09-10 05:56:47 +02:00
|
|
|
(LPWSTR)RT_DIALOG);
|
2000-11-09 21:25:27 +01:00
|
|
|
if(!hResource)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
resSize = SizeofResource(ppshpage->hInstance, hResource);
|
|
|
|
|
|
|
|
hTemplate = LoadResource(ppshpage->hInstance, hResource);
|
|
|
|
if(!hTemplate)
|
|
|
|
return FALSE;
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
pTemplate = (LPDLGTEMPLATEW)LockResource(hTemplate);
|
2000-11-09 21:25:27 +01:00
|
|
|
/*
|
|
|
|
* Make a copy of the dialog template to make it writable
|
|
|
|
*/
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
2003-07-09 04:49:52 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
HRSRC hResource;
|
|
|
|
HANDLE hTemplate;
|
|
|
|
|
|
|
|
hResource = FindResourceA(ppshpage->hInstance,
|
2006-08-30 20:40:52 +02:00
|
|
|
(LPCSTR)ppshpage->u.pszTemplate,
|
2003-09-10 05:56:47 +02:00
|
|
|
(LPSTR)RT_DIALOG);
|
2003-07-09 04:49:52 +02:00
|
|
|
if(!hResource)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
resSize = SizeofResource(ppshpage->hInstance, hResource);
|
|
|
|
|
|
|
|
hTemplate = LoadResource(ppshpage->hInstance, hResource);
|
|
|
|
if(!hTemplate)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);
|
|
|
|
/*
|
|
|
|
* Make a copy of the dialog template to make it writable
|
|
|
|
*/
|
|
|
|
}
|
2003-09-22 23:32:33 +02:00
|
|
|
temp = Alloc(resSize);
|
2002-10-13 19:54:48 +02:00
|
|
|
if (!temp)
|
|
|
|
return FALSE;
|
|
|
|
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("copying pTemplate %p into temp %p (%d)\n", pTemplate, temp, resSize);
|
2002-10-13 19:54:48 +02:00
|
|
|
memcpy(temp, pTemplate, resSize);
|
|
|
|
pTemplate = temp;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
if (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF)
|
|
|
|
{
|
2004-09-14 01:19:51 +02:00
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->style |= WS_CHILD | WS_TABSTOP | DS_CONTROL;
|
1999-04-22 11:24:47 +02:00
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->style &= ~DS_MODALFRAME;
|
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_CAPTION;
|
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_SYSMENU;
|
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_POPUP;
|
1999-07-20 16:56:08 +02:00
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_DISABLED;
|
1999-11-28 22:01:47 +01:00
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_VISIBLE;
|
2002-05-14 20:38:07 +02:00
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_THICKFRAME;
|
2004-08-16 21:50:44 +02:00
|
|
|
|
|
|
|
((MyDLGTEMPLATEEX*)pTemplate)->exStyle |= WS_EX_CONTROLPARENT;
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-09-14 01:19:51 +02:00
|
|
|
pTemplate->style |= WS_CHILD | WS_TABSTOP | DS_CONTROL;
|
1999-04-22 11:24:47 +02:00
|
|
|
pTemplate->style &= ~DS_MODALFRAME;
|
|
|
|
pTemplate->style &= ~WS_CAPTION;
|
|
|
|
pTemplate->style &= ~WS_SYSMENU;
|
|
|
|
pTemplate->style &= ~WS_POPUP;
|
1999-07-20 16:56:08 +02:00
|
|
|
pTemplate->style &= ~WS_DISABLED;
|
1999-11-28 22:01:47 +01:00
|
|
|
pTemplate->style &= ~WS_VISIBLE;
|
2002-05-14 20:38:07 +02:00
|
|
|
pTemplate->style &= ~WS_THICKFRAME;
|
2004-08-16 21:50:44 +02:00
|
|
|
|
|
|
|
pTemplate->dwExtendedStyle |= WS_EX_CONTROLPARENT;
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (psInfo->proppage[index].useCallback)
|
2003-11-04 05:23:00 +01:00
|
|
|
(*(ppshpage->pfnCallback))(0, PSPCB_CREATE,
|
2002-01-29 18:14:53 +01:00
|
|
|
(LPPROPSHEETPAGEW)ppshpage);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2003-07-09 04:49:52 +02:00
|
|
|
if(ppshpage->dwFlags & PSP_INTERNAL_UNICODE)
|
|
|
|
hwndPage = CreateDialogIndirectParamW(ppshpage->hInstance,
|
|
|
|
pTemplate,
|
|
|
|
hwndParent,
|
|
|
|
ppshpage->pfnDlgProc,
|
|
|
|
(LPARAM)ppshpage);
|
|
|
|
else
|
|
|
|
hwndPage = CreateDialogIndirectParamA(ppshpage->hInstance,
|
1999-05-08 17:38:57 +02:00
|
|
|
pTemplate,
|
|
|
|
hwndParent,
|
|
|
|
ppshpage->pfnDlgProc,
|
1999-05-08 20:28:13 +02:00
|
|
|
(LPARAM)ppshpage);
|
2000-11-09 21:25:27 +01:00
|
|
|
/* Free a no more needed copy */
|
|
|
|
if(temp)
|
2003-09-22 23:32:33 +02:00
|
|
|
Free(temp);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-02-25 02:24:22 +01:00
|
|
|
psInfo->proppage[index].hwndPage = hwndPage;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-09-13 21:17:00 +02:00
|
|
|
/* Subclass exterior wizard pages */
|
|
|
|
if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
|
|
|
|
(ppshpage->dwFlags & PSP_HIDEHEADER))
|
|
|
|
{
|
|
|
|
SetWindowSubclass(hwndPage, PROPSHEET_WizardSubclassProc, 1,
|
|
|
|
(DWORD_PTR)ppshpage);
|
|
|
|
}
|
2005-07-18 12:31:06 +02:00
|
|
|
if (!(psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD))
|
|
|
|
EnableThemeDialogTexture (hwndPage, ETDT_ENABLETAB);
|
2004-09-13 21:17:00 +02:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-08-09 21:48:04 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* 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 =
|
2005-08-30 12:07:17 +02:00
|
|
|
CreateMappedBitmap(psInfo->ppshheader.hInstance, (INT_PTR)psInfo->ppshheader.u4.pszbmWatermark, 0, NULL, 0);
|
2004-08-09 21:48:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Same behavior as for watermarks */
|
|
|
|
if ((psInfo->ppshheader.dwFlags & PSH_HEADER) &&
|
|
|
|
!(psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER))
|
|
|
|
{
|
|
|
|
((PropSheetInfo *)psInfo)->ppshheader.u5.hbmHeader =
|
2005-08-30 12:07:17 +02:00
|
|
|
CreateMappedBitmap(psInfo->ppshheader.hInstance, (INT_PTR)psInfo->ppshheader.u5.pszbmHeader, 0, NULL, 0);
|
2004-08-09 21:48:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_ShowPage
|
|
|
|
*
|
|
|
|
* Displays or creates the specified page.
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo)
|
|
|
|
{
|
2001-08-06 19:51:09 +02:00
|
|
|
HWND hwndTabCtrl;
|
2004-05-10 23:26:04 +02:00
|
|
|
HWND hwndLineHeader;
|
|
|
|
LPCPROPSHEETPAGEW ppshpage;
|
2001-08-06 19:51:09 +02:00
|
|
|
|
|
|
|
TRACE("active_page %d, index %d\n", psInfo->active_page, index);
|
1999-04-22 11:24:47 +02:00
|
|
|
if (index == psInfo->active_page)
|
2001-06-06 23:03:21 +02:00
|
|
|
{
|
2000-02-26 19:28:38 +01:00
|
|
|
if (GetTopWindow(hwndDlg) != psInfo->proppage[index].hwndPage)
|
1999-11-28 22:01:47 +01:00
|
|
|
SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
2001-06-06 23:03:21 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-09-07 21:31:50 +02:00
|
|
|
ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage;
|
1999-11-28 22:01:47 +01:00
|
|
|
if (psInfo->proppage[index].hwndPage == 0)
|
1999-05-01 12:27:05 +02:00
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage);
|
2000-02-26 19:28:38 +01:00
|
|
|
}
|
1999-11-28 22:01:47 +01:00
|
|
|
|
2006-05-05 15:58:26 +02:00
|
|
|
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
|
2004-08-10 00:54:14 +02:00
|
|
|
{
|
|
|
|
PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags,
|
|
|
|
psInfo->proppage[index].pszText);
|
|
|
|
}
|
2003-10-02 06:26:53 +02:00
|
|
|
|
2000-02-25 21:49:49 +01:00
|
|
|
if (psInfo->active_page != -1)
|
|
|
|
ShowWindow(psInfo->proppage[psInfo->active_page].hwndPage, SW_HIDE);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
2000-02-25 21:49:49 +01:00
|
|
|
ShowWindow(psInfo->proppage[index].hwndPage, SW_SHOW);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
/* Synchronize current selection with tab control
|
|
|
|
* It seems to be needed even in case of PSH_WIZARD (no tab controls there) */
|
|
|
|
hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
2002-01-29 18:14:53 +01:00
|
|
|
SendMessageW(hwndTabCtrl, TCM_SETCURSEL, index, 0);
|
2000-02-26 19:28:38 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
psInfo->active_page = index;
|
1999-11-28 22:01:47 +01:00
|
|
|
psInfo->activeValid = TRUE;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-05-10 23:26:04 +02:00
|
|
|
if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW) )
|
|
|
|
{
|
|
|
|
hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER);
|
|
|
|
ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage;
|
|
|
|
|
|
|
|
if ((ppshpage->dwFlags & PSP_HIDEHEADER) || (!(psInfo->ppshheader.dwFlags & PSH_HEADER)) )
|
|
|
|
ShowWindow(hwndLineHeader, SW_HIDE);
|
|
|
|
else
|
|
|
|
ShowWindow(hwndLineHeader, SW_SHOW);
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_Back
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_Back(HWND hwndDlg)
|
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
PSHNOTIFY psn;
|
1999-09-19 14:14:38 +02:00
|
|
|
HWND hwndPage;
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-09-19 14:14:38 +02:00
|
|
|
PropSheetInfoStr);
|
2001-06-06 23:03:21 +02:00
|
|
|
LRESULT result;
|
2002-05-14 20:38:07 +02:00
|
|
|
int idx;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("active_page %d\n", psInfo->active_page);
|
1999-11-28 22:01:47 +01:00
|
|
|
if (psInfo->active_page < 0)
|
1999-11-13 21:49:12 +01:00
|
|
|
return FALSE;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_WIZBACK;
|
|
|
|
psn.hdr.hwndFrom = hwndDlg;
|
|
|
|
psn.hdr.idFrom = 0;
|
|
|
|
psn.lParam = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
result = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
2001-06-06 23:03:21 +02:00
|
|
|
if (result == -1)
|
1999-09-19 14:14:38 +02:00
|
|
|
return FALSE;
|
2002-05-14 20:38:07 +02:00
|
|
|
else if (result == 0)
|
|
|
|
idx = psInfo->active_page - 1;
|
|
|
|
else
|
|
|
|
idx = PROPSHEET_FindPageByResId(psInfo, result);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2002-05-14 20:38:07 +02:00
|
|
|
if (idx >= 0 && idx < psInfo->nPages)
|
1999-10-13 17:54:08 +02:00
|
|
|
{
|
2002-05-14 20:38:07 +02:00
|
|
|
if (PROPSHEET_CanSetCurSel(hwndDlg))
|
|
|
|
PROPSHEET_SetCurSel(hwndDlg, idx, -1, 0);
|
1999-10-13 17:54:08 +02:00
|
|
|
}
|
1999-09-19 14:14:38 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_Next
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_Next(HWND hwndDlg)
|
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
PSHNOTIFY psn;
|
1999-09-19 14:14:38 +02:00
|
|
|
HWND hwndPage;
|
|
|
|
LRESULT msgResult = 0;
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-09-19 14:14:38 +02:00
|
|
|
PropSheetInfoStr);
|
2002-05-14 20:38:07 +02:00
|
|
|
int idx;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("active_page %d\n", psInfo->active_page);
|
1999-11-28 22:01:47 +01:00
|
|
|
if (psInfo->active_page < 0)
|
1999-11-13 21:49:12 +01:00
|
|
|
return FALSE;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_WIZNEXT;
|
|
|
|
psn.hdr.hwndFrom = hwndDlg;
|
|
|
|
psn.hdr.idFrom = 0;
|
|
|
|
psn.lParam = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
1999-09-19 14:14:38 +02:00
|
|
|
if (msgResult == -1)
|
|
|
|
return FALSE;
|
2002-05-14 20:38:07 +02:00
|
|
|
else if (msgResult == 0)
|
|
|
|
idx = psInfo->active_page + 1;
|
|
|
|
else
|
|
|
|
idx = PROPSHEET_FindPageByResId(psInfo, msgResult);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2002-05-14 20:38:07 +02:00
|
|
|
if (idx < psInfo->nPages )
|
1999-10-13 17:54:08 +02:00
|
|
|
{
|
2002-05-14 20:38:07 +02:00
|
|
|
if (PROPSHEET_CanSetCurSel(hwndDlg) != FALSE)
|
|
|
|
PROPSHEET_SetCurSel(hwndDlg, idx, 1, 0);
|
1999-10-13 17:54:08 +02:00
|
|
|
}
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_Finish
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_Finish(HWND hwndDlg)
|
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
PSHNOTIFY psn;
|
1999-09-19 14:14:38 +02:00
|
|
|
HWND hwndPage;
|
|
|
|
LRESULT msgResult = 0;
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-09-19 14:14:38 +02:00
|
|
|
PropSheetInfoStr);
|
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("active_page %d\n", psInfo->active_page);
|
1999-11-13 21:49:12 +01:00
|
|
|
if (psInfo->active_page < 0)
|
|
|
|
return FALSE;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_WIZFINISH;
|
|
|
|
psn.hdr.hwndFrom = hwndDlg;
|
|
|
|
psn.hdr.idFrom = 0;
|
|
|
|
psn.lParam = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
TRACE("msg result %ld\n", msgResult);
|
|
|
|
|
|
|
|
if (msgResult != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
2006-11-20 13:21:17 +01:00
|
|
|
if (psInfo->result == 0)
|
|
|
|
psInfo->result = IDOK;
|
1999-09-19 14:14:38 +02:00
|
|
|
if (psInfo->isModeless)
|
1999-11-28 22:01:47 +01:00
|
|
|
psInfo->activeValid = FALSE;
|
1999-09-19 14:14:38 +02:00
|
|
|
else
|
2005-06-15 21:12:57 +02:00
|
|
|
psInfo->ended = TRUE;
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_Apply
|
|
|
|
*/
|
1999-11-28 22:01:47 +01:00
|
|
|
static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
HWND hwndPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
PSHNOTIFY psn;
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("active_page %d\n", psInfo->active_page);
|
1999-11-13 21:49:12 +01:00
|
|
|
if (psInfo->active_page < 0)
|
|
|
|
return FALSE;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.hwndFrom = hwndDlg;
|
|
|
|
psn.hdr.idFrom = 0;
|
|
|
|
psn.lParam = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Send PSN_KILLACTIVE to the current page.
|
|
|
|
*/
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_KILLACTIVE;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) != FALSE)
|
1999-04-22 11:24:47 +02:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Send PSN_APPLY to all pages.
|
|
|
|
*/
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_APPLY;
|
|
|
|
psn.lParam = lParam;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-01 12:27:05 +02:00
|
|
|
for (i = 0; i < psInfo->nPages; i++)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
|
|
|
hwndPage = psInfo->proppage[i].hwndPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
if (hwndPage)
|
|
|
|
{
|
2005-03-23 11:23:23 +01:00
|
|
|
switch (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn))
|
2003-02-24 21:40:45 +01:00
|
|
|
{
|
|
|
|
case PSNRET_INVALID:
|
|
|
|
PROPSHEET_ShowPage(hwndDlg, i, psInfo);
|
|
|
|
/* fall through */
|
|
|
|
case PSNRET_INVALID_NOCHANGEPAGE:
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-11-28 22:01:47 +01:00
|
|
|
}
|
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
if(lParam)
|
|
|
|
{
|
|
|
|
psInfo->activeValid = FALSE;
|
|
|
|
}
|
|
|
|
else if(psInfo->active_page >= 0)
|
|
|
|
{
|
|
|
|
psn.hdr.code = PSN_SETACTIVE;
|
|
|
|
psn.lParam = 0;
|
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
2005-03-23 11:23:23 +01:00
|
|
|
SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_Cancel
|
|
|
|
*/
|
1999-11-28 22:01:47 +01:00
|
|
|
static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
1999-11-13 21:49:12 +01:00
|
|
|
HWND hwndPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
PSHNOTIFY psn;
|
|
|
|
int i;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("active_page %d\n", psInfo->active_page);
|
1999-11-13 21:49:12 +01:00
|
|
|
if (psInfo->active_page < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_QUERYCANCEL;
|
|
|
|
psn.hdr.hwndFrom = hwndDlg;
|
|
|
|
psn.hdr.idFrom = 0;
|
|
|
|
psn.lParam = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn))
|
1999-04-22 11:24:47 +02:00
|
|
|
return;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_RESET;
|
|
|
|
psn.lParam = lParam;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
for (i = 0; i < psInfo->nPages; i++)
|
|
|
|
{
|
|
|
|
hwndPage = psInfo->proppage[i].hwndPage;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
if (hwndPage)
|
2005-03-23 11:23:23 +01:00
|
|
|
SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
1999-11-28 22:01:47 +01:00
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
if (psInfo->isModeless)
|
1999-11-28 22:01:47 +01:00
|
|
|
{
|
|
|
|
/* makes PSM_GETCURRENTPAGEHWND return NULL */
|
|
|
|
psInfo->activeValid = FALSE;
|
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
else
|
2005-06-15 21:12:57 +02:00
|
|
|
psInfo->ended = TRUE;
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
|
1999-05-01 12:27:05 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_Help
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_Help(HWND hwndDlg)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-05-01 12:27:05 +02:00
|
|
|
PropSheetInfoStr);
|
1999-11-13 21:49:12 +01:00
|
|
|
HWND hwndPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
PSHNOTIFY psn;
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("active_page %d\n", psInfo->active_page);
|
1999-11-13 21:49:12 +01:00
|
|
|
if (psInfo->active_page < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_HELP;
|
|
|
|
psn.hdr.hwndFrom = hwndDlg;
|
|
|
|
psn.hdr.idFrom = 0;
|
|
|
|
psn.lParam = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
1999-05-01 12:27:05 +02:00
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_Changed
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_Changed(HWND hwndDlg, HWND hwndDirtyPage)
|
|
|
|
{
|
|
|
|
int i;
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("\n");
|
1999-07-03 18:01:42 +02:00
|
|
|
if (!psInfo) return;
|
1999-04-22 11:24:47 +02:00
|
|
|
/*
|
|
|
|
* Set the dirty flag of this page.
|
|
|
|
*/
|
1999-05-01 12:27:05 +02:00
|
|
|
for (i = 0; i < psInfo->nPages; i++)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
|
|
|
if (psInfo->proppage[i].hwndPage == hwndDirtyPage)
|
|
|
|
psInfo->proppage[i].isDirty = TRUE;
|
|
|
|
}
|
1999-01-24 20:14:58 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/*
|
|
|
|
* Enable the Apply button.
|
|
|
|
*/
|
|
|
|
if (psInfo->hasApply)
|
|
|
|
{
|
|
|
|
HWND hwndApplyBtn = GetDlgItem(hwndDlg, IDC_APPLY_BUTTON);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
EnableWindow(hwndApplyBtn, TRUE);
|
|
|
|
}
|
|
|
|
}
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_UnChanged
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_UnChanged(HWND hwndDlg, HWND hwndCleanPage)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
BOOL noPageDirty = TRUE;
|
|
|
|
HWND hwndApplyBtn = GetDlgItem(hwndDlg, IDC_APPLY_BUTTON);
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("\n");
|
1999-10-23 20:59:01 +02:00
|
|
|
if ( !psInfo ) return;
|
1999-05-01 12:27:05 +02:00
|
|
|
for (i = 0; i < psInfo->nPages; i++)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
|
|
|
/* set the specified page as clean */
|
|
|
|
if (psInfo->proppage[i].hwndPage == hwndCleanPage)
|
|
|
|
psInfo->proppage[i].isDirty = FALSE;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/* look to see if there's any dirty pages */
|
|
|
|
if (psInfo->proppage[i].isDirty)
|
|
|
|
noPageDirty = FALSE;
|
|
|
|
}
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/*
|
|
|
|
* Disable Apply button.
|
|
|
|
*/
|
|
|
|
if (noPageDirty)
|
|
|
|
EnableWindow(hwndApplyBtn, FALSE);
|
|
|
|
}
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_PressButton
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_PressButton(HWND hwndDlg, int buttonID)
|
|
|
|
{
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("buttonID %d\n", buttonID);
|
1999-04-22 11:24:47 +02:00
|
|
|
switch (buttonID)
|
|
|
|
{
|
|
|
|
case PSBTN_APPLYNOW:
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEET_DoCommand(hwndDlg, IDC_APPLY_BUTTON);
|
1999-04-22 11:24:47 +02:00
|
|
|
break;
|
|
|
|
case PSBTN_BACK:
|
1999-09-19 14:14:38 +02:00
|
|
|
PROPSHEET_Back(hwndDlg);
|
1999-04-22 11:24:47 +02:00
|
|
|
break;
|
|
|
|
case PSBTN_CANCEL:
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEET_DoCommand(hwndDlg, IDCANCEL);
|
1999-04-22 11:24:47 +02:00
|
|
|
break;
|
|
|
|
case PSBTN_FINISH:
|
1999-09-19 14:14:38 +02:00
|
|
|
PROPSHEET_Finish(hwndDlg);
|
1999-04-22 11:24:47 +02:00
|
|
|
break;
|
|
|
|
case PSBTN_HELP:
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEET_DoCommand(hwndDlg, IDHELP);
|
1999-04-22 11:24:47 +02:00
|
|
|
break;
|
|
|
|
case PSBTN_NEXT:
|
1999-09-19 14:14:38 +02:00
|
|
|
PROPSHEET_Next(hwndDlg);
|
1999-04-22 11:24:47 +02:00
|
|
|
break;
|
|
|
|
case PSBTN_OK:
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEET_DoCommand(hwndDlg, IDOK);
|
1999-04-22 11:24:47 +02:00
|
|
|
break;
|
|
|
|
default:
|
1999-06-12 17:45:58 +02:00
|
|
|
FIXME("Invalid button index %d\n", buttonID);
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
}
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-10-13 17:54:08 +02:00
|
|
|
|
|
|
|
/*************************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* BOOL PROPSHEET_CanSetCurSel [Internal]
|
1999-10-13 17:54:08 +02:00
|
|
|
*
|
2000-12-27 05:02:46 +01:00
|
|
|
* Test whether the current page can be changed by sending a PSN_KILLACTIVE
|
1999-10-13 17:54:08 +02:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hwndDlg [I] handle to a Dialog hWnd
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE if Current Selection can change
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-10-13 17:54:08 +02:00
|
|
|
PropSheetInfoStr);
|
|
|
|
HWND hwndPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
PSHNOTIFY psn;
|
2001-08-06 19:51:09 +02:00
|
|
|
BOOL res = FALSE;
|
1999-10-31 03:24:29 +01:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("active_page %d\n", psInfo->active_page);
|
1999-11-28 22:01:47 +01:00
|
|
|
if (!psInfo)
|
2001-08-06 19:51:09 +02:00
|
|
|
{
|
|
|
|
res = FALSE;
|
|
|
|
goto end;
|
|
|
|
}
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
if (psInfo->active_page < 0)
|
2001-08-06 19:51:09 +02:00
|
|
|
{
|
|
|
|
res = TRUE;
|
|
|
|
goto end;
|
|
|
|
}
|
1999-11-28 22:01:47 +01:00
|
|
|
|
1999-10-13 17:54:08 +02:00
|
|
|
/*
|
|
|
|
* Notify the current page.
|
|
|
|
*/
|
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
psn.hdr.code = PSN_KILLACTIVE;
|
|
|
|
psn.hdr.hwndFrom = hwndDlg;
|
|
|
|
psn.hdr.idFrom = 0;
|
|
|
|
psn.lParam = 0;
|
1999-10-13 17:54:08 +02:00
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
res = !SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
2001-08-06 19:51:09 +02:00
|
|
|
|
|
|
|
end:
|
|
|
|
TRACE("<-- %d\n", res);
|
|
|
|
return res;
|
1999-10-13 17:54:08 +02:00
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetCurSel
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
|
|
|
|
int index,
|
2001-06-06 23:03:21 +02:00
|
|
|
int skipdir,
|
|
|
|
HPROPSHEETPAGE hpage
|
|
|
|
)
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
|
1999-04-22 11:24:47 +02:00
|
|
|
HWND hwndHelp = GetDlgItem(hwndDlg, IDHELP);
|
2002-06-28 19:31:57 +02:00
|
|
|
HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("index %d, skipdir %d, hpage %p\n", index, skipdir, hpage);
|
1999-11-28 22:01:47 +01:00
|
|
|
/* hpage takes precedence over index */
|
1999-04-22 11:24:47 +02:00
|
|
|
if (hpage != NULL)
|
1999-07-24 12:16:53 +02:00
|
|
|
index = PROPSHEET_GetPageIndex(hpage, psInfo);
|
|
|
|
|
1999-11-13 21:49:12 +01:00
|
|
|
if (index < 0 || index >= psInfo->nPages)
|
|
|
|
{
|
|
|
|
TRACE("Could not find page to select!\n");
|
|
|
|
return FALSE;
|
1999-07-24 12:16:53 +02:00
|
|
|
}
|
|
|
|
|
2001-06-06 23:03:21 +02:00
|
|
|
while (1) {
|
2000-02-26 19:28:38 +01:00
|
|
|
int result;
|
|
|
|
PSHNOTIFY psn;
|
2004-09-07 22:28:14 +02:00
|
|
|
RECT rc;
|
2004-09-14 01:19:51 +02:00
|
|
|
LPCPROPSHEETPAGEW ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage;
|
2000-02-26 19:28:38 +01:00
|
|
|
|
2002-06-28 19:31:57 +02:00
|
|
|
if (hwndTabControl)
|
|
|
|
SendMessageW(hwndTabControl, TCM_SETCURSEL, index, 0);
|
|
|
|
|
2000-02-26 19:28:38 +01:00
|
|
|
psn.hdr.code = PSN_SETACTIVE;
|
|
|
|
psn.hdr.hwndFrom = hwndDlg;
|
|
|
|
psn.hdr.idFrom = 0;
|
|
|
|
psn.lParam = 0;
|
|
|
|
|
2001-06-06 23:03:21 +02:00
|
|
|
if (!psInfo->proppage[index].hwndPage) {
|
|
|
|
PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage);
|
|
|
|
}
|
2000-02-26 19:28:38 +01:00
|
|
|
|
2004-09-14 01:19:51 +02:00
|
|
|
/* Resize the property sheet page to the fit in the Tab control
|
|
|
|
* (for regular property sheets) or to fit in the client area (for
|
|
|
|
* wizards).
|
|
|
|
* NOTE: The resizing happens every time the page is selected and
|
2004-09-07 22:28:14 +02:00
|
|
|
* not only when it's created (some applications depend on it). */
|
2004-09-14 01:19:51 +02:00
|
|
|
PROPSHEET_GetPageRect(psInfo, hwndDlg, &rc, ppshpage);
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("setting page %p, rc (%d,%d)-(%d,%d) w=%d, h=%d\n",
|
2004-09-14 01:19:51 +02:00
|
|
|
psInfo->proppage[index].hwndPage, rc.left, rc.top, rc.right, rc.bottom,
|
|
|
|
rc.right - rc.left, rc.bottom - rc.top);
|
|
|
|
SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP,
|
|
|
|
rc.left, rc.top,
|
|
|
|
rc.right - rc.left, rc.bottom - rc.top, 0);
|
2004-09-07 22:28:14 +02:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
result = SendMessageW(psInfo->proppage[index].hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
2001-06-06 23:03:21 +02:00
|
|
|
if (!result)
|
|
|
|
break;
|
|
|
|
if (result == -1) {
|
|
|
|
index+=skipdir;
|
|
|
|
if (index < 0) {
|
|
|
|
index = 0;
|
2003-11-03 23:15:39 +01:00
|
|
|
WARN("Tried to skip before first property sheet page!\n");
|
2001-06-06 23:03:21 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (index >= psInfo->nPages) {
|
2003-11-03 23:15:39 +01:00
|
|
|
WARN("Tried to skip after last property sheet page!\n");
|
2001-06-06 23:03:21 +02:00
|
|
|
index = psInfo->nPages-1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-05-14 20:38:07 +02:00
|
|
|
else if (result != 0)
|
|
|
|
{
|
2003-11-03 23:15:39 +01:00
|
|
|
int old_index = index;
|
|
|
|
index = PROPSHEET_FindPageByResId(psInfo, result);
|
|
|
|
if(index >= psInfo->nPages) {
|
|
|
|
index = old_index;
|
|
|
|
WARN("Tried to skip to nonexistant page by res id\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
continue;
|
2002-05-14 20:38:07 +02:00
|
|
|
}
|
2000-02-26 19:28:38 +01:00
|
|
|
}
|
2006-07-31 16:28:17 +02:00
|
|
|
|
|
|
|
/* Invalidate the header area */
|
|
|
|
if ( (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_HEADER) )
|
|
|
|
{
|
|
|
|
HWND hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER);
|
|
|
|
RECT r;
|
|
|
|
|
|
|
|
GetClientRect(hwndLineHeader, &r);
|
|
|
|
MapWindowPoints(hwndLineHeader, hwndDlg, (LPPOINT) &r, 2);
|
|
|
|
SetRect(&r, 0, 0, r.right + 1, r.top - 1);
|
|
|
|
|
|
|
|
InvalidateRect(hwndDlg, &r, TRUE);
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/*
|
|
|
|
* Display the new page.
|
|
|
|
*/
|
|
|
|
PROPSHEET_ShowPage(hwndDlg, index, psInfo);
|
|
|
|
|
|
|
|
if (psInfo->proppage[index].hasHelp)
|
|
|
|
EnableWindow(hwndHelp, TRUE);
|
|
|
|
else
|
|
|
|
EnableWindow(hwndHelp, FALSE);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-08-26 23:47:06 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetCurSelId
|
|
|
|
*
|
|
|
|
* Selects the page, specified by resource id.
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetCurSelId(HWND hwndDlg, int id)
|
|
|
|
{
|
|
|
|
int idx;
|
|
|
|
PropSheetInfo* psInfo =
|
|
|
|
(PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
|
|
|
|
|
|
|
|
idx = PROPSHEET_FindPageByResId(psInfo, id);
|
|
|
|
if (idx < psInfo->nPages )
|
|
|
|
{
|
|
|
|
if (PROPSHEET_CanSetCurSel(hwndDlg) != FALSE)
|
|
|
|
PROPSHEET_SetCurSel(hwndDlg, idx, 1, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetTitleA
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
if(HIWORD(lpszText))
|
|
|
|
{
|
|
|
|
WCHAR szTitle[256];
|
2002-06-01 01:06:46 +02:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszText, -1,
|
2005-09-13 00:07:53 +02:00
|
|
|
szTitle, sizeof(szTitle)/sizeof(WCHAR));
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PROPSHEET_SetTitleW(hwndDlg, dwStyle, (LPCWSTR)lpszText);
|
|
|
|
}
|
|
|
|
}
|
1999-11-07 06:28:32 +01:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetTitleW
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText)
|
|
|
|
{
|
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
|
|
|
|
WCHAR szTitle[256];
|
|
|
|
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("'%s' (style %08x)\n", debugstr_w(lpszText), dwStyle);
|
1999-11-07 06:28:32 +01:00
|
|
|
if (HIWORD(lpszText) == 0) {
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!LoadStringW(psInfo->ppshheader.hInstance,
|
2002-01-29 18:14:53 +01:00
|
|
|
LOWORD(lpszText), szTitle, sizeof(szTitle)-sizeof(WCHAR)))
|
1999-11-07 06:28:32 +01:00
|
|
|
return;
|
|
|
|
lpszText = szTitle;
|
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
if (dwStyle & PSH_PROPTITLE)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
WCHAR* dest;
|
|
|
|
int lentitle = strlenW(lpszText);
|
|
|
|
int lenprop = strlenW(psInfo->strPropertiesFor);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2003-09-22 23:32:33 +02:00
|
|
|
dest = Alloc( (lentitle + lenprop + 1)*sizeof (WCHAR));
|
2006-07-12 19:16:10 +02:00
|
|
|
wsprintfW(dest, psInfo->strPropertiesFor, lpszText);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
SetWindowTextW(hwndDlg, dest);
|
2003-09-22 23:32:33 +02:00
|
|
|
Free(dest);
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
else
|
2002-01-29 18:14:53 +01:00
|
|
|
SetWindowTextW(hwndDlg, lpszText);
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetFinishTextA
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText)
|
|
|
|
{
|
2005-07-15 11:59:04 +02:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
|
1999-09-19 14:14:38 +02:00
|
|
|
HWND hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON);
|
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("'%s'\n", lpszText);
|
1999-09-19 14:14:38 +02:00
|
|
|
/* Set text, show and enable the Finish button */
|
|
|
|
SetWindowTextA(hwndButton, lpszText);
|
|
|
|
ShowWindow(hwndButton, SW_SHOW);
|
|
|
|
EnableWindow(hwndButton, TRUE);
|
|
|
|
|
|
|
|
/* Make it default pushbutton */
|
2005-03-23 11:23:23 +01:00
|
|
|
SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
/* Hide Back button */
|
|
|
|
hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON);
|
|
|
|
ShowWindow(hwndButton, SW_HIDE);
|
|
|
|
|
2005-07-15 11:59:04 +02:00
|
|
|
if (!psInfo->hasFinish)
|
|
|
|
{
|
|
|
|
/* Hide Next button */
|
|
|
|
hwndButton = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON);
|
|
|
|
ShowWindow(hwndButton, SW_HIDE);
|
|
|
|
}
|
1999-09-19 14:14:38 +02:00
|
|
|
}
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetFinishTextW
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetFinishTextW(HWND hwndDlg, LPCWSTR lpszText)
|
|
|
|
{
|
2005-07-15 11:59:04 +02:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
|
2002-01-29 18:14:53 +01:00
|
|
|
HWND hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON);
|
|
|
|
|
|
|
|
TRACE("'%s'\n", debugstr_w(lpszText));
|
|
|
|
/* Set text, show and enable the Finish button */
|
|
|
|
SetWindowTextW(hwndButton, lpszText);
|
|
|
|
ShowWindow(hwndButton, SW_SHOW);
|
|
|
|
EnableWindow(hwndButton, TRUE);
|
|
|
|
|
|
|
|
/* Make it default pushbutton */
|
|
|
|
SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
|
|
|
|
|
|
|
|
/* Hide Back button */
|
|
|
|
hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON);
|
|
|
|
ShowWindow(hwndButton, SW_HIDE);
|
|
|
|
|
2005-07-15 11:59:04 +02:00
|
|
|
if (!psInfo->hasFinish)
|
|
|
|
{
|
|
|
|
/* Hide Next button */
|
|
|
|
hwndButton = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON);
|
|
|
|
ShowWindow(hwndButton, SW_HIDE);
|
|
|
|
}
|
2002-01-29 18:14:53 +01:00
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_QuerySiblings
|
|
|
|
*/
|
|
|
|
static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
|
|
|
|
WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
HWND hwndPage;
|
|
|
|
LRESULT msgResult = 0;
|
2005-03-23 11:23:23 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
1999-05-01 12:27:05 +02:00
|
|
|
while ((i < psInfo->nPages) && (msgResult == 0))
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
|
|
|
hwndPage = psInfo->proppage[i].hwndPage;
|
2005-03-23 11:23:23 +01:00
|
|
|
msgResult = SendMessageW(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam);
|
1999-04-22 11:24:47 +02:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return msgResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_AddPage
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_AddPage(HWND hwndDlg,
|
|
|
|
HPROPSHEETPAGE hpage)
|
|
|
|
{
|
2005-12-31 13:12:19 +01:00
|
|
|
PropPageInfo * ppi;
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
|
|
|
HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
2002-01-29 18:14:53 +01:00
|
|
|
TCITEMW item;
|
|
|
|
LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("hpage %p\n", hpage);
|
1999-05-01 12:27:05 +02:00
|
|
|
/*
|
|
|
|
* Allocate and fill in a new PropPageInfo entry.
|
|
|
|
*/
|
2005-12-31 13:12:19 +01:00
|
|
|
ppi = (PropPageInfo*) ReAlloc(psInfo->proppage,
|
|
|
|
sizeof(PropPageInfo) *
|
|
|
|
(psInfo->nPages + 1));
|
|
|
|
if (!ppi)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
psInfo->proppage = ppi;
|
2002-05-14 05:48:48 +02:00
|
|
|
if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages))
|
2000-02-25 21:49:49 +01:00
|
|
|
return FALSE;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
1999-05-01 12:27:05 +02:00
|
|
|
psInfo->proppage[psInfo->nPages].hpage = hpage;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
if (ppsp->dwFlags & PSP_PREMATURE)
|
|
|
|
{
|
|
|
|
/* Create the page but don't show it */
|
|
|
|
PROPSHEET_CreatePage(hwndDlg, psInfo->nPages, psInfo, ppsp);
|
|
|
|
}
|
1999-05-01 12:27:05 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add a new tab to the tab control.
|
|
|
|
*/
|
|
|
|
item.mask = TCIF_TEXT;
|
2002-01-29 18:14:53 +01:00
|
|
|
item.pszText = (LPWSTR) psInfo->proppage[psInfo->nPages].pszText;
|
1999-05-01 12:27:05 +02:00
|
|
|
item.cchTextMax = MAX_TABTEXT_LENGTH;
|
|
|
|
|
2002-06-15 01:26:37 +02:00
|
|
|
if (psInfo->hImageList)
|
|
|
|
{
|
|
|
|
SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( psInfo->proppage[psInfo->nPages].hasIcon )
|
|
|
|
{
|
|
|
|
item.mask |= TCIF_IMAGE;
|
|
|
|
item.iImage = psInfo->nPages;
|
|
|
|
}
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
SendMessageW(hwndTabControl, TCM_INSERTITEMW, psInfo->nPages + 1,
|
1999-05-01 12:27:05 +02:00
|
|
|
(LPARAM)&item);
|
|
|
|
|
|
|
|
psInfo->nPages++;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
/* If it is the only page - show it */
|
|
|
|
if(psInfo->nPages == 1)
|
2001-06-06 23:03:21 +02:00
|
|
|
PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0);
|
1999-10-31 19:29:47 +01:00
|
|
|
return TRUE;
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_RemovePage
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_RemovePage(HWND hwndDlg,
|
|
|
|
int index,
|
|
|
|
HPROPSHEETPAGE hpage)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
|
|
|
HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
1999-10-13 14:31:52 +02:00
|
|
|
PropPageInfo* oldPages;
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("index %d, hpage %p\n", index, hpage);
|
1999-10-13 14:31:52 +02:00
|
|
|
if (!psInfo) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-05-01 12:27:05 +02:00
|
|
|
/*
|
|
|
|
* hpage takes precedence over index.
|
|
|
|
*/
|
|
|
|
if (hpage != 0)
|
|
|
|
{
|
|
|
|
index = PROPSHEET_GetPageIndex(hpage, psInfo);
|
1999-10-24 01:59:47 +02:00
|
|
|
}
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2000-08-26 22:28:02 +02:00
|
|
|
/* Make sure that index is within range */
|
1999-10-24 01:59:47 +02:00
|
|
|
if (index < 0 || index >= psInfo->nPages)
|
1999-11-28 22:01:47 +01:00
|
|
|
{
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE("Could not find page to remove!\n");
|
1999-05-01 12:27:05 +02:00
|
|
|
return FALSE;
|
1999-11-28 22:01:47 +01:00
|
|
|
}
|
1999-05-01 12:27:05 +02:00
|
|
|
|
1999-06-12 17:45:58 +02:00
|
|
|
TRACE("total pages %d removing page %d active page %d\n",
|
1999-05-01 12:27:05 +02:00
|
|
|
psInfo->nPages, index, psInfo->active_page);
|
|
|
|
/*
|
|
|
|
* Check if we're removing the active page.
|
|
|
|
*/
|
|
|
|
if (index == psInfo->active_page)
|
|
|
|
{
|
|
|
|
if (psInfo->nPages > 1)
|
|
|
|
{
|
|
|
|
if (index > 0)
|
|
|
|
{
|
|
|
|
/* activate previous page */
|
2001-06-06 23:03:21 +02:00
|
|
|
PROPSHEET_SetCurSel(hwndDlg, index - 1, -1, 0);
|
1999-05-01 12:27:05 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* activate the next page */
|
2001-06-06 23:03:21 +02:00
|
|
|
PROPSHEET_SetCurSel(hwndDlg, index + 1, 1, 0);
|
2000-06-07 04:01:28 +02:00
|
|
|
psInfo->active_page = index;
|
1999-05-01 12:27:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
psInfo->active_page = -1;
|
|
|
|
if (!psInfo->isModeless)
|
|
|
|
{
|
2005-06-15 21:12:57 +02:00
|
|
|
psInfo->ended = TRUE;
|
1999-11-28 22:01:47 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
1999-05-01 12:27:05 +02:00
|
|
|
}
|
|
|
|
}
|
1999-11-28 22:01:47 +01:00
|
|
|
else if (index < psInfo->active_page)
|
1999-05-01 12:27:05 +02:00
|
|
|
psInfo->active_page--;
|
|
|
|
|
2004-09-13 21:17:00 +02:00
|
|
|
/* Unsubclass the page dialog window */
|
|
|
|
if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
|
|
|
|
((PROPSHEETPAGEW*)psInfo->proppage[index].hpage)->dwFlags & PSP_HIDEHEADER))
|
|
|
|
{
|
|
|
|
RemoveWindowSubclass(psInfo->proppage[index].hwndPage,
|
|
|
|
PROPSHEET_WizardSubclassProc, 1);
|
|
|
|
}
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
/* Destroy page dialog window */
|
|
|
|
DestroyWindow(psInfo->proppage[index].hwndPage);
|
|
|
|
|
|
|
|
/* Free page resources */
|
|
|
|
if(psInfo->proppage[index].hpage)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEETPAGEW* psp = (PROPSHEETPAGEW*)psInfo->proppage[index].hpage;
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[index].pszText)
|
2005-03-25 21:49:00 +01:00
|
|
|
Free ((LPVOID)psInfo->proppage[index].pszText);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
DestroyPropertySheetPage(psInfo->proppage[index].hpage);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-01 12:27:05 +02:00
|
|
|
/* Remove the tab */
|
2002-01-29 18:14:53 +01:00
|
|
|
SendMessageW(hwndTabControl, TCM_DELETEITEM, index, 0);
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2004-02-25 02:24:22 +01:00
|
|
|
oldPages = psInfo->proppage;
|
1999-05-01 12:27:05 +02:00
|
|
|
psInfo->nPages--;
|
2003-09-22 23:32:33 +02:00
|
|
|
psInfo->proppage = Alloc(sizeof(PropPageInfo) * psInfo->nPages);
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (index > 0)
|
1999-05-01 12:27:05 +02:00
|
|
|
memcpy(&psInfo->proppage[0], &oldPages[0], index * sizeof(PropPageInfo));
|
|
|
|
|
|
|
|
if (index < psInfo->nPages)
|
|
|
|
memcpy(&psInfo->proppage[index], &oldPages[index + 1],
|
|
|
|
(psInfo->nPages - index) * sizeof(PropPageInfo));
|
|
|
|
|
2003-09-22 23:32:33 +02:00
|
|
|
Free(oldPages);
|
1999-05-01 12:27:05 +02:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetWizButtons
|
|
|
|
*
|
|
|
|
* This code will work if (and assumes that) the Next button is on top of the
|
|
|
|
* Finish button. ie. Finish comes after Next in the Z order.
|
|
|
|
* This means make sure the dialog template reflects this.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
|
|
|
|
{
|
2005-07-15 11:59:04 +02:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
|
|
|
PropSheetInfoStr);
|
1999-11-28 22:01:47 +01:00
|
|
|
HWND hwndBack = GetDlgItem(hwndDlg, IDC_BACK_BUTTON);
|
|
|
|
HWND hwndNext = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON);
|
|
|
|
HWND hwndFinish = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2006-10-13 15:34:21 +02:00
|
|
|
TRACE("%d\n", dwFlags);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
EnableWindow(hwndBack, FALSE);
|
|
|
|
EnableWindow(hwndNext, FALSE);
|
|
|
|
EnableWindow(hwndFinish, FALSE);
|
|
|
|
|
2006-05-20 16:31:10 +02:00
|
|
|
/* set the default pushbutton to an enabled button */
|
|
|
|
if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
|
|
|
|
SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
|
|
|
|
else if (dwFlags & PSWIZB_NEXT)
|
|
|
|
SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
|
|
|
|
else if (dwFlags & PSWIZB_BACK)
|
|
|
|
SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
|
|
|
|
else
|
|
|
|
SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
|
|
|
|
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
if (dwFlags & PSWIZB_BACK)
|
1999-11-28 22:01:47 +01:00
|
|
|
EnableWindow(hwndBack, TRUE);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
|
|
|
if (dwFlags & PSWIZB_NEXT)
|
1999-11-28 22:01:47 +01:00
|
|
|
EnableWindow(hwndNext, TRUE);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2005-07-15 11:59:04 +02:00
|
|
|
if (!psInfo->hasFinish)
|
1999-09-19 14:14:38 +02:00
|
|
|
{
|
2005-07-15 11:59:04 +02:00
|
|
|
if ((dwFlags & PSWIZB_FINISH) || (dwFlags & PSWIZB_DISABLEDFINISH))
|
|
|
|
{
|
|
|
|
/* Hide the Next button */
|
|
|
|
ShowWindow(hwndNext, SW_HIDE);
|
|
|
|
|
|
|
|
/* Show the Finish button */
|
|
|
|
ShowWindow(hwndFinish, SW_SHOW);
|
1999-09-19 14:14:38 +02:00
|
|
|
|
2005-07-15 11:59:04 +02:00
|
|
|
if (!(dwFlags & PSWIZB_DISABLEDFINISH))
|
|
|
|
EnableWindow(hwndFinish, TRUE);
|
|
|
|
}
|
2006-05-20 16:31:01 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Hide the Finish button */
|
|
|
|
ShowWindow(hwndFinish, SW_HIDE);
|
|
|
|
/* Show the Next button */
|
|
|
|
ShowWindow(hwndNext, SW_SHOW);
|
|
|
|
}
|
1999-09-19 14:14:38 +02:00
|
|
|
}
|
2005-07-15 11:59:04 +02:00
|
|
|
else if (!(dwFlags & PSWIZB_DISABLEDFINISH))
|
|
|
|
EnableWindow(hwndFinish, TRUE);
|
1999-09-19 14:14:38 +02:00
|
|
|
}
|
|
|
|
|
2004-07-13 01:30:54 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_InsertPage
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
|
|
|
|
{
|
|
|
|
if (!HIWORD(hpageInsertAfter))
|
|
|
|
FIXME("(%p, %d, %p): stub\n", hwndDlg, LOWORD(hpageInsertAfter), hpage);
|
|
|
|
else
|
|
|
|
FIXME("(%p, %p, %p): stub\n", hwndDlg, hpageInsertAfter, hpage);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetHeaderTitleW
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetHeaderTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderTitle)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderTitle));
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetHeaderTitleA
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetHeaderTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderTitle)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderTitle));
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetHeaderSubTitleW
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetHeaderSubTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderSubTitle)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderSubTitle));
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_SetHeaderSubTitleA
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_SetHeaderSubTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderSubTitle)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderSubTitle));
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_HwndToIndex
|
|
|
|
*/
|
|
|
|
static LRESULT PROPSHEET_HwndToIndex(HWND hwndDlg, HWND hPageDlg)
|
|
|
|
{
|
2004-07-13 01:48:11 +02:00
|
|
|
int index;
|
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
|
|
|
PropSheetInfoStr);
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", hwndDlg, hPageDlg);
|
|
|
|
|
|
|
|
for (index = 0; index < psInfo->nPages; index++)
|
|
|
|
if (psInfo->proppage[index].hwndPage == hPageDlg)
|
|
|
|
return index;
|
|
|
|
WARN("%p not found\n", hPageDlg);
|
2004-07-13 01:30:54 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_IndexToHwnd
|
|
|
|
*/
|
|
|
|
static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex)
|
|
|
|
{
|
2004-08-02 20:24:58 +02:00
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
|
|
|
PropSheetInfoStr);
|
|
|
|
TRACE("(%p, %d)\n", hwndDlg, iPageIndex);
|
|
|
|
if (iPageIndex<0 || iPageIndex>=psInfo->nPages) {
|
|
|
|
WARN("%d out of range.\n", iPageIndex);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return (LRESULT)psInfo->proppage[iPageIndex].hwndPage;
|
2004-07-13 01:30:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_PageToIndex
|
|
|
|
*/
|
|
|
|
static LRESULT PROPSHEET_PageToIndex(HWND hwndDlg, HPROPSHEETPAGE hPage)
|
|
|
|
{
|
2004-09-20 21:13:36 +02:00
|
|
|
int index;
|
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
|
|
|
PropSheetInfoStr);
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", hwndDlg, hPage);
|
|
|
|
|
|
|
|
for (index = 0; index < psInfo->nPages; index++)
|
|
|
|
if (psInfo->proppage[index].hpage == hPage)
|
|
|
|
return index;
|
|
|
|
WARN("%p not found\n", hPage);
|
2004-07-13 01:30:54 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_IndexToPage
|
|
|
|
*/
|
|
|
|
static LRESULT PROPSHEET_IndexToPage(HWND hwndDlg, int iPageIndex)
|
|
|
|
{
|
2004-09-20 21:13:36 +02:00
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
|
|
|
PropSheetInfoStr);
|
|
|
|
TRACE("(%p, %d)\n", hwndDlg, iPageIndex);
|
|
|
|
if (iPageIndex<0 || iPageIndex>=psInfo->nPages) {
|
|
|
|
WARN("%d out of range.\n", iPageIndex);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return (LRESULT)psInfo->proppage[iPageIndex].hpage;
|
2004-07-13 01:30:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_IdToIndex
|
|
|
|
*/
|
|
|
|
static LRESULT PROPSHEET_IdToIndex(HWND hwndDlg, int iPageId)
|
|
|
|
{
|
2005-07-15 13:42:18 +02:00
|
|
|
int index;
|
|
|
|
LPCPROPSHEETPAGEW psp;
|
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
|
|
|
PropSheetInfoStr);
|
|
|
|
TRACE("(%p, %d)\n", hwndDlg, iPageId);
|
|
|
|
for (index = 0; index < psInfo->nPages; index++) {
|
|
|
|
psp = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage;
|
2005-08-30 12:07:17 +02:00
|
|
|
if (psp->u.pszTemplate == MAKEINTRESOURCEW(iPageId))
|
2005-07-15 13:42:18 +02:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
2004-07-13 01:30:54 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_IndexToId
|
|
|
|
*/
|
|
|
|
static LRESULT PROPSHEET_IndexToId(HWND hwndDlg, int iPageIndex)
|
|
|
|
{
|
2004-09-20 21:13:36 +02:00
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
|
|
|
PropSheetInfoStr);
|
|
|
|
LPCPROPSHEETPAGEW psp;
|
|
|
|
TRACE("(%p, %d)\n", hwndDlg, iPageIndex);
|
|
|
|
if (iPageIndex<0 || iPageIndex>=psInfo->nPages) {
|
|
|
|
WARN("%d out of range.\n", iPageIndex);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
psp = (LPCPROPSHEETPAGEW)psInfo->proppage[iPageIndex].hpage;
|
|
|
|
if (psp->dwFlags & PSP_DLGINDIRECT || HIWORD(psp->u.pszTemplate)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return (LRESULT)psp->u.pszTemplate;
|
2004-07-13 01:30:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_GetResult
|
|
|
|
*/
|
|
|
|
static LRESULT PROPSHEET_GetResult(HWND hwndDlg)
|
|
|
|
{
|
2006-11-02 13:26:22 +01:00
|
|
|
PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
|
|
|
|
PropSheetInfoStr);
|
|
|
|
return psInfo->result;
|
2004-07-13 01:30:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_RecalcPageSizes
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_RecalcPageSizes(HWND hwndDlg)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", hwndDlg);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-05-01 12:27:05 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_GetPageIndex
|
|
|
|
*
|
|
|
|
* Given a HPROPSHEETPAGE, returns the index of the corresponding page from
|
|
|
|
* the array of PropPageInfo.
|
|
|
|
*/
|
|
|
|
static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, PropSheetInfo* psInfo)
|
|
|
|
{
|
|
|
|
BOOL found = FALSE;
|
|
|
|
int index = 0;
|
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("hpage %p\n", hpage);
|
1999-05-01 12:27:05 +02:00
|
|
|
while ((index < psInfo->nPages) && (found == FALSE))
|
|
|
|
{
|
|
|
|
if (psInfo->proppage[index].hpage == hpage)
|
|
|
|
found = TRUE;
|
|
|
|
else
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found == FALSE)
|
|
|
|
index = -1;
|
|
|
|
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_CleanUp
|
|
|
|
*/
|
|
|
|
static void PROPSHEET_CleanUp(HWND hwndDlg)
|
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
int i;
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) RemovePropW(hwndDlg,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
1999-08-14 17:51:10 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
2001-12-19 19:46:49 +01:00
|
|
|
if (!psInfo) return;
|
2000-07-08 14:48:13 +02:00
|
|
|
if (HIWORD(psInfo->ppshheader.pszCaption))
|
2005-03-25 21:49:00 +01:00
|
|
|
Free ((LPVOID)psInfo->ppshheader.pszCaption);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
for (i = 0; i < psInfo->nPages; i++)
|
|
|
|
{
|
|
|
|
PROPSHEETPAGEA* psp = (PROPSHEETPAGEA*)psInfo->proppage[i].hpage;
|
|
|
|
|
2004-09-13 21:17:00 +02:00
|
|
|
/* Unsubclass the page dialog window */
|
|
|
|
if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
|
|
|
|
(psp->dwFlags & PSP_HIDEHEADER))
|
|
|
|
{
|
|
|
|
RemoveWindowSubclass(psInfo->proppage[i].hwndPage,
|
|
|
|
PROPSHEET_WizardSubclassProc, 1);
|
|
|
|
}
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
if(psInfo->proppage[i].hwndPage)
|
|
|
|
DestroyWindow(psInfo->proppage[i].hwndPage);
|
|
|
|
|
|
|
|
if(psp)
|
|
|
|
{
|
|
|
|
if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[i].pszText)
|
2005-03-25 21:49:00 +01:00
|
|
|
Free ((LPVOID)psInfo->proppage[i].pszText);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
DestroyPropertySheetPage(psInfo->proppage[i].hpage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-10 23:26:04 +02:00
|
|
|
DeleteObject(psInfo->hFont);
|
|
|
|
DeleteObject(psInfo->hFontBold);
|
|
|
|
/* If we created the bitmaps, destroy them */
|
|
|
|
if ((psInfo->ppshheader.dwFlags & PSH_WATERMARK) &&
|
|
|
|
(!(psInfo->ppshheader.dwFlags & PSH_USEHBMWATERMARK)) )
|
|
|
|
DeleteObject(psInfo->ppshheader.u4.hbmWatermark);
|
|
|
|
if ((psInfo->ppshheader.dwFlags & PSH_HEADER) &&
|
|
|
|
(!(psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER)) )
|
|
|
|
DeleteObject(psInfo->ppshheader.u5.hbmHeader);
|
|
|
|
|
2003-09-22 23:32:33 +02:00
|
|
|
Free(psInfo->proppage);
|
|
|
|
Free(psInfo->strPropertiesFor);
|
1999-08-14 17:51:10 +02:00
|
|
|
ImageList_Destroy(psInfo->hImageList);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
GlobalFree((HGLOBAL)psInfo);
|
|
|
|
}
|
|
|
|
|
2005-06-15 21:12:57 +02:00
|
|
|
static INT do_loop(PropSheetInfo *psInfo)
|
|
|
|
{
|
|
|
|
MSG msg;
|
|
|
|
INT ret = -1;
|
|
|
|
HWND hwnd = psInfo->hwnd;
|
|
|
|
|
|
|
|
while(IsWindow(hwnd) && !psInfo->ended && (ret = GetMessageW(&msg, NULL, 0, 0)))
|
|
|
|
{
|
|
|
|
if(ret == -1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if(!IsDialogMessageW(hwnd, &msg))
|
|
|
|
{
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
DispatchMessageW(&msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ret == 0)
|
|
|
|
{
|
|
|
|
PostQuitMessage(msg.wParam);
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
2006-11-02 13:21:53 +01:00
|
|
|
if(ret != -1)
|
|
|
|
ret = psInfo->result;
|
|
|
|
|
2005-06-15 21:12:57 +02:00
|
|
|
DestroyWindow(hwnd);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* PropertySheet (COMCTL32.@)
|
|
|
|
* PropertySheetA (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* Creates a property sheet in the specified property sheet header.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Modal property sheets: Positive if successful or -1 otherwise.
|
|
|
|
* Modeless property sheets: Property sheet handle.
|
|
|
|
* Or:
|
|
|
|
*| ID_PSREBOOTSYSTEM - The user must reboot the computer for the changes to take effect.
|
|
|
|
*| ID_PSRESTARTWINDOWS - The user must restart Windows for the changes to take effect.
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
2005-08-30 12:07:17 +02:00
|
|
|
INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
|
1998-12-10 16:49:22 +01:00
|
|
|
{
|
2005-08-30 12:07:17 +02:00
|
|
|
INT_PTR bRet = 0;
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
|
|
|
|
sizeof(PropSheetInfo));
|
2002-12-16 23:43:58 +01:00
|
|
|
UINT i, n;
|
2006-11-28 23:23:42 +01:00
|
|
|
const BYTE* pByte;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
TRACE("(%p)\n", lppsh);
|
|
|
|
|
|
|
|
PROPSHEET_CollectSheetInfoA(lppsh, psInfo);
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2003-09-22 23:32:33 +02:00
|
|
|
psInfo->proppage = (PropPageInfo*) Alloc(sizeof(PropPageInfo) *
|
1999-05-01 12:27:05 +02:00
|
|
|
lppsh->nPages);
|
2006-11-28 23:23:42 +01:00
|
|
|
pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp;
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2000-02-25 21:49:49 +01:00
|
|
|
for (n = i = 0; i < lppsh->nPages; i++, n++)
|
1999-05-01 12:27:05 +02:00
|
|
|
{
|
|
|
|
if (!(lppsh->dwFlags & PSH_PROPSHEETPAGE))
|
2000-07-08 14:48:13 +02:00
|
|
|
psInfo->proppage[n].hpage = psInfo->ppshheader.u3.phpage[i];
|
1999-11-28 22:01:47 +01:00
|
|
|
else
|
|
|
|
{
|
2000-02-25 21:49:49 +01:00
|
|
|
psInfo->proppage[n].hpage = CreatePropertySheetPageA((LPCPROPSHEETPAGEA)pByte);
|
2006-11-28 23:23:42 +01:00
|
|
|
pByte += ((LPCPROPSHEETPAGEA)pByte)->dwSize;
|
1999-11-28 22:01:47 +01:00
|
|
|
}
|
|
|
|
|
2002-05-14 05:48:48 +02:00
|
|
|
if (!PROPSHEET_CollectPageInfo((LPCPROPSHEETPAGEW)psInfo->proppage[n].hpage,
|
2000-02-25 21:49:49 +01:00
|
|
|
psInfo, n))
|
|
|
|
{
|
|
|
|
if (lppsh->dwFlags & PSH_PROPSHEETPAGE)
|
|
|
|
DestroyPropertySheetPage(psInfo->proppage[n].hpage);
|
|
|
|
n--;
|
|
|
|
psInfo->nPages--;
|
|
|
|
}
|
1999-05-01 12:27:05 +02:00
|
|
|
}
|
1998-12-10 16:49:22 +01:00
|
|
|
|
2006-12-01 00:50:31 +01:00
|
|
|
if (psInfo->active_page >= psInfo->nPages) psInfo->active_page = 0;
|
|
|
|
TRACE("startpage: %d of %d pages\n", psInfo->active_page, psInfo->nPages);
|
|
|
|
|
2003-07-09 04:49:52 +02:00
|
|
|
psInfo->unicode = FALSE;
|
2005-06-15 21:12:57 +02:00
|
|
|
psInfo->ended = FALSE;
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
bRet = PROPSHEET_CreateDialog(psInfo);
|
2005-06-15 21:12:57 +02:00
|
|
|
if(!psInfo->isModeless)
|
|
|
|
bRet = do_loop(psInfo);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
return bRet;
|
1998-12-10 16:49:22 +01:00
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* PropertySheetW (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See PropertySheetA.
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
2005-08-30 12:07:17 +02:00
|
|
|
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
|
1998-12-10 16:49:22 +01:00
|
|
|
{
|
2005-08-30 12:07:17 +02:00
|
|
|
INT_PTR bRet = 0;
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
|
|
|
|
sizeof(PropSheetInfo));
|
2002-12-16 23:43:58 +01:00
|
|
|
UINT i, n;
|
2006-11-28 23:23:42 +01:00
|
|
|
const BYTE* pByte;
|
2002-01-29 18:14:53 +01:00
|
|
|
|
|
|
|
TRACE("(%p)\n", lppsh);
|
|
|
|
|
|
|
|
PROPSHEET_CollectSheetInfoW(lppsh, psInfo);
|
|
|
|
|
2003-09-22 23:32:33 +02:00
|
|
|
psInfo->proppage = (PropPageInfo*) Alloc(sizeof(PropPageInfo) *
|
2002-01-29 18:14:53 +01:00
|
|
|
lppsh->nPages);
|
2006-11-28 23:23:42 +01:00
|
|
|
pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp;
|
1998-12-10 16:49:22 +01:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
for (n = i = 0; i < lppsh->nPages; i++, n++)
|
|
|
|
{
|
|
|
|
if (!(lppsh->dwFlags & PSH_PROPSHEETPAGE))
|
|
|
|
psInfo->proppage[n].hpage = psInfo->ppshheader.u3.phpage[i];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
psInfo->proppage[n].hpage = CreatePropertySheetPageW((LPCPROPSHEETPAGEW)pByte);
|
2006-11-28 23:23:42 +01:00
|
|
|
pByte += ((LPCPROPSHEETPAGEW)pByte)->dwSize;
|
2002-01-29 18:14:53 +01:00
|
|
|
}
|
|
|
|
|
2002-05-14 05:48:48 +02:00
|
|
|
if (!PROPSHEET_CollectPageInfo((LPCPROPSHEETPAGEW)psInfo->proppage[n].hpage,
|
2002-01-29 18:14:53 +01:00
|
|
|
psInfo, n))
|
|
|
|
{
|
|
|
|
if (lppsh->dwFlags & PSH_PROPSHEETPAGE)
|
|
|
|
DestroyPropertySheetPage(psInfo->proppage[n].hpage);
|
|
|
|
n--;
|
|
|
|
psInfo->nPages--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-01 00:50:31 +01:00
|
|
|
if (psInfo->active_page >= psInfo->nPages) psInfo->active_page = 0;
|
|
|
|
TRACE("startpage: %d of %d pages\n", psInfo->active_page, psInfo->nPages);
|
|
|
|
|
2003-07-09 04:49:52 +02:00
|
|
|
psInfo->unicode = TRUE;
|
2005-06-15 21:12:57 +02:00
|
|
|
psInfo->ended = FALSE;
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
bRet = PROPSHEET_CreateDialog(psInfo);
|
2005-06-15 21:12:57 +02:00
|
|
|
if(!psInfo->isModeless)
|
|
|
|
bRet = do_loop(psInfo);
|
2002-01-29 18:14:53 +01:00
|
|
|
|
|
|
|
return bRet;
|
1998-12-10 16:49:22 +01:00
|
|
|
}
|
|
|
|
|
2006-06-08 16:56:52 +02:00
|
|
|
static LPWSTR load_string( HINSTANCE instance, LPCWSTR str )
|
|
|
|
{
|
|
|
|
LPWSTR ret;
|
|
|
|
UINT len;
|
|
|
|
|
|
|
|
if (IS_INTRESOURCE(str))
|
|
|
|
{
|
|
|
|
HRSRC hrsrc;
|
|
|
|
HGLOBAL hmem;
|
|
|
|
WCHAR *ptr;
|
|
|
|
WORD i, id = LOWORD(str);
|
|
|
|
|
|
|
|
if (!(hrsrc = FindResourceW( instance, MAKEINTRESOURCEW((id >> 4) + 1), (LPWSTR)RT_STRING )))
|
|
|
|
return NULL;
|
|
|
|
if (!(hmem = LoadResource( instance, hrsrc ))) return NULL;
|
|
|
|
if (!(ptr = LockResource( hmem ))) return NULL;
|
|
|
|
for (i = id & 0x0f; i > 0; i--) ptr += *ptr + 1;
|
|
|
|
len = *ptr;
|
|
|
|
if (!len) return NULL;
|
|
|
|
ret = Alloc( (len + 1) * sizeof(WCHAR) );
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
memcpy( ret, ptr + 1, len * sizeof(WCHAR) );
|
|
|
|
ret[len] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int len = (strlenW(str) + 1) * sizeof(WCHAR);
|
|
|
|
ret = Alloc( len );
|
|
|
|
if (ret) memcpy( ret, str, len );
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* CreatePropertySheetPage (COMCTL32.@)
|
|
|
|
* CreatePropertySheetPageA (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* Creates a new property sheet page.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: Handle to new property sheet page.
|
|
|
|
* Failure: NULL.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* An application must use the PSM_ADDPAGE message to add the new page to
|
|
|
|
* an existing property sheet.
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
1999-05-01 12:27:05 +02:00
|
|
|
HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
|
|
|
|
LPCPROPSHEETPAGEA lpPropSheetPage)
|
1998-12-10 16:49:22 +01:00
|
|
|
{
|
2003-09-22 23:32:33 +02:00
|
|
|
PROPSHEETPAGEW* ppsp = Alloc(sizeof(PROPSHEETPAGEW));
|
1998-12-10 16:49:22 +01:00
|
|
|
|
2001-01-10 23:42:58 +01:00
|
|
|
memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEA)));
|
1999-05-01 12:27:05 +02:00
|
|
|
|
2003-07-09 04:49:52 +02:00
|
|
|
ppsp->dwFlags &= ~ PSP_INTERNAL_UNICODE;
|
|
|
|
|
2006-05-05 15:58:55 +02:00
|
|
|
if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) )
|
|
|
|
{
|
|
|
|
if (HIWORD( ppsp->u.pszTemplate ))
|
|
|
|
{
|
|
|
|
int len = strlen(lpPropSheetPage->u.pszTemplate) + 1;
|
2006-11-28 23:23:42 +01:00
|
|
|
char *template = Alloc( len );
|
|
|
|
|
|
|
|
ppsp->u.pszTemplate = (LPWSTR)strcpy( template, lpPropSheetPage->u.pszTemplate );
|
2006-05-05 15:58:55 +02:00
|
|
|
}
|
|
|
|
}
|
1999-11-28 22:01:47 +01:00
|
|
|
|
2006-05-05 15:58:55 +02:00
|
|
|
if (ppsp->dwFlags & PSP_USEICONID)
|
|
|
|
{
|
|
|
|
if (HIWORD( ppsp->u2.pszIcon ))
|
|
|
|
PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ppsp->dwFlags & PSP_USETITLE)
|
|
|
|
{
|
|
|
|
if (HIWORD( ppsp->pszTitle ))
|
|
|
|
PROPSHEET_AtoW( &ppsp->pszTitle, lpPropSheetPage->pszTitle );
|
|
|
|
else
|
2006-06-08 16:56:52 +02:00
|
|
|
ppsp->pszTitle = load_string( ppsp->hInstance, ppsp->pszTitle );
|
2006-05-05 15:58:55 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ppsp->pszTitle = NULL;
|
1999-11-28 22:01:47 +01:00
|
|
|
|
2006-05-05 15:58:55 +02:00
|
|
|
if (ppsp->dwFlags & PSP_HIDEHEADER)
|
|
|
|
ppsp->dwFlags &= ~(PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE);
|
|
|
|
|
|
|
|
if (ppsp->dwFlags & PSP_USEHEADERTITLE)
|
|
|
|
{
|
|
|
|
if (HIWORD( ppsp->pszHeaderTitle ))
|
|
|
|
PROPSHEET_AtoW(&ppsp->pszHeaderTitle, lpPropSheetPage->pszHeaderTitle);
|
|
|
|
else
|
2006-06-08 16:56:52 +02:00
|
|
|
ppsp->pszHeaderTitle = load_string( ppsp->hInstance, ppsp->pszHeaderTitle );
|
2006-05-05 15:58:55 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ppsp->pszHeaderTitle = NULL;
|
|
|
|
|
|
|
|
if (ppsp->dwFlags & PSP_USEHEADERSUBTITLE)
|
|
|
|
{
|
|
|
|
if (HIWORD( ppsp->pszHeaderSubTitle ))
|
|
|
|
PROPSHEET_AtoW(&ppsp->pszHeaderSubTitle, lpPropSheetPage->pszHeaderSubTitle);
|
|
|
|
else
|
2006-06-08 16:56:52 +02:00
|
|
|
ppsp->pszHeaderSubTitle = load_string( ppsp->hInstance, ppsp->pszHeaderSubTitle );
|
2006-05-05 15:58:55 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ppsp->pszHeaderSubTitle = NULL;
|
|
|
|
|
|
|
|
return (HPROPSHEETPAGE)ppsp;
|
1998-12-10 16:49:22 +01:00
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* CreatePropertySheetPageW (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See CreatePropertySheetA.
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
|
1998-12-10 16:49:22 +01:00
|
|
|
{
|
2003-09-22 23:32:33 +02:00
|
|
|
PROPSHEETPAGEW* ppsp = Alloc(sizeof(PROPSHEETPAGEW));
|
2002-01-29 18:14:53 +01:00
|
|
|
|
|
|
|
memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEW)));
|
|
|
|
|
2003-07-09 04:49:52 +02:00
|
|
|
ppsp->dwFlags |= PSP_INTERNAL_UNICODE;
|
|
|
|
|
2006-05-05 15:58:55 +02:00
|
|
|
if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) )
|
|
|
|
{
|
|
|
|
if (HIWORD( ppsp->u.pszTemplate ))
|
|
|
|
{
|
|
|
|
int len = strlenW(lpPropSheetPage->u.pszTemplate) + 1;
|
2006-11-28 23:23:42 +01:00
|
|
|
WCHAR *template = Alloc( len * sizeof (WCHAR) );
|
|
|
|
|
|
|
|
ppsp->u.pszTemplate = strcpyW( template, lpPropSheetPage->u.pszTemplate );
|
2006-05-05 15:58:55 +02:00
|
|
|
}
|
|
|
|
}
|
1998-12-10 16:49:22 +01:00
|
|
|
|
2006-05-05 15:58:55 +02:00
|
|
|
if ( ppsp->dwFlags & PSP_USEICONID )
|
|
|
|
{
|
|
|
|
if (HIWORD( ppsp->u2.pszIcon ))
|
|
|
|
{
|
|
|
|
int len = strlenW(lpPropSheetPage->u2.pszIcon) + 1;
|
2006-11-28 23:23:42 +01:00
|
|
|
WCHAR *icon = Alloc( len * sizeof (WCHAR) );
|
|
|
|
|
|
|
|
ppsp->u2.pszIcon = strcpyW( icon, lpPropSheetPage->u2.pszIcon );
|
2006-05-05 15:58:55 +02:00
|
|
|
}
|
|
|
|
}
|
2002-01-29 18:14:53 +01:00
|
|
|
|
2006-05-05 15:58:55 +02:00
|
|
|
if (ppsp->dwFlags & PSP_USETITLE)
|
2006-06-08 16:56:52 +02:00
|
|
|
ppsp->pszTitle = load_string( ppsp->hInstance, ppsp->pszTitle );
|
2006-05-05 15:58:55 +02:00
|
|
|
else
|
|
|
|
ppsp->pszTitle = NULL;
|
|
|
|
|
|
|
|
if (ppsp->dwFlags & PSP_HIDEHEADER)
|
|
|
|
ppsp->dwFlags &= ~(PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE);
|
|
|
|
|
|
|
|
if (ppsp->dwFlags & PSP_USEHEADERTITLE)
|
2006-06-08 16:56:52 +02:00
|
|
|
ppsp->pszHeaderTitle = load_string( ppsp->hInstance, ppsp->pszHeaderTitle );
|
2006-05-05 15:58:55 +02:00
|
|
|
else
|
|
|
|
ppsp->pszHeaderTitle = NULL;
|
|
|
|
|
|
|
|
if (ppsp->dwFlags & PSP_USEHEADERSUBTITLE)
|
2006-06-08 16:56:52 +02:00
|
|
|
ppsp->pszHeaderSubTitle = load_string( ppsp->hInstance, ppsp->pszHeaderSubTitle );
|
2006-05-05 15:58:55 +02:00
|
|
|
else
|
|
|
|
ppsp->pszHeaderSubTitle = NULL;
|
2002-01-29 18:14:53 +01:00
|
|
|
|
2006-05-05 15:58:55 +02:00
|
|
|
return (HPROPSHEETPAGE)ppsp;
|
1998-12-10 16:49:22 +01:00
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* DestroyPropertySheetPage (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* Destroys a property sheet page previously created with
|
|
|
|
* CreatePropertySheetA() or CreatePropertySheetW() and frees the associated
|
|
|
|
* memory.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE
|
|
|
|
* Failure: FALSE
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
|
1998-12-10 16:49:22 +01:00
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEETPAGEW *psp = (PROPSHEETPAGEW *)hPropPage;
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
if (!psp)
|
|
|
|
return FALSE;
|
|
|
|
|
2000-09-19 04:43:00 +02:00
|
|
|
if ( !(psp->dwFlags & PSP_DLGINDIRECT) && HIWORD( psp->u.pszTemplate ) )
|
2005-03-25 21:49:00 +01:00
|
|
|
Free ((LPVOID)psp->u.pszTemplate);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
if ( (psp->dwFlags & PSP_USEICONID) && HIWORD( psp->u2.pszIcon ) )
|
2005-03-25 21:49:00 +01:00
|
|
|
Free ((LPVOID)psp->u2.pszIcon);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
if ((psp->dwFlags & PSP_USETITLE) && HIWORD( psp->pszTitle ))
|
2005-03-25 21:49:00 +01:00
|
|
|
Free ((LPVOID)psp->pszTitle);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
2003-09-22 23:32:33 +02:00
|
|
|
Free(hPropPage);
|
1999-05-01 12:27:05 +02:00
|
|
|
|
|
|
|
return TRUE;
|
1998-12-10 16:49:22 +01:00
|
|
|
}
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_IsDialogMessage
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
2001-08-06 19:51:09 +02:00
|
|
|
TRACE("\n");
|
1999-11-28 22:01:47 +01:00
|
|
|
if (!psInfo || (hwnd != lpMsg->hwnd && !IsChild(hwnd, lpMsg->hwnd)))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (lpMsg->message == WM_KEYDOWN && (GetKeyState(VK_CONTROL) & 0x8000))
|
|
|
|
{
|
|
|
|
int new_page = 0;
|
2005-03-23 11:23:23 +01:00
|
|
|
INT dlgCode = SendMessageW(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg);
|
1999-11-28 22:01:47 +01:00
|
|
|
|
|
|
|
if (!(dlgCode & DLGC_WANTMESSAGE))
|
|
|
|
{
|
|
|
|
switch (lpMsg->wParam)
|
|
|
|
{
|
|
|
|
case VK_TAB:
|
|
|
|
if (GetKeyState(VK_SHIFT) & 0x8000)
|
|
|
|
new_page = -1;
|
|
|
|
else
|
|
|
|
new_page = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VK_NEXT: new_page = 1; break;
|
|
|
|
case VK_PRIOR: new_page = -1; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_page)
|
|
|
|
{
|
|
|
|
if (PROPSHEET_CanSetCurSel(hwnd) != FALSE)
|
|
|
|
{
|
|
|
|
new_page += psInfo->active_page;
|
|
|
|
|
|
|
|
if (new_page < 0)
|
|
|
|
new_page = psInfo->nPages - 1;
|
|
|
|
else if (new_page >= psInfo->nPages)
|
|
|
|
new_page = 0;
|
|
|
|
|
2001-06-06 23:03:21 +02:00
|
|
|
PROPSHEET_SetCurSel(hwnd, new_page, 1, 0);
|
1999-11-28 22:01:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
return IsDialogMessageW(hwnd, lpMsg);
|
1999-11-28 22:01:47 +01:00
|
|
|
}
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_DoCommand
|
|
|
|
*/
|
|
|
|
static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (wID) {
|
|
|
|
|
|
|
|
case IDOK:
|
|
|
|
case IDC_APPLY_BUTTON:
|
|
|
|
{
|
|
|
|
HWND hwndApplyBtn = GetDlgItem(hwnd, IDC_APPLY_BUTTON);
|
|
|
|
|
|
|
|
if (PROPSHEET_Apply(hwnd, wID == IDOK ? 1: 0) == FALSE)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (wID == IDOK)
|
|
|
|
{
|
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
|
|
|
|
PropSheetInfoStr);
|
|
|
|
|
2006-11-02 13:21:53 +01:00
|
|
|
/* don't overwrite ID_PSRESTARTWINDOWS or ID_PSREBOOTSYSTEM */
|
|
|
|
if (psInfo->result == 0)
|
|
|
|
psInfo->result = IDOK;
|
2002-01-29 18:14:53 +01:00
|
|
|
|
|
|
|
if (psInfo->isModeless)
|
|
|
|
psInfo->activeValid = FALSE;
|
|
|
|
else
|
2005-06-15 21:12:57 +02:00
|
|
|
psInfo->ended = TRUE;
|
2002-01-29 18:14:53 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
EnableWindow(hwndApplyBtn, FALSE);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case IDC_BACK_BUTTON:
|
|
|
|
PROPSHEET_Back(hwnd);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_NEXT_BUTTON:
|
|
|
|
PROPSHEET_Next(hwnd);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_FINISH_BUTTON:
|
|
|
|
PROPSHEET_Finish(hwnd);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDCANCEL:
|
|
|
|
PROPSHEET_Cancel(hwnd, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDHELP:
|
|
|
|
PROPSHEET_Help(hwnd);
|
|
|
|
break;
|
2004-01-27 21:11:05 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
2002-01-29 18:14:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-05-10 23:26:04 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_Paint
|
|
|
|
*/
|
2005-03-25 11:26:10 +01:00
|
|
|
static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
|
2004-05-10 23:26:04 +02:00
|
|
|
{
|
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr);
|
|
|
|
PAINTSTRUCT ps;
|
|
|
|
HDC hdc, hdcSrc;
|
|
|
|
BITMAP bm;
|
|
|
|
HBITMAP hbmp;
|
|
|
|
HPALETTE hOldPal = 0;
|
|
|
|
int offsety = 0;
|
|
|
|
HBRUSH hbr;
|
2004-09-13 21:17:00 +02:00
|
|
|
RECT r, rzone;
|
2004-05-10 23:26:04 +02:00
|
|
|
LPCPROPSHEETPAGEW ppshpage;
|
2004-08-30 20:39:32 +02:00
|
|
|
WCHAR szBuffer[256];
|
|
|
|
int nLength;
|
2004-05-10 23:26:04 +02:00
|
|
|
|
2005-03-25 11:26:10 +01:00
|
|
|
hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps);
|
2004-05-10 23:26:04 +02:00
|
|
|
if (!hdc) return 1;
|
|
|
|
|
|
|
|
hdcSrc = CreateCompatibleDC(0);
|
|
|
|
ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[psInfo->active_page].hpage;
|
|
|
|
|
|
|
|
if (psInfo->ppshheader.dwFlags & PSH_USEHPLWATERMARK)
|
|
|
|
hOldPal = SelectPalette(hdc, psInfo->ppshheader.hplWatermark, FALSE);
|
|
|
|
|
|
|
|
if ( (!(ppshpage->dwFlags & PSP_HIDEHEADER)) &&
|
2004-07-21 23:17:59 +02:00
|
|
|
(psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_HEADER) )
|
2004-05-10 23:26:04 +02:00
|
|
|
{
|
|
|
|
HWND hwndLineHeader = GetDlgItem(hwnd, IDC_SUNKEN_LINEHEADER);
|
|
|
|
HFONT hOldFont;
|
|
|
|
COLORREF clrOld = 0;
|
|
|
|
int oldBkMode = 0;
|
|
|
|
|
|
|
|
hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u5.hbmHeader);
|
2004-09-07 21:31:50 +02:00
|
|
|
hOldFont = SelectObject(hdc, psInfo->hFontBold);
|
2004-05-10 23:26:04 +02:00
|
|
|
|
|
|
|
GetClientRect(hwndLineHeader, &r);
|
|
|
|
MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2);
|
2004-09-07 21:31:50 +02:00
|
|
|
SetRect(&rzone, 0, 0, r.right + 1, r.top - 1);
|
2004-05-10 23:26:04 +02:00
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
GetObjectW(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm);
|
2004-05-10 23:26:04 +02:00
|
|
|
|
2004-08-10 00:54:14 +02:00
|
|
|
if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD)
|
|
|
|
{
|
|
|
|
/* Fill the unoccupied part of the header with color of the
|
|
|
|
* left-top pixel, but do it only when needed.
|
|
|
|
*/
|
|
|
|
if (bm.bmWidth < r.right || bm.bmHeight < r.bottom)
|
|
|
|
{
|
|
|
|
hbr = CreateSolidBrush(GetPixel(hdcSrc, 0, 0));
|
|
|
|
CopyRect(&r, &rzone);
|
|
|
|
if (bm.bmWidth < r.right)
|
|
|
|
{
|
|
|
|
r.left = bm.bmWidth;
|
|
|
|
FillRect(hdc, &r, hbr);
|
|
|
|
}
|
|
|
|
if (bm.bmHeight < r.bottom)
|
|
|
|
{
|
|
|
|
r.left = 0;
|
|
|
|
r.top = bm.bmHeight;
|
|
|
|
FillRect(hdc, &r, hbr);
|
|
|
|
}
|
|
|
|
DeleteObject(hbr);
|
|
|
|
}
|
2004-09-07 21:31:50 +02:00
|
|
|
|
|
|
|
/* Draw the header itself. */
|
|
|
|
BitBlt(hdc, 0, 0,
|
|
|
|
bm.bmWidth, min(bm.bmHeight, rzone.bottom),
|
|
|
|
hdcSrc, 0, 0, SRCCOPY);
|
2004-08-10 00:54:14 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-07-31 16:38:14 +02:00
|
|
|
int margin;
|
2004-09-13 21:17:00 +02:00
|
|
|
hbr = GetSysColorBrush(COLOR_WINDOW);
|
2004-08-10 00:54:14 +02:00
|
|
|
FillRect(hdc, &rzone, hbr);
|
2004-09-07 21:31:50 +02:00
|
|
|
|
|
|
|
/* Draw the header bitmap. It's always centered like a
|
|
|
|
* common 49 x 49 bitmap. */
|
2006-07-31 16:38:14 +02:00
|
|
|
margin = (rzone.bottom - 49) / 2;
|
|
|
|
BitBlt(hdc, rzone.right - 49 - margin, margin,
|
|
|
|
min(bm.bmWidth, 49), min(bm.bmHeight, 49),
|
|
|
|
hdcSrc, 0, 0, SRCCOPY);
|
2004-09-07 21:31:50 +02:00
|
|
|
|
|
|
|
/* NOTE: Native COMCTL32 draws a white stripe over the bitmap
|
|
|
|
* if its height is smaller than 49 pixels. Because the reason
|
|
|
|
* for this bug is unknown the current code doesn't try to
|
|
|
|
* replicate it. */
|
2004-08-10 00:54:14 +02:00
|
|
|
}
|
2004-09-07 21:31:50 +02:00
|
|
|
|
2004-05-10 23:26:04 +02:00
|
|
|
clrOld = SetTextColor (hdc, 0x00000000);
|
|
|
|
oldBkMode = SetBkMode (hdc, TRANSPARENT);
|
|
|
|
|
2004-08-30 20:39:32 +02:00
|
|
|
if (ppshpage->dwFlags & PSP_USEHEADERTITLE) {
|
2004-09-07 21:31:50 +02:00
|
|
|
SetRect(&r, 20, 10, 0, 0);
|
2004-08-30 20:39:32 +02:00
|
|
|
if (HIWORD(ppshpage->pszHeaderTitle))
|
2006-07-31 13:47:45 +02:00
|
|
|
DrawTextW(hdc, ppshpage->pszHeaderTitle, -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP);
|
2004-05-10 23:26:04 +02:00
|
|
|
else
|
2004-08-30 20:39:32 +02:00
|
|
|
{
|
2005-08-30 12:07:17 +02:00
|
|
|
nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderTitle,
|
2004-08-30 20:39:32 +02:00
|
|
|
szBuffer, 256);
|
|
|
|
if (nLength != 0)
|
|
|
|
{
|
2006-07-31 14:58:43 +02:00
|
|
|
DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP);
|
2004-08-30 20:39:32 +02:00
|
|
|
}
|
|
|
|
}
|
2004-05-10 23:26:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) {
|
|
|
|
SelectObject(hdc, psInfo->hFont);
|
2004-09-13 20:02:32 +02:00
|
|
|
SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom);
|
2004-08-30 20:39:32 +02:00
|
|
|
if (HIWORD(ppshpage->pszHeaderTitle))
|
2006-07-31 14:58:43 +02:00
|
|
|
DrawTextW(hdc, ppshpage->pszHeaderSubTitle, -1, &r, DT_LEFT | DT_WORDBREAK);
|
2004-05-10 23:26:04 +02:00
|
|
|
else
|
2004-08-30 20:39:32 +02:00
|
|
|
{
|
2005-08-30 12:07:17 +02:00
|
|
|
nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderSubTitle,
|
2004-08-30 20:39:32 +02:00
|
|
|
szBuffer, 256);
|
|
|
|
if (nLength != 0)
|
|
|
|
{
|
2006-07-31 14:58:43 +02:00
|
|
|
DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_WORDBREAK);
|
2004-08-30 20:39:32 +02:00
|
|
|
}
|
|
|
|
}
|
2004-05-10 23:26:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
offsety = rzone.bottom + 2;
|
|
|
|
|
|
|
|
SetTextColor(hdc, clrOld);
|
|
|
|
SetBkMode(hdc, oldBkMode);
|
|
|
|
SelectObject(hdc, hOldFont);
|
|
|
|
SelectObject(hdcSrc, hbmp);
|
|
|
|
}
|
|
|
|
|
2004-09-08 23:47:03 +02:00
|
|
|
if ( (ppshpage->dwFlags & PSP_HIDEHEADER) &&
|
2004-07-21 23:17:59 +02:00
|
|
|
(psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_WATERMARK) )
|
2004-05-10 23:26:04 +02:00
|
|
|
{
|
2004-07-21 23:17:59 +02:00
|
|
|
HWND hwndLine = GetDlgItem(hwnd, IDC_SUNKEN_LINE);
|
|
|
|
|
|
|
|
GetClientRect(hwndLine, &r);
|
|
|
|
MapWindowPoints(hwndLine, hwnd, (LPPOINT) &r, 2);
|
|
|
|
|
2004-09-13 21:17:00 +02:00
|
|
|
rzone.left = 0;
|
|
|
|
rzone.top = 0;
|
|
|
|
rzone.right = r.right;
|
|
|
|
rzone.bottom = r.top - 1;
|
|
|
|
|
|
|
|
hbr = GetSysColorBrush(COLOR_WINDOW);
|
|
|
|
FillRect(hdc, &rzone, hbr);
|
|
|
|
|
2005-03-23 11:23:23 +01:00
|
|
|
GetObjectW(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm);
|
2004-07-21 23:17:59 +02:00
|
|
|
hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark);
|
|
|
|
|
2006-08-01 13:22:59 +02:00
|
|
|
/* The watermark is truncated to a width of 164 pixels */
|
|
|
|
r.right = min(r.right, 164);
|
2004-07-21 23:17:59 +02:00
|
|
|
BitBlt(hdc, 0, offsety, min(bm.bmWidth, r.right),
|
|
|
|
min(bm.bmHeight, r.bottom), hdcSrc, 0, 0, SRCCOPY);
|
|
|
|
|
|
|
|
/* If the bitmap is not big enough, fill the remaining area
|
|
|
|
with the color of pixel (0,0) of bitmap - see MSDN */
|
|
|
|
if (r.top > bm.bmHeight) {
|
|
|
|
r.bottom = r.top - 1;
|
|
|
|
r.top = bm.bmHeight;
|
|
|
|
r.left = 0;
|
|
|
|
r.right = bm.bmWidth;
|
|
|
|
hbr = CreateSolidBrush(GetPixel(hdcSrc, 0, 0));
|
|
|
|
FillRect(hdc, &r, hbr);
|
|
|
|
DeleteObject(hbr);
|
2004-05-10 23:26:04 +02:00
|
|
|
}
|
2004-07-21 23:17:59 +02:00
|
|
|
|
|
|
|
SelectObject(hdcSrc, hbmp);
|
2004-05-10 23:26:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (psInfo->ppshheader.dwFlags & PSH_USEHPLWATERMARK)
|
|
|
|
SelectPalette(hdc, hOldPal, FALSE);
|
|
|
|
|
|
|
|
DeleteDC(hdcSrc);
|
|
|
|
|
2005-03-25 11:26:10 +01:00
|
|
|
if (!hdcParam) EndPaint(hwnd, &ps);
|
2004-05-10 23:26:04 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* PROPSHEET_DialogProc
|
|
|
|
*/
|
2006-05-05 15:59:20 +02:00
|
|
|
static INT_PTR CALLBACK
|
1999-04-22 11:24:47 +02:00
|
|
|
PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2002-11-25 03:45:19 +01:00
|
|
|
TRACE("hwnd=%p msg=0x%04x wparam=%x lparam=%lx\n",
|
2002-01-29 18:14:53 +01:00
|
|
|
hwnd, uMsg, wParam, lParam);
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
{
|
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) lParam;
|
2003-09-22 23:32:33 +02:00
|
|
|
WCHAR* strCaption = (WCHAR*)Alloc(MAX_CAPTION_LENGTH*sizeof(WCHAR));
|
1999-04-22 11:24:47 +02:00
|
|
|
HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
|
2002-01-29 18:14:53 +01:00
|
|
|
LPCPROPSHEETPAGEW ppshpage;
|
1999-11-28 22:01:47 +01:00
|
|
|
int idx;
|
2005-03-23 11:23:23 +01:00
|
|
|
LOGFONTW logFont;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-03-13 20:24:04 +01:00
|
|
|
/* Using PropSheetInfoStr to store extra data doesn't match the native
|
|
|
|
* common control: native uses TCM_[GS]ETITEM
|
|
|
|
*/
|
2002-01-29 18:14:53 +01:00
|
|
|
SetPropW(hwnd, PropSheetInfoStr, (HANDLE)psInfo);
|
1999-11-13 21:49:12 +01:00
|
|
|
|
2000-07-08 14:48:13 +02:00
|
|
|
/*
|
2002-06-01 01:06:46 +02:00
|
|
|
* psInfo->hwnd is not being used by WINE code - it exists
|
|
|
|
* for compatibility with "real" Windoze. The same about
|
2004-08-25 19:33:01 +02:00
|
|
|
* SetWindowLongPtr - WINE is only using the PropSheetInfoStr
|
2000-07-08 14:48:13 +02:00
|
|
|
* property.
|
|
|
|
*/
|
|
|
|
psInfo->hwnd = hwnd;
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_USER, (DWORD_PTR)psInfo);
|
2000-07-08 14:48:13 +02:00
|
|
|
|
2003-07-21 22:01:59 +02:00
|
|
|
/* set up the Next and Back buttons by default */
|
|
|
|
PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT);
|
|
|
|
|
2004-05-10 23:26:04 +02:00
|
|
|
/* Set up fonts */
|
2005-03-23 11:23:23 +01:00
|
|
|
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
|
|
|
|
psInfo->hFont = CreateFontIndirectW (&logFont);
|
2004-05-10 23:26:04 +02:00
|
|
|
logFont.lfWeight = FW_BOLD;
|
2005-03-23 11:23:23 +01:00
|
|
|
psInfo->hFontBold = CreateFontIndirectW (&logFont);
|
2004-05-10 23:26:04 +02:00
|
|
|
|
1999-08-18 20:25:46 +02:00
|
|
|
/*
|
|
|
|
* Small icon in the title bar.
|
|
|
|
*/
|
2000-07-08 14:48:13 +02:00
|
|
|
if ((psInfo->ppshheader.dwFlags & PSH_USEICONID) ||
|
|
|
|
(psInfo->ppshheader.dwFlags & PSH_USEHICON))
|
1999-08-18 20:25:46 +02:00
|
|
|
{
|
|
|
|
HICON hIcon;
|
|
|
|
int icon_cx = GetSystemMetrics(SM_CXSMICON);
|
|
|
|
int icon_cy = GetSystemMetrics(SM_CYSMICON);
|
|
|
|
|
2000-07-08 14:48:13 +02:00
|
|
|
if (psInfo->ppshheader.dwFlags & PSH_USEICONID)
|
2002-01-29 18:14:53 +01:00
|
|
|
hIcon = LoadImageW(psInfo->ppshheader.hInstance,
|
2000-09-19 04:43:00 +02:00
|
|
|
psInfo->ppshheader.u.pszIcon,
|
1999-08-18 20:25:46 +02:00
|
|
|
IMAGE_ICON,
|
|
|
|
icon_cx, icon_cy,
|
|
|
|
LR_DEFAULTCOLOR);
|
|
|
|
else
|
2000-09-19 04:43:00 +02:00
|
|
|
hIcon = psInfo->ppshheader.u.hIcon;
|
1999-08-18 20:25:46 +02:00
|
|
|
|
2002-10-10 23:22:09 +02:00
|
|
|
SendMessageW(hwnd, WM_SETICON, 0, (LPARAM)hIcon);
|
1999-08-18 20:25:46 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-08 14:48:13 +02:00
|
|
|
if (psInfo->ppshheader.dwFlags & PSH_USEHICON)
|
2002-10-10 23:22:09 +02:00
|
|
|
SendMessageW(hwnd, WM_SETICON, 0, (LPARAM)psInfo->ppshheader.u.hIcon);
|
1999-08-18 20:25:46 +02:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
psInfo->strPropertiesFor = strCaption;
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
GetWindowTextW(hwnd, psInfo->strPropertiesFor, MAX_CAPTION_LENGTH);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
1999-10-31 03:24:29 +01:00
|
|
|
PROPSHEET_CreateTabControl(hwnd, psInfo);
|
|
|
|
|
2004-08-09 21:48:04 +02:00
|
|
|
PROPSHEET_LoadWizardBitmaps(psInfo);
|
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
|
1999-09-19 14:14:38 +02:00
|
|
|
{
|
2004-05-10 23:26:04 +02:00
|
|
|
ShowWindow(hwndTabCtrl, SW_HIDE);
|
2004-09-14 01:19:51 +02:00
|
|
|
PROPSHEET_AdjustSizeWizard(hwnd, psInfo);
|
|
|
|
PROPSHEET_AdjustButtonsWizard(hwnd, psInfo);
|
1999-09-19 14:14:38 +02:00
|
|
|
}
|
|
|
|
else
|
1999-04-22 11:24:47 +02:00
|
|
|
{
|
2000-02-25 21:49:49 +01:00
|
|
|
if (PROPSHEET_SizeMismatch(hwnd, psInfo))
|
1999-09-19 14:14:38 +02:00
|
|
|
{
|
|
|
|
PROPSHEET_AdjustSize(hwnd, psInfo);
|
|
|
|
PROPSHEET_AdjustButtons(hwnd, psInfo);
|
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
|
2000-07-08 14:48:13 +02:00
|
|
|
if (!HIWORD(psInfo->ppshheader.pszCaption) &&
|
|
|
|
psInfo->ppshheader.hInstance)
|
1999-10-23 18:57:28 +02:00
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
WCHAR szText[256];
|
1999-10-23 18:57:28 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (LoadStringW(psInfo->ppshheader.hInstance,
|
2005-08-30 12:07:17 +02:00
|
|
|
(UINT_PTR)psInfo->ppshheader.pszCaption, szText, 255))
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEET_SetTitleW(hwnd, psInfo->ppshheader.dwFlags, szText);
|
1999-10-23 18:57:28 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PROPSHEET_SetTitleW(hwnd, psInfo->ppshheader.dwFlags,
|
2000-07-08 14:48:13 +02:00
|
|
|
psInfo->ppshheader.pszCaption);
|
1999-10-23 18:57:28 +02:00
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2006-04-06 17:55:32 +02:00
|
|
|
|
|
|
|
if (psInfo->useCallback)
|
|
|
|
(*(psInfo->ppshheader.pfnCallback))(hwnd,
|
|
|
|
PSCB_INITIALIZED, (LPARAM)0);
|
|
|
|
|
|
|
|
idx = psInfo->active_page;
|
|
|
|
ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[idx].hpage;
|
|
|
|
psInfo->active_page = -1;
|
|
|
|
|
|
|
|
PROPSHEET_SetCurSel(hwnd, idx, 1, psInfo->proppage[idx].hpage);
|
|
|
|
|
|
|
|
/* doing TCM_SETCURSEL seems to be needed even in case of PSH_WIZARD,
|
|
|
|
* as some programs call TCM_GETCURSEL to get the current selection
|
|
|
|
* from which to switch to the next page */
|
|
|
|
SendMessageW(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-11-08 13:52:35 +01:00
|
|
|
case WM_PRINTCLIENT:
|
2004-05-10 23:26:04 +02:00
|
|
|
case WM_PAINT:
|
2005-03-25 11:26:10 +01:00
|
|
|
PROPSHEET_Paint(hwnd, (HDC)wParam);
|
2004-05-10 23:26:04 +02:00
|
|
|
return TRUE;
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
case WM_DESTROY:
|
|
|
|
PROPSHEET_CleanUp(hwnd);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case WM_CLOSE:
|
1999-11-28 22:01:47 +01:00
|
|
|
PROPSHEET_Cancel(hwnd, 1);
|
2006-06-08 16:56:52 +02:00
|
|
|
return FALSE; /* let DefDlgProc post us WM_COMMAND/IDCANCEL */
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
case WM_COMMAND:
|
2004-01-27 21:11:05 +01:00
|
|
|
if (!PROPSHEET_DoCommand(hwnd, LOWORD(wParam)))
|
|
|
|
{
|
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr);
|
|
|
|
|
2004-10-04 22:39:55 +02:00
|
|
|
if (!psInfo)
|
|
|
|
return FALSE;
|
|
|
|
|
2004-01-27 21:11:05 +01:00
|
|
|
/* No default handler, forward notification to active page */
|
|
|
|
if (psInfo->activeValid && psInfo->active_page != -1)
|
|
|
|
{
|
|
|
|
HWND hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
|
|
|
SendMessageW(hwndPage, WM_COMMAND, wParam, lParam);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
NMHDR* pnmh = (LPNMHDR) lParam;
|
|
|
|
|
|
|
|
if (pnmh->code == TCN_SELCHANGE)
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
int index = SendMessageW(pnmh->hwndFrom, TCM_GETCURSEL, 0, 0);
|
2001-06-06 23:03:21 +02:00
|
|
|
PROPSHEET_SetCurSel(hwnd, index, 1, 0);
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
|
1999-10-13 17:54:08 +02:00
|
|
|
if(pnmh->code == TCN_SELCHANGING)
|
|
|
|
{
|
|
|
|
BOOL bRet = PROPSHEET_CanSetCurSel(hwnd);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, !bRet);
|
1999-10-13 17:54:08 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-11-09 21:25:27 +01:00
|
|
|
return FALSE;
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
2005-07-05 12:57:37 +02:00
|
|
|
|
|
|
|
case WM_SYSCOLORCHANGE:
|
|
|
|
COMCTL32_RefreshSysColors();
|
|
|
|
return FALSE;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
case PSM_GETCURRENTPAGEHWND:
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
|
|
|
HWND hwndPage = 0;
|
|
|
|
|
2004-10-04 22:39:55 +02:00
|
|
|
if (!psInfo)
|
|
|
|
return FALSE;
|
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
if (psInfo->activeValid && psInfo->active_page != -1)
|
1999-04-22 11:24:47 +02:00
|
|
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
|
|
|
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (DWORD_PTR)hwndPage);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_CHANGED:
|
|
|
|
PROPSHEET_Changed(hwnd, (HWND)wParam);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case PSM_UNCHANGED:
|
|
|
|
PROPSHEET_UnChanged(hwnd, (HWND)wParam);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case PSM_GETTABCONTROL:
|
|
|
|
{
|
|
|
|
HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
|
|
|
|
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (DWORD_PTR)hwndTabCtrl);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_SETCURSEL:
|
|
|
|
{
|
|
|
|
BOOL msgResult;
|
|
|
|
|
1999-10-13 17:54:08 +02:00
|
|
|
msgResult = PROPSHEET_CanSetCurSel(hwnd);
|
|
|
|
if(msgResult != FALSE)
|
|
|
|
{
|
|
|
|
msgResult = PROPSHEET_SetCurSel(hwnd,
|
|
|
|
(int)wParam,
|
2001-06-06 23:03:21 +02:00
|
|
|
1,
|
1999-10-13 17:54:08 +02:00
|
|
|
(HPROPSHEETPAGE)lParam);
|
|
|
|
}
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_CANCELTOCLOSE:
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
WCHAR buf[MAX_BUTTONTEXT_LENGTH];
|
1999-04-22 11:24:47 +02:00
|
|
|
HWND hwndOK = GetDlgItem(hwnd, IDOK);
|
|
|
|
HWND hwndCancel = GetDlgItem(hwnd, IDCANCEL);
|
|
|
|
|
|
|
|
EnableWindow(hwndCancel, FALSE);
|
2002-01-29 18:14:53 +01:00
|
|
|
if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf)))
|
|
|
|
SetWindowTextW(hwndOK, buf);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-11-28 22:01:47 +01:00
|
|
|
return FALSE;
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
case PSM_RESTARTWINDOWS:
|
|
|
|
{
|
2002-01-29 18:14:53 +01:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
2004-10-04 22:39:55 +02:00
|
|
|
if (!psInfo)
|
|
|
|
return FALSE;
|
|
|
|
|
2006-11-02 13:21:53 +01:00
|
|
|
/* reboot system takes precedence over restart windows */
|
|
|
|
if (psInfo->result != ID_PSREBOOTSYSTEM)
|
|
|
|
psInfo->result = ID_PSRESTARTWINDOWS;
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_REBOOTSYSTEM:
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
|
1999-04-22 11:24:47 +02:00
|
|
|
PropSheetInfoStr);
|
|
|
|
|
2004-10-04 22:39:55 +02:00
|
|
|
if (!psInfo)
|
|
|
|
return FALSE;
|
|
|
|
|
2006-11-02 13:21:53 +01:00
|
|
|
psInfo->result = ID_PSREBOOTSYSTEM;
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_SETTITLEA:
|
|
|
|
PROPSHEET_SetTitleA(hwnd, (DWORD) wParam, (LPCSTR) lParam);
|
|
|
|
return TRUE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-01-29 18:14:53 +01:00
|
|
|
case PSM_SETTITLEW:
|
|
|
|
PROPSHEET_SetTitleW(hwnd, (DWORD) wParam, (LPCWSTR) lParam);
|
|
|
|
return TRUE;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
case PSM_APPLY:
|
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
BOOL msgResult = PROPSHEET_Apply(hwnd, 0);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_QUERYSIBLINGS:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_QuerySiblings(hwnd, wParam, lParam);
|
|
|
|
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
1999-04-22 11:24:47 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-05-01 12:27:05 +02:00
|
|
|
case PSM_ADDPAGE:
|
1999-10-31 19:29:47 +01:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Note: MSVC++ 6.0 documentation says that PSM_ADDPAGE does not have
|
|
|
|
* a return value. This is not true. PSM_ADDPAGE returns TRUE
|
|
|
|
* on success or FALSE otherwise, as specified on MSDN Online.
|
|
|
|
* Also see the MFC code for
|
|
|
|
* CPropertySheet::AddPage(CPropertyPage* pPage).
|
|
|
|
*/
|
|
|
|
|
|
|
|
BOOL msgResult = PROPSHEET_AddPage(hwnd, (HPROPSHEETPAGE)lParam);
|
|
|
|
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
1999-10-31 19:29:47 +01:00
|
|
|
|
1999-05-01 12:27:05 +02:00
|
|
|
return TRUE;
|
1999-10-31 19:29:47 +01:00
|
|
|
}
|
1999-05-01 12:27:05 +02:00
|
|
|
|
|
|
|
case PSM_REMOVEPAGE:
|
|
|
|
PROPSHEET_RemovePage(hwnd, (int)wParam, (HPROPSHEETPAGE)lParam);
|
|
|
|
return TRUE;
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
case PSM_ISDIALOGMESSAGE:
|
|
|
|
{
|
1999-11-28 22:01:47 +01:00
|
|
|
BOOL msgResult = PROPSHEET_IsDialogMessage(hwnd, (LPMSG)lParam);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
1999-11-28 22:01:47 +01:00
|
|
|
return TRUE;
|
1999-04-22 11:24:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_PRESSBUTTON:
|
|
|
|
PROPSHEET_PressButton(hwnd, (int)wParam);
|
|
|
|
return TRUE;
|
|
|
|
|
1999-09-19 14:14:38 +02:00
|
|
|
case PSM_SETFINISHTEXTA:
|
2002-06-01 01:06:46 +02:00
|
|
|
PROPSHEET_SetFinishTextA(hwnd, (LPCSTR) lParam);
|
1999-09-19 14:14:38 +02:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case PSM_SETWIZBUTTONS:
|
|
|
|
PROPSHEET_SetWizButtons(hwnd, (DWORD)lParam);
|
|
|
|
return TRUE;
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
case PSM_SETCURSELID:
|
2002-08-26 23:47:06 +02:00
|
|
|
PROPSHEET_SetCurSelId(hwnd, (int)lParam);
|
|
|
|
return TRUE;
|
2000-11-09 21:25:27 +01:00
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
case PSM_SETFINISHTEXTW:
|
2002-06-01 01:06:46 +02:00
|
|
|
PROPSHEET_SetFinishTextW(hwnd, (LPCWSTR) lParam);
|
2000-11-09 21:25:27 +01:00
|
|
|
return FALSE;
|
1999-04-22 11:24:47 +02:00
|
|
|
|
2004-07-13 01:30:54 +02:00
|
|
|
case PSM_INSERTPAGE:
|
|
|
|
{
|
|
|
|
BOOL msgResult = PROPSHEET_InsertPage(hwnd, (HPROPSHEETPAGE)wParam, (HPROPSHEETPAGE)lParam);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_SETHEADERTITLEW:
|
|
|
|
PROPSHEET_SetHeaderTitleW(hwnd, (int)wParam, (LPCWSTR)lParam);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case PSM_SETHEADERTITLEA:
|
|
|
|
PROPSHEET_SetHeaderTitleA(hwnd, (int)wParam, (LPCSTR)lParam);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case PSM_SETHEADERSUBTITLEW:
|
|
|
|
PROPSHEET_SetHeaderSubTitleW(hwnd, (int)wParam, (LPCWSTR)lParam);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case PSM_SETHEADERSUBTITLEA:
|
|
|
|
PROPSHEET_SetHeaderSubTitleA(hwnd, (int)wParam, (LPCSTR)lParam);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case PSM_HWNDTOINDEX:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_HwndToIndex(hwnd, (HWND)wParam);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_INDEXTOHWND:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_IndexToHwnd(hwnd, (int)wParam);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_PAGETOINDEX:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_PageToIndex(hwnd, (HPROPSHEETPAGE)wParam);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_INDEXTOPAGE:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_IndexToPage(hwnd, (int)wParam);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_IDTOINDEX:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_IdToIndex(hwnd, (int)lParam);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_INDEXTOID:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_IndexToId(hwnd, (int)wParam);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_GETRESULT:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_GetResult(hwnd);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PSM_RECALCPAGESIZES:
|
|
|
|
{
|
|
|
|
LRESULT msgResult = PROPSHEET_RecalcPageSizes(hwnd);
|
2004-08-25 19:33:01 +02:00
|
|
|
SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult);
|
2004-07-13 01:30:54 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-04-22 11:24:47 +02:00
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|