kmultitabbar.h
/***************************************************************************
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 <qscrollview.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qlayout.h>
#include <qstring.h>
#include <qptrlist.h>
#include <qpushbutton.h>
#include <kdelibs_export.h>
class QPixmap;
class QPainter;
class QFrame;
class KMultiTabBarPrivate;
class KMultiTabBarTabPrivate;
class KMultiTabBarButtonPrivate;
class KMultiTabBarInternal;
class KUTILS_EXPORT KMultiTabBar: public QWidget
{
Q_OBJECT
public:
enum KMultiTabBarMode {
Horizontal,
Vertical
};
enum KMultiTabBarPosition {
Left,
Right,
Top,
Bottom
};
enum KMultiTabBarStyle {
VSNET=0,
KDEV3=1,
KONQSBC=2,
KDEV3ICON=3,
STYLELAST=0xffff
};
KMultiTabBar(KMultiTabBarMode bm,QWidget *parent=0,const char *name=0);
virtual ~KMultiTabBar();
int appendButton(const QPixmap &pic,int id=-1,QPopupMenu* popup=0,const QString& not_used_yet=QString::null);
void removeButton(int id);
int appendTab(const QPixmap &pic,int id=-1,const QString& text=QString::null);
void removeTab(int id);
void setTab(int id ,bool state);
bool isTabRaised(int id) const;
class KMultiTabBarButton *button(int id) const;
class KMultiTabBarTab *tab(int id) const;
void setPosition(KMultiTabBarPosition pos);
KMultiTabBarPosition position() const;
void setStyle(KMultiTabBarStyle style);
KMultiTabBarStyle tabStyle() const;
QPtrList<KMultiTabBarTab>* tabs();
QPtrList<KMultiTabBarButton>* buttons();
void showActiveTabTexts(bool show=true);
protected:
friend class KMultiTabBarButton;
virtual void fontChange( const QFont& );
void updateSeparator();
private:
class KMultiTabBarInternal *m_internal;
QBoxLayout *m_l;
QFrame *m_btnTabSep;
QPtrList<KMultiTabBarButton> m_buttons;
KMultiTabBarPosition m_position;
KMultiTabBarPrivate *d;
};
class KUTILS_EXPORT KMultiTabBarButton: public QPushButton
{
Q_OBJECT
public:
KMultiTabBarButton(const QPixmap& pic,const QString&, QPopupMenu *popup,
int id,QWidget *parent, KMultiTabBar::KMultiTabBarPosition pos, KMultiTabBar::KMultiTabBarStyle style);
KMultiTabBarButton(const QString&, QPopupMenu *popup,
int id,QWidget *parent, KMultiTabBar::KMultiTabBarPosition pos, KMultiTabBar::KMultiTabBarStyle style);
virtual ~KMultiTabBarButton();
int id() const;
public slots:
void setPosition(KMultiTabBar::KMultiTabBarPosition);
void setStyle(KMultiTabBar::KMultiTabBarStyle);
void setText(const QString &);
QSize sizeHint() const;
protected:
KMultiTabBar::KMultiTabBarPosition m_position;
KMultiTabBar::KMultiTabBarStyle m_style;
QString m_text;
virtual void hideEvent( class QHideEvent*);
virtual void showEvent( class QShowEvent*);
private:
int m_id;
KMultiTabBarButtonPrivate *d;
signals:
void clicked(int id);
protected slots:
virtual void slotClicked();
};
class KUTILS_EXPORT KMultiTabBarTab: public KMultiTabBarButton
{
Q_OBJECT
public:
KMultiTabBarTab(const QPixmap& pic,const QString&,int id,QWidget *parent,
KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style);
virtual ~KMultiTabBarTab();
void setState(bool state);
void showActiveTabText(bool show);
void resize(){ setSize( neededSize() ); }
private:
bool m_showActiveTabText;
int m_expandedSize;
KMultiTabBarTabPrivate *d;
protected:
friend class KMultiTabBarInternal;
void setSize(int);
int neededSize();
void updateState();
virtual void drawButton(QPainter *);
virtual void drawButtonLabel(QPainter *);
void drawButtonStyled(QPainter *);
void drawButtonClassic(QPainter *);
protected slots:
virtual void slotClicked();
void setTabsPosition(KMultiTabBar::KMultiTabBarPosition);
public slots:
virtual void setIcon(const QString&);
virtual void setIcon(const QPixmap&);
};
#endif
KMultiTabBar::KMultiTabBarPosition
KMultiTabBarPosition
The tab bar's position.
Definition: kmultitabbar.h:71
KMultiTabBar::Right
Right hand side.
Definition: kmultitabbar.h:73
KMultiTabBar::Top
On top.
Definition: kmultitabbar.h:74
KMultiTabBarTab
This class represents a tab bar's tab in a KMultiTabBarWidget.
Definition: kmultitabbar.h:268
KMultiTabBarButton::setStyle
void setStyle(KMultiTabBar::KMultiTabBarStyle)
this is used internaly, but can be used by the user, if (s)he wants to It the according call of KMult...
Definition: kmultitabbar.cpp:440
KMultiTabBarButton::setPosition
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 KMult...
Definition: kmultitabbar.cpp:434
KMultiTabBar
A Widget for horizontal and vertical tabs.
Definition: kmultitabbar.h:56
KMultiTabBar::Horizontal
Horizontal orientation (i.e. on top or bottom)
Definition: kmultitabbar.h:64
KMultiTabBar::Left
Left hand side.
Definition: kmultitabbar.h:72
KMultiTabBar::KMultiTabBarMode
KMultiTabBarMode
The tab bar's orientation.
Definition: kmultitabbar.h:63
KMultiTabBar::KMultiTabBarStyle
KMultiTabBarStyle
The list of available styles for KMultiTabBar.
Definition: kmultitabbar.h:81
KMultiTabBarTab::resize
void resize()
Resized the tab to the needed size.
Definition: kmultitabbar.h:293
KMultiTabBarButton
This class represents a tab bar button in a KMultiTabBarWidget.
Definition: kmultitabbar.h:205

KDE Home | KDE Accessibility Home | Description of Access Keys