| 2138 | //----------------------------------------------------------------------------- |
| 2139 | |
| 2140 | GuiControl *GuiControl::findPrevTabable(GuiControl *curResponder, bool firstCall) |
| 2141 | { |
| 2142 | // No tabbing if the control is disabled or hidden. |
| 2143 | if ( !mAwake || !mVisible ) |
| 2144 | return NULL; |
| 2145 | |
| 2146 | if (firstCall) |
| 2147 | smPrevResponder = NULL; |
| 2148 | |
| 2149 | //if this is the current reponder, return the previous one |
| 2150 | if (curResponder == this) |
| 2151 | return smPrevResponder; |
| 2152 | |
| 2153 | //else if this is a responder, store it in case the next found is the current responder |
| 2154 | else if ( mProfile->mTabable && mAwake && mVisible && mActive ) |
| 2155 | smPrevResponder = this; |
| 2156 | |
| 2157 | //loop through, checking each child to see if it is the one that follows the firstResponder |
| 2158 | GuiControl *tabCtrl = NULL; |
| 2159 | iterator i; |
| 2160 | for (i = begin(); i != end(); i++) |
| 2161 | { |
| 2162 | GuiControl *ctrl = static_cast<GuiControl *>(*i); |
| 2163 | tabCtrl = ctrl->findPrevTabable(curResponder, false); |
| 2164 | if (tabCtrl) break; |
| 2165 | } |
| 2166 | mFirstResponder = tabCtrl; |
| 2167 | return tabCtrl; |
| 2168 | } |
| 2169 | |
| 2170 | //----------------------------------------------------------------------------- |
| 2171 | |