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.lcdnumber;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.coreevent;
17 import qt.core.size;
18 import qt.core.string;
19 import qt.gui.event;
20 import qt.helpers;
21 import qt.widgets.frame;
22 import qt.widgets.widget;
23 
24 /+ QT_REQUIRE_CONFIG(lcdnumber); +/
25 
26 extern(C++, class) struct QLCDNumberPrivate;
27 /// Binding for C++ class [QLCDNumber](https://doc.qt.io/qt-6/qlcdnumber.html).
28 class /+ Q_WIDGETS_EXPORT +/ QLCDNumber : QFrame // LCD number widget
29 {
30     mixin(Q_OBJECT);
31     /+ Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint)
32     Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount)
33     Q_PROPERTY(Mode mode READ mode WRITE setMode)
34     Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle)
35     Q_PROPERTY(double value READ value WRITE display)
36     Q_PROPERTY(int intValue READ intValue WRITE display) +/
37 
38 public:
39     /+ explicit +/this(QWidget parent = null);
40     /+ explicit +/this(uint numDigits, QWidget parent = null);
41     ~this();
42 
43     enum Mode {
44         Hex, Dec, Oct, Bin
45     }
46     /+ Q_ENUM(Mode) +/
47     enum SegmentStyle {
48         Outline, Filled, Flat
49     }
50     /+ Q_ENUM(SegmentStyle) +/
51 
52     final bool smallDecimalPoint() const;
53     final int digitCount() const;
54     final void setDigitCount(int nDigits);
55 
56     final bool checkOverflow(double num) const;
57     final bool checkOverflow(int num) const;
58 
59     final Mode mode() const;
60     final void setMode(Mode);
61 
62     final SegmentStyle segmentStyle() const;
63     final void setSegmentStyle(SegmentStyle);
64 
65     final double value() const;
66     final int intValue() const;
67  
68     final void setValue(double val)
69     {
70         setProperty("value", val);
71     }
72     final void setIntValue(int val)
73     {
74         setProperty("intValue", val);
75     }
76 
77     override QSize sizeHint() const;
78 
79 public /+ Q_SLOTS +/:
80     @QSlot final void display(ref const(QString) str);
81     @QSlot final void display(int num);
82     @QSlot final void display(double num);
83     @QSlot final void setHexMode();
84     @QSlot final void setDecMode();
85     @QSlot final void setOctMode();
86     @QSlot final void setBinMode();
87     @QSlot final void setSmallDecimalPoint(bool);
88 
89 /+ Q_SIGNALS +/public:
90     @QSignal final void overflow();
91 
92 protected:
93     override bool event(QEvent e);
94     override void paintEvent(QPaintEvent );
95 
96 public:
97 
98 private:
99     /+ Q_DISABLE_COPY(QLCDNumber) +/
100     /+ Q_DECLARE_PRIVATE(QLCDNumber) +/
101     mixin(CREATE_CONVENIENCE_WRAPPERS);
102 }
103