author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 11:15:19 +0300 | |
branch | RCL_3 |
changeset 11 | 25a739ee40f4 |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QDYNAMICTOOLBAR_H |
|
43 |
#define QDYNAMICTOOLBAR_H |
|
44 |
||
45 |
#include <QtGui/qwidget.h> |
|
46 |
||
47 |
QT_BEGIN_HEADER |
|
48 |
||
49 |
QT_BEGIN_NAMESPACE |
|
50 |
||
51 |
QT_MODULE(Gui) |
|
52 |
||
53 |
#ifndef QT_NO_TOOLBAR |
|
54 |
||
55 |
class QToolBarPrivate; |
|
56 |
||
57 |
class QAction; |
|
58 |
class QIcon; |
|
59 |
class QMainWindow; |
|
60 |
class QStyleOptionToolBar; |
|
61 |
||
62 |
class Q_GUI_EXPORT QToolBar : public QWidget |
|
63 |
{ |
|
64 |
Q_OBJECT |
|
65 |
||
66 |
Q_PROPERTY(bool movable READ isMovable WRITE setMovable |
|
67 |
DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) != 0) |
|
68 |
NOTIFY movableChanged) |
|
69 |
Q_PROPERTY(Qt::ToolBarAreas allowedAreas READ allowedAreas WRITE setAllowedAreas |
|
70 |
DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) != 0) |
|
71 |
NOTIFY allowedAreasChanged) |
|
72 |
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation |
|
73 |
DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) == 0) |
|
74 |
NOTIFY orientationChanged) |
|
75 |
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged) |
|
76 |
Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle |
|
77 |
NOTIFY toolButtonStyleChanged) |
|
78 |
Q_PROPERTY(bool floating READ isFloating) |
|
79 |
Q_PROPERTY(bool floatable READ isFloatable WRITE setFloatable) |
|
80 |
||
81 |
public: |
|
82 |
explicit QToolBar(const QString &title, QWidget *parent = 0); |
|
83 |
explicit QToolBar(QWidget *parent = 0); |
|
84 |
~QToolBar(); |
|
85 |
||
86 |
void setMovable(bool movable); |
|
87 |
bool isMovable() const; |
|
88 |
||
89 |
void setAllowedAreas(Qt::ToolBarAreas areas); |
|
90 |
Qt::ToolBarAreas allowedAreas() const; |
|
91 |
||
92 |
inline bool isAreaAllowed(Qt::ToolBarArea area) const |
|
93 |
{ return (allowedAreas() & area) == area; } |
|
94 |
||
95 |
void setOrientation(Qt::Orientation orientation); |
|
96 |
Qt::Orientation orientation() const; |
|
97 |
||
98 |
void clear(); |
|
99 |
||
100 |
#ifdef Q_NO_USING_KEYWORD |
|
101 |
inline void addAction(QAction *action) |
|
102 |
{ QWidget::addAction(action); } |
|
103 |
#else |
|
104 |
using QWidget::addAction; |
|
105 |
#endif |
|
106 |
||
107 |
QAction *addAction(const QString &text); |
|
108 |
QAction *addAction(const QIcon &icon, const QString &text); |
|
109 |
QAction *addAction(const QString &text, const QObject *receiver, const char* member); |
|
110 |
QAction *addAction(const QIcon &icon, const QString &text, |
|
111 |
const QObject *receiver, const char* member); |
|
112 |
||
113 |
QAction *addSeparator(); |
|
114 |
QAction *insertSeparator(QAction *before); |
|
115 |
||
116 |
QAction *addWidget(QWidget *widget); |
|
117 |
QAction *insertWidget(QAction *before, QWidget *widget); |
|
118 |
||
119 |
QRect actionGeometry(QAction *action) const; |
|
120 |
QAction *actionAt(const QPoint &p) const; |
|
121 |
inline QAction *actionAt(int x, int y) const; |
|
122 |
||
123 |
QAction *toggleViewAction() const; |
|
124 |
||
125 |
QSize iconSize() const; |
|
126 |
Qt::ToolButtonStyle toolButtonStyle() const; |
|
127 |
||
128 |
QWidget *widgetForAction(QAction *action) const; |
|
129 |
||
130 |
bool isFloatable() const; |
|
131 |
void setFloatable(bool floatable); |
|
132 |
bool isFloating() const; |
|
133 |
||
134 |
public Q_SLOTS: |
|
135 |
void setIconSize(const QSize &iconSize); |
|
136 |
void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle); |
|
137 |
||
138 |
Q_SIGNALS: |
|
139 |
void actionTriggered(QAction *action); |
|
140 |
void movableChanged(bool movable); |
|
141 |
void allowedAreasChanged(Qt::ToolBarAreas allowedAreas); |
|
142 |
void orientationChanged(Qt::Orientation orientation); |
|
143 |
void iconSizeChanged(const QSize &iconSize); |
|
144 |
void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
145 |
void topLevelChanged(bool topLevel); |
0 | 146 |
|
147 |
protected: |
|
148 |
void actionEvent(QActionEvent *event); |
|
149 |
void changeEvent(QEvent *event); |
|
150 |
void childEvent(QChildEvent *event); |
|
151 |
void paintEvent(QPaintEvent *event); |
|
152 |
void resizeEvent(QResizeEvent *event); |
|
153 |
bool event(QEvent *event); |
|
154 |
void initStyleOption(QStyleOptionToolBar *option) const; |
|
155 |
||
156 |
#ifdef QT3_SUPPORT |
|
157 |
public: |
|
158 |
QT3_SUPPORT_CONSTRUCTOR QToolBar(QWidget *parent, const char *name); |
|
159 |
inline QT3_SUPPORT void setLabel(const QString &label) |
|
160 |
{ setWindowTitle(label); } |
|
161 |
inline QT3_SUPPORT QString label() const |
|
162 |
{ return windowTitle(); } |
|
163 |
#endif |
|
164 |
||
165 |
private: |
|
166 |
Q_DECLARE_PRIVATE(QToolBar) |
|
167 |
Q_DISABLE_COPY(QToolBar) |
|
168 |
Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool)) |
|
169 |
Q_PRIVATE_SLOT(d_func(), void _q_updateIconSize(const QSize &)) |
|
170 |
Q_PRIVATE_SLOT(d_func(), void _q_updateToolButtonStyle(Qt::ToolButtonStyle)) |
|
171 |
||
172 |
friend class QMainWindow; |
|
173 |
friend class QMainWindowLayout; |
|
174 |
friend class QToolBarLayout; |
|
175 |
friend class QToolBarAreaLayout; |
|
176 |
}; |
|
177 |
||
178 |
inline QAction *QToolBar::actionAt(int ax, int ay) const |
|
179 |
{ return actionAt(QPoint(ax, ay)); } |
|
180 |
||
181 |
#endif // QT_NO_TOOLBAR |
|
182 |
||
183 |
QT_END_NAMESPACE |
|
184 |
||
185 |
QT_END_HEADER |
|
186 |
||
187 |
#endif // QDYNAMICTOOLBAR_H |