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     virtual void removeTab( QTab * );
00046 
00047     void setTabReorderingEnabled( bool enable );
00048     bool isTabReorderingEnabled() const;
00049 
00050     void setHoverCloseButton( bool );
00051     bool hoverCloseButton() const;
00052 
00053     void setHoverCloseButtonDelayed( bool );
00054     bool hoverCloseButtonDelayed() const;
00055 
00056 signals:
00057     void contextMenu( int, const QPoint & );
00058     void mouseDoubleClick( int );
00059     void mouseMiddleClick( int );
00060     void initiateDrag( int );
00061     void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */);
00062     void receivedDropEvent( int, QDropEvent * );
00063     void moveTab( int, int );
00064     void closeRequest( int );
00065 
00066 protected:
00067     virtual void mouseDoubleClickEvent( QMouseEvent *e );
00068     virtual void mousePressEvent( QMouseEvent *e );
00069     virtual void mouseMoveEvent( QMouseEvent *e );
00070     virtual void mouseReleaseEvent( QMouseEvent *e );
00071 
00072     virtual void dragMoveEvent( QDragMoveEvent *e );
00073     virtual void dropEvent( QDropEvent *e );
00074 
00075     virtual void paintLabel( QPainter*, const QRect&, QTab*, bool ) const;
00076 
00077 protected slots:
00078     virtual void closeButtonClicked();
00079     virtual void onLayoutChange();
00080     virtual void enableCloseButton();
00081     virtual void activateDragSwitchTab();
00082 
00083 private:
00084     QPoint mDragStart;
00085     int mReorderStartTab;
00086     int mReorderPreviousTab;
00087     QMap<int, QColor> mTabColors;
00088     QTab *mHoverCloseButtonTab, *mDragSwitchTab;
00089     QPushButton *mHoverCloseButton;
00090     QTimer *mEnableCloseButtonTimer, *mActivateDragSwitchTabTimer;
00091 
00092     bool mHoverCloseButtonEnabled;
00093     bool mHoverCloseButtonDelayed;
00094     bool mTabReorderingEnabled;
00095 
00096     KTabBarPrivate * d;
00097 };
00098 
00099 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 3 19:23:13 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003