lib

KoTabBar.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Ariya Hidayat <ariya@kde.org>
00003    Copyright (C) 2003 Norbert Andres <nandres@web.de>
00004    Copyright (C) 2002 Laurent Montel <montel@kde.org>
00005    Copyright (C) 1999 David Faure <faure@kde.org>
00006    Copyright (C) 1999 Boris Wedl <boris.wedl@kfunigraz.ac.at>
00007    Copyright (C) 1998-2000 Torben Weis <weis@kde.org>
00008 
00009    This library is free software; you can redistribute it and/or
00010    modify it under the terms of the GNU Library General Public
00011    License as published by the Free Software Foundation; either
00012    version 2 of the License, or (at your option) any later version.
00013 
00014    This library is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017    Library General Public License for more details.
00018 
00019    You should have received a copy of the GNU Library General Public License
00020    along with this library; see the file COPYING.LIB.  If not, write to
00021    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00022  * Boston, MA 02110-1301, USA.
00023 */
00024 
00025 #ifndef kotabbar_h
00026 #define kotabbar_h
00027 
00028 #include <qwidget.h>
00029 #include <qstringlist.h>
00030 #include <koffice_export.h>
00031 class KoTabBarPrivate;
00032 
00061 class KOFFICEUI_EXPORT KoTabBar : public QWidget
00062 {
00063     Q_OBJECT
00064     
00065     Q_PROPERTY( QString activeTab READ activeTab WRITE setActiveTab )
00066     Q_PROPERTY( bool readOnly READ readOnly WRITE setReadOnly )
00067     Q_PROPERTY( QStringList tabs READ tabs WRITE setTabs )
00068     Q_PROPERTY( unsigned count READ count )
00069     
00070 public:
00071 
00075     KoTabBar( QWidget* parent = 0, const char *name = 0 );
00076 
00080     virtual ~KoTabBar();
00081 
00085     bool readOnly() const;
00086     
00091     bool reverseLayout() const;
00092     
00096     QStringList tabs() const;
00097 
00102     unsigned count() const;
00103 
00107     QString activeTab() const;
00108 
00114     bool canScrollBack() const;
00115 
00121     bool canScrollForward() const;
00122 
00126     void ensureVisible( const QString& tab );
00127 
00128 public slots:
00129 
00133     void setTabs( const QStringList& list );
00134 
00142     void setReadOnly( bool ro );
00143 
00148     void setReverseLayout( bool reverse );
00149 
00153     void addTab( const QString& text );
00154 
00160     void removeTab( const QString& text );
00161 
00165     void renameTab( const QString& old_name, const QString& new_name );
00166     
00177     void moveTab( unsigned tab, unsigned target );
00178 
00185     void scrollBack();
00186 
00193     void scrollForward();
00194 
00201     void scrollFirst();
00202 
00209     void scrollLast();
00210 
00214     void setActiveTab( const QString& text );
00215 
00219     void clear();
00220     
00221     QSize sizeHint() const;
00222 
00223 signals:
00224 
00228     void tabChanged( const QString& _text );
00229 
00240     void tabMoved( unsigned tab, unsigned target );
00241 
00246     void contextMenu( const QPoint& pos );
00247 
00251     void doubleClicked();
00252 
00253 protected slots:
00254     void autoScrollBack();
00255     void autoScrollForward();
00256 
00257 protected:
00258     virtual void paintEvent ( QPaintEvent* ev );
00259     virtual void resizeEvent( QResizeEvent* ev );
00260     virtual void mousePressEvent ( QMouseEvent* ev );
00261     virtual void mouseReleaseEvent ( QMouseEvent* ev );
00262     virtual void mouseDoubleClickEvent ( QMouseEvent* ev );
00263     virtual void mouseMoveEvent ( QMouseEvent* ev );
00264     virtual void wheelEvent ( QWheelEvent * e );
00265 
00266 private:
00267     KoTabBarPrivate *d;
00268 
00269     // don't allow copy or assignment
00270     KoTabBar( const KoTabBar& );
00271     KoTabBar& operator=( const KoTabBar& );
00272 };
00273 
00274 
00275 #endif // kotabbar_h
KDE Home | KDE Accessibility Home | Description of Access Keys