1 /* 2 * DQt - D bindings for the Qt Toolkit 3 * 4 * GNU Lesser General Public License Usage 5 * This file may be used under the terms of the GNU Lesser 6 * General Public License version 3 as published by the Free Software 7 * Foundation and appearing in the file LICENSE.LGPL3 included in the 8 * packaging of this file. Please review the following information to 9 * ensure the GNU Lesser General Public License version 3 requirements 10 * will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 11 */ 12 module qt.widgets.frame; 13 extern(C++): 14 15 import qt.config; 16 import qt.core.coreevent; 17 import qt.core.namespace; 18 import qt.core.rect; 19 import qt.core.size; 20 import qt.gui.event; 21 import qt.gui.painter; 22 import qt.helpers; 23 import qt.widgets.styleoption; 24 import qt.widgets.widget; 25 26 extern(C++, class) struct QFramePrivate; 27 28 /// Binding for C++ class [QFrame](https://doc.qt.io/qt-6/qframe.html). 29 class /+ Q_WIDGETS_EXPORT +/ QFrame : QWidget 30 { 31 mixin(Q_OBJECT); 32 33 /+ Q_PROPERTY(Shape frameShape READ frameShape WRITE setFrameShape) 34 Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow) 35 Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth) 36 Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth) 37 Q_PROPERTY(int frameWidth READ frameWidth) 38 Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false) +/ 39 40 public: 41 /+ explicit +/this(QWidget parent = null, /+ Qt:: +/qt.core.namespace.WindowFlags f = /+ Qt:: +/qt.core.namespace.WindowFlags()); 42 ~this(); 43 44 final int frameStyle() const; 45 final void setFrameStyle(int); 46 47 final int frameWidth() const; 48 49 override QSize sizeHint() const; 50 51 enum Shape { 52 NoFrame = 0, // no frame 53 Box = 0x0001, // rectangular box 54 Panel = 0x0002, // rectangular panel 55 WinPanel = 0x0003, // rectangular panel (Windows) 56 HLine = 0x0004, // horizontal line 57 VLine = 0x0005, // vertical line 58 StyledPanel = 0x0006 // rectangular panel depending on the GUI style 59 } 60 /+ Q_ENUM(Shape) +/ 61 enum Shadow { 62 Plain = 0x0010, // plain line 63 Raised = 0x0020, // raised shadow effect 64 Sunken = 0x0030 // sunken shadow effect 65 } 66 /+ Q_ENUM(Shadow) +/ 67 68 enum StyleMask { 69 Shadow_Mask = 0x00f0, // mask for the shadow 70 Shape_Mask = 0x000f // mask for the shape 71 } 72 73 final Shape frameShape() const; 74 final void setFrameShape(Shape); 75 final Shadow frameShadow() const; 76 final void setFrameShadow(Shadow); 77 78 final int lineWidth() const; 79 final void setLineWidth(int); 80 81 final int midLineWidth() const; 82 final void setMidLineWidth(int); 83 84 final QRect frameRect() const; 85 final void setFrameRect(ref const(QRect) ); 86 87 protected: 88 override bool event(QEvent e); 89 override void paintEvent(QPaintEvent ); 90 override void changeEvent(QEvent ); 91 final void drawFrame(QPainter* ); 92 93 94 protected: 95 this(ref QFramePrivate dd, QWidget parent = null, /+ Qt:: +/qt.core.namespace.WindowFlags f = /+ Qt:: +/qt.core.namespace.WindowFlags()); 96 /+ virtual +/ void initStyleOption(QStyleOptionFrame* option) const; 97 98 private: 99 /+ Q_DISABLE_COPY(QFrame) +/ 100 /+ Q_DECLARE_PRIVATE(QFrame) +/ 101 mixin(CREATE_CONVENIENCE_WRAPPERS); 102 } 103