Eneboo - Documentación para desarrolladores
src/qt/src/widgets/qtabbar.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qtabbar.h   3.3.8   edited Jan 11 14:39 $
00003 **
00004 ** Definition of QTab and QTabBar classes
00005 **
00006 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00007 **
00008 ** This file is part of the widgets module of the Qt GUI Toolkit.
00009 **
00010 ** This file may be distributed under the terms of the Q Public License
00011 ** as defined by Trolltech ASA of Norway and appearing in the file
00012 ** LICENSE.QPL included in the packaging of this file.
00013 **
00014 ** This file may be distributed and/or modified under the terms of the
00015 ** GNU General Public License version 2 as published by the Free Software
00016 ** Foundation and appearing in the file LICENSE.GPL included in the
00017 ** packaging of this file.
00018 **
00019 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00020 ** licenses may use this file in accordance with the Qt Commercial License
00021 ** Agreement provided with the Software.
00022 **
00023 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00024 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00025 **
00026 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00027 **   information about Qt Commercial License Agreements.
00028 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00029 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00030 **
00031 ** Contact info@trolltech.com if any conditions of this licensing are
00032 ** not clear to you.
00033 **
00034 **********************************************************************/
00035 
00036 #ifndef QTABBAR_H
00037 #define QTABBAR_H
00038 
00039 #ifndef QT_H
00040 #include "qwidget.h"
00041 #include "qptrlist.h"
00042 #endif // QT_H
00043 
00044 #ifndef QT_NO_TABBAR
00045 
00046 class QTabBar;
00047 class QIconSet;
00048 
00049 class Q_EXPORT QTab : public Qt
00050 {
00051     friend class QTabBar;
00052     friend class QTabWidget;
00053 
00054 public:
00055     QTab();
00056     virtual ~QTab();
00057     QTab( const QString& text );
00058     QTab( const QIconSet& icon, const QString& text = QString::null );
00059 
00060     void setText( const QString& text);
00061     QString text() const { return label; }
00062     void setIconSet( const QIconSet& icon );
00063     QIconSet* iconSet() const { return iconset; }
00064     void setRect( const QRect& rect ) { r = rect; }
00065     QRect rect() const { return r; }
00066     void setEnabled( bool enable ) { enabled = enable; }
00067     bool isEnabled() const { return enabled; }
00068     void setIdentifier( int i ) { id = i; }
00069     int identifier() const { return id; }
00070 
00071 private:
00072     void setTabBar( QTabBar *tb );
00073     QString label;
00074     QRect r; // the bounding rectangle of this (may overlap with others)
00075     bool enabled;
00076     int id;
00077     QIconSet* iconset; // optional iconset
00078     QTabBar *tb;
00079 };
00080 
00081 
00082 struct QTabPrivate;
00083 //class *QAccel;
00084 
00085 class Q_EXPORT QTabBar: public QWidget
00086 {
00087     Q_OBJECT
00088     Q_ENUMS( Shape )
00089     Q_PROPERTY( Shape shape READ shape WRITE setShape )
00090     Q_PROPERTY( int currentTab READ currentTab WRITE setCurrentTab )
00091     Q_PROPERTY( int count READ count )
00092     Q_PROPERTY( int keyboardFocusTab READ keyboardFocusTab )
00093 
00094 public:
00095     QTabBar( QWidget* parent=0, const char* name=0 );
00096     ~QTabBar();
00097 
00098     enum Shape { RoundedAbove, RoundedBelow,
00099                  TriangularAbove, TriangularBelow };
00100 
00101     Shape shape() const;
00102     virtual void setShape( Shape );
00103 
00104     void show();
00105 
00106     virtual int addTab( QTab * );
00107     virtual int insertTab( QTab *, int index = -1 );
00108     virtual void removeTab( QTab * );
00109 
00110     virtual void setTabEnabled( int, bool );
00111     bool isTabEnabled( int ) const;
00112 
00113 
00114     QSize sizeHint() const;
00115     QSize minimumSizeHint() const;
00116 
00117     int currentTab() const;
00118     int keyboardFocusTab() const;
00119 
00120     QTab * tab( int ) const;
00121     QTab * tabAt( int ) const;
00122     int indexOf( int ) const;
00123     int count() const;
00124 
00125     virtual void layoutTabs();
00126     virtual QTab * selectTab( const QPoint & p ) const;
00127 
00128     void        removeToolTip( int index );
00129     void        setToolTip( int index, const QString & tip );
00130     QString     toolTip( int index ) const;
00131 
00132 public slots:
00133     virtual void setCurrentTab( int );
00134     virtual void setCurrentTab( QTab * );
00135 
00136 signals:
00137     void selected( int );
00138     void layoutChanged();
00139 
00140 protected:
00141     virtual void paint( QPainter *, QTab *, bool ) const; // ### not const
00142     virtual void paintLabel( QPainter*, const QRect&, QTab*, bool ) const;
00143 
00144     void focusInEvent( QFocusEvent *e );
00145     void focusOutEvent( QFocusEvent *e );
00146 
00147     void resizeEvent( QResizeEvent * );
00148     void paintEvent( QPaintEvent * );
00149     void mousePressEvent ( QMouseEvent * );
00150     void mouseMoveEvent ( QMouseEvent * );
00151     void mouseReleaseEvent ( QMouseEvent * );
00152     void keyPressEvent( QKeyEvent * );
00153     void styleChange( QStyle& );
00154     void fontChange ( const QFont & );
00155 
00156     bool event( QEvent *e );
00157     
00158     QPtrList<QTab> * tabList();
00159 
00160 private slots:
00161     void scrollTabs();
00162 
00163 private:
00164     QPtrList<QTab> * l;
00165     QPtrList<QTab> * lstatic;
00166     void makeVisible( QTab* t = 0 );
00167     void updateArrowButtons();
00168     QTabPrivate * d;
00169 
00170     friend class QTabBarToolTip;
00171     friend class QTab;
00172 
00173 private:        // Disabled copy constructor and operator=
00174 #if defined(Q_DISABLE_COPY)
00175     QTabBar( const QTabBar & );
00176     QTabBar& operator=( const QTabBar & );
00177 #endif
00178 };
00179 
00180 
00181 #endif // QT_NO_TABBAR
00182 
00183 #endif // QTABBAR_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'