kdeui Library API Documentation

ktabwidget.h

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2003 Stephan Binner <binner@kde.org>
00003     Copyright (C) 2003 Zack Rusin <zack@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef KTABWIDGET_H
00022 #define KTABWIDGET_H
00023 
00024 #include <qtabwidget.h>
00025 #include <qstringlist.h>
00026 
00027 #include <kdelibs_export.h>
00028 
00029 class KTabWidgetPrivate;
00030 
00036 class KDEUI_EXPORT KTabWidget : public QTabWidget
00037 {
00038     Q_OBJECT
00039     Q_PROPERTY( bool tabReorderingEnabled READ isTabReorderingEnabled WRITE setTabReorderingEnabled )
00040     Q_PROPERTY( bool hoverCloseButton READ hoverCloseButton WRITE setHoverCloseButton )
00041     Q_PROPERTY( bool hoverCloseButtonDelayed READ hoverCloseButtonDelayed WRITE setHoverCloseButtonDelayed )
00042     Q_PROPERTY( bool tabCloseActivatePrevious READ tabCloseActivatePrevious WRITE setTabCloseActivatePrevious )
00043     Q_PROPERTY( bool automaticResizeTabs READ automaticResizeTabs WRITE setAutomaticResizeTabs )
00044 
00045 public:
00046     KTabWidget( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
00050     virtual ~KTabWidget();
00054     void setTabColor( QWidget *, const QColor& color );
00055     QColor tabColor( QWidget * ) const;
00056 
00061     bool isTabReorderingEnabled() const;
00062 
00067     bool hoverCloseButton() const;
00068 
00073     bool hoverCloseButtonDelayed() const;
00074 
00080     bool tabCloseActivatePrevious() const;
00081 
00087     bool automaticResizeTabs() const;
00088 
00094     void setTabBarHidden( bool hide );
00095 
00100     bool isTabBarHidden() const;
00101 
00105     virtual void insertTab( QWidget *, const QString &, int index = -1 );
00106 
00110     virtual void insertTab( QWidget *child, const QIconSet& iconset,
00111                             const QString &label, int index = -1 );
00115     virtual void insertTab( QWidget *, QTab *, int index = -1 );
00116 
00120     void changeTab( QWidget *, const QString & );
00121 
00125     void changeTab( QWidget *child, const QIconSet& iconset, const QString &label );
00126 
00130     QString label( int ) const;
00131 
00135     QString tabLabel( QWidget * ) const;
00136 
00140     void setTabLabel( QWidget *, const QString & );
00141 
00142 public slots:
00147     virtual void moveTab( int, int );
00148 
00153     virtual void removePage ( QWidget * w );
00154 
00164     void setTabReorderingEnabled( bool enable );
00165 
00171     void setHoverCloseButton( bool enable );
00172 
00177     void setHoverCloseButtonDelayed( bool delayed );
00178 
00184     void setTabCloseActivatePrevious( bool previous );
00185 
00193     void setAutomaticResizeTabs( bool enable );
00194 
00195 signals:
00199     void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */);
00200 
00205     void receivedDropEvent( QDropEvent * );
00206 
00211     void receivedDropEvent( QWidget *, QDropEvent * );
00212 
00216     void initiateDrag( QWidget * );
00217 
00221     void contextMenu( const QPoint & );
00222 
00226     void contextMenu( QWidget *, const QPoint & );
00227 
00232     void movedTab( int, int );
00233 
00238     void mouseDoubleClick();
00239 
00243     void mouseDoubleClick( QWidget * );
00244 
00248     void mouseMiddleClick();
00249 
00253     void mouseMiddleClick( QWidget * );
00254 
00259     void closeRequest( QWidget * );
00260 
00261 protected:
00262     virtual void mouseDoubleClickEvent( QMouseEvent *e );
00263     virtual void mousePressEvent( QMouseEvent * );
00264     virtual void dragMoveEvent( QDragMoveEvent * );
00265     virtual void dropEvent( QDropEvent * );
00266     unsigned int tabBarWidthForMaxChars( uint maxLength );
00267 #ifndef QT_NO_WHEELEVENT
00268     virtual void wheelEvent( QWheelEvent *e );
00269 #endif
00270     virtual void resizeEvent( QResizeEvent * );
00271 
00272 protected slots:
00273     virtual void receivedDropEvent( int, QDropEvent * );
00274     virtual void initiateDrag( int );
00275     virtual void contextMenu( int, const QPoint & );
00276     virtual void mouseDoubleClick( int );
00277     virtual void mouseMiddleClick( int );
00278     virtual void closeRequest( int );
00279 #ifndef QT_NO_WHEELEVENT
00280     virtual void wheelDelta( int );
00281 #endif
00282 
00283 private:
00284     bool isEmptyTabbarSpace( const QPoint & )  const;
00285     void resizeTabs( int changedTabIndex = -1 );
00286     void updateTab( int index );
00287 
00288     KTabWidgetPrivate *d;
00289 };
00290 
00291 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 9 07:56:06 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003