Notify multiline hint to IMF context
[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    */
188   Slider( const Slider& handle );
189
190   /**
191    * @brief Assignment operator.
192    *
193    * Changes this handle to point to another real object.
194    * @SINCE_1_1.39
195    */
196   Slider& operator=( const Slider& handle );
197
198   /**
199    * @brief Destructor.
200    *
201    * This is non-virtual since derived Handle types must not contain data or virtual methods.
202    * @SINCE_1_1.39
203    */
204   ~Slider();
205
206   /**
207    * @brief Downcast an Object handle to Slider.
208    *
209    * If handle points to a Slider the
210    * downcast produces valid handle. If not the returned handle is left uninitialized.
211    * @SINCE_1_1.39
212    * @param[in] handle Handle to an object
213    * @return handle to a Slider or an uninitialized handle
214    */
215   static Slider DownCast( BaseHandle handle );
216
217 public:  // Signals
218
219   /**
220    * @brief Value changed signal type.
221    * @SINCE_1_1.39
222    */
223   typedef Signal< bool ( Slider, float ) > ValueChangedSignalType;
224
225   /**
226    * @brief Mark reached signal type.
227    * @SINCE_1_1.39
228    */
229   typedef Signal< bool ( Slider, int ) > MarkReachedSignalType;
230
231   /**
232    * @brief Signal emitted when the slider value changes.
233    *
234    * A callback of the following type may be connected:
235    * @code
236    *   bool YourCallbackName( Slider slider, float value );
237    * @endcode
238    * @SINCE_1_1.39
239    * @return The signal to connect to
240    */
241   ValueChangedSignalType& ValueChangedSignal();
242
243   /**
244    * @brief Signal emitted when the sliding is finished.
245    *
246    * A callback of the following type may be connected:
247    * @code
248    *   bool YourCallbackName( Slider slider, float value );
249    * @endcode
250    * @SINCE_1_1.39
251    * @return The signal to connect to
252    */
253   ValueChangedSignalType& SlidingFinishedSignal();
254
255   /**
256    * @brief Signal emitted when the slider handle reaches a mark.
257    *
258    * A callback of the following type may be connected:
259    * @code
260    *   bool YourCallbackName( Slider slider, int value );
261    * @endcode
262    * @SINCE_1_1.39
263    * @return The signal to connect to
264    */
265   MarkReachedSignalType& MarkReachedSignal();
266
267 public: // Not intended for application developers
268
269   /**
270    * @brief Creates a handle using the Toolkit::Internal implementation.
271    * @SINCE_1_1.39
272    * @param[in]  implementation  The Control implementation
273    */
274   DALI_INTERNAL Slider(Internal::Slider& implementation);
275
276   /**
277    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
278    * @SINCE_1_1.39
279    * @param[in]  internal  A pointer to the internal CustomActor
280    */
281   explicit DALI_INTERNAL Slider( Dali::Internal::CustomActor* internal );
282 };
283
284 /**
285  * @}
286  */
287 } // namespace Toolkit
288
289 } // namespace Dali
290
291 #endif // __DALI_TOOLKIT_SLIDER_H__