void Panel::addTab( const std::string contentID ) { TabPtr newTab = new Tab( this, contentID ); tabList_.push_back( newTab ); tabBar_->insertItem( newTab->getTabDisplayString(), newTab->getIcon(), newTab.getObject() ); newTab->show( true ); setActiveTab( newTab ); }
ContentPtr Panel::cloneTab( ContentPtr content, int x, int y ) { if ( !content ) return 0; content = content->clone(); TabPtr tab = new Tab( this, content ); tab->show( true ); addTab( tab ); CRect rect; GetWindowRect( &rect ); Manager::instance().dock()->dockTab( this, tab, 0, FLOATING, rect.left, rect.top, x, y ); return content; }
void Panel::showTab( TabPtr tab, bool show ) { TabItr i; for( i = tabList_.begin(); i != tabList_.end(); ++i ) if ( (*i) == tab ) break; if ( i == tabList_.end() ) return; if ( show ) { if ( !tabBar_->contains( tab.getObject() ) ) { tab->setVisible( true ); tabBar_->insertItem( tab->getTabDisplayString(), tab->getIcon(), tab.getObject() ); } setActiveTab( tab ); } else { if ( tabBar_->contains( tab.getObject() ) ) { tab->show( false ); tabBar_->removeItem( tab.getObject() ); } if ( activeTab_ == tab ) { for( i = tabList_.begin(); i != tabList_.end(); ++i ) { if ( tabBar_->contains( (*i).getObject() ) ) { setActiveTab( (*i) ); break; } } } } updateTabBar(); if ( tabBar_->itemCount() == 0 ) Manager::instance().dock()->showPanel( this, false ); }