1 /*
2  *  Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef __KIS_UNIFORM_PAINTOP_PROPERTY_WIDGET_H
20 #define __KIS_UNIFORM_PAINTOP_PROPERTY_WIDGET_H
21 
22 #include <QScopedPointer>
23 #include <QWidget>
24 
25 #include "kis_uniform_paintop_property.h"
26 
27 
28 class KisUniformPaintOpPropertyWidget : public QWidget
29 {
30     Q_OBJECT
31 public:
32     KisUniformPaintOpPropertyWidget(KisUniformPaintOpPropertySP property, QWidget *parent);
33     ~KisUniformPaintOpPropertyWidget() override;
34     void slotThemeChanged(QPalette pal);
35 
36 protected:
37     KisUniformPaintOpPropertySP property() const;
38 
39 protected Q_SLOTS:
40     virtual void setValue(const QVariant &value) = 0;
41 
42 Q_SIGNALS:
43     void valueChanged(const QVariant &value);
44 
45 private:
46     struct Private;
47     const QScopedPointer<Private> m_d;
48 };
49 
50 class KisSliderSpinBox;
51 class KisDoubleSliderSpinBox;
52 class QCheckBox;
53 
54 class KisUniformPaintOpPropertyIntSlider : public KisUniformPaintOpPropertyWidget
55 {
56     Q_OBJECT
57 public:
58     KisUniformPaintOpPropertyIntSlider(KisUniformPaintOpPropertySP property, QWidget *parent);
59 
60     void setValue(const QVariant &value) override;
61 
62 private Q_SLOTS:
63     void slotSliderChanged(int value);
64 
65 private:
66     KisSliderSpinBox *m_slider;
67 };
68 
69 class KisUniformPaintOpPropertyDoubleSlider : public KisUniformPaintOpPropertyWidget
70 {
71     Q_OBJECT
72 public:
73     KisUniformPaintOpPropertyDoubleSlider(KisUniformPaintOpPropertySP property, QWidget *parent);
74 
75     void setValue(const QVariant &value) override;
76 
77 private Q_SLOTS:
78     void slotSliderChanged(qreal value);
79 
80 private:
81     KisDoubleSliderSpinBox *m_slider;
82 };
83 
84 class KisUniformPaintOpPropertyCheckBox : public KisUniformPaintOpPropertyWidget
85 {
86     Q_OBJECT
87 public:
88     KisUniformPaintOpPropertyCheckBox(KisUniformPaintOpPropertySP property, QWidget *parent);
89 
90     void setValue(const QVariant &value) override;
91 
92 private Q_SLOTS:
93     void slotCheckBoxChanged(bool value);
94 
95 private:
96     QCheckBox *m_checkBox;
97 };
98 
99 class QComboBox;
100 
101 class KisUniformPaintOpPropertyComboBox : public KisUniformPaintOpPropertyWidget
102 {
103     Q_OBJECT
104 public:
105     KisUniformPaintOpPropertyComboBox(KisUniformPaintOpPropertySP property, QWidget *parent);
106 
107     void setValue(const QVariant &value) override;
108 
109 private Q_SLOTS:
110     void slotComboBoxChanged(int value);
111 
112 private:
113     QComboBox *m_comboBox;
114 };
115 
116 #endif /* __KIS_UNIFORM_PAINTOP_PROPERTY_WIDGET_H */
117