KoTabBar.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Ariya Hidayat <ariya@kde.org>
3 Copyright (C) 2003 Norbert Andres <nandres@web.de>
4 Copyright (C) 2002 Laurent Montel <montel@kde.org>
5 Copyright (C) 1999 David Faure <faure@kde.org>
6 Copyright (C) 1999 Boris Wedl <boris.wedl@kfunigraz.ac.at>
7 Copyright (C) 1998-2000 Torben Weis <weis@kde.org>
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#ifndef kotabbar_h
26#define kotabbar_h
27
28#include <tqwidget.h>
29#include <tqstringlist.h>
30#include <koffice_export.h>
31class KoTabBarPrivate;
32
61class KOFFICEUI_EXPORT KoTabBar : public TQWidget
62{
63 TQ_OBJECT
64
65
66 TQ_PROPERTY( TQString activeTab READ activeTab WRITE setActiveTab )
67 TQ_PROPERTY( bool readOnly READ readOnly WRITE setReadOnly )
68 TQ_PROPERTY( TQStringList tabs READ tabs WRITE setTabs )
69 TQ_PROPERTY( unsigned count READ count )
70
71public:
72
76 KoTabBar( TQWidget* parent = 0, const char *name = 0 );
77
81 virtual ~KoTabBar();
82
86 bool readOnly() const;
87
92 bool reverseLayout() const;
93
97 TQStringList tabs() const;
98
103 unsigned count() const;
104
108 TQString activeTab() const;
109
115 bool canScrollBack() const;
116
122 bool canScrollForward() const;
123
127 void ensureVisible( const TQString& tab );
128
129public slots:
130
134 void setTabs( const TQStringList& list );
135
143 void setReadOnly( bool ro );
144
149 void setReverseLayout( bool reverse );
150
154 void addTab( const TQString& text );
155
161 void removeTab( const TQString& text );
162
166 void renameTab( const TQString& old_name, const TQString& new_name );
167
178 void moveTab( unsigned tab, unsigned target );
179
186 void scrollBack();
187
194 void scrollForward();
195
202 void scrollFirst();
203
210 void scrollLast();
211
215 void setActiveTab( const TQString& text );
216
220 void clear();
221
222 TQSize sizeHint() const;
223
224signals:
225
229 void tabChanged( const TQString& _text );
230
241 void tabMoved( unsigned tab, unsigned target );
242
247 void contextMenu( const TQPoint& pos );
248
253
254protected slots:
255 void autoScrollBack();
256 void autoScrollForward();
257
258protected:
259 virtual void paintEvent ( TQPaintEvent* ev );
260 virtual void resizeEvent( TQResizeEvent* ev );
261 virtual void mousePressEvent ( TQMouseEvent* ev );
262 virtual void mouseReleaseEvent ( TQMouseEvent* ev );
263 virtual void mouseDoubleClickEvent ( TQMouseEvent* ev );
264 virtual void mouseMoveEvent ( TQMouseEvent* ev );
265 virtual void wheelEvent ( TQWheelEvent * e );
266
267private:
268 KoTabBarPrivate *d;
269
270 // don't allow copy or assignment
271 KoTabBar( const KoTabBar& );
272 KoTabBar& operator=( const KoTabBar& );
273};
274
275
276#endif // kotabbar_h
The KoTabBar class provides a tab bar, for use to switch active page/sheet in a document.
Definition KoTabBar.h:62
void tabMoved(unsigned tab, unsigned target)
This signal is emitted whenever a tab is dragged, moved and released.
void doubleClicked()
This signal is emitted whenever the tab bar is double-clicked.
void contextMenu(const TQPoint &pos)
This signal is emitted whenever the tab bar is right-clicked.
void tabChanged(const TQString &_text)
Emitted if the active tab changed.