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.abstractspinbox; 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.size; 22 import qt.core.string; 23 import qt.core.variant; 24 import qt.gui.event; 25 import qt.helpers; 26 import qt.widgets.lineedit; 27 import qt.widgets.styleoption; 28 import qt.widgets.widget; 29 version(QT_NO_VALIDATOR){}else 30 import qt.gui.validator; 31 32 /+ QT_REQUIRE_CONFIG(spinbox); 33 34 35 class QLineEdit; +/ 36 37 extern(C++, class) struct QAbstractSpinBoxPrivate; 38 /+ class QStyleOptionSpinBox; +/ 39 40 class /+ Q_WIDGETS_EXPORT +/ QAbstractSpinBox : QWidget 41 { 42 mixin(Q_OBJECT); 43 44 /+ Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping) 45 Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) 46 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) 47 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) 48 Q_PROPERTY(ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols) 49 Q_PROPERTY(QString specialValueText READ specialValueText WRITE setSpecialValueText) 50 Q_PROPERTY(QString text READ text) 51 Q_PROPERTY(bool accelerated READ isAccelerated WRITE setAccelerated) 52 Q_PROPERTY(CorrectionMode correctionMode READ correctionMode WRITE setCorrectionMode) 53 Q_PROPERTY(bool acceptableInput READ hasAcceptableInput) 54 Q_PROPERTY(bool keyboardTracking READ keyboardTracking WRITE setKeyboardTracking) 55 Q_PROPERTY(bool showGroupSeparator READ isGroupSeparatorShown WRITE setGroupSeparatorShown) +/ 56 public: 57 /+ explicit +/this(QWidget parent = null); 58 ~this(); 59 60 enum StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01, 61 StepDownEnabled = 0x02 } 62 /+ Q_DECLARE_FLAGS(StepEnabled, StepEnabledFlag) +/ 63 alias StepEnabled = QFlags!(StepEnabledFlag); 64 enum ButtonSymbols { UpDownArrows, PlusMinus, NoButtons } 65 /+ Q_ENUM(ButtonSymbols) +/ 66 67 final ButtonSymbols buttonSymbols() const; 68 final void setButtonSymbols(ButtonSymbols bs); 69 70 enum CorrectionMode { CorrectToPreviousValue, CorrectToNearestValue } 71 /+ Q_ENUM(CorrectionMode) +/ 72 73 final void setCorrectionMode(CorrectionMode cm); 74 final CorrectionMode correctionMode() const; 75 76 final bool hasAcceptableInput() const; 77 final QString text() const; 78 79 final QString specialValueText() const; 80 final void setSpecialValueText(ref const(QString) txt); 81 82 final bool wrapping() const; 83 final void setWrapping(bool w); 84 85 final void setReadOnly(bool r); 86 final bool isReadOnly() const; 87 88 final void setKeyboardTracking(bool kt); 89 final bool keyboardTracking() const; 90 91 final void setAlignment(/+ Qt:: +/qt.core.namespace.Alignment flag); 92 final /+ Qt:: +/qt.core.namespace.Alignment alignment() const; 93 94 final void setFrame(bool); 95 final bool hasFrame() const; 96 97 final void setAccelerated(bool on); 98 final bool isAccelerated() const; 99 100 final void setGroupSeparatorShown(bool shown); 101 final bool isGroupSeparatorShown() const; 102 103 override QSize sizeHint() const; 104 override QSize minimumSizeHint() const; 105 final void interpretText(); 106 override bool event(QEvent event); 107 108 override QVariant inputMethodQuery(/+ Qt:: +/qt.core.namespace.InputMethodQuery) const; 109 110 /+ virtual +/ QValidator.State validate(ref QString input, ref int pos) const; 111 /+ virtual +/ void fixup(ref QString input) const; 112 113 /+ virtual +/ void stepBy(int steps); 114 115 enum StepType { 116 DefaultStepType, 117 AdaptiveDecimalStepType 118 } 119 /+ Q_ENUM(StepType) +/ 120 121 public /+ Q_SLOTS +/: 122 @QSlot final void stepUp(); 123 @QSlot final void stepDown(); 124 @QSlot final void selectAll(); 125 /+ virtual +/ @QSlot void clear(); 126 protected: 127 override void resizeEvent(QResizeEvent event); 128 override void keyPressEvent(QKeyEvent event); 129 override void keyReleaseEvent(QKeyEvent event); 130 /+ #if QT_CONFIG(wheelevent) +/ 131 override void wheelEvent(QWheelEvent event); 132 /+ #endif +/ 133 override void focusInEvent(QFocusEvent event); 134 override void focusOutEvent(QFocusEvent event); 135 /+ #if QT_CONFIG(contextmenu) +/ 136 override void contextMenuEvent(QContextMenuEvent event); 137 /+ #endif +/ 138 override void changeEvent(QEvent event); 139 override void closeEvent(QCloseEvent event); 140 override void hideEvent(QHideEvent event); 141 override void mousePressEvent(QMouseEvent event); 142 override void mouseReleaseEvent(QMouseEvent event); 143 override void mouseMoveEvent(QMouseEvent event); 144 override void timerEvent(QTimerEvent event); 145 override void paintEvent(QPaintEvent event); 146 override void showEvent(QShowEvent event); 147 final void initStyleOption(QStyleOptionSpinBox* option) const; 148 149 final QLineEdit lineEdit() const; 150 final void setLineEdit(QLineEdit edit); 151 152 /+ virtual +/ StepEnabled stepEnabled() const; 153 /+ Q_SIGNALS +/public: 154 @QSignal final void editingFinished(); 155 protected: 156 this(ref QAbstractSpinBoxPrivate dd, QWidget parent = null); 157 158 private: 159 /+ Q_PRIVATE_SLOT(d_func(), void _q_editorTextChanged(const QString &)) 160 Q_PRIVATE_SLOT(d_func(), void _q_editorCursorPositionChanged(int, int)) 161 162 Q_DECLARE_PRIVATE(QAbstractSpinBox) +/ 163 /+ Q_DISABLE_COPY(QAbstractSpinBox) +/ 164 /+ friend class QAccessibleAbstractSpinBox; +/ 165 } 166 /+pragma(inline, true) QFlags!(QAbstractSpinBox.StepEnabled.enum_type) operator |(QAbstractSpinBox.StepEnabled.enum_type f1, QAbstractSpinBox.StepEnabled.enum_type f2)/+noexcept+/{return QFlags!(QAbstractSpinBox.StepEnabled.enum_type)(f1)|f2;}+/ 167 /+pragma(inline, true) QFlags!(QAbstractSpinBox.StepEnabled.enum_type) operator |(QAbstractSpinBox.StepEnabled.enum_type f1, QFlags!(QAbstractSpinBox.StepEnabled.enum_type) f2)/+noexcept+/{return f2|f1;}+/ 168 /+pragma(inline, true) QIncompatibleFlag operator |(QAbstractSpinBox.StepEnabled.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/ 169 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled) +/