Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

dlgmgrc.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

PWND UT_PrevGroupItem (PWND pwndDlg, PWND pwndCurrent)
PWND UT_NextGroupItem (PWND pwndDlg, PWND pwndCurrent)
PWND _PrevControl (PWND pwndRoot, PWND pwndStart, UINT uFlags)
PWND _GetChildControl (PWND pwndRoot, PWND pwndChild)
PWND _NextSibblingOrAncestor (PWND pwndRoot, PWND pwndStart)
PWND _NextControl (PWND pwndRoot, PWND pwndStart, UINT uFlags)
HWND WINAPI GetNextDlgTabItem (HWND hwndDlg, HWND hwnd, BOOL fPrev)
PWND _GetNextDlgTabItem (PWND pwndDlg, PWND pwnd, BOOL fPrev)
HWND GetNextDlgGroupItem (HWND hwndDlg, HWND hwndCtl, BOOL bPrevious)
PWND _GetNextDlgGroupItem (PWND pwndDlg, PWND pwnd, BOOL fPrev)


Function Documentation

PWND _GetChildControl PWND  pwndRoot,
PWND  pwndChild
 

Definition at line 125 of file dlgmgrc.c.

References NULL, REBASEPWND, TestWF, TestwndChild, and WEFCONTROLPARENT.

Referenced by _GetNextDlgGroupItem(), _GetNextDlgTabItem(), _NextSibblingOrAncestor(), GetNextDlgHelpItem(), xxxGNM_FindNextMnem(), and xxxRemoveDefaultButton().

00125 { 00126 PWND pwndControl = NULL; 00127 00128 while (pwndChild && TestwndChild(pwndChild) && (pwndChild != pwndRoot)) { 00129 pwndControl = pwndChild; 00130 pwndChild = REBASEPWND(pwndChild, spwndParent); 00131 00132 if (TestWF(pwndChild, WEFCONTROLPARENT)) 00133 break; 00134 } 00135 00136 return(pwndControl); 00137 }

PWND _GetNextDlgGroupItem PWND  pwndDlg,
PWND  pwnd,
BOOL  fPrev
 

Definition at line 439 of file dlgmgrc.c.

References _GetChildControl(), BOOL, FALSE, TestWF, TRUE, UT_NextGroupItem(), UT_PrevGroupItem(), WFDISABLED, and WFVISIBLE.

Referenced by GetNextDlgGroupItem(), IsDialogMessageW(), xxxBNReleaseCapture(), and xxxGNM_FindNextMnem().

00443 { 00444 PWND pwndCurrent; 00445 BOOL fOnceAround = FALSE; 00446 00447 pwnd = pwndCurrent = _GetChildControl(pwndDlg, pwnd); 00448 00449 do { 00450 pwnd = (fPrev ? UT_PrevGroupItem(pwndDlg, pwnd) : 00451 UT_NextGroupItem(pwndDlg, pwnd)); 00452 00453 if (pwnd == pwndCurrent) 00454 fOnceAround = TRUE; 00455 00456 if (!pwndCurrent) 00457 pwndCurrent = pwnd; 00458 } 00459 while (!fOnceAround && ((TestWF(pwnd, WFDISABLED) || !TestWF(pwnd, WFVISIBLE)))); 00460 00461 return pwnd; 00462 }

PWND _GetNextDlgTabItem PWND  pwndDlg,
PWND  pwnd,
BOOL  fPrev
 

Definition at line 348 of file dlgmgrc.c.

References _GetChildControl(), _IsDescendant(), _NextControl(), _PrevControl(), and NULL.

Referenced by DefDlgProcWorker(), GetNextDlgTabItem(), InternalCreateDialog(), IsDialogMessageW(), and xxxGotoNextMnem().

00352 { 00353 PWND pwndSave; 00354 00355 if (pwnd == pwndDlg) 00356 pwnd = NULL; 00357 else 00358 { 00359 pwnd = _GetChildControl(pwndDlg, pwnd); 00360 if (pwnd && !_IsDescendant(pwndDlg, pwnd)) 00361 return(NULL); 00362 } 00363 00364 // 00365 // BACKWARD COMPATIBILITY 00366 // 00367 // Note that the result when there are no tabstops of 00368 // IGetNextDlgTabItem(pwndDlg, NULL, FALSE) was the last item, now 00369 // will be the first item. We could put a check for fRecurse here 00370 // and do the old thing if not set. 00371 // 00372 00373 // We are going to bug out if we hit the first child a second time. 00374 00375 pwndSave = pwnd; 00376 00377 pwnd = (fPrev ? _PrevControl(pwndDlg, pwnd, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED) : 00378 _NextControl(pwndDlg, pwnd, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED)); 00379 00380 if (!pwnd) 00381 goto AllOver; 00382 00383 while ((pwnd != pwndSave) && (pwnd != pwndDlg)) { 00384 UserAssert(pwnd); 00385 00386 if (!pwndSave) 00387 pwndSave = pwnd; 00388 00389 if ((pwnd->style & (WS_TABSTOP | WS_VISIBLE | WS_DISABLED)) == (WS_TABSTOP | WS_VISIBLE)) 00390 // Found it. 00391 break; 00392 00393 pwnd = (fPrev ? _PrevControl(pwndDlg, pwnd, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED) : 00394 _NextControl(pwndDlg, pwnd, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED)); 00395 } 00396 00397 AllOver: 00398 return pwnd; 00399 }

PWND _NextControl PWND  pwndRoot,
PWND  pwndStart,
UINT  uFlags
 

Definition at line 207 of file dlgmgrc.c.

References _IsDescendant(), _NextSibblingOrAncestor(), BOOL, FALSE, NULL, REBASEPWND, tagWND::spwndParent, TestWF, TRUE, WEFCONTROLPARENT, WFDISABLED, and WFVISIBLE.

Referenced by _FindDlgItem(), _GetNextDlgTabItem(), _PrevControl(), GetNextDlgHelpItem(), UT_NextGroupItem(), UT_PrevGroupItem(), xxxGNM_FindNextMnem(), and xxxRemoveDefaultButton().

00211 { 00212 BOOL fSkip, fAncestor; 00213 PWND pwndLast, pwndSibblingLoop; 00214 /* Bug 272874 - joejo 00215 * 00216 * Stop infinite loop by only looping a finite number of times and 00217 * then bailing. 00218 */ 00219 int nLoopCount = 0; 00220 00221 UserAssert (pwndRoot != NULL); 00222 00223 if (pwndStart == NULL) { 00224 // Start with pwndRoot's first child 00225 pwndStart = REBASEPWND(pwndRoot, spwndChild); 00226 pwndLast = pwndStart; 00227 fAncestor = FALSE; 00228 } else { 00229 UserAssert ((pwndRoot != pwndStart) && _IsDescendant(pwndRoot, pwndStart)); 00230 00231 // Save starting handle and get next one 00232 pwndLast = pwndStart; 00233 pwndSibblingLoop = pwndStart; 00234 fAncestor = TRUE; 00235 goto TryNextOne; 00236 } 00237 00238 00239 // If no more controls, game over 00240 if (pwndStart == NULL) { 00241 return pwndRoot; 00242 } 00243 00244 // Search for a non WS_EX_CONTROLPARENT window; if a window should be skipped, 00245 // try its spwndNext; otherwise, walk down its child chain. 00246 pwndSibblingLoop = pwndStart; 00247 do { 00248 00249 //If not WS_EX_CONTROLPARENT parent, done. 00250 if (!TestWF(pwndStart, WEFCONTROLPARENT)) { 00251 return pwndStart; 00252 } 00253 00254 // Do they want to skip this window? 00255 fSkip = ((uFlags & CWP_SKIPINVISIBLE) && !TestWF(pwndStart, WFVISIBLE)) 00256 || ((uFlags & CWP_SKIPDISABLED) && TestWF(pwndStart, WFDISABLED)); 00257 00258 00259 // Remember the current window 00260 pwndLast = pwndStart; 00261 00262 // Walk down child chain? 00263 if (!fSkip && !fAncestor) { 00264 pwndStart = _NextControl (pwndStart, NULL, uFlags); 00265 // If it found one, done. 00266 if (pwndStart != pwndLast) { 00267 return pwndStart; 00268 } 00269 } 00270 00271 TryNextOne: 00272 // Try the next one. 00273 pwndStart = _NextSibblingOrAncestor (pwndRoot, pwndStart); 00274 if (pwndStart == NULL) { 00275 break; 00276 } 00277 00278 // If parents are the same, we are still in the same sibbling chain 00279 if (pwndLast->spwndParent == pwndStart->spwndParent) { 00280 // If we had just moved up the parent chain last time around, 00281 // mark this as the beginning of the new sibbling chain. 00282 // Otherwise, check if we've looped through all sibblings already. 00283 if (fAncestor) { 00284 // Beggining of new sibbling chain. 00285 pwndSibblingLoop = pwndStart; 00286 } else if (pwndStart == pwndSibblingLoop) { 00287 // Already visited all sibblings, so done. 00288 break; 00289 } 00290 fAncestor = FALSE; 00291 } else { 00292 // We must have moved up the parent chain, so don't 00293 // walk down the child chain right away (try the next window first) 00294 // Eventhough we are on a new sibbling chain, we don't update 00295 // pwndSibblingLoop yet; this is because we must walk down this 00296 // child chain again to make sure we visit all the descendents 00297 fAncestor = TRUE; 00298 } 00299 00300 /* Bug 272874 - joejo 00301 * 00302 * Stop infinite loop by only looping a finite number of times and 00303 * then bailing. 00304 */ 00305 } while (nLoopCount++ < 256 * 4); 00306 00307 // It couldn't find one... 00308 return pwndRoot; 00309 }

PWND _NextSibblingOrAncestor PWND  pwndRoot,
PWND  pwndStart
 

Definition at line 151 of file dlgmgrc.c.

References _GetChildControl(), NULL, REBASEALWAYS, tagWND::spwndNext, TestWF, and WEFCONTROLPARENT.

Referenced by _NextControl().

00152 { 00153 PWND pwndParent; 00154 #if DBG 00155 PWND pwndNext; 00156 #endif 00157 00158 // If there is a sibbling, go for it 00159 if (pwndStart->spwndNext != NULL) { 00160 return (REBASEALWAYS(pwndStart, spwndNext)); 00161 } 00162 00163 // If it cannot go up the parent chain, then return the first sibbling. 00164 pwndParent = REBASEALWAYS(pwndStart, spwndParent); 00165 if (pwndParent == pwndRoot) { 00166 // Note that if pwndStart doesn't have any sibblings, 00167 // this will return pwndStart again 00168 return (REBASEALWAYS(pwndParent, spwndChild)); 00169 } 00170 00171 00172 // Otherwise walk up the parent chain looking for the first window with 00173 // a WS_EX_CONTROLPARENT parent. 00174 00175 #if DBG 00176 pwndNext = 00177 #else 00178 return 00179 #endif 00180 _GetChildControl(pwndRoot, pwndParent); 00181 00182 #if DBG 00183 if ((pwndNext != pwndParent) || !TestWF(pwndParent, WEFCONTROLPARENT)) { 00184 // Code looping through the controls in a dialog might go into an infinite 00185 // loop because of this (i.e., xxxRemoveDefaultButton, _GetNextDlgTabItem,..) 00186 // We've walked up the parent chain but will never walk down the child chain again 00187 // because there is a NON WS_EX_CONTROLPARENT parent window somewhere in the chain. 00188 RIPMSG0 (RIP_ERROR, "_NextSibblingOrAncestor: Non WS_EX_CONTROLPARENT window in parent chain"); 00189 } 00190 return pwndNext; 00191 #endif 00192 }

PWND _PrevControl PWND  pwndRoot,
PWND  pwndStart,
UINT  uFlags
 

Definition at line 78 of file dlgmgrc.c.

References _NextControl(), BOOL, FALSE, NULL, TestWF, TRUE, and WEFCONTROLPARENT.

Referenced by _GetNextDlgTabItem(), UT_NextGroupItem(), and UT_PrevGroupItem().

00082 { 00083 BOOL fFirstFound; 00084 PWND pwndNext; 00085 PWND pwnd, pwndFirst; 00086 00087 if (!pwndStart) 00088 return(NULL); 00089 00090 UserAssert(pwndRoot != pwndStart); 00091 UserAssert(!TestWF(pwndStart, WEFCONTROLPARENT)); 00092 00093 pwnd = _NextControl(pwndRoot, NULL, uFlags); 00094 00095 pwndFirst = pwnd; 00096 fFirstFound = FALSE; 00097 while (pwndNext = _NextControl(pwndRoot, pwnd, uFlags)) { 00098 00099 if (pwndNext == pwndStart) 00100 break; 00101 00102 if (pwndNext == pwndFirst) { 00103 if (fFirstFound) { 00104 RIPMSG0(RIP_WARNING, "_PrevControl: Loop Detected"); 00105 break; 00106 } else { 00107 fFirstFound = TRUE; 00108 } 00109 } 00110 00111 pwnd = pwndNext; 00112 } 00113 00114 return pwnd; 00115 }

HWND GetNextDlgGroupItem HWND  hwndDlg,
HWND  hwndCtl,
BOOL  bPrevious
 

Definition at line 407 of file dlgmgrc.c.

References _GetNextDlgGroupItem(), HW, NULL, and ValidateHwnd.

00411 { 00412 PWND pwndDlg; 00413 PWND pwndCtl; 00414 PWND pwndNext; 00415 00416 pwndDlg = ValidateHwnd(hwndDlg); 00417 00418 if (pwndDlg == NULL) 00419 return 0; 00420 00421 00422 if (hwndCtl != (HWND)0) { 00423 pwndCtl = ValidateHwnd(hwndCtl); 00424 00425 if (pwndCtl == NULL) 00426 return 0; 00427 } else { 00428 pwndCtl = (PWND)NULL; 00429 } 00430 00431 if (pwndCtl == pwndDlg) 00432 pwndCtl = pwndDlg; 00433 00434 pwndNext = _GetNextDlgGroupItem(pwndDlg, pwndCtl, bPrevious); 00435 00436 return (HW(pwndNext)); 00437 }

HWND WINAPI GetNextDlgTabItem HWND  hwndDlg,
HWND  hwnd,
BOOL  fPrev
 

Definition at line 318 of file dlgmgrc.c.

References _GetNextDlgTabItem(), HW, NULL, and ValidateHwnd.

00322 { 00323 00324 PWND pwnd; 00325 PWND pwndDlg; 00326 PWND pwndNext; 00327 00328 pwndDlg = ValidateHwnd(hwndDlg); 00329 00330 if (pwndDlg == NULL) 00331 return NULL; 00332 00333 if (hwnd != (HWND)0) { 00334 pwnd = ValidateHwnd(hwnd); 00335 00336 if (pwnd == NULL) 00337 return NULL; 00338 00339 } else { 00340 pwnd = (PWND)NULL; 00341 } 00342 00343 pwndNext = _GetNextDlgTabItem(pwndDlg, pwnd, fPrev); 00344 00345 return (HW(pwndNext)); 00346 }

PWND UT_NextGroupItem PWND  pwndDlg,
PWND  pwndCurrent
 

Definition at line 50 of file dlgmgrc.c.

References _NextControl(), _PrevControl(), NULL, TestWF, and WFGROUP.

Referenced by _GetNextDlgGroupItem().

00053 { 00054 PWND pwnd, pwndNext; 00055 00056 pwnd = _NextControl(pwndDlg, pwndCurrent, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED); 00057 00058 if (pwndCurrent == NULL || !TestWF(pwnd, WFGROUP)) 00059 return pwnd; 00060 00061 pwndNext = pwndCurrent; 00062 00063 while (!TestWF(pwndNext, WFGROUP)) { 00064 pwnd = _PrevControl(pwndDlg, pwndNext, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED); 00065 if (pwnd == pwndCurrent) 00066 return pwndNext; 00067 pwndNext = pwnd; 00068 } 00069 00070 return pwndNext; 00071 }

PWND UT_PrevGroupItem PWND  pwndDlg,
PWND  pwndCurrent
 

Definition at line 22 of file dlgmgrc.c.

References _NextControl(), _PrevControl(), NULL, TestWF, TRUE, and WFGROUP.

Referenced by _GetNextDlgGroupItem().

00025 { 00026 PWND pwnd, pwndPrev; 00027 00028 if (pwndCurrent == NULL || !TestWF(pwndCurrent, WFGROUP)) 00029 return _PrevControl(pwndDlg, pwndCurrent, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED); 00030 00031 pwndPrev = pwndCurrent; 00032 00033 while (TRUE) { 00034 pwnd = _NextControl(pwndDlg, pwndPrev, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED); 00035 00036 if (TestWF(pwnd, WFGROUP) || pwnd == pwndCurrent) 00037 return pwndPrev; 00038 00039 pwndPrev = pwnd; 00040 } 00041 }


Generated on Sat May 15 19:43:28 2004 for test by doxygen 1.3.7