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.spinbox;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.coreevent;
19 import qt.core.string;
20 import qt.helpers;
21 import qt.widgets.abstractspinbox;
22 import qt.widgets.widget;
23 version(QT_NO_VALIDATOR){}else
24     import qt.gui.validator;
25 
26 /+ QT_REQUIRE_CONFIG(spinbox); +/
27 
28 
29 extern(C++, class) struct QSpinBoxPrivate;
30 class /+ Q_WIDGETS_EXPORT +/ QSpinBox : QAbstractSpinBox
31 {
32     mixin(Q_OBJECT);
33 
34     /+ Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
35     Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
36     Q_PROPERTY(QString cleanText READ cleanText)
37     Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
38     Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
39     Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
40     Q_PROPERTY(StepType stepType READ stepType WRITE setStepType)
41     Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true)
42     Q_PROPERTY(int displayIntegerBase READ displayIntegerBase WRITE setDisplayIntegerBase) +/
43 
44 public:
45     /+ explicit +/this(QWidget parent = null);
46     ~this();
47 
48     final int value() const;
49 
50     final QString prefix() const;
51     final void setPrefix(ref const(QString) prefix);
52 
53     final QString suffix() const;
54     final void setSuffix(ref const(QString) suffix);
55 
56     final QString cleanText() const;
57 
58     final int singleStep() const;
59     final void setSingleStep(int val);
60 
61     final int minimum() const;
62     final void setMinimum(int min);
63 
64     final int maximum() const;
65     final void setMaximum(int max);
66 
67     final void setRange(int min, int max);
68 
69     final StepType stepType() const;
70     final void setStepType(StepType stepType);
71 
72     final int displayIntegerBase() const;
73     final void setDisplayIntegerBase(int base);
74 
75 protected:
76     override bool event(QEvent event);
77     override QValidator.State validate(ref QString input, ref int pos) const;
78     /+ virtual +/ int valueFromText(ref const(QString) text) const;
79     /+ virtual +/ QString textFromValue(int val) const;
80     override void fixup(ref QString str) const;
81 
82 
83 public /+ Q_SLOTS +/:
84     @QSlot final void setValue(int val);
85 
86 /+ Q_SIGNALS +/public:
87     @QSignal final void valueChanged(int);
88     @QSignal final void textChanged(ref const(QString) );
89 /+ #if QT_DEPRECATED_SINCE(5, 14) +/
90     /+ QT_DEPRECATED_X("Use textChanged(QString) instead") +/
91         @QSignal final void valueChanged(ref const(QString) );
92 /+ #endif +/
93 
94 private:
95     /+ Q_DISABLE_COPY(QSpinBox) +/
96     /+ Q_DECLARE_PRIVATE(QSpinBox) +/
97 }
98 
99 extern(C++, class) struct QDoubleSpinBoxPrivate;
100 class /+ Q_WIDGETS_EXPORT +/ QDoubleSpinBox : QAbstractSpinBox
101 {
102     mixin(Q_OBJECT);
103 
104     /+ Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
105     Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
106     Q_PROPERTY(QString cleanText READ cleanText)
107     Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
108     Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
109     Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
110     Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
111     Q_PROPERTY(StepType stepType READ stepType WRITE setStepType)
112     Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true) +/
113 public:
114     /+ explicit +/this(QWidget parent = null);
115     ~this();
116 
117     final double value() const;
118 
119     final QString prefix() const;
120     final void setPrefix(ref const(QString) prefix);
121 
122     final QString suffix() const;
123     final void setSuffix(ref const(QString) suffix);
124 
125     final QString cleanText() const;
126 
127     final double singleStep() const;
128     final void setSingleStep(double val);
129 
130     final double minimum() const;
131     final void setMinimum(double min);
132 
133     final double maximum() const;
134     final void setMaximum(double max);
135 
136     final void setRange(double min, double max);
137 
138     final StepType stepType() const;
139     final void setStepType(StepType stepType);
140 
141     final int decimals() const;
142     final void setDecimals(int prec);
143 
144     override QValidator.State validate(ref QString input, ref int pos) const;
145     /+ virtual +/ double valueFromText(ref const(QString) text) const;
146     /+ virtual +/ QString textFromValue(double val) const;
147     override void fixup(ref QString str) const;
148 
149 public /+ Q_SLOTS +/:
150     @QSlot final void setValue(double val);
151 
152 /+ Q_SIGNALS +/public:
153     @QSignal final void valueChanged(double);
154     @QSignal final void textChanged(ref const(QString) );
155 /+ #if QT_DEPRECATED_SINCE(5, 14) +/
156     /+ QT_DEPRECATED_X("Use textChanged(QString) instead") +/
157         @QSignal final void valueChanged(ref const(QString) );
158 /+ #endif +/
159 
160 private:
161     /+ Q_DISABLE_COPY(QDoubleSpinBox) +/
162     /+ Q_DECLARE_PRIVATE(QDoubleSpinBox) +/
163 }
164