kdeui Library API Documentation

ktabbar.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 KTABBAR_H
00022 #define KTABBAR_H
00023 
00024 #include <qtabbar.h>
00025 
00026 class QTimer;
00027 class QPushButton;
00028 class KTabBarPrivate;
00029 
00033 class KTabBar: public QTabBar
00034 {
00035     Q_OBJECT
00036 
00037 public:
00038     KTabBar( QWidget* parent=0, const char* name=0 );
00039     virtual ~KTabBar();
00040 
00041     virtual void setTabEnabled( int, bool );
00042 
00043     const QColor &tabColor( int ) const;
00044     void setTabColor( int, const QColor& );
00045 
00046     virtual int insertTab( QTab *, int index = -1 );
00047     virtual void removeTab( QTab * );
00048 
00049     void setTabReorderingEnabled( bool enable );
00050     bool isTabReorderingEnabled() const;
00051 
00052     void setHoverCloseButton( bool );
00053     bool hoverCloseButton() const;
00054 
00055     void setHoverCloseButtonDelayed( bool );
00056     bool hoverCloseButtonDelayed() const;
00057 
00058     void setTabCloseActivatePrevious( bool );
00059     bool tabCloseActivatePrevious() const;
00060 
00061 signals:
00062     void contextMenu( int, const QPoint & );
00063     void mouseDoubleClick( int );
00064     void mouseMiddleClick( int );
00065     void initiateDrag( int );
00066     void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */);
00067     void receivedDropEvent( int, QDropEvent * );
00068     void moveTab( int, int );
00069     void closeRequest( int );
00070 #ifndef QT_NO_WHEELEVENT
00071     void wheelDelta( int );
00072 #endif
00073 
00074 protected:
00075     virtual void mouseDoubleClickEvent( QMouseEvent *e );
00076     virtual void mousePressEvent( QMouseEvent *e );
00077     virtual void mouseMoveEvent( QMouseEvent *e );
00078     virtual void mouseReleaseEvent( QMouseEvent *e );
00079 #ifndef QT_NO_WHEELEVENT
00080     virtual void wheelEvent( QWheelEvent *e );
00081 #endif
00082 
00083     virtual void dragMoveEvent( QDragMoveEvent *e );
00084     virtual void dropEvent( QDropEvent *e );
00085 
00086     virtual void paintLabel( QPainter*, const QRect&, QTab*, bool ) const;
00087 
00088 protected slots:
00089     virtual void closeButtonClicked();
00090     virtual void onLayoutChange();
00091     virtual void enableCloseButton();
00092     virtual void activateDragSwitchTab();
00093 
00094 private:
00095     QPoint mDragStart;
00096     int mReorderStartTab;
00097     int mReorderPreviousTab;
00098     QMap<int, QColor> mTabColors;
00099     QTab *mHoverCloseButtonTab, *mDragSwitchTab;
00100     QPushButton *mHoverCloseButton;
00101     QTimer *mEnableCloseButtonTimer, *mActivateDragSwitchTabTimer;
00102 
00103     bool mHoverCloseButtonEnabled;
00104     bool mHoverCloseButtonDelayed;
00105     bool mTabReorderingEnabled;
00106     bool mTabCloseActivatePrevious;
00107 
00108     KTabBarPrivate * d;
00109 };
00110 
00111 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 23 17:11:55 2004 by doxygen 1.3.8-20040913 written by Dimitri van Heesch, © 1997-2003