/usr/include/kmultitabbar.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 | /***************************************************************************
kmultitabbar.h - description
-------------------
begin : 2001
copyright : (C) 2001,2002,2003 by Joseph Wenninger <jowenn@kde.org>
***************************************************************************/
/***************************************************************************
This library 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 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
***************************************************************************/
#ifndef _KMultitabbar_h_
#define _KMultitabbar_h_
#include <QtGui/QLayout>
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtGui/QPushButton>
#include <kdeui_export.h>
class QPixmap;
class QPainter;
class QMenu;
class QStyleOptionToolButton;
class KMultiTabBarPrivate;
class KMultiTabBarTabPrivate;
class KMultiTabBarButtonPrivate;
class KMultiTabBarInternal;
/**
* A Widget for horizontal and vertical tabs.
* (Note that in Qt4, QTabBar can be vertical as well)
*
* It is possible to add normal buttons to the top/left
* The handling if only one tab at a time or multiple tabs
* should be raisable is left to the "user".
*
* \image html kmultitabbar.png "KDE Multi Tab Bar Widget"
*
* @author Joseph Wenninger
*/
class KDEUI_EXPORT KMultiTabBar: public QWidget
{
Q_OBJECT
Q_ENUMS(KMultiTabBarPosition KMultiTabBarStyle)
Q_PROPERTY(KMultiTabBarPosition position READ position WRITE setPosition)
Q_PROPERTY(KMultiTabBarStyle tabStyle READ tabStyle WRITE setStyle)
public:
enum KMultiTabBarPosition { Left, Right, Top, Bottom };
/**
* The list of available styles for KMultiTabBar
* - VSNET - Visual Studio .Net like, always shows icon, only show the text of active tabs
* - KDEV3ICON - Kdevelop 3 like, always shows the text and icons
*/
enum KMultiTabBarStyle{VSNET=0, KDEV3ICON=2,STYLELAST=0xffff};
explicit KMultiTabBar(KMultiTabBarPosition pos, QWidget *parent=0 );
virtual ~KMultiTabBar();
/**
* append a new button to the button area. The button can later on be accessed with button(ID)
* eg for connecting signals to it
* @param pic a pixmap for the button
* @param id an arbitraty ID value. It will be emitted in the clicked signal for identifying the button
* if more than one button is connected to a signals.
* @param popup A popup menu which should be displayed if the button is clicked
* @param not_used_yet will be used for a popup text in the future
*/
int appendButton(const QPixmap &pic,int id=-1,QMenu* popup=0,const QString& not_used_yet=QString());
/**
* remove a button with the given ID
*/
void removeButton(int id);
/**
* append a new tab to the tab area. It can be accessed lateron with tabb(id);
* @param pic a bitmap for the tab
* @param id an arbitrary ID which can be used later on to identify the tab
* @param text if a mode with text is used it will be the tab text, otherwise a mouse over hint
*/
int appendTab(const QPixmap &pic,int id=-1,const QString& text=QString());
/**
* remove a tab with a given ID
*/
void removeTab(int id);
/**
* set a tab to "raised"
* @param id The ID of the tab to manipulate
* @param state true == activated/raised, false == not active
*/
void setTab(int id ,bool state);
/**
* return the state of a tab, identified by its ID
*/
bool isTabRaised(int id) const;
/**
* get a pointer to a button within the button area identified by its ID
*/
class KMultiTabBarButton *button(int id) const;
/**
* get a pointer to a tab within the tab area, identiifed by its ID
*/
class KMultiTabBarTab *tab(int id) const;
/**
* set the real position of the widget.
* @param pos if the mode is horizontal, only use top, bottom, if it is vertical use left or right
*/
void setPosition(KMultiTabBarPosition pos);
/**
* get the tabbar position.
* @return position
*/
KMultiTabBarPosition position() const;
/**
* set the display style of the tabs
*/
void setStyle(KMultiTabBarStyle style);
/**
* get the display style of the tabs
* @return display style
*/
KMultiTabBarStyle tabStyle() const;
protected:
friend class KMultiTabBarButton;
virtual void fontChange( const QFont& );
void updateSeparator();
private:
KMultiTabBarPrivate * const d;
};
/**
* Use KMultiTabBar::appendButton to append a button, which creates a KMultiTabBarButton instance
*/
class KDEUI_EXPORT KMultiTabBarButton: public QPushButton
{
Q_OBJECT
public:
int id() const;
virtual ~KMultiTabBarButton();
public Q_SLOTS:
void setText(const QString &text);
Q_SIGNALS:
/**
* this is emitted if the button is clicked
* @param id the ID identifying the button
*/
void clicked(int id);
protected Q_SLOTS:
virtual void slotClicked();
protected:
virtual void hideEvent( class QHideEvent*);
virtual void showEvent( class QShowEvent*);
virtual void paintEvent( class QPaintEvent*);
/** Should not be created directly. Use KMultiTabBar::appendButton
*/
KMultiTabBarButton(const QPixmap& pic, const QString&, int id, QWidget *parent);
private:
friend class KMultiTabBar;
int m_id;
KMultiTabBarButtonPrivate * const d;
};
/**
* Use KMultiTabBar::appendTab to append a tab, which creates a KMultiTabBarTab instance
*/
class KDEUI_EXPORT KMultiTabBarTab: public KMultiTabBarButton
{
Q_OBJECT
public:
virtual ~KMultiTabBarTab();
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
public Q_SLOTS:
/**
* this is used internaly, but can be used by the user, if (s)he wants to
* It the according call of KMultiTabBar is invoked though this modifications will be overwritten
*/
void setPosition(KMultiTabBar::KMultiTabBarPosition);
/**
* this is used internaly, but can be used by the user, if (s)he wants to
* It the according call of KMultiTabBar is invoked though this modifications will be overwritten
*/
void setStyle(KMultiTabBar::KMultiTabBarStyle);
/**
* set the active state of the tab
* @param state true==active false==not active
*/
void setState(bool state);
void setIcon(const QString&);
void setIcon(const QPixmap&);
protected:
virtual void paintEvent(QPaintEvent *);
private:
KMultiTabBar::KMultiTabBarPosition m_position;
KMultiTabBar::KMultiTabBarStyle m_style;
void computeMargins (int* hMargin, int* vMargin) const;
QSize computeSizeHint(bool withText) const;
bool shouldDrawText() const;
bool isVertical() const;
QPixmap iconPixmap() const;
void initStyleOption(QStyleOptionToolButton* opt) const;
friend class KMultiTabBarInternal;
/**
* This class should never be created except with the appendTab call of KMultiTabBar
*/
KMultiTabBarTab(const QPixmap& pic, const QString&, int id, QWidget *parent,
KMultiTabBar::KMultiTabBarPosition pos, KMultiTabBar::KMultiTabBarStyle style);
KMultiTabBarTabPrivate * const d;
};
#endif
// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
|