Commit 2f8e5da9 authored by Jan de Mooij's avatar Jan de Mooij Committed by Alexandre Julliard

comctl32/propsheet: Update position of hidden buttons too.

parent e94d30ed
......@@ -904,7 +904,7 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, const PropSheetInfo* psInfo
*/
hwndButton = GetDlgItem(hwndParent, IDCANCEL);
x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1));
x += padding.x + buttonWidth;
SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
......@@ -914,34 +914,25 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, const PropSheetInfo* psInfo
*/
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);
SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
EnableWindow(hwndButton, FALSE);
}
if(psInfo->hasApply)
x += padding.x + buttonWidth;
else
ShowWindow(hwndButton, SW_HIDE);
SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
EnableWindow(hwndButton, FALSE);
/*
* Position Help button.
*/
hwndButton = GetDlgItem(hwndParent, IDHELP);
if (psInfo->hasHelp)
{
x = rcSheet.right - (padding.x + buttonWidth);
x += padding.x + buttonWidth;
SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
}
else
if(!psInfo->hasHelp)
ShowWindow(hwndButton, SW_HIDE);
return TRUE;
......
/* Unit test suite for property sheet control.
*
* Copyright 2006 Huw Davies
* Copyright 2009 Jan de Mooij
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -28,6 +29,8 @@ static HWND parent;
static LONG active_page = -1;
#define IDC_APPLY_BUTTON 12321
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
{
switch(msg)
......@@ -341,6 +344,64 @@ static void test_wiznavigation(void)
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)
{
......@@ -348,4 +409,5 @@ START_TEST(propsheet)
test_nopage();
test_disableowner();
test_wiznavigation();
test_buttons();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment