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.abstractslider;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.coreevent;
19 import qt.core.namespace;
20 import qt.gui.event;
21 import qt.helpers;
22 import qt.widgets.widget;
23 
24 /+ QT_REQUIRE_CONFIG(abstractslider); +/
25 
26 
27 
28 extern(C++, class) struct QAbstractSliderPrivate;
29 
30 class /+ Q_WIDGETS_EXPORT +/ QAbstractSlider : QWidget
31 {
32     mixin(Q_OBJECT);
33 
34     /+ Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
35     Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
36     Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
37     Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep)
38     Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true)
39     Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition NOTIFY sliderMoved)
40     Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
41     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
42     Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
43     Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
44     Q_PROPERTY(bool sliderDown READ isSliderDown WRITE setSliderDown DESIGNABLE false) +/
45 
46 public:
47     /+ explicit +/this(QWidget parent = null);
48     ~this();
49 
50     final /+ Qt:: +/qt.core.namespace.Orientation orientation() const;
51 
52     final void setMinimum(int);
53     final int minimum() const;
54 
55     final void setMaximum(int);
56     final int maximum() const;
57 
58     final void setSingleStep(int);
59     final int singleStep() const;
60 
61     final void setPageStep(int);
62     final int pageStep() const;
63 
64     final void setTracking(bool enable);
65     final bool hasTracking() const;
66 
67     final void setSliderDown(bool);
68     final bool isSliderDown() const;
69 
70     final void setSliderPosition(int);
71     final int sliderPosition() const;
72 
73     final void setInvertedAppearance(bool);
74     final bool invertedAppearance() const;
75 
76     final void setInvertedControls(bool);
77     final bool invertedControls() const;
78 
79     enum SliderAction {
80         SliderNoAction,
81         SliderSingleStepAdd,
82         SliderSingleStepSub,
83         SliderPageStepAdd,
84         SliderPageStepSub,
85         SliderToMinimum,
86         SliderToMaximum,
87         SliderMove
88     }
89 
90     final int value() const;
91 
92     final void triggerAction(SliderAction action);
93 
94 public /+ Q_SLOTS +/:
95     @QSlot final void setValue(int);
96     @QSlot final void setOrientation(/+ Qt:: +/qt.core.namespace.Orientation);
97     @QSlot final void setRange(int min, int max);
98 
99 /+ Q_SIGNALS +/public:
100     @QSignal final void valueChanged(int value);
101 
102     @QSignal final void sliderPressed();
103     @QSignal final void sliderMoved(int position);
104     @QSignal final void sliderReleased();
105 
106     @QSignal final void rangeChanged(int min, int max);
107 
108     @QSignal final void actionTriggered(int action);
109 
110 protected:
111     override bool event(QEvent e);
112 
113     final void setRepeatAction(SliderAction action, int thresholdTime = 500, int repeatTime = 50);
114     final SliderAction repeatAction() const;
115 
116     enum SliderChange {
117         SliderRangeChange,
118         SliderOrientationChange,
119         SliderStepsChange,
120         SliderValueChange
121     }
122     /+ virtual +/ void sliderChange(SliderChange change);
123 
124     override void keyPressEvent(QKeyEvent ev);
125     override void timerEvent(QTimerEvent );
126 /+ #if QT_CONFIG(wheelevent) +/
127     override void wheelEvent(QWheelEvent e);
128 /+ #endif +/
129     override void changeEvent(QEvent e);
130 
131 
132 protected:
133     this(ref QAbstractSliderPrivate dd, QWidget parent = null);
134 
135 private:
136     /+ Q_DISABLE_COPY(QAbstractSlider) +/
137     /+ Q_DECLARE_PRIVATE(QAbstractSlider) +/
138 }
139