[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 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 | **
|
---|
[561] | 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.
|
---|
[2] | 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 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at [email protected].
|
---|
[2] | 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 |
|
---|
| 48 | QT_BEGIN_HEADER
|
---|
| 49 |
|
---|
| 50 | QT_BEGIN_NAMESPACE
|
---|
| 51 |
|
---|
| 52 | QT_MODULE(Gui)
|
---|
| 53 |
|
---|
| 54 | #ifndef QT_NO_MAINWINDOW
|
---|
| 55 |
|
---|
| 56 | class QDockWidget;
|
---|
| 57 | class QMainWindowPrivate;
|
---|
| 58 | class QMenuBar;
|
---|
| 59 | class QStatusBar;
|
---|
| 60 | class QToolBar;
|
---|
| 61 | class QMenu;
|
---|
| 62 |
|
---|
| 63 | class 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 |
|
---|
| 86 | public:
|
---|
| 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 |
|
---|
[651] | 105 | #ifndef QT_NO_DOCKWIDGET
|
---|
[2] | 106 | bool isAnimated() const;
|
---|
| 107 | bool isDockNestingEnabled() const;
|
---|
[651] | 108 | #endif
|
---|
[2] | 109 |
|
---|
| 110 | #ifndef QT_NO_TABBAR
|
---|
| 111 | bool documentMode() const;
|
---|
| 112 | void setDocumentMode(bool enabled);
|
---|
| 113 | #endif
|
---|
| 114 |
|
---|
| 115 | #ifndef QT_NO_TABWIDGET
|
---|
| 116 | QTabWidget::TabShape tabShape() const;
|
---|
| 117 | void setTabShape(QTabWidget::TabShape tabShape);
|
---|
| 118 | QTabWidget::TabPosition tabPosition(Qt::DockWidgetArea area) const;
|
---|
| 119 | void setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition);
|
---|
| 120 | #endif // QT_NO_TABWIDGET
|
---|
| 121 |
|
---|
| 122 | void setDockOptions(DockOptions options);
|
---|
| 123 | DockOptions dockOptions() const;
|
---|
| 124 |
|
---|
| 125 | bool isSeparator(const QPoint &pos) const;
|
---|
| 126 |
|
---|
| 127 | #ifndef QT_NO_MENUBAR
|
---|
| 128 | QMenuBar *menuBar() const;
|
---|
| 129 | void setMenuBar(QMenuBar *menubar);
|
---|
| 130 |
|
---|
| 131 | QWidget *menuWidget() const;
|
---|
| 132 | void setMenuWidget(QWidget *menubar);
|
---|
| 133 | #endif
|
---|
| 134 |
|
---|
| 135 | #ifndef QT_NO_STATUSBAR
|
---|
| 136 | QStatusBar *statusBar() const;
|
---|
| 137 | void setStatusBar(QStatusBar *statusbar);
|
---|
| 138 | #endif
|
---|
| 139 |
|
---|
| 140 | QWidget *centralWidget() const;
|
---|
| 141 | void setCentralWidget(QWidget *widget);
|
---|
| 142 |
|
---|
| 143 | #ifndef QT_NO_DOCKWIDGET
|
---|
| 144 | void setCorner(Qt::Corner corner, Qt::DockWidgetArea area);
|
---|
| 145 | Qt::DockWidgetArea corner(Qt::Corner corner) const;
|
---|
| 146 | #endif
|
---|
| 147 |
|
---|
| 148 | #ifndef QT_NO_TOOLBAR
|
---|
| 149 | void addToolBarBreak(Qt::ToolBarArea area = Qt::TopToolBarArea);
|
---|
| 150 | void insertToolBarBreak(QToolBar *before);
|
---|
| 151 |
|
---|
| 152 | void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar);
|
---|
| 153 | void addToolBar(QToolBar *toolbar);
|
---|
| 154 | QToolBar *addToolBar(const QString &title);
|
---|
| 155 | void insertToolBar(QToolBar *before, QToolBar *toolbar);
|
---|
| 156 | void removeToolBar(QToolBar *toolbar);
|
---|
| 157 | void removeToolBarBreak(QToolBar *before);
|
---|
| 158 |
|
---|
| 159 | void setUnifiedTitleAndToolBarOnMac(bool set);
|
---|
| 160 | bool unifiedTitleAndToolBarOnMac() const;
|
---|
| 161 |
|
---|
| 162 | Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const;
|
---|
| 163 | bool toolBarBreak(QToolBar *toolbar) const;
|
---|
| 164 | #endif
|
---|
| 165 | #ifndef QT_NO_DOCKWIDGET
|
---|
| 166 | void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget);
|
---|
| 167 | void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget,
|
---|
| 168 | Qt::Orientation orientation);
|
---|
| 169 | void splitDockWidget(QDockWidget *after, QDockWidget *dockwidget,
|
---|
| 170 | Qt::Orientation orientation);
|
---|
| 171 | void tabifyDockWidget(QDockWidget *first, QDockWidget *second);
|
---|
| 172 | QList<QDockWidget*> tabifiedDockWidgets(QDockWidget *dockwidget) const;
|
---|
| 173 | void removeDockWidget(QDockWidget *dockwidget);
|
---|
| 174 | bool restoreDockWidget(QDockWidget *dockwidget);
|
---|
| 175 |
|
---|
| 176 | Qt::DockWidgetArea dockWidgetArea(QDockWidget *dockwidget) const;
|
---|
| 177 | #endif // QT_NO_DOCKWIDGET
|
---|
| 178 |
|
---|
| 179 | QByteArray saveState(int version = 0) const;
|
---|
| 180 | bool restoreState(const QByteArray &state, int version = 0);
|
---|
| 181 |
|
---|
| 182 | #ifndef QT_NO_MENU
|
---|
| 183 | virtual QMenu *createPopupMenu();
|
---|
| 184 | #endif
|
---|
| 185 |
|
---|
| 186 | #ifdef QT3_SUPPORT
|
---|
| 187 | QT3_SUPPORT_CONSTRUCTOR QMainWindow(QWidget *parent, const char *name, Qt::WindowFlags flags = 0);
|
---|
| 188 | #endif
|
---|
| 189 |
|
---|
| 190 | #ifndef QT_NO_DOCKWIDGET
|
---|
| 191 | public Q_SLOTS:
|
---|
| 192 | void setAnimated(bool enabled);
|
---|
| 193 | void setDockNestingEnabled(bool enabled);
|
---|
| 194 | #endif
|
---|
| 195 |
|
---|
| 196 | Q_SIGNALS:
|
---|
| 197 | void iconSizeChanged(const QSize &iconSize);
|
---|
| 198 | void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle);
|
---|
| 199 |
|
---|
| 200 | protected:
|
---|
| 201 | #ifndef QT_NO_CONTEXTMENU
|
---|
| 202 | void contextMenuEvent(QContextMenuEvent *event);
|
---|
| 203 | #endif
|
---|
| 204 | bool event(QEvent *event);
|
---|
| 205 |
|
---|
| 206 | private:
|
---|
| 207 | Q_DECLARE_PRIVATE(QMainWindow)
|
---|
| 208 | Q_DISABLE_COPY(QMainWindow)
|
---|
| 209 | };
|
---|
| 210 |
|
---|
| 211 | Q_DECLARE_OPERATORS_FOR_FLAGS(QMainWindow::DockOptions)
|
---|
| 212 |
|
---|
| 213 | #endif // QT_NO_MAINWINDOW
|
---|
| 214 |
|
---|
| 215 | QT_END_NAMESPACE
|
---|
| 216 |
|
---|
| 217 | QT_END_HEADER
|
---|
| 218 |
|
---|
| 219 | #endif // QDYNAMICMAINWINDOW_H
|
---|