| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #ifndef QMDISUBWINDOW_H |
| 41 | #define QMDISUBWINDOW_H |
| 42 | |
| 43 | #include <QtWidgets/qtwidgetsglobal.h> |
| 44 | #include <QtWidgets/qwidget.h> |
| 45 | |
| 46 | QT_REQUIRE_CONFIG(mdiarea); |
| 47 | |
| 48 | QT_BEGIN_NAMESPACE |
| 49 | |
| 50 | class ; |
| 51 | class QMdiArea; |
| 52 | |
| 53 | namespace QMdi { class ControlContainer; } |
| 54 | class QMdiSubWindowPrivate; |
| 55 | class Q_WIDGETS_EXPORT QMdiSubWindow : public QWidget |
| 56 | { |
| 57 | Q_OBJECT |
| 58 | Q_PROPERTY(int keyboardSingleStep READ keyboardSingleStep WRITE setKeyboardSingleStep) |
| 59 | Q_PROPERTY(int keyboardPageStep READ keyboardPageStep WRITE setKeyboardPageStep) |
| 60 | public: |
| 61 | enum SubWindowOption { |
| 62 | AllowOutsideAreaHorizontally = 0x1, // internal |
| 63 | AllowOutsideAreaVertically = 0x2, // internal |
| 64 | RubberBandResize = 0x4, |
| 65 | RubberBandMove = 0x8 |
| 66 | }; |
| 67 | Q_DECLARE_FLAGS(SubWindowOptions, SubWindowOption) |
| 68 | |
| 69 | QMdiSubWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); |
| 70 | ~QMdiSubWindow(); |
| 71 | |
| 72 | QSize sizeHint() const override; |
| 73 | QSize minimumSizeHint() const override; |
| 74 | |
| 75 | void setWidget(QWidget *widget); |
| 76 | QWidget *widget() const; |
| 77 | |
| 78 | QWidget *maximizedButtonsWidget() const; // internal |
| 79 | QWidget *() const; // internal |
| 80 | |
| 81 | bool isShaded() const; |
| 82 | |
| 83 | void setOption(SubWindowOption option, bool on = true); |
| 84 | bool testOption(SubWindowOption) const; |
| 85 | |
| 86 | void setKeyboardSingleStep(int step); |
| 87 | int keyboardSingleStep() const; |
| 88 | |
| 89 | void setKeyboardPageStep(int step); |
| 90 | int keyboardPageStep() const; |
| 91 | |
| 92 | #if QT_CONFIG(menu) |
| 93 | void (QMenu *); |
| 94 | QMenu *() const; |
| 95 | #endif |
| 96 | |
| 97 | QMdiArea *mdiArea() const; |
| 98 | |
| 99 | Q_SIGNALS: |
| 100 | void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState); |
| 101 | void aboutToActivate(); |
| 102 | |
| 103 | public Q_SLOTS: |
| 104 | #if QT_CONFIG(menu) |
| 105 | void (); |
| 106 | #endif |
| 107 | void showShaded(); |
| 108 | |
| 109 | protected: |
| 110 | bool eventFilter(QObject *object, QEvent *event) override; |
| 111 | bool event(QEvent *event) override; |
| 112 | void showEvent(QShowEvent *showEvent) override; |
| 113 | void hideEvent(QHideEvent *hideEvent) override; |
| 114 | void changeEvent(QEvent *changeEvent) override; |
| 115 | void closeEvent(QCloseEvent *closeEvent) override; |
| 116 | void leaveEvent(QEvent *leaveEvent) override; |
| 117 | void resizeEvent(QResizeEvent *resizeEvent) override; |
| 118 | void timerEvent(QTimerEvent *timerEvent) override; |
| 119 | void moveEvent(QMoveEvent *moveEvent) override; |
| 120 | void paintEvent(QPaintEvent *paintEvent) override; |
| 121 | void mousePressEvent(QMouseEvent *mouseEvent) override; |
| 122 | void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override; |
| 123 | void mouseReleaseEvent(QMouseEvent *mouseEvent) override; |
| 124 | void mouseMoveEvent(QMouseEvent *mouseEvent) override; |
| 125 | void keyPressEvent(QKeyEvent *keyEvent) override; |
| 126 | #ifndef QT_NO_CONTEXTMENU |
| 127 | void (QContextMenuEvent *) override; |
| 128 | #endif |
| 129 | void focusInEvent(QFocusEvent *focusInEvent) override; |
| 130 | void focusOutEvent(QFocusEvent *focusOutEvent) override; |
| 131 | void childEvent(QChildEvent *childEvent) override; |
| 132 | |
| 133 | private: |
| 134 | Q_DISABLE_COPY(QMdiSubWindow) |
| 135 | Q_DECLARE_PRIVATE(QMdiSubWindow) |
| 136 | Q_PRIVATE_SLOT(d_func(), void _q_updateStaysOnTopHint()) |
| 137 | Q_PRIVATE_SLOT(d_func(), void _q_enterInteractiveMode()) |
| 138 | Q_PRIVATE_SLOT(d_func(), void _q_processFocusChanged(QWidget *, QWidget *)) |
| 139 | friend class QMdiAreaPrivate; |
| 140 | #if QT_CONFIG(tabbar) |
| 141 | friend class QMdiAreaTabBar; |
| 142 | #endif |
| 143 | friend class QMdi::ControlContainer; |
| 144 | }; |
| 145 | |
| 146 | Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiSubWindow::SubWindowOptions) |
| 147 | |
| 148 | QT_END_NAMESPACE |
| 149 | |
| 150 | #endif // QMDISUBWINDOW_H |
| 151 | |