comctl32/propsheet: Added PSM_INSERTPAGE implementation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
28d9215961
commit
a6661ba9ad
|
@ -32,7 +32,6 @@
|
||||||
* - Wizard 97 header resizing
|
* - Wizard 97 header resizing
|
||||||
* - Enforcing of minimal wizard size
|
* - Enforcing of minimal wizard size
|
||||||
* - Messages:
|
* - Messages:
|
||||||
* o PSM_INSERTPAGE
|
|
||||||
* o PSM_RECALCPAGESIZES
|
* o PSM_RECALCPAGESIZES
|
||||||
* o PSM_SETHEADERSUBTITLE
|
* o PSM_SETHEADERSUBTITLE
|
||||||
* o PSM_SETHEADERTITLE
|
* o PSM_SETHEADERTITLE
|
||||||
|
@ -2244,69 +2243,110 @@ static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
|
||||||
return msgResult;
|
return msgResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* PROPSHEET_AddPage
|
* PROPSHEET_InsertPage
|
||||||
*/
|
*/
|
||||||
static BOOL PROPSHEET_AddPage(HWND hwndDlg,
|
static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
|
||||||
HPROPSHEETPAGE hpage)
|
|
||||||
{
|
{
|
||||||
PropPageInfo * ppi;
|
PropSheetInfo *psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
|
||||||
PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
|
PropPageInfo *ppi, *prev_ppi = psInfo->proppage;
|
||||||
HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
||||||
TCITEMW item;
|
|
||||||
LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage;
|
LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage;
|
||||||
|
TCITEMW item;
|
||||||
|
int index;
|
||||||
|
|
||||||
TRACE("hpage %p\n", hpage);
|
TRACE("hwndDlg %p, hpageInsertAfter %p, hpage %p\n", hwndDlg, hpageInsertAfter, hpage);
|
||||||
/*
|
|
||||||
* Allocate and fill in a new PropPageInfo entry.
|
if (IS_INTRESOURCE(hpageInsertAfter))
|
||||||
*/
|
index = LOWORD(hpageInsertAfter);
|
||||||
ppi = ReAlloc(psInfo->proppage, sizeof(PropPageInfo) * (psInfo->nPages + 1));
|
else
|
||||||
|
{
|
||||||
|
index = PROPSHEET_GetPageIndex(hpageInsertAfter, psInfo, -1);
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
TRACE("Could not find page to insert after!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index > psInfo->nPages)
|
||||||
|
index = psInfo->nPages;
|
||||||
|
|
||||||
|
ppi = Alloc(sizeof(PropPageInfo) * (psInfo->nPages + 1));
|
||||||
if (!ppi)
|
if (!ppi)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill in a new PropPageInfo entry.
|
||||||
|
*/
|
||||||
|
if (index > 0)
|
||||||
|
memcpy(ppi, prev_ppi, index * sizeof(PropPageInfo));
|
||||||
|
memset(&ppi[index], 0, sizeof(PropPageInfo));
|
||||||
|
if (index < psInfo->nPages)
|
||||||
|
memcpy(&ppi[index + 1], &prev_ppi[index], (psInfo->nPages - index) * sizeof(PropPageInfo));
|
||||||
psInfo->proppage = ppi;
|
psInfo->proppage = ppi;
|
||||||
if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages, FALSE))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
psInfo->proppage[psInfo->nPages].hpage = hpage;
|
if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, index, FALSE))
|
||||||
|
{
|
||||||
|
psInfo->proppage = prev_ppi;
|
||||||
|
Free(ppi);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
psInfo->proppage[index].hpage = hpage;
|
||||||
|
|
||||||
if (ppsp->dwFlags & PSP_PREMATURE)
|
if (ppsp->dwFlags & PSP_PREMATURE)
|
||||||
{
|
{
|
||||||
/* Create the page but don't show it */
|
/* Create the page but don't show it */
|
||||||
if(!PROPSHEET_CreatePage(hwndDlg, psInfo->nPages, psInfo, ppsp))
|
if (!PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppsp))
|
||||||
|
{
|
||||||
|
psInfo->proppage = prev_ppi;
|
||||||
|
Free(ppi);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Free(prev_ppi);
|
||||||
|
psInfo->nPages++;
|
||||||
|
if (index <= psInfo->active_page)
|
||||||
|
psInfo->active_page++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a new tab to the tab control.
|
* Add a new tab to the tab control.
|
||||||
*/
|
*/
|
||||||
item.mask = TCIF_TEXT;
|
item.mask = TCIF_TEXT;
|
||||||
item.pszText = (LPWSTR) psInfo->proppage[psInfo->nPages].pszText;
|
item.pszText = (LPWSTR) psInfo->proppage[index].pszText;
|
||||||
item.cchTextMax = MAX_TABTEXT_LENGTH;
|
item.cchTextMax = MAX_TABTEXT_LENGTH;
|
||||||
|
|
||||||
if (psInfo->hImageList)
|
if (psInfo->hImageList)
|
||||||
{
|
|
||||||
SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
|
SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
|
||||||
}
|
|
||||||
|
|
||||||
if ( psInfo->proppage[psInfo->nPages].hasIcon )
|
if (psInfo->proppage[index].hasIcon)
|
||||||
{
|
{
|
||||||
item.mask |= TCIF_IMAGE;
|
item.mask |= TCIF_IMAGE;
|
||||||
item.iImage = psInfo->nPages;
|
item.iImage = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(hwndTabControl, TCM_INSERTITEMW, psInfo->nPages + 1,
|
SendMessageW(hwndTabControl, TCM_INSERTITEMW, index, (LPARAM)&item);
|
||||||
(LPARAM)&item);
|
|
||||||
|
|
||||||
psInfo->nPages++;
|
|
||||||
|
|
||||||
/* If it is the only page - show it */
|
/* If it is the only page - show it */
|
||||||
if(psInfo->nPages == 1)
|
if (psInfo->nPages == 1)
|
||||||
PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0);
|
PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* PROPSHEET_AddPage
|
||||||
|
*/
|
||||||
|
static BOOL PROPSHEET_AddPage(HWND hwndDlg, HPROPSHEETPAGE hpage)
|
||||||
|
{
|
||||||
|
PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
|
||||||
|
TRACE("hwndDlg %p, hpage %p\n", hwndDlg, hpage);
|
||||||
|
return PROPSHEET_InsertPage(hwndDlg, UlongToPtr(psInfo->nPages), hpage);
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* PROPSHEET_RemovePage
|
* PROPSHEET_RemovePage
|
||||||
*/
|
*/
|
||||||
|
@ -2460,18 +2500,6 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* PROPSHEET_InsertPage
|
|
||||||
*/
|
|
||||||
static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
|
|
||||||
{
|
|
||||||
if (IS_INTRESOURCE(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
|
* PROPSHEET_SetHeaderTitleW
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -935,7 +935,7 @@ static void test_PSM_INSERTPAGE(void)
|
||||||
|
|
||||||
/* add pages one by one */
|
/* add pages one by one */
|
||||||
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 5, (LPARAM)hpsp[1]);
|
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 5, (LPARAM)hpsp[1]);
|
||||||
todo_wine ok(ret == TRUE, "got %d\n", ret);
|
ok(ret == TRUE, "got %d\n", ret);
|
||||||
|
|
||||||
/* try with invalid values */
|
/* try with invalid values */
|
||||||
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, 0);
|
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, 0);
|
||||||
|
@ -954,34 +954,34 @@ if (0)
|
||||||
tab = (HWND)SendMessageA(hdlg, PSM_GETTABCONTROL, 0, 0);
|
tab = (HWND)SendMessageA(hdlg, PSM_GETTABCONTROL, 0, 0);
|
||||||
|
|
||||||
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
todo_wine ok(r == 2, "got %d\n", r);
|
ok(r == 2, "got %d\n", r);
|
||||||
|
|
||||||
ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)hpsp[1], (LPARAM)hpsp[2]);
|
ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)hpsp[1], (LPARAM)hpsp[2]);
|
||||||
todo_wine ok(ret == TRUE, "got %d\n", ret);
|
ok(ret == TRUE, "got %d\n", ret);
|
||||||
|
|
||||||
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
todo_wine ok(r == 3, "got %d\n", r);
|
ok(r == 3, "got %d\n", r);
|
||||||
|
|
||||||
/* add property sheet page that can't be created */
|
/* add property sheet page that can't be created */
|
||||||
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 1, (LPARAM)hpsp[3]);
|
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 1, (LPARAM)hpsp[3]);
|
||||||
todo_wine ok(ret == TRUE, "got %d\n", ret);
|
ok(ret == TRUE, "got %d\n", ret);
|
||||||
|
|
||||||
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
todo_wine ok(r == 4, "got %d\n", r);
|
ok(r == 4, "got %d\n", r);
|
||||||
|
|
||||||
/* select page that can't be created */
|
/* select page that can't be created */
|
||||||
ret = SendMessageA(hdlg, PSM_SETCURSEL, 1, 0);
|
ret = SendMessageA(hdlg, PSM_SETCURSEL, 1, 0);
|
||||||
todo_wine ok(ret == TRUE, "got %d\n", ret);
|
ok(ret == TRUE, "got %d\n", ret);
|
||||||
|
|
||||||
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
todo_wine ok(r == 3, "got %d\n", r);
|
ok(r == 3, "got %d\n", r);
|
||||||
|
|
||||||
/* test PSP_PREMATURE flag with incorrect property sheet page */
|
/* test PSP_PREMATURE flag with incorrect property sheet page */
|
||||||
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)hpsp[4]);
|
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)hpsp[4]);
|
||||||
ok(ret == FALSE, "got %d\n", ret);
|
ok(ret == FALSE, "got %d\n", ret);
|
||||||
|
|
||||||
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
|
||||||
todo_wine ok(r == 3, "got %d\n", r);
|
ok(r == 3, "got %d\n", r);
|
||||||
|
|
||||||
DestroyPropertySheetPage(hpsp[4]);
|
DestroyPropertySheetPage(hpsp[4]);
|
||||||
DestroyWindow(hdlg);
|
DestroyWindow(hdlg);
|
||||||
|
|
Loading…
Reference in New Issue