source: trunk/src/qt3support/widgets/q3mainwindow.h@ 353

Last change on this file since 353 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 8.4 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the Qt3Support module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
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
49QT_BEGIN_HEADER
50
51QT_BEGIN_NAMESPACE
52
53QT_MODULE(Qt3SupportLight)
54
55#ifndef QT_NO_MAINWINDOW
56
57class QMenuBar;
58class QStatusBar;
59class QToolTipGroup;
60class Q3MainWindowPrivate;
61class Q3MainWindowLayout;
62class Q3PopupMenu;
63class QHideDock;
64template<class T> class QList;
65
66class 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
77public:
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
154public 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
168Q_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
178protected Q_SLOTS:
179 virtual void setUpLayout();
180 virtual bool showDockMenu(const QPoint &globalPos);
181 void menuAboutToShow();
182
183protected:
184 void paintEvent(QPaintEvent *);
185 void childEvent(QChildEvent *);
186 bool event(QEvent *);
187
188private Q_SLOTS:
189 void slotPlaceChanged();
190 void doLineUp() { lineUpDockWindows(true); }
191
192private:
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
214inline void Q3MainWindow::addToolBar(Q3DockWindow *w, Qt::ToolBarDock dock, bool newLine)
215{
216 addDockWindow(w, dock, newLine);
217}
218
219inline void Q3MainWindow::addToolBar(Q3DockWindow *w, const QString &label,
220 Qt::ToolBarDock dock, bool newLine)
221{
222 addDockWindow(w, label, dock, newLine);
223}
224
225inline void Q3MainWindow::moveToolBar(Q3DockWindow *w, Qt::ToolBarDock dock)
226{
227 moveDockWindow(w, dock);
228}
229
230inline void Q3MainWindow::moveToolBar(Q3DockWindow *w, Qt::ToolBarDock dock, bool nl, int index, int extraOffset)
231{
232 moveDockWindow(w, dock, nl, index, extraOffset);
233}
234
235inline void Q3MainWindow::removeToolBar(Q3DockWindow *w)
236{
237 removeDockWindow(w);
238}
239
240inline bool Q3MainWindow::toolBarsMovable() const
241{
242 return dockWindowsMovable();
243}
244
245inline void Q3MainWindow::lineUpToolBars(bool keepNewLines)
246{
247 lineUpDockWindows(keepNewLines);
248}
249
250inline void Q3MainWindow::setToolBarsMovable(bool b)
251{
252 setDockWindowsMovable(b);
253}
254#endif
255
256#ifndef QT_NO_TEXTSTREAM
257Q_COMPAT_EXPORT QTextStream &operator<<(QTextStream &, const Q3MainWindow &);
258Q_COMPAT_EXPORT QTextStream &operator>>(QTextStream &, Q3MainWindow &);
259#endif
260
261#endif // QT_NO_MAINWINDOW
262
263QT_END_NAMESPACE
264
265QT_END_HEADER
266
267#endif // Q3MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.