| 2105 | //----------------------------------------------------------------------------- |
| 2106 | |
| 2107 | GuiControl *GuiControl::findNextTabable(GuiControl *curResponder, bool firstCall) |
| 2108 | { |
| 2109 | // No tabbing if the control is disabled or hidden. |
| 2110 | if ( !mAwake || !mVisible ) |
| 2111 | return NULL; |
| 2112 | |
| 2113 | //if this is the first call, clear the global |
| 2114 | if (firstCall) |
| 2115 | smCurResponder = NULL; |
| 2116 | |
| 2117 | //first find the current responder |
| 2118 | if (curResponder == this) |
| 2119 | smCurResponder = this; |
| 2120 | |
| 2121 | //if the first responder has been found, return the very next *tabable* control |
| 2122 | else if ( smCurResponder && mProfile->mTabable && mAwake && mVisible && mActive ) |
| 2123 | return( this ); |
| 2124 | |
| 2125 | //loop through, checking each child to see if it is the one that follows the firstResponder |
| 2126 | GuiControl *tabCtrl = NULL; |
| 2127 | iterator i; |
| 2128 | for (i = begin(); i != end(); i++) |
| 2129 | { |
| 2130 | GuiControl *ctrl = static_cast<GuiControl *>(*i); |
| 2131 | tabCtrl = ctrl->findNextTabable(curResponder, false); |
| 2132 | if (tabCtrl) break; |
| 2133 | } |
| 2134 | mFirstResponder = tabCtrl; |
| 2135 | return tabCtrl; |
| 2136 | } |
| 2137 | |
| 2138 | //----------------------------------------------------------------------------- |
| 2139 | |