/** * @brief * Give keyboard focus to next tab-stop widget */ bool Widget::NextTabStop(bool bForward) { // Start with this widget Widget *pWidget = this; // Activate next/previous sibling do { // Get next sibling if (bForward) pWidget = pWidget->GetNextSibling(); else pWidget = pWidget->GetPreviousSibling(); if (pWidget) { // Activate first/last tab-stop bool bDone = (bForward ? pWidget->ActivateFirstTabStop() : pWidget->ActivateLastTabStop()); if (bDone) { // Next/previous tab-stop has been found return true; } } } while (pWidget); // No more siblings, find next tab stop from parent Widget *pParent = GetParent(); if (pParent) { return pParent->NextTabStop(bForward); } // Last resort: Activate first/last tab-stop return (bForward ? ActivateFirstTabStop() : ActivateLastTabStop()); }