/usr/include/plasma/widgets/tabbar.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | /*
* Copyright 2008 Marco Martin <notmart@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_TABBAR_H
#define PLASMA_TABBAR_H
#include <QtGui/QGraphicsWidget>
#include <ktabbar.h>
#include <plasma/plasma_export.h>
class QString;
class QIcon;
namespace Plasma
{
class TabBarPrivate;
/**
* @class TabBar plasma/widgets/tabbar.h <Plasma/Widgets/TabBar>
*
* @short A tab bar widget, to be used for tabbed interfaces.
*
* Provides a Tab bar for use in a tabbed interface where each page is a QGraphicsLayoutItem.
* Only one of them is displayed at a given time. It is possible to add and remove tabs
* or modify their text label or their icon.
*/
class PLASMA_EXPORT TabBar : public QGraphicsWidget
{
Q_OBJECT
Q_PROPERTY(KTabBar *nativeWidget READ nativeWidget)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
Q_PROPERTY(int count READ count)
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
Q_PROPERTY(bool tabBarShown READ isTabBarShown WRITE setTabBarShown)
Q_PROPERTY(QGraphicsWidget *firstPositionWidget READ firstPositionWidget WRITE setFirstPositionWidget)
Q_PROPERTY(QGraphicsWidget *lastPositionWidget READ lastPositionWidget WRITE setLastPositionWidget)
public:
/**
* Constructs a new TabBar
*
* @param parent the parent of this widget
*/
explicit TabBar(QGraphicsWidget *parent = 0);
~TabBar();
/**
* Adds a new tab in the desired position
*
* @param index the position where to insert the new tab,
* if index <=0 will be the first position,
* if index >= count() will be the last
* @param icon the icon for this tab
* @param label the text label of the tab
* @param content the page content that will be shown by this tab
* @return the index of the inserted tab
*/
Q_INVOKABLE int insertTab(int index, const QIcon &icon, const QString &label,
QGraphicsLayoutItem *content = 0);
/**
* Adds a new tab in the desired position
* This is an overloaded member provided for convenience
* equivalent to insertTab(index, QIcon(), label);
*
* @param index the position where to insert the new tab,
* if index <=0 will be the first position,
* if index >= count() will be the last
* @param label the text label of the tab
* @param content the page content that will be shown by this tab
* @return the index of the inserted tab
*/
Q_INVOKABLE int insertTab(int index, const QString &label, QGraphicsLayoutItem *content = 0);
/**
* Adds a new tab in the last position
*
* @param icon the icon for this tab
* @param label the text label of the tab
* @param content the page content that will be shown by this tab
* @return the index of the inserted tab
*/
Q_INVOKABLE int addTab(const QIcon &icon, const QString &label, QGraphicsLayoutItem *content = 0);
/**
* Adds a new tab in the last position
* This is an overloaded member provided for convenience
* equivalent to addTab(QIcon(), label, page)
*
* @param label the text label of the tab
* @param content the page content that will be shown by this tab
* @return the index of the inserted tab
*/
Q_INVOKABLE int addTab(const QString &label, QGraphicsLayoutItem *content = 0);
/**
* Removes a tab, contents are deleted
*
* @param index the index of the tab to remove
*/
Q_INVOKABLE void removeTab(int index);
/**
* Removes a tab, the page is reparented to 0 and is returned
*
* @param index the index of the tab to remove
* @since 4.4
*/
Q_INVOKABLE QGraphicsLayoutItem *takeTab(int index);
/**
* Returns the contents of a page
*
* @param index the index of the tab to retrieve
* @since 4.4
*/
Q_INVOKABLE QGraphicsLayoutItem *tabAt(int index);
/**
* @return the index of the tab currently active
*/
int currentIndex() const;
/**
* @return the number of tabs in this tabbar
*/
int count() const;
/**
* Sets the text label of the given tab
*
* @param index the index of the tab to modify
* @param label the new text label of the given tab
*/
Q_INVOKABLE void setTabText(int index, const QString &label);
/**
* @return the text label of the given tab
*
* @param index the index of the tab we want to know its label
*/
Q_INVOKABLE QString tabText(int index) const;
/**
* Sets an icon for a given tab
*
* @param index the index of the tab to modify
* @param icon the new icon for the given tab
*/
Q_INVOKABLE void setTabIcon(int index, const QIcon &icon);
/**
* @return the current icon for a given tab
*
* @param index the index of the tab we want to know its icon
*/
Q_INVOKABLE QIcon tabIcon(int index) const;
/**
* shows or hides the tabbar, used if you just want to display the
* pages, when the tabbar doesn't have content pages at all this
* function has no effect
*
* @param show true if we want to show the tabbar
* @since 4.3
*/
void setTabBarShown(bool show);
/**
* @return true if the tabbar is shown
* @since 4.3
*/
bool isTabBarShown() const;
/**
* Sets the stylesheet used to control the visual display of this TabBar
*
* @param stylesheet a CSS string
*/
void setStyleSheet(const QString &stylesheet);
/**
* @return the stylesheet currently used with this widget
*/
QString styleSheet() const;
/**
* Highlight the specified tab
* @param index of the tab to highlight
* @param highlight true if it should be highlighted, wrong if not
* @since 4.7
*/
Q_INVOKABLE void setTabHighlighted(int index, bool highlight);
/**
* @return if the tab at index is highlighted
* @since 4.7
*/
Q_INVOKABLE bool isTabHighlighted(int index) const;
/**
* @return the native widget wrapped by this TabBar
*/
KTabBar *nativeWidget() const;
/**
* Set a widget to be displayed on one side of the TabBar, depending on the
* LayoutDirection and the Shape.
* @param widget the widget to be displayed. Passing 0 will show nothing.
* Any previous widget will be deleted.
* @since 4.6
*/
void setFirstPositionWidget(QGraphicsWidget *widget);
/**
* @return the widget in the first position
* @since 4.6
*/
QGraphicsWidget *firstPositionWidget() const;
/**
* Set a widget to be displayed on one side of the TabBar, depending on the
* LayoutDirection and the Shape.
* @param widget the widget to be displayed. Passing 0 will show nothing.
* Any previous widget will be deleted.
* @since 4.6
*/
void setLastPositionWidget(QGraphicsWidget *widget);
/**
* @return the widget in the last position
* @since 4.6
*/
QGraphicsWidget *lastPositionWidget() const;
public Q_SLOTS:
/**
* Activate a given tab
*
* @param index the index of the tab to activate
*/
void setCurrentIndex(int index);
Q_SIGNALS:
/**
* Emitted when the active tab changes
*
* @param index the newly activated tab
*/
void currentChanged(int index);
protected:
void wheelEvent(QGraphicsSceneWheelEvent *event);
void resizeEvent(QGraphicsSceneResizeEvent * event);
void changeEvent(QEvent *event);
private:
TabBarPrivate * const d;
friend class TabBarPrivate;
Q_PRIVATE_SLOT(d, void slidingNewPageCompleted())
Q_PRIVATE_SLOT(d, void slidingOldPageCompleted())
Q_PRIVATE_SLOT(d, void shapeChanged(const QTabBar::Shape shape))
Q_PRIVATE_SLOT(d, void setPalette())
};
} // namespace Plasma
#endif // multiple inclusion guard
|