1// qmdiarea.sip generated by MetaSIP
2//
3// This file is part of the QtWidgets Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QMdiArea : QAbstractScrollArea
24{
25%TypeHeaderCode
26#include <qmdiarea.h>
27%End
28
29public:
30    enum AreaOption
31    {
32        DontMaximizeSubWindowOnActivation,
33    };
34
35    typedef QFlags<QMdiArea::AreaOption> AreaOptions;
36
37    enum ViewMode
38    {
39        SubWindowView,
40        TabbedView,
41    };
42
43    enum WindowOrder
44    {
45        CreationOrder,
46        StackingOrder,
47        ActivationHistoryOrder,
48    };
49
50    QMdiArea(QWidget *parent /TransferThis/ = 0);
51    virtual ~QMdiArea();
52    virtual QSize sizeHint() const;
53    virtual QSize minimumSizeHint() const;
54    QMdiSubWindow *activeSubWindow() const;
55    QMdiSubWindow *addSubWindow(QWidget *widget /Transfer/, Qt::WindowFlags flags = Qt::WindowFlags());
56    QList<QMdiSubWindow *> subWindowList(QMdiArea::WindowOrder order = QMdiArea::CreationOrder) const;
57    QMdiSubWindow *currentSubWindow() const;
58    void removeSubWindow(QWidget *widget /GetWrapper/);
59%MethodCode
60        // We need to implement /TransferBack/ on the argument, but it might be the
61        // QMdiSubWindow that wraps the widget we are really after.
62        QMdiSubWindow *swin = qobject_cast<QMdiSubWindow *>(a0);
63
64        if (swin)
65        {
66            QWidget *w = swin->widget();
67
68            a0Wrapper = (w ? sipGetPyObject(w, sipType_QWidget) : 0);
69        }
70        else
71            a0Wrapper = 0;
72
73        Py_BEGIN_ALLOW_THREADS
74        sipCpp->removeSubWindow(a0);
75        Py_END_ALLOW_THREADS
76
77        if (a0Wrapper)
78            sipTransferBack(a0Wrapper);
79%End
80
81    QBrush background() const;
82    void setBackground(const QBrush &background);
83    void setOption(QMdiArea::AreaOption option, bool on = true);
84    bool testOption(QMdiArea::AreaOption opton) const;
85
86signals:
87    void subWindowActivated(QMdiSubWindow *);
88
89public slots:
90    void setActiveSubWindow(QMdiSubWindow *window);
91    void tileSubWindows();
92    void cascadeSubWindows();
93    void closeActiveSubWindow();
94    void closeAllSubWindows();
95    void activateNextSubWindow();
96    void activatePreviousSubWindow();
97
98protected:
99    virtual void setupViewport(QWidget *viewport);
100    virtual bool event(QEvent *event);
101    virtual bool eventFilter(QObject *object, QEvent *event);
102    virtual void paintEvent(QPaintEvent *paintEvent);
103    virtual void childEvent(QChildEvent *childEvent);
104    virtual void resizeEvent(QResizeEvent *resizeEvent);
105    virtual void timerEvent(QTimerEvent *timerEvent);
106    virtual void showEvent(QShowEvent *showEvent);
107    virtual bool viewportEvent(QEvent *event);
108    virtual void scrollContentsBy(int dx, int dy);
109
110public:
111    QMdiArea::WindowOrder activationOrder() const;
112    void setActivationOrder(QMdiArea::WindowOrder order);
113    void setViewMode(QMdiArea::ViewMode mode);
114    QMdiArea::ViewMode viewMode() const;
115    void setTabShape(QTabWidget::TabShape shape);
116    QTabWidget::TabShape tabShape() const;
117    void setTabPosition(QTabWidget::TabPosition position);
118    QTabWidget::TabPosition tabPosition() const;
119    bool documentMode() const;
120    void setDocumentMode(bool enabled);
121    void setTabsClosable(bool closable);
122    bool tabsClosable() const;
123    void setTabsMovable(bool movable);
124    bool tabsMovable() const;
125};
126
127QFlags<QMdiArea::AreaOption> operator|(QMdiArea::AreaOption f1, QFlags<QMdiArea::AreaOption> f2);
128