home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / ktabbar.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.2 KB  |  114 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 2003 Stephan Binner <binner@kde.org>
  3.     Copyright (C) 2003 Zack Rusin <zack@kde.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifndef KTABBAR_H
  22. #define KTABBAR_H
  23.  
  24. #include <qtabbar.h>
  25.  
  26. #include <kdelibs_export.h>
  27.  
  28. class QTimer;
  29. class QPushButton;
  30. class KTabBarPrivate;
  31.  
  32. /**
  33.  * @since 3.2
  34.  */
  35. class KDEUI_EXPORT KTabBar: public QTabBar
  36. {
  37.     Q_OBJECT
  38.  
  39. public:
  40.     KTabBar( QWidget* parent=0, const char* name=0 );
  41.     virtual ~KTabBar();
  42.  
  43.     virtual void setTabEnabled( int, bool );
  44.  
  45.     const QColor &tabColor( int ) const;
  46.     void setTabColor( int, const QColor& );
  47.  
  48.     virtual int insertTab( QTab *, int index = -1 );
  49.     virtual void removeTab( QTab * );
  50.  
  51.     void setTabReorderingEnabled( bool enable );
  52.     bool isTabReorderingEnabled() const;
  53.  
  54.     void setHoverCloseButton( bool );
  55.     bool hoverCloseButton() const;
  56.  
  57.     void setHoverCloseButtonDelayed( bool );
  58.     bool hoverCloseButtonDelayed() const;
  59.  
  60.     void setTabCloseActivatePrevious( bool );
  61.     bool tabCloseActivatePrevious() const;
  62.  
  63. signals:
  64.     void contextMenu( int, const QPoint & );
  65.     void mouseDoubleClick( int );
  66.     void mouseMiddleClick( int );
  67.     void initiateDrag( int );
  68.     void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */);
  69.     void receivedDropEvent( int, QDropEvent * );
  70.     void moveTab( int, int );
  71.     void closeRequest( int );
  72. #ifndef QT_NO_WHEELEVENT
  73.     void wheelDelta( int );
  74. #endif
  75.  
  76. protected:
  77.     virtual void mouseDoubleClickEvent( QMouseEvent *e );
  78.     virtual void mousePressEvent( QMouseEvent *e );
  79.     virtual void mouseMoveEvent( QMouseEvent *e );
  80.     virtual void mouseReleaseEvent( QMouseEvent *e );
  81. #ifndef QT_NO_WHEELEVENT
  82.     virtual void wheelEvent( QWheelEvent *e );
  83. #endif
  84.  
  85.     virtual void dragMoveEvent( QDragMoveEvent *e );
  86.     virtual void dropEvent( QDropEvent *e );
  87.  
  88.     virtual void paintLabel( QPainter*, const QRect&, QTab*, bool ) const;
  89.  
  90. protected slots:
  91.     virtual void closeButtonClicked();
  92.     virtual void onLayoutChange();
  93.     virtual void enableCloseButton();
  94.     virtual void activateDragSwitchTab();
  95.  
  96. private:
  97.     QPoint mDragStart;
  98.     int mReorderStartTab;
  99.     int mReorderPreviousTab;
  100.     QMap<int, QColor> mTabColors;
  101.     QTab *mHoverCloseButtonTab, *mDragSwitchTab;
  102.     QPushButton *mHoverCloseButton;
  103.     QTimer *mEnableCloseButtonTimer, *mActivateDragSwitchTabTimer;
  104.  
  105.     bool mHoverCloseButtonEnabled;
  106.     bool mHoverCloseButtonDelayed;
  107.     bool mTabReorderingEnabled;
  108.     bool mTabCloseActivatePrevious;
  109.  
  110.     KTabBarPrivate * d;
  111. };
  112.  
  113. #endif
  114.