/************************************************************************* Select tab implementation *************************************************************************/ void TabControl::selectTab_impl(Window* wnd) { makeTabVisible_impl(wnd); bool modified = false; // Iterate in order of tab index for (size_t i = 0; i < d_tabButtonVector.size(); ++i) { // get corresponding tab button and content window TabButton* tb = d_tabButtonVector [i]; Window* child = tb->getTargetWindow(); // Should we be selecting? bool selectThis = (child == wnd); // Are we modifying this tab? modified = modified || (tb->isSelected() != selectThis); // Select tab & set visible if this is the window, not otherwise tb->setSelected(selectThis); child->setVisible(selectThis); } // Trigger event? if (modified) { WindowEventArgs args(this); onSelectionChanged(args); } }
/************************************************************************* Select tab implementation *************************************************************************/ void TabControl::selectTab_impl(Window* wnd) { bool modified = false; bool foundSelected = false; // Iterate in order of tab index TabButtonIndexMap::iterator i, iend; iend = d_tabButtonIndexMap.end(); for (i = d_tabButtonIndexMap.begin(); i != iend; ++i) { // get corresponding tab button and content window TabButton* tb = i->second; Window* child = tb->getTargetWindow(); // Should we be selecting? bool selectThis = (child == wnd); // Are we modifying this tab? modified = modified || (tb->isSelected() != selectThis); foundSelected = foundSelected || selectThis; // Select tab & set visible if this is the window, not otherwise tb->setSelected(selectThis); tb->setRightOfSelected(foundSelected); child->setVisible(selectThis); } // Trigger event? if (modified) { WindowEventArgs args(this); onSelectionChanged(args); } }
void FalagardTabButton::render() { TabButton* w = (TabButton*)d_window; // get WidgetLookFeel for the assigned look. const WidgetLookFeel& wlf = getLookNFeel(); TabControl* tc = static_cast<TabControl*>(w->getParent()->getParent()); String state; String prefix((tc->getTabPanePosition() == TabControl::Top) ? "Top" : "Bottom"); if (w->isDisabled()) state = "Disabled"; else if (w->isSelected()) state = "Selected"; else if (w->isPushed()) state = "Pushed"; else if (w->isHovering()) state = "Hover"; else state = "Normal"; if (!wlf.isStateImageryPresent(prefix + state)) { state = "Normal"; if (!wlf.isStateImageryPresent(prefix + state)) prefix = ""; } wlf.getStateImagery(prefix + state).render(*w); }
/************************************************************************* Return whether the tab content window is currently selected. *************************************************************************/ uint TabControl::getSelectedTabIndex() const { uint index; TabButtonIndexMap::const_iterator i, iend; iend = d_tabButtonIndexMap.end(); for (i = d_tabButtonIndexMap.begin(); i != iend; ++i) { // get corresponding tab button and content window TabButton* tb = i->second; if (tb->isSelected()) { index = i->first; break; } } return index; }
/************************************************************************* Return whether the tab content window is currently selected. *************************************************************************/ bool TabControl::isTabContentsSelected(Window* wnd) const { TabButton* button = getButtonForTabContents(wnd); return button->isSelected(); }