Esempio n. 1
0
/*************************************************************************
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);
    }
}
Esempio n. 2
0
/*************************************************************************
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);
    }
}