1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.widgets.dockwidget;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.coreevent;
19 import qt.core.flags;
20 import qt.core.namespace;
21 import qt.core.string;
22 import qt.gui.event;
23 import qt.helpers;
24 import qt.widgets.styleoption;
25 import qt.widgets.widget;
26 version(QT_NO_ACTION){}else
27     import qt.widgets.action;
28 
29 /+ QT_REQUIRE_CONFIG(dockwidget); +/
30 
31 
32 extern(C++, class) struct QDockAreaLayout;
33 extern(C++, class) struct QDockWidgetPrivate;
34 /+ class QMainWindow;
35 class QStyleOptionDockWidget; +/
36 
37 class /+ Q_WIDGETS_EXPORT +/ QDockWidget : QWidget
38 {
39     mixin(Q_OBJECT);
40 
41     /+ Q_PROPERTY(bool floating READ isFloating WRITE setFloating)
42     Q_PROPERTY(DockWidgetFeatures features READ features WRITE setFeatures NOTIFY featuresChanged)
43     Q_PROPERTY(Qt::DockWidgetAreas allowedAreas READ allowedAreas
44                WRITE setAllowedAreas NOTIFY allowedAreasChanged)
45     Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE true) +/
46 
47 public:
48     /+ explicit +/this(ref const(QString) title, QWidget parent = null,
49                              /+ Qt:: +/qt.core.namespace.WindowFlags flags = /+ Qt:: +/qt.core.namespace.WindowFlags());
50     /+ explicit +/this(QWidget parent = null, /+ Qt:: +/qt.core.namespace.WindowFlags flags = /+ Qt:: +/qt.core.namespace.WindowFlags());
51     ~this();
52 
53     final QWidget widget() const;
54     final void setWidget(QWidget widget);
55 
56     enum DockWidgetFeature {
57         DockWidgetClosable    = 0x01,
58         DockWidgetMovable     = 0x02,
59         DockWidgetFloatable   = 0x04,
60         DockWidgetVerticalTitleBar = 0x08,
61 
62         DockWidgetFeatureMask = 0x0f,
63 /+ #if QT_DEPRECATED_SINCE(5, 15) +/
64         AllDockWidgetFeatures /+ Q_DECL_ENUMERATOR_DEPRECATED +/ =
65             DockWidgetFeature.DockWidgetClosable|DockWidgetFeature.DockWidgetMovable|DockWidgetFeature.DockWidgetFloatable, // ### Qt 6: remove
66 /+ #endif +/
67         NoDockWidgetFeatures  = 0x00,
68 
69         Reserved              = 0xff
70     }
71     /+ Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature) +/
72 alias DockWidgetFeatures = QFlags!(DockWidgetFeature);    /+ Q_FLAG(DockWidgetFeatures) +/
73 
74     final void setFeatures(DockWidgetFeatures features);
75     final DockWidgetFeatures features() const;
76 
77     final void setFloating(bool floating);
78     pragma(inline, true) final bool isFloating() const { return isWindow(); }
79 
80     final void setAllowedAreas(/+ Qt:: +/qt.core.namespace.DockWidgetAreas areas);
81     final /+ Qt:: +/qt.core.namespace.DockWidgetAreas allowedAreas() const;
82 
83     final void setTitleBarWidget(QWidget widget);
84     final QWidget titleBarWidget() const;
85 
86     pragma(inline, true) final bool isAreaAllowed(/+ Qt:: +/qt.core.namespace.DockWidgetArea area) const
87     { return (allowedAreas() & area) == qt.core.namespace.DockWidgetAreas(area); }
88 
89     version(QT_NO_ACTION){}else
90     {
91         final QAction toggleViewAction() const;
92     }
93 
94 /+ Q_SIGNALS +/public:
95     @QSignal final void featuresChanged(QDockWidget.DockWidgetFeatures features);
96     @QSignal final void topLevelChanged(bool topLevel);
97     @QSignal final void allowedAreasChanged(/+ Qt:: +/qt.core.namespace.DockWidgetAreas allowedAreas);
98     @QSignal final void visibilityChanged(bool visible);
99     @QSignal final void dockLocationChanged(/+ Qt:: +/qt.core.namespace.DockWidgetArea area);
100 
101 protected:
102     override void changeEvent(QEvent event);
103     override void closeEvent(QCloseEvent event);
104     override void paintEvent(QPaintEvent event);
105     override bool event(QEvent event);
106 //    final void initStyleOption(QStyleOptionDockWidget* option) const;
107 
108 private:
109     /+ Q_DECLARE_PRIVATE(QDockWidget) +/
110     /+ Q_DISABLE_COPY(QDockWidget) +/
111     /+ Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool))
112     Q_PRIVATE_SLOT(d_func(), void _q_toggleTopLevel()) +/
113     /+ friend class QDockAreaLayout; +/
114     /+ friend class QDockWidgetItem; +/
115     /+ friend class QMainWindowLayout; +/
116     /+ friend class QDockWidgetLayout; +/
117     /+ friend class QDockAreaLayoutInfo; +/
118 }
119 /+pragma(inline, true) QFlags!(QDockWidget.DockWidgetFeatures.enum_type) operator |(QDockWidget.DockWidgetFeatures.enum_type f1, QDockWidget.DockWidgetFeatures.enum_type f2)/+noexcept+/{return QFlags!(QDockWidget.DockWidgetFeatures.enum_type)(f1)|f2;}+/
120 /+pragma(inline, true) QFlags!(QDockWidget.DockWidgetFeatures.enum_type) operator |(QDockWidget.DockWidgetFeatures.enum_type f1, QFlags!(QDockWidget.DockWidgetFeatures.enum_type) f2)/+noexcept+/{return f2|f1;}+/
121 /+pragma(inline, true) QIncompatibleFlag operator |(QDockWidget.DockWidgetFeatures.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/
122 
123 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QDockWidget::DockWidgetFeatures) +/