Commit 8e238d04 authored by Luc Tourangeau's avatar Luc Tourangeau Committed by Alexandre Julliard

Reimplemented the CheckRadioButton function.

parent bbafc7a6
......@@ -62,6 +62,14 @@ typedef struct
BOOL dialogEx;
} DLG_TEMPLATE;
/* Radio button group */
typedef struct
{
UINT firstID;
UINT lastID;
UINT checkID;
} RADIOGROUP;
/* Dialog base units */
static WORD xBaseUnit = 0, yBaseUnit = 0;
......@@ -1593,41 +1601,52 @@ BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
/***********************************************************************
* CheckRadioButton32 (USER32.48)
* CheckRB
*
* Callback function used to check/uncheck radio buttons that fall
* within a specific range of IDs.
*/
BOOL WINAPI CheckRadioButton( HWND hwndDlg, UINT firstID,
UINT lastID, UINT checkID )
static BOOL CALLBACK CheckRB(HWND hwndChild, LPARAM lParam)
{
WND *pWnd = WIN_FindWndPtr( hwndDlg );
if (!pWnd) return FALSE;
LONG lChildID = GetWindowLongA(hwndChild, GWL_ID);
RADIOGROUP *lpRadioGroup = (RADIOGROUP *) lParam;
for (WIN_UpdateWndPtr(&pWnd,pWnd->child); pWnd;WIN_UpdateWndPtr(&pWnd,pWnd->next))
if ((pWnd->wIDmenu == firstID) || (pWnd->wIDmenu == lastID))
if ((lChildID >= lpRadioGroup->firstID) &&
(lChildID <= lpRadioGroup->lastID))
{
break;
}
if (!pWnd) return FALSE;
if (pWnd->wIDmenu == lastID)
lastID = firstID; /* Buttons are in reverse order */
while (pWnd)
if (lChildID == lpRadioGroup->checkID)
{
SendMessageA( pWnd->hwndSelf, BM_SETCHECK,
(pWnd->wIDmenu == checkID), 0 );
if (pWnd->wIDmenu == lastID)
SendMessageA(hwndChild, BM_SETCHECK, BST_CHECKED, 0);
}
else
{
WIN_ReleaseWndPtr(pWnd);
break;
SendMessageA(hwndChild, BM_SETCHECK, BST_UNCHECKED, 0);
}
WIN_UpdateWndPtr(&pWnd,pWnd->next);
}
return TRUE;
}
/***********************************************************************
* CheckRadioButton32 (USER32.48)
*/
BOOL WINAPI CheckRadioButton( HWND hwndDlg, UINT firstID,
UINT lastID, UINT checkID )
{
RADIOGROUP radioGroup;
/* perform bounds checking for a radio button group */
radioGroup.firstID = min(min(firstID, lastID), checkID);
radioGroup.lastID = max(max(firstID, lastID), checkID);
radioGroup.checkID = checkID;
return EnumChildWindows(hwndDlg, (WNDENUMPROC)CheckRB,
(LPARAM)&radioGroup);
}
/***********************************************************************
* GetDialogBaseUnits (USER.243) (USER32.233)
*/
DWORD WINAPI GetDialogBaseUnits(void)
......
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