~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/gui/widgets/qtabbar.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the widgets module of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef QTABBAR_H
 
30
#define QTABBAR_H
 
31
 
 
32
#include "QtGui/qwidget.h"
 
33
 
 
34
class QIcon;
 
35
class QTabBarPrivate;
 
36
 
 
37
class Q_GUI_EXPORT QTabBar: public QWidget
 
38
{
 
39
    Q_OBJECT
 
40
 
 
41
    Q_ENUMS(Shape)
 
42
    Q_PROPERTY(Shape shape READ shape WRITE setShape)
 
43
    Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
 
44
    Q_PROPERTY(int count READ count)
 
45
    Q_PROPERTY(bool drawBase READ drawBase WRITE setDrawBase)
 
46
 
 
47
public:
 
48
    explicit QTabBar(QWidget* parent=0);
 
49
    ~QTabBar();
 
50
 
 
51
    enum Shape { RoundedNorth, RoundedSouth, RoundedWest, RoundedEast,
 
52
                 TriangularNorth, TriangularSouth, TriangularWest, TriangularEast
 
53
#if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN)
 
54
                , RoundedAbove = RoundedNorth, RoundedBelow = RoundedSouth,
 
55
                TriangularAbove = TriangularNorth, TriangularBelow = TriangularSouth
 
56
#endif
 
57
    };
 
58
 
 
59
    Shape shape() const;
 
60
    void setShape(Shape shape);
 
61
 
 
62
    int addTab(const QString &text);
 
63
    int addTab(const QIcon &icon, const QString &text);
 
64
 
 
65
    int insertTab(int index, const QString &text);
 
66
    int insertTab(int index, const QIcon&icon, const QString &text);
 
67
 
 
68
    void removeTab(int index);
 
69
 
 
70
    bool isTabEnabled(int index) const;
 
71
    void setTabEnabled(int index, bool);
 
72
 
 
73
    QString tabText(int index) const;
 
74
    void setTabText(int index, const QString &text);
 
75
 
 
76
    QIcon tabIcon(int index) const;
 
77
    void setTabIcon(int index, const QIcon &icon);
 
78
 
 
79
    void setTabToolTip(int index, const QString &tip);
 
80
    QString tabToolTip(int index) const;
 
81
 
 
82
    void setTabData(int index, const QVariant &data);
 
83
    QVariant tabData(int index) const;
 
84
 
 
85
    QRect tabRect(int index) const;
 
86
 
 
87
    int currentIndex() const;
 
88
    int count() const;
 
89
 
 
90
    QSize sizeHint() const;
 
91
    QSize minimumSizeHint() const;
 
92
 
 
93
    void setDrawBase(bool drawTheBase);
 
94
    bool drawBase() const;
 
95
 
 
96
public slots:
 
97
    void setCurrentIndex(int index);
 
98
 
 
99
signals:
 
100
    void currentChanged(int index);
 
101
 
 
102
protected:
 
103
    virtual QSize tabSizeHint(int index) const;
 
104
    virtual void tabInserted(int index);
 
105
    virtual void tabRemoved(int index);
 
106
    virtual void tabLayoutChange();
 
107
 
 
108
    bool event(QEvent *);
 
109
    void resizeEvent(QResizeEvent *);
 
110
    void showEvent(QShowEvent *);
 
111
    void paintEvent(QPaintEvent *);
 
112
    void mousePressEvent (QMouseEvent *);
 
113
    void mouseMoveEvent (QMouseEvent *);
 
114
    void mouseReleaseEvent (QMouseEvent *);
 
115
    void keyPressEvent(QKeyEvent *);
 
116
    void changeEvent(QEvent *);
 
117
 
 
118
#ifdef QT3_SUPPORT
 
119
public slots:
 
120
    QT_MOC_COMPAT void setCurrentTab(int index) { setCurrentIndex(index); }
 
121
signals:
 
122
    QT_MOC_COMPAT void selected(int);
 
123
#endif
 
124
 
 
125
private:
 
126
    Q_DISABLE_COPY(QTabBar)
 
127
    Q_DECLARE_PRIVATE(QTabBar)
 
128
    Q_PRIVATE_SLOT(d_func(), void scrollTabs())
 
129
};
 
130
 
 
131
#endif // QTABBAR_H