| 2077 | //----------------------------------------------------------------------------- |
| 2078 | |
| 2079 | GuiControl* GuiControl::findLastTabable(bool firstCall) |
| 2080 | { |
| 2081 | // No tabbing if the control is disabled or hidden. |
| 2082 | if ( !mAwake || !mVisible ) |
| 2083 | return NULL; |
| 2084 | |
| 2085 | //if this is the first call, clear the global |
| 2086 | if (firstCall) |
| 2087 | smPrevResponder = NULL; |
| 2088 | |
| 2089 | //if this control is tabable, set the global |
| 2090 | if (mProfile->mTabable) |
| 2091 | smPrevResponder = this; |
| 2092 | |
| 2093 | iterator i; |
| 2094 | for (i = begin(); i != end(); i++) |
| 2095 | { |
| 2096 | GuiControl *ctrl = static_cast<GuiControl *>(*i); |
| 2097 | ctrl->findLastTabable(false); |
| 2098 | } |
| 2099 | |
| 2100 | //after the entire tree has been traversed, return the last responder found |
| 2101 | mFirstResponder = smPrevResponder; |
| 2102 | return smPrevResponder; |
| 2103 | } |
| 2104 | |
| 2105 | //----------------------------------------------------------------------------- |
| 2106 | |