2
* Copyright (C) 2010 Ivan Cukic <ivan.cukic(at)kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser/Library General Public License version 2,
6
* or (at your option) any later version, as published by the Free
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser/Library General Public License for more details
14
* You should have received a copy of the GNU Lesser/Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#ifndef LANCELOT_TAB_BAR_H
21
#define LANCELOT_TAB_BAR_H
23
#include <QtGui/QIcon>
25
#include <Plasma/Plasma>
26
#include <Plasma/ItemBackground>
27
#include <Plasma/FrameSvg>
29
#include <lancelot/lancelot_export.h>
35
* Provides a group of buttons representing tabs. Can
36
* be used for controlling the CardLayout
40
class LANCELOT_EXPORT TabBar: public QGraphicsWidget {
43
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
44
Q_PROPERTY(Qt::Orientation textDirection READ textDirection WRITE setTextDirection)
45
Q_PROPERTY(QString currentTab READ currentTab WRITE setCurrentTab)
46
Q_PROPERTY(QSize tabIconSize READ tabIconSize WRITE setTabIconSize)
49
// @puck L_INCLUDE(lancelot/widgets/TabBar.h QIcon QSize QString)
53
* Creates a new Lancelot::TabBar
54
* @param parent parent item
56
TabBar(QGraphicsWidget * parent = 0);
59
* Destroys this Lancelot::TabBar
64
* @returns the tab bar orientation
66
Qt::Orientation orientation() const;
69
* Sets the tab bar orientation
70
* @param value new orientation
72
void setOrientation(Qt::Orientation value);
75
* @returns the inner layout of buttons
76
* @see setTextDirection
78
Qt::Orientation textDirection() const;
81
* Sets the inner layout of tab buttons - that is
82
* whether the icon is above or beside the text
84
void setTextDirection(Qt::Orientation value);
87
* @returns the active tab
89
QString currentTab() const;
93
* @param id id of the tab
94
* @param icon icon for the tab
95
* @param title tab title
97
void addTab(const QString & id, const QIcon & icon, const QString & title,
98
const QString & mimeType = QString::null, const QString & mimeData = QString::null);
101
* Removes the specified tab
102
* @param id id of the tab to remove
104
void removeTab(const QString & id);
107
* Sets the Lancelot::Group for the tab buttons
108
* @param groupName name of the specific Lancelot::Group
110
void setTabsGroupName(const QString & groupName);
113
* Sets the layout flip
114
* @param flip new value
116
void setFlip(Plasma::Flip flip);
119
* @returns the current layout flip
121
Plasma::Flip flip() const;
124
* Sets the icon size for tab buttons
125
* @param size new size
127
void setTabIconSize(const QSize & size);
130
* @returns the current icon size of tab buttons
132
QSize tabIconSize() const;
135
L_Override void resizeEvent(QGraphicsSceneResizeEvent * event);
136
L_Override bool sceneEventFilter(QGraphicsItem * watched, QEvent * event);
141
* This signal is emitted when the currently selected
144
void currentTabChanged(const QString & current);
148
* Sets the current tab
150
void setCurrentTab(const QString & current);
158
} // namespace Lancelot
160
#endif /* LANCELOT_TAB_BAR_H */