void PropertyTreeViewer::tabChanged(int _newNum) { QWidget* w = m_ui->tabWidget->widget(_newNum); if(!w) return; if(!isServiceTab(m_currentTab) && !isNormalised()) saveValuesFromUi(); if(w == m_ui->average) { displayValuesForArithmeticalMean(); w->layout()->addWidget(m_treePropertyWidget); m_currentTab = _newNum; } else if(w == m_ui->add) { addTab(); return; } else if(w == m_ui->import) { import(); return; } else { m_treePropertyWidget->setValues(m_values[_newNum]); m_currentTab = _newNum; } setActiveTab(w); normalise(isNormalised()); }
bool TabViewController::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::Back) { if (app()->firstResponder() != this) { app()->setFirstResponder(this); return true; } return false; } if (app()->firstResponder() != this) { return false; } if (event == Ion::Events::Left) { if (m_dataSource->selectedTab() > 0) { setSelectedTab(m_dataSource->selectedTab()-1); } return true; } if (event == Ion::Events::Right) { if (m_dataSource->selectedTab() < m_numberOfChildren-1) { setSelectedTab(m_dataSource->selectedTab()+1); } return true; } if (event == Ion::Events::Down) { setActiveTab(m_dataSource->activeTab()); return true; } if (event == Ion::Events::OK || event == Ion::Events::EXE) { setActiveTab(m_dataSource->selectedTab()); return true; } return false; }
void Panel::detachTab( TabPtr tab ) { for(TabItr i = tabList_.begin(); i != tabList_.end(); ++i ) { if ( (*i) == tab ) { if ( activeTab_ == tab ) activeTab_ = 0; tab->getCWnd()->ShowWindow( SW_HIDE ); tab->getCWnd()->SetParent( 0 ); tabBar_->removeItem( tab.getObject() ); tabList_.erase( i ); for( i = tabList_.begin(); i != tabList_.end(); ++i ) { if ( tabBar_->contains( (*i).getObject() ) ) { setActiveTab( *i ); break; } } if ( i == tabList_.end() ) setActiveTab( 0 ); break; } } }
Ti::TiValue TiUITabGroupProxy::setActiveTab(Ti::TiValue value) { if(value.isNumber()) { setActiveTab(_allTabs.at((int)value.toNumber())); } else if(value.isProxy()) { setActiveTab(static_cast<TiUITabProxy*>(value.toProxy())); } return Ti::TiValue(); }
void TabWidget::removeTab(int index) { assert(mContent->childCount() < index); mHeader->removeTab(index); mContent->removeChild(index); if (activeTab() == index) setActiveTab(index == (index - 1) ? index - 1 : 0); }
void CGUITabControl::selectTab(core::position2d<s32> p) { IGUISkin* skin = Environment->getSkin(); IGUIFont* font = skin->getFont(); core::rect<s32> frameRect(AbsoluteRect); s32 tabheight = skin->getSize(gui::EGDS_BUTTON_HEIGHT); frameRect.UpperLeftCorner.Y += 2; frameRect.LowerRightCorner.Y = frameRect.UpperLeftCorner.Y + tabheight; s32 pos = frameRect.UpperLeftCorner.X + 2; for (u32 i=0; i<Tabs.size(); ++i) { // get Text const wchar_t* text = 0; if (Tabs[i]) text = Tabs[i]->getText(); // get text length s32 len = 20; if (font) len += font->getDimension(text).Width; frameRect.UpperLeftCorner.X = pos; frameRect.LowerRightCorner.X = frameRect.UpperLeftCorner.X + len; pos += len; if (frameRect.isPointInside(p)) { setActiveTab(i); return; } } }
bool CGUITabControl::setActiveTab(IGUIElement *tab) { for (s32 i=0; i<(s32)Tabs.size(); ++i) if (Tabs[i] == tab) return setActiveTab(i); return false; }
void TabBar::setTabs(const QStringList& list) { QString left, active; if (d->activeTab > 0) active = d->tabs[ d->activeTab-1 ]; if (d->firstTab > 0 && d->firstTab <= d->tabs.size()) left = d->tabs[ d->firstTab-1 ]; d->tabs = list; if (!left.isNull()) { d->firstTab = d->tabs.indexOf(left) + 1; if (d->firstTab > (int)d->tabs.count()) d->firstTab = 1; if (d->firstTab <= 0) d->firstTab = 1; } d->activeTab = 0; if (!active.isNull()) setActiveTab(active); update(); }
bool Panel::load( DataSectionPtr section ) { lastX_ = section->readInt( "lastX", lastX_ ); lastY_ = section->readInt( "lastY", lastY_ ); isExpanded_ = section->readBool( "expanded", isExpanded_ ); expandedSize_ = section->readInt( "expandedSize", expandedSize_ ); isFloating_ = section->readBool( "floating", isFloating_ ); std::vector<DataSectionPtr> tabs; section->openSections( "Tab", tabs ); if ( tabs.empty() ) return false; activeTab_ = 0; TabPtr firstTab = 0; for( std::vector<DataSectionPtr>::iterator i = tabs.begin(); i != tabs.end(); ++i ) { std::string contentID = (*i)->readString( "contentID" ); if ( contentID.empty() ) continue; TabPtr newTab = new Tab( this, contentID ); if ( !newTab->getContent() ) continue; newTab->setVisible( (*i)->readBool( "visible", true ) ); // ignoring if loading a tab returns false newTab->load( *i ); addTab( newTab ); newTab->getCWnd()->ShowWindow( SW_HIDE ); if ( !firstTab && !!activeTab_ ) firstTab = activeTab_; } if ( firstTab ) setActiveTab( firstTab ); if ( activeTab_ ) { updateTabBar(); if ( isExpanded_ ) activeTab_->getCWnd()->ShowWindow( SW_SHOW ); else activeTab_->getCWnd()->ShowWindow( SW_HIDE ); } int w; int h; getPreferredSize( w, h ); SetWindowPos( 0, 0, 0, section->readInt( "lastWidth", w ), section->readInt( "lastHeight", h ), SWP_NOMOVE | SWP_NOZORDER ); return true; }
void Panel::doubleClickedTab( void* itemData, int x, int y ) { for( TabItr i = tabList_.begin(); i != tabList_.end(); ++i ) { if ( (*i).getObject() == itemData ) { setActiveTab( *i ); break; } } if ( activeTab_ ) { Manager::instance().dock()->toggleTabPos( this, activeTab_ ); setActiveTab( *tabList_.begin() ); } }
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 ); }
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 ); }
void MainWindowController::onSelectedTab(int t) { if (getTabAt(t)) { setActiveTab(getTabAt(t)); } //qDebug() << "selected tab " << t; }
void PmChart::closeTab() { int index = chartTabWidget->currentIndex(); chartTabWidget->removeTab(index); if (index > 0) index--; setActiveTab(index, false); enableUi(); }
void Panel::addTab( TabPtr tab ) { tab->getCWnd()->SetParent( this ); tabList_.push_back( tab ); if ( tab->isVisible() ) { tabBar_->insertItem( tab->getTabDisplayString(), tab->getIcon(), tab.getObject() ); setActiveTab( tab ); } }
//! Reads attributes of the element void CGUITabControl::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { Border = in->getAttributeAsBool("Border"); FillBackground = in->getAttributeAsBool("FillBackground"); ActiveTab = -1; IGUITabControl::deserializeAttributes(in,options); setActiveTab(in->getAttributeAsInt("ActiveTab")); }
//! Reads attributes of the element void CGUITabControl::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { Border = in->getAttributeAsBool("Border"); FillBackground = in->getAttributeAsBool("FillBackground"); ActiveTab = -1; setTabHeight(in->getAttributeAsInt("TabHeight")); IGUITabControl::deserializeAttributes(in,options); setActiveTab(in->getAttributeAsInt("ActiveTab")); setTabVerticalAlignment( static_cast<EGUI_ALIGNMENT>(in->getAttributeAsEnumeration("TabVerticalAlignment" , GUIAlignmentNames)) ); }
void presentation::UI::revertTabChange(UI::ActiveTab targetTab) { if(targetTab == UI::TabHeatSources) { tabWidgetMain->setCurrentIndex(UI::TabConfiguration); tabWidgetSub->setCurrentIndex(UI::TabHeatSources-tabMainCount); } else { tabWidgetMain->setCurrentIndex(UI::TabConfiguration); tabWidgetSub->setCurrentIndex(UI::TabThermalDiffusivities-tabMainCount); } setActiveTab(targetTab); }
PropertyTreeViewer::PropertyTreeViewer(const ProjectsLoaderPtr &_loader, const QString &_leftSideTreeId, int _mode, QWidget *parent) : QWidget(parent), m_ui(new Ui::PropertyTreeViewer), m_loader(_loader), m_mode(_mode), m_average(nullptr), m_add(nullptr), m_import(nullptr), m_serviceTabsCount(0), m_leftSideTreeId(_leftSideTreeId), m_treePropertyWidget(NULL), m_currentTab(0), m_factory(NULL), m_leftInfo(NULL) { Q_ASSERT(!_loader.isNull()); setAttribute(Qt::WA_DeleteOnClose); m_ui->setupUi(this); init(); showMaximized(); setMode(_mode); readRightSideVals(); if(m_ui->tabWidget->count() == m_serviceTabsCount) addTab(); // ---------------------- Q_ASSERT(m_values.size() > 0); m_treePropertyWidget->setValues(m_values[0]); m_currentTab = 0; setActiveTab(0); // ---------------------- m_treePropertyWidget->setResizeMode(QtTreePropertyBrowser::ResizeToContents); m_treePropertyWidget->update(); m_treePropertyWidget->setResizeMode(QtTreePropertyBrowser::Interactive); QFont font = m_treePropertyWidget->font(); font.setPointSize(12); m_treePropertyWidget->setFont(font); m_treePropertyWidget->setSplitterPosition(double(width()) / 0.5); connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabChanged(int))); connect(m_ui->normalise, SIGNAL(clicked(bool)), SLOT(normalise(bool))); setDefaultTabName(m_leftInfo->defaultRightSideTreeName()); }
void tabWidget::wheelEvent( QWheelEvent * _we ) { _we->accept(); int dir = ( _we->delta() < 0 ) ? 1 : -1; int tab = m_activeTab; while( tab > -1 && static_cast<int>( tab ) < m_widgets.count() ) { tab += dir; if( m_widgets.contains( tab ) ) { break; } } setActiveTab( tab ); }
// Activate tab when clicked void TabWidget::mousePressEvent( QMouseEvent * me ) { // Find index of tab that has been clicked QPoint pos = me->pos(); int idx = findTabAtPos( &pos ); // When found, activate tab that has been clicked if ( idx != -1 ) { setActiveTab( idx ); update(); return; } }
void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) { assert(y < _tabHeight); // Determine which tab was clicked int tabID = -1; if (x >= 0 && (x % _tabWidth) < _tabWidth) { tabID = x / _tabWidth; if (tabID >= (int)_tabs.size()) tabID = -1; } // If a tab was clicked, switch to that pane if (tabID >= 0 && tabID + _firstVisibleTab < (int)_tabs.size()) { setActiveTab(tabID + _firstVisibleTab); } }
bool CGUITabControl::selectTab(core::position2d<s32> p) { IGUISkin* skin = Environment->getSkin(); IGUIFont* font = skin->getFont(); core::rect<s32> frameRect(AbsoluteRect); if ( VerticalAlignment == EGUIA_UPPERLEFT ) { frameRect.UpperLeftCorner.Y += 2; frameRect.LowerRightCorner.Y = frameRect.UpperLeftCorner.Y + TabHeight; } else { frameRect.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y - TabHeight; } s32 pos = frameRect.UpperLeftCorner.X + 2; if (!frameRect.isPointInside(p)) return false; for (s32 i=CurrentScrollTabIndex; i<(s32)Tabs.size(); ++i) { // get Text const wchar_t* text = 0; if (Tabs[i]) text = Tabs[i]->getText(); // get text length s32 len = font->getDimension(text).Width + TabExtraWidth; frameRect.UpperLeftCorner.X = pos; frameRect.LowerRightCorner.X = frameRect.UpperLeftCorner.X + len; if ( ScrollControl && pos > AbsoluteRect.LowerRightCorner.X) return false; pos += len; if (frameRect.isPointInside(p)) { setActiveTab(i); return true; } } return false; }
void Panel::clickedTab( void* itemData, int x, int y ) { for( TabItr i = tabList_.begin(); i != tabList_.end(); ++i ) { if ( (*i).getObject() == itemData ) { setActiveTab( *i ); break; } } if ( activeTab_ ) { CRect rect; tabBar_->GetWindowRect( &rect ); Manager::instance().dragManager()->startDrag( rect.left + x, rect.top + y, this, activeTab_ ); } }
void TabWidget::adjustTabs(int value) { // Determine which tab is next int tabID = _activeTab + value; if (tabID >= (int)_tabs.size()) tabID = 0; else if (tabID < 0) tabID = ((int)_tabs.size() - 1); // Slides _firstVisibleTab forward to the correct tab int maxTabsOnScreen = (_w / _tabWidth); if (tabID >= maxTabsOnScreen && (_firstVisibleTab + maxTabsOnScreen) < (int)_tabs.size()) _firstVisibleTab++; // Slides _firstVisibleTab backwards to the correct tab while (tabID < _firstVisibleTab) _firstVisibleTab--; setActiveTab(tabID); }
void TabWidget::mousePressEvent( QMouseEvent * _me ) { if( _me->y() > 1 && _me->y() < 13 ) { int cx = ( ( m_caption == "" ) ? 4 : 14 ) + fontMetrics().width( m_caption ); for( widgetStack::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { if( _me->x() >= cx && _me->x() <= cx + ( *it ).nwidth ) { setActiveTab( it.key() ); update(); return; } cx += ( *it ).nwidth; } } }
// Switch between tabs with mouse wheel void TabWidget::wheelEvent( QWheelEvent * we ) { if( we->y() > m_tabheight ) { return; } we->accept(); int dir = ( we->delta() < 0 ) ? 1 : -1; int tab = m_activeTab; while( tab > -1 && static_cast<int>( tab ) < m_widgets.count() ) { tab += dir; if( m_widgets.contains( tab ) ) { break; } } setActiveTab( tab ); }
void TabBarPlus::exchangeTabItemData(int oldTab, int newTab) { //1. shift their data, and insert the source TCITEM itemData_nDraggedTab, itemData_shift; itemData_nDraggedTab.mask = itemData_shift.mask = TCIF_IMAGE | TCIF_TEXT | TCIF_PARAM; const int stringSize = 256; TCHAR str1[stringSize]; TCHAR str2[stringSize]; itemData_nDraggedTab.pszText = str1; itemData_nDraggedTab.cchTextMax = (stringSize); itemData_shift.pszText = str2; itemData_shift.cchTextMax = (stringSize); ::SendMessage(_hSelf, TCM_GETITEM, oldTab, reinterpret_cast<LPARAM>(&itemData_nDraggedTab)); if (oldTab > newTab) { for (int i = oldTab; i > newTab; i--) { ::SendMessage(_hSelf, TCM_GETITEM, i - 1, reinterpret_cast<LPARAM>(&itemData_shift)); ::SendMessage(_hSelf, TCM_SETITEM, i, reinterpret_cast<LPARAM>(&itemData_shift)); } } else { for (int i = oldTab; i < newTab; ++i) { ::SendMessage(_hSelf, TCM_GETITEM, i + 1, reinterpret_cast<LPARAM>(&itemData_shift)); ::SendMessage(_hSelf, TCM_SETITEM, i, reinterpret_cast<LPARAM>(&itemData_shift)); } } ::SendMessage(_hSelf, TCM_SETITEM, newTab, reinterpret_cast<LPARAM>(&itemData_nDraggedTab)); // Tell Notepad_plus to notifiy plugins that a D&D operation was done (so doc index has been changed) ::SendMessage(_hParent, NPPM_INTERNAL_DOCORDERCHANGED, 0, oldTab); //2. set to focus setActiveTab(newTab); }
void TabBar::tabClicked( int _id ) { if( m_exclusive == true && activeTab() == -1 ) { setActiveTab( _id ); } else { bool all_hidden_before = allHidden(); // disable tabbar-buttons except the one clicked hideAll( _id ); bool now_hidden = allHidden(); if( all_hidden_before == true && now_hidden == false ) { emit widgetShown(); } else if( all_hidden_before == false && now_hidden == true ) { emit allWidgetsHidden(); } } }
//! adds a tab which has been created elsewhere void CGUITabControl::addTab(CGUITab* tab) { if (!tab) return; // check if its already added for (u32 i=0; i < Tabs.size(); ++i) { if (Tabs[i] == tab) return; } tab->grab(); if (tab->getNumber() == -1) tab->setNumber((s32)Tabs.size()); while (tab->getNumber() >= (s32)Tabs.size()) Tabs.push_back(0); if (Tabs[tab->getNumber()]) { Tabs.push_back(Tabs[tab->getNumber()]); Tabs[Tabs.size()-1]->setNumber(Tabs.size()); } Tabs[tab->getNumber()] = tab; if (ActiveTab == -1) ActiveTab = tab->getNumber(); if (tab->getNumber() == ActiveTab) { setActiveTab(ActiveTab); } }