qmdisubwindow.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. #ifndef QMDISUBWINDOW_H
  40. #define QMDISUBWINDOW_H
  41. #include <QtWidgets/qwidget.h>
  42. QT_BEGIN_NAMESPACE
  43. #ifndef QT_NO_MDIAREA
  44. class QMenu;
  45. class QMdiArea;
  46. namespace QMdi { class ControlContainer; }
  47. class QMdiSubWindowPrivate;
  48. class Q_WIDGETS_EXPORT QMdiSubWindow : public QWidget
  49. {
  50. Q_OBJECT
  51. Q_PROPERTY(int keyboardSingleStep READ keyboardSingleStep WRITE setKeyboardSingleStep)
  52. Q_PROPERTY(int keyboardPageStep READ keyboardPageStep WRITE setKeyboardPageStep)
  53. public:
  54. enum SubWindowOption {
  55. AllowOutsideAreaHorizontally = 0x1, // internal
  56. AllowOutsideAreaVertically = 0x2, // internal
  57. RubberBandResize = 0x4,
  58. RubberBandMove = 0x8
  59. };
  60. Q_DECLARE_FLAGS(SubWindowOptions, SubWindowOption)
  61. QMdiSubWindow(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
  62. ~QMdiSubWindow();
  63. QSize sizeHint() const Q_DECL_OVERRIDE;
  64. QSize minimumSizeHint() const Q_DECL_OVERRIDE;
  65. void setWidget(QWidget *widget);
  66. QWidget *widget() const;
  67. QWidget *maximizedButtonsWidget() const; // internal
  68. QWidget *maximizedSystemMenuIconWidget() const; // internal
  69. bool isShaded() const;
  70. void setOption(SubWindowOption option, bool on = true);
  71. bool testOption(SubWindowOption) const;
  72. void setKeyboardSingleStep(int step);
  73. int keyboardSingleStep() const;
  74. void setKeyboardPageStep(int step);
  75. int keyboardPageStep() const;
  76. #ifndef QT_NO_MENU
  77. void setSystemMenu(QMenu *systemMenu);
  78. QMenu *systemMenu() const;
  79. #endif
  80. QMdiArea *mdiArea() const;
  81. Q_SIGNALS:
  82. void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState);
  83. void aboutToActivate();
  84. public Q_SLOTS:
  85. #ifndef QT_NO_MENU
  86. void showSystemMenu();
  87. #endif
  88. void showShaded();
  89. protected:
  90. bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
  91. bool event(QEvent *event) Q_DECL_OVERRIDE;
  92. void showEvent(QShowEvent *showEvent) Q_DECL_OVERRIDE;
  93. void hideEvent(QHideEvent *hideEvent) Q_DECL_OVERRIDE;
  94. void changeEvent(QEvent *changeEvent) Q_DECL_OVERRIDE;
  95. void closeEvent(QCloseEvent *closeEvent) Q_DECL_OVERRIDE;
  96. void leaveEvent(QEvent *leaveEvent) Q_DECL_OVERRIDE;
  97. void resizeEvent(QResizeEvent *resizeEvent) Q_DECL_OVERRIDE;
  98. void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
  99. void moveEvent(QMoveEvent *moveEvent) Q_DECL_OVERRIDE;
  100. void paintEvent(QPaintEvent *paintEvent) Q_DECL_OVERRIDE;
  101. void mousePressEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
  102. void mouseDoubleClickEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
  103. void mouseReleaseEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
  104. void mouseMoveEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
  105. void keyPressEvent(QKeyEvent *keyEvent) Q_DECL_OVERRIDE;
  106. #ifndef QT_NO_CONTEXTMENU
  107. void contextMenuEvent(QContextMenuEvent *contextMenuEvent) Q_DECL_OVERRIDE;
  108. #endif
  109. void focusInEvent(QFocusEvent *focusInEvent) Q_DECL_OVERRIDE;
  110. void focusOutEvent(QFocusEvent *focusOutEvent) Q_DECL_OVERRIDE;
  111. void childEvent(QChildEvent *childEvent) Q_DECL_OVERRIDE;
  112. private:
  113. Q_DISABLE_COPY(QMdiSubWindow)
  114. Q_DECLARE_PRIVATE(QMdiSubWindow)
  115. Q_PRIVATE_SLOT(d_func(), void _q_updateStaysOnTopHint())
  116. Q_PRIVATE_SLOT(d_func(), void _q_enterInteractiveMode())
  117. Q_PRIVATE_SLOT(d_func(), void _q_processFocusChanged(QWidget *, QWidget *))
  118. friend class QMdiAreaPrivate;
  119. #ifndef QT_NO_TABBAR
  120. friend class QMdiAreaTabBar;
  121. #endif
  122. friend class QMdi::ControlContainer;
  123. };
  124. Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiSubWindow::SubWindowOptions)
  125. QT_END_NAMESPACE
  126. #endif // QT_NO_MDIAREA
  127. #endif // QMDISUBWINDOW_H