1 /** ===========================================================
2  * @file
3  *
4  * This file is a part of digiKam project
5  * <a href="https://www.digikam.org">https://www.digikam.org</a>
6  *
7  * @date   2008-08-16
8  * @brief  Integer and double num input widget
9  *         re-implemented with a reset button to switch to
10  *         a default value
11  *
12  * @author Copyright (C) 2008-2015 by Gilles Caulier
13  *         <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
14  *
15  * This program is free software; you can redistribute it
16  * and/or modify it under the terms of the GNU General
17  * Public License as published by the Free Software Foundation;
18  * either version 2, or (at your option)
19  * any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * ============================================================ */
27 
28 #ifndef RNUMINPUT_H
29 #define RNUMINPUT_H
30 
31 // Qt includes
32 
33 #include <QWidget>
34 
35 // Local includes
36 
37 
38 
39 namespace KDcrawIface
40 {
41 
42 class  RIntNumInput : public QWidget
43 {
44     Q_OBJECT
45 
46 public:
47 
48     RIntNumInput(QWidget* const parent=0);
49     ~RIntNumInput() override;
50 
51     void setRange(int min, int max, int step);
52 
53     void setDefaultValue(int d);
54     int  defaultValue() const;
55     int  value()        const;
56 
57     void setSuffix(const QString& suffix);
58 
59 Q_SIGNALS:
60 
61     void reset();
62     void valueChanged(int);
63 
64 public Q_SLOTS:
65 
66     void setValue(int d);
67     void slotReset();
68 
69 private Q_SLOTS:
70 
71     void slotValueChanged(int);
72 
73 private:
74 
75     class Private;
76     Private* const d;
77 };
78 
79 // ---------------------------------------------------------
80 
81 class  RDoubleNumInput : public QWidget
82 {
83     Q_OBJECT
84 
85 public:
86 
87     RDoubleNumInput(QWidget* const parent=0);
88     ~RDoubleNumInput() override;
89 
90     void   setDecimals(int p);
91     void   setRange(double min, double max, double step);
92 
93     void   setDefaultValue(double d);
94     double defaultValue() const;
95     double value()        const;
96 
97     void setSuffix(const QString& suffix);
98 
99 Q_SIGNALS:
100 
101     void reset();
102     void valueChanged(double);
103 
104 public Q_SLOTS:
105 
106     void setValue(double d);
107     void slotReset();
108 
109 private Q_SLOTS:
110 
111     void slotValueChanged(double);
112 
113 private:
114 
115     class Private;
116     Private* const d;
117 };
118 
119 }  // namespace KDcrawIface
120 
121 #endif /* RNUMINPUT_H */
122