PageTabBar::PageTabBar(const QRectF& pageTabBarGeometry,LauncherObject * p_belongsTo) : ThingPaintable(pageTabBarGeometry) , m_maxTabWidth(150) , m_interactionsBlocked(false) , m_qp_currentUIOwner(p_belongsTo) , m_qp_backgroundPmo(0) , m_qp_backgroundShadowPmo(0) { resetTabSpaces(); if (m_qp_currentUIOwner) this->setParentItem(m_qp_currentUIOwner); grabGesture((Qt::GestureType) SysMgrGestureFlick); m_backgroundGeom = m_geom; m_backgroundShadowGeom = m_geom; }
//virtual bool PageTabBar::resize(const QSize& s) { m_geom = DimensionsGlobal::realRectAroundRealPoint(QSizeF(s)); m_boundingRect = m_geom.adjusted(-0.5,-0.5,0.5,0.5); m_backgroundGeom = m_geom; m_backgroundShadowGeom = m_geom.adjusted(0.0,0.0, 0.0,2.0); if (m_qp_backgroundPmo) { m_qp_backgroundPmo->resize(m_backgroundGeom.size().toSize()); } if (m_qp_backgroundShadowPmo) { m_qp_backgroundShadowPmo->resize(m_backgroundShadowGeom.size().toSize()); } if (m_pageTabs.size() == 0) return true; //nothing to do resetTabSpaces(); QSizeF tabMaxSize = QSizeF(newTabMaxSize()); //TODO: TEMP - equal sized tabs, all left compressed (aligned left, no space between) for (PageTabConstIterator it = m_pageTabs.constBegin(); it != m_pageTabs.constEnd();++it) { if (!(*it)) { continue; } (*it)->resize(tabMaxSize.toSize()); } relayoutExistingTabs(); //WARN: this should be the greatest of m_geom, m_backgroundShadowGeom, and m_backgroundGeom ThingPaintable::recomputeBoundingRect(m_backgroundShadowGeom); update(); return true; }
//virtual void PageTabBar::relayoutExistingTabs(const qreal toWidth,const qreal toHeight) { if (m_pageTabs.size() == 0) return; //nothing to do resetTabSpaces(); for (PageTabConstIterator it = m_pageTabs.constBegin(); it != m_pageTabs.constEnd();++it) { if (!(*it)) { continue; } //get the unused tab space rect in terms of the actual screen position (*it)->setPos(m_unusedTabSpace.topLeft()-(*it)->geometry().topLeft()); // //adjust the unused space and the used space - THE TWO REGIONS MUST BE CONTIGUOUS (FLUSH AGAINST EACH OTHER)! m_usedTabSpace.adjust(0.0, 0.0, (*it)->geometry().width(), 0.0 ); recalculateUnusedSpace(); } }