mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[COMCTL32][COMCTL32_WINETEST] Import wine implementation for PSN_QUERYINITIALFOCUS (#9272)
Import patch from wine-9.15: wine-mirror/wine@786bb3b ``` comctl32: Add handling for PSN_QUERYINITIALFOCUS in prop.c. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54862 wine commit id 786bb3b993f7fe195adb732271df912286c5bfe7 by Jacob Czekalla <[email protected]> ```
This commit is contained in:
@@ -37,7 +37,6 @@
|
|||||||
* o WM_CONTEXTMENU
|
* o WM_CONTEXTMENU
|
||||||
* - Notifications:
|
* - Notifications:
|
||||||
* o PSN_GETOBJECT
|
* o PSN_GETOBJECT
|
||||||
* o PSN_QUERYINITIALFOCUS
|
|
||||||
* o PSN_TRANSLATEACCELERATOR
|
* o PSN_TRANSLATEACCELERATOR
|
||||||
* - Styles:
|
* - Styles:
|
||||||
* o PSH_RTLREADING
|
* o PSH_RTLREADING
|
||||||
@@ -195,6 +194,30 @@ static WCHAR *heap_strdupAtoW(const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");}
|
#define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");}
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
static void PROPSHEET_SetInitialFocus(HWND hwndDlg, int index, PropSheetInfo* psInfo)
|
||||||
|
{
|
||||||
|
PSHNOTIFY psn;
|
||||||
|
HWND focusable_item = NULL;
|
||||||
|
HWND initial_focus = NULL;
|
||||||
|
|
||||||
|
focusable_item = GetNextDlgTabItem(psInfo->proppage[index].hwndPage, NULL, FALSE);
|
||||||
|
if (!focusable_item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
psn.hdr.code = PSN_QUERYINITIALFOCUS;
|
||||||
|
psn.hdr.hwndFrom = hwndDlg;
|
||||||
|
psn.hdr.idFrom = 0;
|
||||||
|
psn.lParam = 0;
|
||||||
|
initial_focus = (HWND)SendMessageW(psInfo->proppage[index].hwndPage, WM_NOTIFY, 0, (LPARAM)&psn);
|
||||||
|
if (initial_focus)
|
||||||
|
SetFocus(initial_focus);
|
||||||
|
else if (focusable_item)
|
||||||
|
SetFocus(focusable_item);
|
||||||
|
}
|
||||||
|
#endif // __REACTOS__
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* PROPSHEET_UnImplementedFlags
|
* PROPSHEET_UnImplementedFlags
|
||||||
*
|
*
|
||||||
@@ -1523,7 +1546,9 @@ static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo)
|
|||||||
{
|
{
|
||||||
HWND hwndTabCtrl;
|
HWND hwndTabCtrl;
|
||||||
HWND hwndLineHeader;
|
HWND hwndLineHeader;
|
||||||
|
#ifndef __REACTOS__
|
||||||
HWND control;
|
HWND control;
|
||||||
|
#endif
|
||||||
LPCPROPSHEETPAGEW ppshpage;
|
LPCPROPSHEETPAGEW ppshpage;
|
||||||
|
|
||||||
TRACE("active_page %d, index %d\n", psInfo->active_page, index);
|
TRACE("active_page %d, index %d\n", psInfo->active_page, index);
|
||||||
@@ -1544,10 +1569,12 @@ static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo)
|
|||||||
{
|
{
|
||||||
PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags,
|
PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags,
|
||||||
psInfo->proppage[index].pszText);
|
psInfo->proppage[index].pszText);
|
||||||
|
#ifndef __REACTOS__
|
||||||
|
|
||||||
control = GetNextDlgTabItem(psInfo->proppage[index].hwndPage, NULL, FALSE);
|
control = GetNextDlgTabItem(psInfo->proppage[index].hwndPage, NULL, FALSE);
|
||||||
if(control != NULL)
|
if(control != NULL)
|
||||||
SetFocus(control);
|
SetFocus(control);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psInfo->active_page != -1)
|
if (psInfo->active_page != -1)
|
||||||
@@ -1563,6 +1590,10 @@ static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo)
|
|||||||
psInfo->active_page = index;
|
psInfo->active_page = index;
|
||||||
psInfo->activeValid = TRUE;
|
psInfo->activeValid = TRUE;
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
PROPSHEET_SetInitialFocus(hwndDlg, index, psInfo);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW) )
|
if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW) )
|
||||||
{
|
{
|
||||||
hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER);
|
hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER);
|
||||||
@@ -1761,6 +1792,9 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam)
|
|||||||
psn.lParam = 0;
|
psn.lParam = 0;
|
||||||
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
||||||
SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
PROPSHEET_SetInitialFocus(hwndPage, psInfo->active_page, psInfo);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -3699,7 +3733,11 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
|
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
return FALSE;
|
||||||
|
#else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
|
|||||||
@@ -1251,25 +1251,25 @@ static void test_QueryInitialFocus(void)
|
|||||||
tab_ctrl = (HWND)SendMessageA(hp, PSM_GETTABCONTROL, 0, 0);
|
tab_ctrl = (HWND)SendMessageA(hp, PSM_GETTABCONTROL, 0, 0);
|
||||||
|
|
||||||
/* Test PSN_QUERYINITIALFOCUS gets sent on start */
|
/* Test PSN_QUERYINITIALFOCUS gets sent on start */
|
||||||
todo_wine ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS on start.\n");
|
ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS on start.\n");
|
||||||
todo_wine ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT2, "Focus not set to IDC_PS_EDIT2.\n");
|
ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT2, "Focus not set to IDC_PS_EDIT2.\n");
|
||||||
|
|
||||||
/* Test changing of tabs */
|
/* Test changing of tabs */
|
||||||
edit_test_ID = IDC_PS_EDIT1;
|
edit_test_ID = IDC_PS_EDIT1;
|
||||||
query_initial_focus = 0;
|
query_initial_focus = 0;
|
||||||
todo_wine ok(tab_ctrl != 0, "Could not test changing tabs. No tab control found.\n");
|
ok(tab_ctrl != 0, "Could not test changing tabs. No tab control found.\n");
|
||||||
SendMessageA(tab_ctrl, TCM_GETITEMRECT, 1, (LPARAM) &rc);
|
SendMessageA(tab_ctrl, TCM_GETITEMRECT, 1, (LPARAM) &rc);
|
||||||
lp = MAKELPARAM(rc.left + ((rc.right - rc.left) / 2), rc.top + ((rc.bottom - rc.top) / 2));
|
lp = MAKELPARAM(rc.left + ((rc.right - rc.left) / 2), rc.top + ((rc.bottom - rc.top) / 2));
|
||||||
SendMessageA(tab_ctrl, WM_LBUTTONDOWN, MK_LBUTTON, lp);
|
SendMessageA(tab_ctrl, WM_LBUTTONDOWN, MK_LBUTTON, lp);
|
||||||
todo_wine ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS from changing tabs.\n");
|
ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS from changing tabs.\n");
|
||||||
todo_wine ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT1, "Focus not set to IDC_PS_EDIT1.\n");
|
ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT1, "Focus not set to IDC_PS_EDIT1.\n");
|
||||||
|
|
||||||
/* Test Apply Button */
|
/* Test Apply Button */
|
||||||
edit_test_ID = IDC_PS_EDIT2;
|
edit_test_ID = IDC_PS_EDIT2;
|
||||||
query_initial_focus = 0;
|
query_initial_focus = 0;
|
||||||
SendMessageA(hp, PSM_PRESSBUTTON, PSBTN_APPLYNOW, 0);
|
SendMessageA(hp, PSM_PRESSBUTTON, PSBTN_APPLYNOW, 0);
|
||||||
todo_wine ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS from apply button.\n");
|
ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS from apply button.\n");
|
||||||
todo_wine ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT2, "Focus not set to IDC_PS_EDIT2.\n");
|
ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT2, "Focus not set to IDC_PS_EDIT2.\n");
|
||||||
|
|
||||||
DestroyWindow(hp);
|
DestroyWindow(hp);
|
||||||
|
|
||||||
@@ -1280,15 +1280,15 @@ static void test_QueryInitialFocus(void)
|
|||||||
hp = (HWND)pPropertySheetA(&psh);
|
hp = (HWND)pPropertySheetA(&psh);
|
||||||
|
|
||||||
/* Test PSN_QUERYINITIALFOCUS gets sent on start */
|
/* Test PSN_QUERYINITIALFOCUS gets sent on start */
|
||||||
todo_wine ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS on start.\n");
|
ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS on start.\n");
|
||||||
todo_wine ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT1, "Focus not set to IDC_PS_EDIT1.\n");
|
ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT1, "Focus not set to IDC_PS_EDIT1.\n");
|
||||||
|
|
||||||
/* Test Next Button */
|
/* Test Next Button */
|
||||||
edit_test_ID = IDC_PS_EDIT2;
|
edit_test_ID = IDC_PS_EDIT2;
|
||||||
query_initial_focus = 0;
|
query_initial_focus = 0;
|
||||||
SendMessageA(hp, PSM_PRESSBUTTON, PSBTN_NEXT, 0);
|
SendMessageA(hp, PSM_PRESSBUTTON, PSBTN_NEXT, 0);
|
||||||
todo_wine ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS from next button.\n");
|
ok(query_initial_focus == 1, "Did not recieve PSN_QUERYINITIALFOCUS from next button.\n");
|
||||||
todo_wine ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT2, "Focus not set to IDC_PS_EDIT2.\n");
|
ok(GetDlgCtrlID(GetFocus()) == IDC_PS_EDIT2, "Focus not set to IDC_PS_EDIT2.\n");
|
||||||
|
|
||||||
DestroyWindow(hp);
|
DestroyWindow(hp);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user