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.splitter; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.bytearray; 19 import qt.core.coreevent; 20 import qt.core.list; 21 import qt.core.namespace; 22 import qt.core.size; 23 import qt.gui.event; 24 import qt.helpers; 25 import qt.widgets.frame; 26 import qt.widgets.widget; 27 28 /+ QT_REQUIRE_CONFIG(splitter); +/ 29 30 31 extern(C++, class) struct QSplitterPrivate; 32 /+ class QTextStream; 33 template <typename T> class QList; 34 35 class QSplitterHandle; +/ 36 37 class /+ Q_WIDGETS_EXPORT +/ QSplitter : QFrame 38 { 39 mixin(Q_OBJECT); 40 41 /+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) 42 Q_PROPERTY(bool opaqueResize READ opaqueResize WRITE setOpaqueResize) 43 Q_PROPERTY(int handleWidth READ handleWidth WRITE setHandleWidth) 44 Q_PROPERTY(bool childrenCollapsible READ childrenCollapsible WRITE setChildrenCollapsible) +/ 45 46 public: 47 /+ explicit +/this(QWidget parent = null); 48 /+ explicit +/this(/+ Qt:: +/qt.core.namespace.Orientation, QWidget parent = null); 49 ~this(); 50 51 final void addWidget(QWidget widget); 52 final void insertWidget(int index, QWidget widget); 53 final QWidget replaceWidget(int index, QWidget widget); 54 55 final void setOrientation(/+ Qt:: +/qt.core.namespace.Orientation); 56 final /+ Qt:: +/qt.core.namespace.Orientation orientation() const; 57 58 final void setChildrenCollapsible(bool); 59 final bool childrenCollapsible() const; 60 61 final void setCollapsible(int index, bool); 62 final bool isCollapsible(int index) const; 63 final void setOpaqueResize(bool opaque = true); 64 final bool opaqueResize() const; 65 final void refresh(); 66 67 override QSize sizeHint() const; 68 override QSize minimumSizeHint() const; 69 70 final QList!(int) sizes() const; 71 final void setSizes(ref const(QList!(int)) list); 72 73 final QByteArray saveState() const; 74 final bool restoreState(ref const(QByteArray) state); 75 76 final int handleWidth() const; 77 final void setHandleWidth(int); 78 79 final int indexOf(QWidget w) const; 80 final QWidget widget(int index) const; 81 final int count() const; 82 83 final void getRange(int index, int* , int* ) const; 84 final QSplitterHandle handle(int index) const; 85 86 final void setStretchFactor(int index, int stretch); 87 88 /+ Q_SIGNALS +/public: 89 @QSignal final void splitterMoved(int pos, int index); 90 91 protected: 92 /+ virtual +/ QSplitterHandle createHandle(); 93 94 override void childEvent(QChildEvent ); 95 96 override bool event(QEvent ); 97 override void resizeEvent(QResizeEvent ); 98 99 override void changeEvent(QEvent ); 100 final void moveSplitter(int pos, int index); 101 final void setRubberBand(int position); 102 final int closestLegalPosition(int, int); 103 104 105 private: 106 /+ Q_DISABLE_COPY(QSplitter) +/ 107 /+ Q_DECLARE_PRIVATE(QSplitter) +/ 108 private: 109 /+ friend class QSplitterHandle; +/ 110 } 111 112 /+ #if QT_DEPRECATED_SINCE(5, 13) 113 QT_DEPRECATED_X("Use QSplitter::saveState() instead") 114 Q_WIDGETS_EXPORT QTextStream& operator<<(QTextStream&, const QSplitter&); 115 QT_DEPRECATED_X("Use QSplitter::restoreState() instead") 116 Q_WIDGETS_EXPORT QTextStream& operator>>(QTextStream&, QSplitter&); 117 #endif +/ 118 119 extern(C++, class) struct QSplitterHandlePrivate; 120 class /+ Q_WIDGETS_EXPORT +/ QSplitterHandle : QWidget 121 { 122 mixin(Q_OBJECT); 123 public: 124 /+ explicit +/this(/+ Qt:: +/qt.core.namespace.Orientation o, QSplitter parent); 125 ~this(); 126 127 final void setOrientation(/+ Qt:: +/qt.core.namespace.Orientation o); 128 final /+ Qt:: +/qt.core.namespace.Orientation orientation() const; 129 final bool opaqueResize() const; 130 final QSplitter splitter() const; 131 132 override QSize sizeHint() const; 133 134 protected: 135 override void paintEvent(QPaintEvent ); 136 override void mouseMoveEvent(QMouseEvent ); 137 override void mousePressEvent(QMouseEvent ); 138 override void mouseReleaseEvent(QMouseEvent ); 139 override void resizeEvent(QResizeEvent ); 140 override bool event(QEvent ); 141 142 final void moveSplitter(int p); 143 final int closestLegalPosition(int p); 144 145 private: 146 /+ Q_DISABLE_COPY(QSplitterHandle) +/ 147 /+ Q_DECLARE_PRIVATE(QSplitterHandle) +/ 148 } 149