[dali_1.9.23] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / slider / slider.h
1 #ifndef DALI_TOOLKIT_SLIDER_H
2 #define DALI_TOOLKIT_SLIDER_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class Slider;
33 }
34 /**
35  * @addtogroup dali_toolkit_controls_slider
36  * @{
37  */
38
39 /**
40  * @brief Slider is a control to enable sliding an indicator between two values.
41  *
42  * Signals
43  * | %Signal Name      | Method                        |
44  * |-------------------|-------------------------------|
45  * | valueChanged      | @ref ValueChangedSignal()     |
46  * | markReached       | @ref MarkReachedSignal()      |
47  * | slidingFinished   | @ref SlidingFinishedSignal()  |
48  * @SINCE_1_1.39
49  */
50 class DALI_TOOLKIT_API Slider : public Control
51 {
52 public:
53
54   // Properties
55
56   /**
57    * @brief Enumeration for the start and end property ranges for this control.
58    * @SINCE_1_1.39
59    */
60   enum PropertyRange
61   {
62     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_1.39
63     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices @SINCE_1_1.39
64   };
65
66   /**
67    * @brief Enumeration for the instance of properties belonging to the Slider class.
68    * @SINCE_1_1.39
69    */
70   struct Property
71   {
72     /**
73      * @brief Enumeration for the instance of properties belonging to the Slider class.
74      * @SINCE_1_1.39
75      */
76     enum
77     {
78
79       /**
80        * @brief name "lowerBound", type float.
81        * @SINCE_1_1.39
82        */
83       LOWER_BOUND = PROPERTY_START_INDEX,
84
85       /**
86        * @brief name "upperBound", type float.
87        * @SINCE_1_1.39
88        */
89       UPPER_BOUND,
90
91       /**
92        * @brief name "value", type float.
93        * @SINCE_1_1.39
94        */
95       VALUE,
96
97       /**
98        * @brief name "trackVisual", type string if it is a url, map otherwise.
99        * @SINCE_1_1.39
100        */
101       TRACK_VISUAL,
102
103       /**
104        * @brief name "handleVisual", type string if it is a url, map otherwise.
105        * @SINCE_1_1.39
106        */
107       HANDLE_VISUAL,
108
109       /**
110        * @brief name "progressVisual", type string if it is a url, map otherwise.
111        * @SINCE_1_1.39
112        */
113       PROGRESS_VISUAL,
114
115       /**
116        * @brief name "popupVisual", type string if it is a url, map otherwise.
117        * @SINCE_1_1.39
118        */
119       POPUP_VISUAL,
120
121       /**
122        * @brief name "popupArrowVisual", type string if it is a url, map otherwise.
123        * @SINCE_1_1.39
124        */
125       POPUP_ARROW_VISUAL,
126
127       /**
128        * @brief name "disabledColor", type Vector4.
129        * @SINCE_1_1.39
130        */
131       DISABLED_COLOR,
132
133       /**
134        * @brief name "valuePrecision", type int.
135        * @SINCE_1_1.39
136        */
137       VALUE_PRECISION,
138
139       /**
140        * @brief name "showPopup", type bool.
141        * @SINCE_1_1.39
142        */
143       SHOW_POPUP,
144
145       /**
146        * @brief name "showValue", type bool.
147        * @SINCE_1_1.39
148        */
149       SHOW_VALUE,
150
151       /**
152        * @brief name "marks", type Property::Array<float>.
153        * @SINCE_1_1.39
154        */
155       MARKS,
156
157       /**
158        * @brief name "snapToMarks", type bool.
159        * @SINCE_1_1.39
160        */
161       SNAP_TO_MARKS,
162
163       /**
164        * @brief name "markTolerance", type float.
165        * @SINCE_1_1.39
166        */
167       MARK_TOLERANCE,
168     };
169   };
170
171 public:
172
173   /**
174    * @brief Creates the Slider control.
175    * @SINCE_1_1.39
176    * @return A handle to the Slider control
177    */
178   static Slider New();
179
180   /**
181    * @brief Creates an empty Slider handle.
182    * @SINCE_1_1.39
183    */
184   Slider();
185
186   /**
187    * @brief Copy constructor.
188    *
189    * Creates another handle that points to the same real object.
190    * @SINCE_1_1.39
191    * @param[in] handle Handle to an object
192    */
193   Slider( const Slider& handle );
194
195   /**
196    * @brief Move constructor
197    * @SINCE_1_9.23
198    *
199    * @param[in] rhs A reference to the moved handle
200    */
201   Slider( Slider&& rhs );
202
203   /**
204    * @brief Assignment operator.
205    *
206    * Changes this handle to point to another real object.
207    * @SINCE_1_1.39
208    * @param[in] handle Handle to an object
209    * @return A reference to this
210    */
211   Slider& operator=( const Slider& handle );
212
213   /**
214    * @brief Move assignment
215    * @SINCE_1_9.23
216    *
217    * @param[in] rhs A reference to the moved handle
218    * @return A reference to this
219    */
220   Slider& operator=( Slider&& rhs );
221
222   /**
223    * @brief Destructor.
224    *
225    * This is non-virtual since derived Handle types must not contain data or virtual methods.
226    * @SINCE_1_1.39
227    */
228   ~Slider();
229
230   /**
231    * @brief Downcasts an Object handle to Slider.
232    *
233    * If handle points to a Slider, the downcast produces valid handle.
234    * If not, the returned handle is left uninitialized.
235    * @SINCE_1_1.39
236    * @param[in] handle Handle to an object
237    * @return handle to a Slider or an uninitialized handle
238    */
239   static Slider DownCast( BaseHandle handle );
240
241 public:  // Signals
242
243   /**
244    * @brief Value changed signal type.
245    * @SINCE_1_1.39
246    */
247   typedef Signal< bool ( Slider, float ) > ValueChangedSignalType;
248
249   /**
250    * @brief Mark reached signal type.
251    * @SINCE_1_1.39
252    */
253   typedef Signal< bool ( Slider, int ) > MarkReachedSignalType;
254
255   /**
256    * @brief Signal emitted when the slider value changes.
257    *
258    * A callback of the following type may be connected:
259    * @code
260    *   bool YourCallbackName( Slider slider, float value );
261    * @endcode
262    * @SINCE_1_1.39
263    * @return The signal to connect to
264    */
265   ValueChangedSignalType& ValueChangedSignal();
266
267   /**
268    * @brief Signal emitted when the sliding is finished.
269    *
270    * A callback of the following type may be connected:
271    * @code
272    *   bool YourCallbackName( Slider slider, float value );
273    * @endcode
274    * @SINCE_1_1.39
275    * @return The signal to connect to
276    */
277   ValueChangedSignalType& SlidingFinishedSignal();
278
279   /**
280    * @brief Signal emitted when the slider handle reaches a mark.
281    *
282    * A callback of the following type may be connected:
283    * @code
284    *   bool YourCallbackName( Slider slider, int value );
285    * @endcode
286    * @SINCE_1_1.39
287    * @return The signal to connect to
288    */
289   MarkReachedSignalType& MarkReachedSignal();
290
291 public: // Not intended for application developers
292
293   /// @cond internal
294   /**
295    * @brief Creates a handle using the Toolkit::Internal implementation.
296    *
297    * @SINCE_1_1.39
298    * @param[in] implementation The Control implementation
299    */
300   DALI_INTERNAL Slider(Internal::Slider& implementation);
301
302   /**
303    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
304    *
305    * @SINCE_1_1.39
306    * @param[in] internal A pointer to the internal CustomActor
307    */
308   explicit DALI_INTERNAL Slider( Dali::Internal::CustomActor* internal );
309   /// @endcond
310 };
311
312 /**
313  * @}
314  */
315 } // namespace Toolkit
316
317 } // namespace Dali
318
319 #endif // DALI_TOOLKIT_SLIDER_H