comctl32/propsheet: Update position of hidden buttons too.
This commit is contained in:
parent
e94d30ed6e
commit
2f8e5da90f
@ -904,7 +904,7 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, const PropSheetInfo* psInfo
|
|||||||
*/
|
*/
|
||||||
hwndButton = GetDlgItem(hwndParent, IDCANCEL);
|
hwndButton = GetDlgItem(hwndParent, IDCANCEL);
|
||||||
|
|
||||||
x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1));
|
x += padding.x + buttonWidth;
|
||||||
|
|
||||||
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
||||||
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
@ -915,33 +915,24 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, const PropSheetInfo* psInfo
|
|||||||
hwndButton = GetDlgItem(hwndParent, IDC_APPLY_BUTTON);
|
hwndButton = GetDlgItem(hwndParent, IDC_APPLY_BUTTON);
|
||||||
|
|
||||||
if(psInfo->hasApply)
|
if(psInfo->hasApply)
|
||||||
{
|
x += padding.x + buttonWidth;
|
||||||
if (psInfo->hasHelp)
|
|
||||||
x = rcSheet.right - ((padding.x + buttonWidth) * 2);
|
|
||||||
else
|
else
|
||||||
x = rcSheet.right - (padding.x + buttonWidth);
|
ShowWindow(hwndButton, SW_HIDE);
|
||||||
|
|
||||||
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
||||||
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
|
|
||||||
EnableWindow(hwndButton, FALSE);
|
EnableWindow(hwndButton, FALSE);
|
||||||
}
|
|
||||||
else
|
|
||||||
ShowWindow(hwndButton, SW_HIDE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Position Help button.
|
* Position Help button.
|
||||||
*/
|
*/
|
||||||
hwndButton = GetDlgItem(hwndParent, IDHELP);
|
hwndButton = GetDlgItem(hwndParent, IDHELP);
|
||||||
|
|
||||||
if (psInfo->hasHelp)
|
x += padding.x + buttonWidth;
|
||||||
{
|
|
||||||
x = rcSheet.right - (padding.x + buttonWidth);
|
|
||||||
|
|
||||||
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
||||||
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
}
|
|
||||||
else
|
if(!psInfo->hasHelp)
|
||||||
ShowWindow(hwndButton, SW_HIDE);
|
ShowWindow(hwndButton, SW_HIDE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* Unit test suite for property sheet control.
|
/* Unit test suite for property sheet control.
|
||||||
*
|
*
|
||||||
* Copyright 2006 Huw Davies
|
* Copyright 2006 Huw Davies
|
||||||
|
* Copyright 2009 Jan de Mooij
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -28,6 +29,8 @@ static HWND parent;
|
|||||||
|
|
||||||
static LONG active_page = -1;
|
static LONG active_page = -1;
|
||||||
|
|
||||||
|
#define IDC_APPLY_BUTTON 12321
|
||||||
|
|
||||||
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
|
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
|
||||||
{
|
{
|
||||||
switch(msg)
|
switch(msg)
|
||||||
@ -341,6 +344,64 @@ static void test_wiznavigation(void)
|
|||||||
|
|
||||||
DestroyWindow(hdlg);
|
DestroyWindow(hdlg);
|
||||||
}
|
}
|
||||||
|
static void test_buttons(void)
|
||||||
|
{
|
||||||
|
HPROPSHEETPAGE hpsp[1];
|
||||||
|
PROPSHEETPAGEA psp;
|
||||||
|
PROPSHEETHEADERA psh;
|
||||||
|
HWND hdlg;
|
||||||
|
HWND button;
|
||||||
|
RECT rc;
|
||||||
|
int prevRight, top;
|
||||||
|
|
||||||
|
memset(&psp, 0, sizeof(psp));
|
||||||
|
psp.dwSize = sizeof(psp);
|
||||||
|
psp.dwFlags = 0;
|
||||||
|
psp.hInstance = GetModuleHandleW(NULL);
|
||||||
|
U(psp).pszTemplate = "prop_page1";
|
||||||
|
U2(psp).pszIcon = NULL;
|
||||||
|
psp.pfnDlgProc = page_dlg_proc;
|
||||||
|
psp.lParam = 0;
|
||||||
|
|
||||||
|
hpsp[0] = CreatePropertySheetPageA(&psp);
|
||||||
|
|
||||||
|
memset(&psh, 0, sizeof(psh));
|
||||||
|
psh.dwSize = sizeof(psh);
|
||||||
|
psh.dwFlags = PSH_MODELESS | PSH_USECALLBACK;
|
||||||
|
psh.pszCaption = "test caption";
|
||||||
|
psh.nPages = 1;
|
||||||
|
psh.hwndParent = GetDesktopWindow();
|
||||||
|
U3(psh).phpage = hpsp;
|
||||||
|
psh.pfnCallback = sheet_callback;
|
||||||
|
|
||||||
|
hdlg = (HWND)PropertySheetA(&psh);
|
||||||
|
|
||||||
|
/* OK button */
|
||||||
|
button = GetDlgItem(hdlg, IDOK);
|
||||||
|
GetWindowRect(button, &rc);
|
||||||
|
prevRight = rc.right;
|
||||||
|
top = rc.top;
|
||||||
|
|
||||||
|
/* Cancel button */
|
||||||
|
button = GetDlgItem(hdlg, IDCANCEL);
|
||||||
|
GetWindowRect(button, &rc);
|
||||||
|
ok(rc.top == top, "Cancel button should have same top as OK button\n");
|
||||||
|
ok(rc.left > prevRight, "Cancel button should be to the right of OK button\n");
|
||||||
|
prevRight = rc.right;
|
||||||
|
|
||||||
|
button = GetDlgItem(hdlg, IDC_APPLY_BUTTON);
|
||||||
|
GetWindowRect(button, &rc);
|
||||||
|
ok(rc.top == top, "Apply button should have same top as OK button\n");
|
||||||
|
ok(rc.left > prevRight, "Apply button should be to the right of Cancel button\n");
|
||||||
|
prevRight = rc.right;
|
||||||
|
|
||||||
|
button = GetDlgItem(hdlg, IDHELP);
|
||||||
|
GetWindowRect(button, &rc);
|
||||||
|
ok(rc.top == top, "Help button should have same top as OK button\n");
|
||||||
|
ok(rc.left > prevRight, "Help button should be to the right of Apply button\n");
|
||||||
|
|
||||||
|
DestroyWindow(hdlg);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(propsheet)
|
START_TEST(propsheet)
|
||||||
{
|
{
|
||||||
@ -348,4 +409,5 @@ START_TEST(propsheet)
|
|||||||
test_nopage();
|
test_nopage();
|
||||||
test_disableowner();
|
test_disableowner();
|
||||||
test_wiznavigation();
|
test_wiznavigation();
|
||||||
|
test_buttons();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user