Krita Source Code Documentation
Loading...
Searching...
No Matches
KisCurveWidgetControlsManager.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KISCURVEWIDGETCONTROLSMANAGER_H
8#define KISCURVEWIDGETCONTROLSMANAGER_H
9
11#include <QObject>
12
13class QSpinBox;
14class QDoubleSpinBox;
15
16namespace detail
17{
22template <typename SpinBox>
24
25template <>
26struct value_of_spin_box<QSpinBox> {
27 using type = int;
28};
29
30template <>
31struct value_of_spin_box<QDoubleSpinBox> {
32 using type = qreal;
33};
34
35template <typename SpinBox>
37
38} // namespace detail
39
40
41class KisCurveWidget;
42
47class KRITAUI_EXPORT KisCurveWidgetControlsManagerBase : public QObject
48{
49 Q_OBJECT
50public:
53
54protected Q_SLOTS:
55 virtual void inOutChanged() = 0;
56 virtual void syncIOControls() = 0;
57 virtual void focusIOControls() = 0;
58
59protected:
60 KisCurveWidget *m_curveWidget {nullptr};
61};
62
63template <typename SpinBox>
65{
66public:
68public:
71 SpinBox *in, SpinBox *out,
72 ValueType inMin, ValueType inMax,
73 ValueType outMin, ValueType outMax);
75
76 void setupInOutControls(SpinBox *in, SpinBox *out,
77 ValueType inMin, ValueType inMax,
78 ValueType outMin, ValueType outMax);
79 void dropInOutControls();
80
81protected:
82 void inOutChanged() override;
83 void syncIOControls() override;
84 void focusIOControls() override;
85
86private:
87 /* In/Out controls */
88 SpinBox *m_intIn {nullptr};
89 SpinBox *m_intOut {nullptr};
90
91 /* Working range of them */
92 ValueType m_inMin {0};
93 ValueType m_inMax {0};
94 ValueType m_outMin {0};
95 ValueType m_outMax {0};
96};
97
98extern template class KisCurveWidgetControlsManager<QSpinBox>;
100
103
104
105#endif // KISCURVEWIDGETCONTROLSMANAGER_H
detail::value_of_spin_box_t< SpinBox > ValueType
#define KRITAUI_EXPORT_TEMPLATE
typename value_of_spin_box< SpinBox >::type value_of_spin_box_t