void TBTabContainer::SetValue(int index) { if (index == m_current_page) return; m_current_page = index; // Update the pages visibility and tabs pressed value. index = 0; TBWidget *page = m_content_root.GetFirstChild(); TBWidget *tab = m_tab_layout.GetFirstChild(); for ( ; page && tab; page = page->GetNext(), tab = tab->GetNext(), index++) { bool active = index == m_current_page; page->SetVisibility(active ? WIDGET_VISIBILITY_VISIBLE : WIDGET_VISIBILITY_INVISIBLE); tab->SetValue(active ? 1 : 0); } }