Changeset 68480 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 21, 2017 9:31:21 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp
r68304 r68480 81 81 public: 82 82 83 /** Position styles. */ 84 enum PositionStyle { PositionStyle_Left, PositionStyle_Middle, PositionStyle_Right, PositionStyle_Single }; 85 83 86 /** Holds the mime-type for the D&D system. */ 84 87 static const QString MimeType; … … 93 96 /** Returns item name. */ 94 97 const QString name() const { return m_strName; } 98 99 /** Defines the item @a enmPositionStyle. */ 100 void setPositionStyle(PositionStyle enmPositionStyle); 95 101 96 102 /** Marks item @a fCurrent. */ … … 130 136 QString m_strName; 131 137 138 /** Holds the item position style. */ 139 PositionStyle m_enmPosition; 140 132 141 /** Holds whether the item is current. */ 133 142 bool m_fCurrent; … … 165 174 , m_icon(icon) 166 175 , m_strName(strName) 176 , m_enmPosition(PositionStyle_Single) 167 177 , m_fCurrent(false) 168 178 , m_fHovered(false) … … 177 187 /* Prepare: */ 178 188 prepare(); 189 } 190 191 void UITabBarItem::setPositionStyle(PositionStyle enmPosition) 192 { 193 /* Remember the position: */ 194 m_enmPosition = enmPosition; 195 196 /* And call for repaint: */ 197 update(); 179 198 } 180 199 … … 475 494 m_pLayoutTab->insertWidget(0, pItem); 476 495 m_aItems.prepend(pItem); 496 /* Update children styles: */ 497 updateChildrenStyles(); 477 498 /* Return unique ID: */ 478 499 return uuid; … … 514 535 sltHandleMakeChildCurrent(m_aItems.first()); 515 536 } 537 538 /* Update children styles: */ 539 updateChildrenStyles(); 516 540 517 541 /* Return result: */ … … 687 711 m_aItems.insert(iPosition, pItemDropped); 688 712 m_pLayoutTab->insertWidget(iPosition, pItemDropped); 713 714 /* Update children styles: */ 715 updateChildrenStyles(); 689 716 } 690 717 … … 756 783 } 757 784 785 void UITabBar::updateChildrenStyles() 786 { 787 /* Single child has corresponding (rounded) style: */ 788 if (m_aItems.size() == 1) 789 m_aItems.first()->setPositionStyle(UITabBarItem::PositionStyle_Single); 790 /* If there are more than one child: */ 791 else if (m_aItems.size() > 1) 792 { 793 /* First make all children have no rounded sides: */ 794 foreach (UITabBarItem *pItem, m_aItems) 795 pItem->setPositionStyle(UITabBarItem::PositionStyle_Middle); 796 /* Then make first child rounded left, while last rounded right: */ 797 m_aItems.first()->setPositionStyle(UITabBarItem::PositionStyle_Left); 798 m_aItems.last()->setPositionStyle(UITabBarItem::PositionStyle_Right); 799 } 800 /* Repaint: */ 801 update(); 802 } 803 758 804 #include "UITabBar.moc" 759 805 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.h
r68304 r68480 100 100 void prepare(); 101 101 102 /** Updates children styles. */ 103 void updateChildrenStyles(); 104 102 105 /** @name Contents: Widgets 103 106 * @{ */
Note:
See TracChangeset
for help on using the changeset viewer.