Plasma
tabbar.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2008 Marco Martin <notmart@gmail.com> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef PLASMA_TABBAR_H 00021 #define PLASMA_TABBAR_H 00022 00023 #include <QtGui/QGraphicsWidget> 00024 00025 #include <ktabbar.h> 00026 00027 #include <plasma/plasma_export.h> 00028 00029 class QString; 00030 class QIcon; 00031 00032 namespace Plasma 00033 { 00034 00035 class TabBarPrivate; 00036 00046 class PLASMA_EXPORT TabBar : public QGraphicsWidget 00047 { 00048 Q_OBJECT 00049 00050 Q_PROPERTY(KTabBar *nativeWidget READ nativeWidget) 00051 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) 00052 Q_PROPERTY(int count READ count) 00053 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) 00054 Q_PROPERTY(bool tabBarShown READ isTabBarShown WRITE setTabBarShown) 00055 Q_PROPERTY(QGraphicsWidget *firstPositionWidget READ firstPositionWidget WRITE setFirstPositionWidget) 00056 Q_PROPERTY(QGraphicsWidget *lastPositionWidget READ lastPositionWidget WRITE setLastPositionWidget) 00057 00058 public: 00064 explicit TabBar(QGraphicsWidget *parent = 0); 00065 ~TabBar(); 00066 00078 Q_INVOKABLE int insertTab(int index, const QIcon &icon, const QString &label, 00079 QGraphicsLayoutItem *content = 0); 00080 00093 Q_INVOKABLE int insertTab(int index, const QString &label, QGraphicsLayoutItem *content = 0); 00094 00103 Q_INVOKABLE int addTab(const QIcon &icon, const QString &label, QGraphicsLayoutItem *content = 0); 00104 00114 Q_INVOKABLE int addTab(const QString &label, QGraphicsLayoutItem *content = 0); 00115 00121 Q_INVOKABLE void removeTab(int index); 00122 00129 Q_INVOKABLE QGraphicsLayoutItem *takeTab(int index); 00130 00137 Q_INVOKABLE QGraphicsLayoutItem *tabAt(int index); 00138 00142 int currentIndex() const; 00143 00147 int count() const; 00148 00155 Q_INVOKABLE void setTabText(int index, const QString &label); 00156 00162 Q_INVOKABLE QString tabText(int index) const; 00163 00170 Q_INVOKABLE void setTabIcon(int index, const QIcon &icon); 00171 00177 Q_INVOKABLE QIcon tabIcon(int index) const; 00178 00187 void setTabBarShown(bool show); 00188 00193 bool isTabBarShown() const; 00194 00200 void setStyleSheet(const QString &stylesheet); 00201 00205 QString styleSheet() const; 00206 00210 KTabBar *nativeWidget() const; 00211 00219 void setFirstPositionWidget(QGraphicsWidget *widget); 00220 00225 QGraphicsWidget *firstPositionWidget() const; 00226 00234 void setLastPositionWidget(QGraphicsWidget *widget); 00235 00240 QGraphicsWidget *lastPositionWidget() const; 00241 00242 public Q_SLOTS: 00248 void setCurrentIndex(int index); 00249 00250 Q_SIGNALS: 00256 void currentChanged(int index); 00257 00258 protected: 00259 void wheelEvent(QGraphicsSceneWheelEvent *event); 00260 void resizeEvent(QGraphicsSceneResizeEvent * event); 00261 void changeEvent(QEvent *event); 00262 00263 private: 00264 TabBarPrivate * const d; 00265 00266 friend class TabBarPrivate; 00267 00268 Q_PRIVATE_SLOT(d, void slidingNewPageCompleted()) 00269 Q_PRIVATE_SLOT(d, void slidingOldPageCompleted()) 00270 Q_PRIVATE_SLOT(d, void shapeChanged(const QTabBar::Shape shape)) 00271 Q_PRIVATE_SLOT(d, void setPalette()) 00272 }; 00273 00274 } // namespace Plasma 00275 00276 #endif // multiple inclusion guard
KDE 4.6 API Reference