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