1 /**************************************************************************** 2 ** $Id: qt/qtabwidget.h 3.3.8 edited Jan 11 14:39 $ 3 ** 4 ** Definition of QTabWidget class 5 ** 6 ** Created : 990318 7 ** 8 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 9 ** 10 ** This file is part of the widgets module of the Qt GUI Toolkit. 11 ** 12 ** This file may be distributed under the terms of the Q Public License 13 ** as defined by Trolltech ASA of Norway and appearing in the file 14 ** LICENSE.QPL included in the packaging of this file. 15 ** 16 ** This file may be distributed and/or modified under the terms of the 17 ** GNU General Public License version 2 as published by the Free Software 18 ** Foundation and appearing in the file LICENSE.GPL included in the 19 ** packaging of this file. 20 ** 21 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 22 ** licenses may use this file in accordance with the Qt Commercial License 23 ** Agreement provided with the Software. 24 ** 25 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 26 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 27 ** 28 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 29 ** information about Qt Commercial License Agreements. 30 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 31 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 32 ** 33 ** Contact info@trolltech.com if any conditions of this licensing are 34 ** not clear to you. 35 ** 36 **********************************************************************/ 37 38 #ifndef QTABWIDGET_H 39 #define QTABWIDGET_H 40 41 #ifndef QT_H 42 #include "qwidget.h" 43 #include "qiconset.h" 44 #endif // QT_H 45 46 #ifndef QT_NO_TABWIDGET 47 48 class QTabBar; 49 class QTabWidgetData; 50 class QTab; 51 class QWidgetStack; 52 53 54 class Q_EXPORT QTabWidget : public QWidget 55 { 56 Q_OBJECT 57 Q_ENUMS( TabPosition ) 58 Q_ENUMS( TabShape ) 59 Q_PROPERTY( TabPosition tabPosition READ tabPosition WRITE setTabPosition ) 60 Q_PROPERTY( TabShape tabShape READ tabShape WRITE setTabShape ) 61 Q_PROPERTY( int margin READ margin WRITE setMargin ) 62 Q_PROPERTY( int currentPage READ currentPageIndex WRITE setCurrentPage ) 63 Q_PROPERTY( int count READ count ) 64 Q_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) 65 66 public: 67 QTabWidget( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 68 ~QTabWidget(); 69 70 virtual void addTab( QWidget *, const QString & ); // ### make these inline in 4.0 71 virtual void addTab( QWidget *child, const QIconSet& iconset, 72 const QString &label ); 73 virtual void addTab( QWidget *, QTab* ); 74 75 virtual void insertTab( QWidget *, const QString &, int index = -1 ); 76 virtual void insertTab( QWidget *child, const QIconSet& iconset, 77 const QString &label, int index = -1 ); 78 virtual void insertTab( QWidget *, QTab*, int index = -1 ); 79 80 void changeTab( QWidget *, const QString &); 81 void changeTab( QWidget *child, const QIconSet& iconset, 82 const QString &label ); 83 84 bool isTabEnabled( QWidget * ) const; 85 void setTabEnabled( QWidget *, bool ); 86 87 void setCornerWidget( QWidget * w, Qt::Corner corner = Qt::TopRight ); 88 QWidget * cornerWidget( Qt::Corner corner = Qt::TopRight ) const; 89 90 QString tabLabel( QWidget * ) const; 91 void setTabLabel( QWidget *p, const QString &l ); 92 93 QIconSet tabIconSet( QWidget * w ) const; 94 void setTabIconSet( QWidget * w, const QIconSet & iconset ); 95 96 void removeTabToolTip( QWidget * w ); 97 void setTabToolTip( QWidget * w, const QString & tip ); 98 QString tabToolTip( QWidget * w ) const; 99 100 QWidget * currentPage() const; 101 QWidget *page( int ) const; 102 QString label( int ) const; 103 int currentPageIndex() const; 104 int indexOf( QWidget * ) const; 105 106 QSize sizeHint() const; 107 QSize minimumSizeHint() const; 108 109 enum TabPosition { Top, Bottom }; 110 TabPosition tabPosition() const; 111 void setTabPosition( TabPosition ); 112 113 enum TabShape { Rounded, Triangular }; 114 TabShape tabShape() const; 115 void setTabShape( TabShape s ); 116 117 int margin() const; 118 void setMargin( int ); 119 120 int count() const; 121 122 public slots: 123 void setCurrentPage( int ); 124 virtual void showPage( QWidget * ); 125 virtual void removePage( QWidget * ); 126 127 protected: 128 void showEvent( QShowEvent * ); 129 void resizeEvent( QResizeEvent * ); 130 void setTabBar( QTabBar * ); 131 QTabBar* tabBar() const; 132 void styleChange( QStyle& ); 133 void updateMask(); 134 bool eventFilter( QObject *, QEvent * ); 135 136 signals: 137 void currentChanged( QWidget * ); 138 #ifndef Q_QDOC 139 void selected( const QString& ); 140 #endif 141 142 private slots: 143 void showTab( int ); 144 145 private: 146 QTabWidgetData *d; 147 void setUpLayout( bool = FALSE ); 148 friend class QTabDialog; 149 150 private: // Disabled copy constructor and operator= 151 #if defined(Q_DISABLE_COPY) 152 QTabWidget( const QTabWidget & ); 153 QTabWidget& operator=( const QTabWidget & ); 154 #endif 155 }; 156 157 #endif // QT_NO_TABWIDGET 158 159 #endif // QTABWIDGET_H 160