|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt3Support 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 Q3MAINWINDOW_H |
|
43 #define Q3MAINWINDOW_H |
|
44 |
|
45 #include <QtGui/qwidget.h> |
|
46 #include <Qt3Support/q3toolbar.h> |
|
47 #include <QtCore/qtextstream.h> |
|
48 |
|
49 QT_BEGIN_HEADER |
|
50 |
|
51 QT_BEGIN_NAMESPACE |
|
52 |
|
53 QT_MODULE(Qt3SupportLight) |
|
54 |
|
55 #ifndef QT_NO_MAINWINDOW |
|
56 |
|
57 class QMenuBar; |
|
58 class QStatusBar; |
|
59 class QToolTipGroup; |
|
60 class Q3MainWindowPrivate; |
|
61 class Q3MainWindowLayout; |
|
62 class Q3PopupMenu; |
|
63 class QHideDock; |
|
64 template<class T> class QList; |
|
65 |
|
66 class Q_COMPAT_EXPORT Q3MainWindow: public QWidget |
|
67 { |
|
68 Q_OBJECT |
|
69 Q_DECLARE_PRIVATE(Q3MainWindow) |
|
70 |
|
71 Q_PROPERTY(bool rightJustification READ rightJustification WRITE setRightJustification DESIGNABLE false) |
|
72 Q_PROPERTY(bool usesBigPixmaps READ usesBigPixmaps WRITE setUsesBigPixmaps) |
|
73 Q_PROPERTY(bool usesTextLabel READ usesTextLabel WRITE setUsesTextLabel) |
|
74 Q_PROPERTY(bool dockWindowsMovable READ dockWindowsMovable WRITE setDockWindowsMovable) |
|
75 Q_PROPERTY(bool opaqueMoving READ opaqueMoving WRITE setOpaqueMoving) |
|
76 |
|
77 public: |
|
78 Q3MainWindow(QWidget* parent=0, const char* name=0, Qt::WindowFlags f = Qt::WType_TopLevel); |
|
79 ~Q3MainWindow(); |
|
80 |
|
81 #ifndef QT_NO_MENUBAR |
|
82 QMenuBar * menuBar() const; |
|
83 #endif |
|
84 QStatusBar * statusBar() const; |
|
85 #if 0 |
|
86 QToolTipGroup * toolTipGroup() const; |
|
87 #endif |
|
88 |
|
89 virtual void setCentralWidget(QWidget *); |
|
90 QWidget * centralWidget() const; |
|
91 |
|
92 virtual void setDockEnabled(Qt::Dock dock, bool enable); |
|
93 bool isDockEnabled(Qt::Dock dock) const; |
|
94 bool isDockEnabled(Q3DockArea *area) const; |
|
95 virtual void setDockEnabled(Q3DockWindow *tb, Qt::Dock dock, bool enable); |
|
96 bool isDockEnabled(Q3DockWindow *tb, Qt::Dock dock) const; |
|
97 bool isDockEnabled(Q3DockWindow *tb, Q3DockArea *area) const; |
|
98 |
|
99 virtual void addDockWindow(Q3DockWindow *, Qt::Dock = Qt::DockTop, bool newLine = false); |
|
100 virtual void addDockWindow(Q3DockWindow *, const QString &label, |
|
101 Qt::Dock = Qt::DockTop, bool newLine = false); |
|
102 virtual void moveDockWindow(Q3DockWindow *, Qt::Dock = Qt::DockTop); |
|
103 virtual void moveDockWindow(Q3DockWindow *, Qt::Dock, bool nl, int index, int extraOffset = -1); |
|
104 virtual void removeDockWindow(Q3DockWindow *); |
|
105 |
|
106 void setVisible(bool); |
|
107 QSize sizeHint() const; |
|
108 QSize minimumSizeHint() const; |
|
109 |
|
110 bool rightJustification() const; |
|
111 bool usesBigPixmaps() const; |
|
112 bool usesTextLabel() const; |
|
113 bool dockWindowsMovable() const; |
|
114 bool opaqueMoving() const; |
|
115 |
|
116 bool eventFilter(QObject*, QEvent*); |
|
117 |
|
118 bool getLocation(Q3DockWindow *tb, Qt::Dock &dock, int &index, bool &nl, int &extraOffset) const; |
|
119 |
|
120 QList<Q3DockWindow *> dockWindows(Qt::Dock dock) const; |
|
121 QList<Q3DockWindow *> dockWindows() const; |
|
122 void lineUpDockWindows(bool keepNewLines = false); |
|
123 |
|
124 bool isDockMenuEnabled() const; |
|
125 |
|
126 // compatibility stuff |
|
127 bool hasDockWindow(Q3DockWindow *dw); |
|
128 #ifndef QT_NO_TOOLBAR |
|
129 void addToolBar(Q3DockWindow *, Qt::Dock = Qt::DockTop, bool newLine = false); |
|
130 void addToolBar(Q3DockWindow *, const QString &label, |
|
131 Qt::Dock = Qt::DockTop, bool newLine = false); |
|
132 void moveToolBar(Q3DockWindow *, Qt::Dock = Qt::DockTop); |
|
133 void moveToolBar(Q3DockWindow *, Qt::Dock, bool nl, int index, int extraOffset = -1); |
|
134 void removeToolBar(Q3DockWindow *); |
|
135 |
|
136 bool toolBarsMovable() const; |
|
137 QList<Q3ToolBar *> toolBars(Qt::Dock dock) const; |
|
138 void lineUpToolBars(bool keepNewLines = false); |
|
139 #endif |
|
140 |
|
141 virtual Q3DockArea *dockingArea(const QPoint &p); |
|
142 Q3DockArea *leftDock() const; |
|
143 Q3DockArea *rightDock() const; |
|
144 Q3DockArea *topDock() const; |
|
145 Q3DockArea *bottomDock() const; |
|
146 |
|
147 virtual bool isCustomizable() const; |
|
148 |
|
149 bool appropriate(Q3DockWindow *dw) const; |
|
150 |
|
151 enum DockWindows { OnlyToolBars, NoToolBars, AllDockWindows }; |
|
152 virtual Q3PopupMenu *createDockWindowMenu(DockWindows dockWindows = AllDockWindows) const; |
|
153 |
|
154 public Q_SLOTS: |
|
155 virtual void setRightJustification(bool); |
|
156 virtual void setUsesBigPixmaps(bool); |
|
157 virtual void setUsesTextLabel(bool); |
|
158 virtual void setDockWindowsMovable(bool); |
|
159 virtual void setOpaqueMoving(bool); |
|
160 virtual void setDockMenuEnabled(bool); |
|
161 virtual void whatsThis(); |
|
162 virtual void setAppropriate(Q3DockWindow *dw, bool a); |
|
163 virtual void customize(); |
|
164 |
|
165 // compatibility stuff |
|
166 void setToolBarsMovable(bool); |
|
167 |
|
168 Q_SIGNALS: |
|
169 void pixmapSizeChanged(bool); |
|
170 void usesTextLabelChanged(bool); |
|
171 void dockWindowPositionChanged(Q3DockWindow *); |
|
172 |
|
173 #ifndef QT_NO_TOOLBAR |
|
174 // compatibility stuff |
|
175 void toolBarPositionChanged(Q3ToolBar *); |
|
176 #endif |
|
177 |
|
178 protected Q_SLOTS: |
|
179 virtual void setUpLayout(); |
|
180 virtual bool showDockMenu(const QPoint &globalPos); |
|
181 void menuAboutToShow(); |
|
182 |
|
183 protected: |
|
184 void paintEvent(QPaintEvent *); |
|
185 void childEvent(QChildEvent *); |
|
186 bool event(QEvent *); |
|
187 |
|
188 private Q_SLOTS: |
|
189 void slotPlaceChanged(); |
|
190 void doLineUp() { lineUpDockWindows(true); } |
|
191 |
|
192 private: |
|
193 Q_DISABLE_COPY(Q3MainWindow) |
|
194 |
|
195 void triggerLayout(bool deleteLayout = true); |
|
196 bool dockMainWindow(QObject *dock) const; |
|
197 |
|
198 #ifndef QT_NO_MENUBAR |
|
199 virtual void setMenuBar(QMenuBar *); |
|
200 #endif |
|
201 virtual void setStatusBar(QStatusBar *); |
|
202 #if 0 |
|
203 virtual void setToolTipGroup(QToolTipGroup *); |
|
204 #endif |
|
205 |
|
206 friend class Q3DockWindow; |
|
207 friend class QMenuBarPrivate; |
|
208 friend class QHideDock; |
|
209 friend class Q3ToolBar; |
|
210 friend class Q3MainWindowLayout; |
|
211 }; |
|
212 |
|
213 #ifndef QT_NO_TOOLBAR |
|
214 inline void Q3MainWindow::addToolBar(Q3DockWindow *w, Qt::ToolBarDock dock, bool newLine) |
|
215 { |
|
216 addDockWindow(w, dock, newLine); |
|
217 } |
|
218 |
|
219 inline void Q3MainWindow::addToolBar(Q3DockWindow *w, const QString &label, |
|
220 Qt::ToolBarDock dock, bool newLine) |
|
221 { |
|
222 addDockWindow(w, label, dock, newLine); |
|
223 } |
|
224 |
|
225 inline void Q3MainWindow::moveToolBar(Q3DockWindow *w, Qt::ToolBarDock dock) |
|
226 { |
|
227 moveDockWindow(w, dock); |
|
228 } |
|
229 |
|
230 inline void Q3MainWindow::moveToolBar(Q3DockWindow *w, Qt::ToolBarDock dock, bool nl, int index, int extraOffset) |
|
231 { |
|
232 moveDockWindow(w, dock, nl, index, extraOffset); |
|
233 } |
|
234 |
|
235 inline void Q3MainWindow::removeToolBar(Q3DockWindow *w) |
|
236 { |
|
237 removeDockWindow(w); |
|
238 } |
|
239 |
|
240 inline bool Q3MainWindow::toolBarsMovable() const |
|
241 { |
|
242 return dockWindowsMovable(); |
|
243 } |
|
244 |
|
245 inline void Q3MainWindow::lineUpToolBars(bool keepNewLines) |
|
246 { |
|
247 lineUpDockWindows(keepNewLines); |
|
248 } |
|
249 |
|
250 inline void Q3MainWindow::setToolBarsMovable(bool b) |
|
251 { |
|
252 setDockWindowsMovable(b); |
|
253 } |
|
254 #endif |
|
255 |
|
256 #ifndef QT_NO_TEXTSTREAM |
|
257 Q_COMPAT_EXPORT QTextStream &operator<<(QTextStream &, const Q3MainWindow &); |
|
258 Q_COMPAT_EXPORT QTextStream &operator>>(QTextStream &, Q3MainWindow &); |
|
259 #endif |
|
260 |
|
261 #endif // QT_NO_MAINWINDOW |
|
262 |
|
263 QT_END_NAMESPACE |
|
264 |
|
265 QT_END_HEADER |
|
266 |
|
267 #endif // Q3MAINWINDOW_H |