Merge "DALi C# binding - Generic Delegates support for EventHandlers" into devel...
[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) 2016 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_IMPORT_API Slider : public Control
51 {
52 public:
53
54   // Properties
55
56   /**
57    * @brief 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 An enumeration of properties belonging to the Slider class.
68    * @SINCE_1_1.39
69    */
70   struct Property
71   {
72     enum
73     {
74
75       /**
76        * @brief name "lowerBound", type float
77        * @SINCE_1_1.39
78        */
79       LOWER_BOUND = PROPERTY_START_INDEX,
80
81       /**
82        * @brief name "upperBound", type float
83        * @SINCE_1_1.39
84        */
85       UPPER_BOUND,
86
87       /**
88        * @brief name "value", type float
89        * @SINCE_1_1.39
90        */
91       VALUE,
92
93       /**
94        * @brief name "trackVisual", type string if it is a url, map otherwise
95        * @SINCE_1_1.39
96        */
97       TRACK_VISUAL,
98
99       /**
100        * @brief name "handleVisual", type string if it is a url, map otherwise
101        * @SINCE_1_1.39
102        */
103       HANDLE_VISUAL,
104
105       /**
106        * @brief name "progressVisual", type string if it is a url, map otherwise
107        * @SINCE_1_1.39
108        */
109       PROGRESS_VISUAL,
110
111       /**
112        * @brief name "popupVisual", type string if it is a url, map otherwise
113        * @SINCE_1_1.39
114        */
115       POPUP_VISUAL,
116
117       /**
118        * @brief name "popupArrowVisual", type string if it is a url, map otherwise
119        * @SINCE_1_1.39
120        */
121       POPUP_ARROW_VISUAL,
122
123       /**
124        * @brief name "disabledColor", type Vector4
125        * @SINCE_1_1.39
126        */
127       DISABLED_COLOR,
128
129       /**
130        * @brief name "valuePrecision", type int
131        * @SINCE_1_1.39
132        */
133       VALUE_PRECISION,
134
135       /**
136        * @brief name "showPopup", type bool
137        * @SINCE_1_1.39
138        */
139       SHOW_POPUP,
140
141       /**
142        * @brief name "showValue", type bool
143        * @SINCE_1_1.39
144        */
145       SHOW_VALUE,
146
147       /**
148        * @brief name "marks", type Property::Array<float>
149        * @SINCE_1_1.39
150        */
151       MARKS,
152
153       /**
154        * @brief name "snapToMarks", type bool
155        * @SINCE_1_1.39
156        */
157       SNAP_TO_MARKS,
158
159       /**
160        * @brief name "markTolerance", type float
161        * @SINCE_1_1.39
162        */
163       MARK_TOLERANCE,
164     };
165   };
166
167 public:
168
169   /**
170    * @brief Creates the Slider control.
171    * @SINCE_1_1.39
172    * @return A handle to the Slider control
173    */
174   static Slider New();
175
176   /**
177    * @brief Creates an empty Slider handle.
178    * @SINCE_1_1.39
179    */
180   Slider();
181
182   /**
183    * @brief Copy constructor.
184    *
185    * Creates another handle that points to the same real object.
186    * @SINCE_1_1.39
187    * @param[in] handle Handle to an object
188    */
189   Slider( const Slider& handle );
190
191   /**
192    * @brief Assignment operator.
193    *
194    * Changes this handle to point to another real object.
195    * @SINCE_1_1.39
196    * @param[in] handle Handle to an object
197    * @return A reference to this
198    */
199   Slider& operator=( const Slider& handle );
200
201   /**
202    * @brief Destructor.
203    *
204    * This is non-virtual since derived Handle types must not contain data or virtual methods.
205    * @SINCE_1_1.39
206    */
207   ~Slider();
208
209   /**
210    * @brief Downcast an Object handle to Slider.
211    *
212    * If handle points to a Slider the
213    * downcast produces valid handle. If not the returned handle is left uninitialized.
214    * @SINCE_1_1.39
215    * @param[in] handle Handle to an object
216    * @return handle to a Slider or an uninitialized handle
217    */
218   static Slider DownCast( BaseHandle handle );
219
220 public:  // Signals
221
222   /**
223    * @brief Value changed signal type.
224    * @SINCE_1_1.39
225    */
226   typedef Signal< bool ( Slider, float ) > ValueChangedSignalType;
227
228   /**
229    * @brief Mark reached signal type.
230    * @SINCE_1_1.39
231    */
232   typedef Signal< bool ( Slider, int ) > MarkReachedSignalType;
233
234   /**
235    * @brief Signal emitted when the slider value changes.
236    *
237    * A callback of the following type may be connected:
238    * @code
239    *   bool YourCallbackName( Slider slider, float value );
240    * @endcode
241    * @SINCE_1_1.39
242    * @return The signal to connect to
243    */
244   ValueChangedSignalType& ValueChangedSignal();
245
246   /**
247    * @brief Signal emitted when the sliding is finished.
248    *
249    * A callback of the following type may be connected:
250    * @code
251    *   bool YourCallbackName( Slider slider, float value );
252    * @endcode
253    * @SINCE_1_1.39
254    * @return The signal to connect to
255    */
256   ValueChangedSignalType& SlidingFinishedSignal();
257
258   /**
259    * @brief Signal emitted when the slider handle reaches a mark.
260    *
261    * A callback of the following type may be connected:
262    * @code
263    *   bool YourCallbackName( Slider slider, int value );
264    * @endcode
265    * @SINCE_1_1.39
266    * @return The signal to connect to
267    */
268   MarkReachedSignalType& MarkReachedSignal();
269
270 public: // Not intended for application developers
271
272   /// @cond internal
273   /**
274    * @brief Creates a handle using the Toolkit::Internal implementation.
275    *
276    * @SINCE_1_1.39
277    * @param[in]  implementation  The Control implementation
278    */
279   DALI_INTERNAL Slider(Internal::Slider& implementation);
280
281   /**
282    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
283    *
284    * @SINCE_1_1.39
285    * @param[in]  internal  A pointer to the internal CustomActor
286    */
287   explicit DALI_INTERNAL Slider( Dali::Internal::CustomActor* internal );
288   /// @endcond
289 };
290
291 /**
292  * @}
293  */
294 } // namespace Toolkit
295
296 } // namespace Dali
297
298 #endif // __DALI_TOOLKIT_SLIDER_H__