source: trunk/src/gui/widgets/qmainwindow.h@ 138

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

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

File size: 7.1 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 QtGui 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 QDYNAMICMAINWINDOW_H
43#define QDYNAMICMAINWINDOW_H
44
45#include <QtGui/qwidget.h>
46#include <QtGui/qtabwidget.h>
47
48QT_BEGIN_HEADER
49
50QT_BEGIN_NAMESPACE
51
52QT_MODULE(Gui)
53
54#ifndef QT_NO_MAINWINDOW
55
56class QDockWidget;
57class QMainWindowPrivate;
58class QMenuBar;
59class QStatusBar;
60class QToolBar;
61class QMenu;
62
63class Q_GUI_EXPORT QMainWindow : public QWidget
64{
65 Q_OBJECT
66
67 Q_ENUMS(DockOption)
68 Q_FLAGS(DockOptions)
69 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
70 Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle)
71#ifndef QT_NO_DOCKWIDGET
72 Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated)
73#ifndef QT_NO_TABBAR
74 Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode)
75#endif // QT_NO_TABBAR
76#ifndef QT_NO_TABWIDGET
77 Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape)
78#endif // QT_NO_TABWIDGET
79 Q_PROPERTY(bool dockNestingEnabled READ isDockNestingEnabled WRITE setDockNestingEnabled)
80#endif // QT_NO_DOCKWIDGET
81 Q_PROPERTY(DockOptions dockOptions READ dockOptions WRITE setDockOptions)
82#ifndef QT_NO_TOOLBAR
83 Q_PROPERTY(bool unifiedTitleAndToolBarOnMac READ unifiedTitleAndToolBarOnMac WRITE setUnifiedTitleAndToolBarOnMac)
84#endif
85
86public:
87 enum DockOption {
88 AnimatedDocks = 0x01,
89 AllowNestedDocks = 0x02,
90 AllowTabbedDocks = 0x04,
91 ForceTabbedDocks = 0x08, // implies AllowTabbedDocks, !AllowNestedDocks
92 VerticalTabs = 0x10 // implies AllowTabbedDocks
93 };
94 Q_DECLARE_FLAGS(DockOptions, DockOption)
95
96 explicit QMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
97 ~QMainWindow();
98
99 QSize iconSize() const;
100 void setIconSize(const QSize &iconSize);
101
102 Qt::ToolButtonStyle toolButtonStyle() const;
103 void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle);
104
105 bool isAnimated() const;
106 bool isDockNestingEnabled() const;
107
108#ifndef QT_NO_TABBAR
109 bool documentMode() const;
110 void setDocumentMode(bool enabled);
111#endif
112
113#ifndef QT_NO_TABWIDGET
114 QTabWidget::TabShape tabShape() const;
115 void setTabShape(QTabWidget::TabShape tabShape);
116 QTabWidget::TabPosition tabPosition(Qt::DockWidgetArea area) const;
117 void setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition);
118#endif // QT_NO_TABWIDGET
119
120 void setDockOptions(DockOptions options);
121 DockOptions dockOptions() const;
122
123 bool isSeparator(const QPoint &pos) const;
124
125#ifndef QT_NO_MENUBAR
126 QMenuBar *menuBar() const;
127 void setMenuBar(QMenuBar *menubar);
128
129 QWidget *menuWidget() const;
130 void setMenuWidget(QWidget *menubar);
131#endif
132
133#ifndef QT_NO_STATUSBAR
134 QStatusBar *statusBar() const;
135 void setStatusBar(QStatusBar *statusbar);
136#endif
137
138 QWidget *centralWidget() const;
139 void setCentralWidget(QWidget *widget);
140
141#ifndef QT_NO_DOCKWIDGET
142 void setCorner(Qt::Corner corner, Qt::DockWidgetArea area);
143 Qt::DockWidgetArea corner(Qt::Corner corner) const;
144#endif
145
146#ifndef QT_NO_TOOLBAR
147 void addToolBarBreak(Qt::ToolBarArea area = Qt::TopToolBarArea);
148 void insertToolBarBreak(QToolBar *before);
149
150 void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar);
151 void addToolBar(QToolBar *toolbar);
152 QToolBar *addToolBar(const QString &title);
153 void insertToolBar(QToolBar *before, QToolBar *toolbar);
154 void removeToolBar(QToolBar *toolbar);
155 void removeToolBarBreak(QToolBar *before);
156
157 void setUnifiedTitleAndToolBarOnMac(bool set);
158 bool unifiedTitleAndToolBarOnMac() const;
159
160 Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const;
161 bool toolBarBreak(QToolBar *toolbar) const;
162#endif
163#ifndef QT_NO_DOCKWIDGET
164 void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget);
165 void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget,
166 Qt::Orientation orientation);
167 void splitDockWidget(QDockWidget *after, QDockWidget *dockwidget,
168 Qt::Orientation orientation);
169 void tabifyDockWidget(QDockWidget *first, QDockWidget *second);
170 QList<QDockWidget*> tabifiedDockWidgets(QDockWidget *dockwidget) const;
171 void removeDockWidget(QDockWidget *dockwidget);
172 bool restoreDockWidget(QDockWidget *dockwidget);
173
174 Qt::DockWidgetArea dockWidgetArea(QDockWidget *dockwidget) const;
175#endif // QT_NO_DOCKWIDGET
176
177 QByteArray saveState(int version = 0) const;
178 bool restoreState(const QByteArray &state, int version = 0);
179
180#ifndef QT_NO_MENU
181 virtual QMenu *createPopupMenu();
182#endif
183
184#ifdef QT3_SUPPORT
185 QT3_SUPPORT_CONSTRUCTOR QMainWindow(QWidget *parent, const char *name, Qt::WindowFlags flags = 0);
186#endif
187
188#ifndef QT_NO_DOCKWIDGET
189public Q_SLOTS:
190 void setAnimated(bool enabled);
191 void setDockNestingEnabled(bool enabled);
192#endif
193
194Q_SIGNALS:
195 void iconSizeChanged(const QSize &iconSize);
196 void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle);
197
198protected:
199#ifndef QT_NO_CONTEXTMENU
200 void contextMenuEvent(QContextMenuEvent *event);
201#endif
202 bool event(QEvent *event);
203
204private:
205 Q_DECLARE_PRIVATE(QMainWindow)
206 Q_DISABLE_COPY(QMainWindow)
207};
208
209Q_DECLARE_OPERATORS_FOR_FLAGS(QMainWindow::DockOptions)
210
211#endif // QT_NO_MAINWINDOW
212
213QT_END_NAMESPACE
214
215QT_END_HEADER
216
217#endif // QDYNAMICMAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.