Merge "Typo fixed in Control implementation doc." into tizen
[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) 2014 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 /**
36  * @brief Slider is a control to enable sliding an indicator between two values
37  *
38  * Signals
39  * | %Signal Name      | Method                      |
40  * |-------------------|-----------------------------|
41  * | value-changed     | @ref ValueChangedSignal()   |
42  * | mark              | @ref MarkSignal()           |
43  */
44 class DALI_IMPORT_API Slider : public Control
45 {
46 public:
47
48   // Properties
49   static const Property::Index LOWER_BOUND_PROPERTY;            ///< Property, name "lower-bound",       type FLOAT
50   static const Property::Index UPPER_BOUND_PROPERTY;            ///< Property, name "upper-bound",       type FLOAT
51   static const Property::Index VALUE_PROPERTY;                  ///< Property, name "value",             type FLOAT
52
53   static const Property::Index HIT_REGION_PROPERTY;             ///< Property, name "hit-region",        type VECTOR2
54   static const Property::Index BACKING_REGION_PROPERTY;         ///< Property, name "backing-region",    type VECTOR2
55   static const Property::Index HANDLE_REGION_PROPERTY;          ///< Property, name "handle-region",     type VECTOR2
56
57   static const Property::Index BACKING_IMAGE_NAME_PROPERTY;     ///< Property, name "backing-image-name",  type STRING
58   static const Property::Index HANDLE_IMAGE_NAME_PROPERTY;      ///< Property, name "handle-image-name",   type STRING
59   static const Property::Index PROGRESS_IMAGE_NAME_PROPERTY;    ///< Property, name "progress-image-name", type STRING
60   static const Property::Index POPUP_IMAGE_NAME_PROPERTY;       ///< Property, name "popup-image-name",    type STRING
61   static const Property::Index POPUP_ARROW_IMAGE_NAME_PROPERTY; ///< Property, name "popup-arrow-image-name", type STRING
62
63   static const Property::Index DISABLE_COLOR_PROPERTY;          ///< Property, name "disable-color",    type VECTOR4
64   static const Property::Index POPUP_TEXT_COLOR_PROPERTY;       ///< Property, name "popup-text-color", type VECTOR4
65
66   static const Property::Index VALUE_PRECISION_PROPERTY;        ///< Property, name "value-precision",  type INT
67
68   static const Property::Index SHOW_POPUP_PROPERTY;             ///< Property, name "show-popup",       type BOOLEAN
69   static const Property::Index SHOW_VALUE_PROPERTY;             ///< Property, name "show-value",       type BOOLEAN
70
71   static const Property::Index ENABLED_PROPERTY;                ///< Property, name "enabled",          type BOOLEAN
72
73   static const Property::Index MARKS_PROPERTY;                  ///< Property, name "marks",            type Property::Array<float>
74   static const Property::Index SNAP_TO_MARKS_PROPERTY;          ///< Property, name "snap-to-marks",    type BOOLEAN
75   static const Property::Index MARK_TOLERANCE_PROPERTY;         ///< Property, name "mark-tolerance",   type FLOAT
76
77 public:
78
79   /**
80    * Create the Slider control
81    * @return A handle to the Slider control.
82    */
83   static Slider New();
84
85   /**
86    * Creates an empty Slider handle
87    */
88   Slider();
89
90   /**
91    * Copy constructor. Creates another handle that points to the same real object
92    */
93   Slider( const Slider& handle );
94
95   /**
96    * Assignment operator. Changes this handle to point to another real object
97    */
98   Slider& operator=( const Slider& handle );
99
100   /**
101    * @brief Destructor
102    *
103    * This is non-virtual since derived Handle types must not contain data or virtual methods.
104    */
105   ~Slider();
106
107   /**
108    * Downcast an Object handle to Slider. If handle points to a Slider the
109    * downcast produces valid handle. If not the returned handle is left uninitialized.
110    * @param[in] handle Handle to an object
111    * @return handle to a Slider or an uninitialized handle
112    */
113   static Slider DownCast( BaseHandle handle );
114
115 public:
116
117   // Signals
118
119   // Value changed
120   typedef Signal< bool ( Slider, float ) > ValueChangedSignalType;
121   typedef Signal< bool ( Slider, int ) > MarkSignalType;
122
123   /**
124    * Signal emitted when the slider value changes
125    */
126   ValueChangedSignalType& ValueChangedSignal();
127
128   /**
129    * Signal emitted when the sliding is finished
130    */
131   ValueChangedSignalType& SlidingFinishedSignal();
132
133   /**
134    * Signal emitted when the slider handle reaches a mark
135    */
136   MarkSignalType& MarkSignal();
137
138 public: // Not intended for application developers
139
140   /**
141    * Creates a handle using the Toolkit::Internal implementation.
142    * @param[in]  implementation  The Control implementation.
143    */
144   DALI_INTERNAL Slider(Internal::Slider& implementation);
145
146   /**
147    * Allows the creation of this Control from an Internal::CustomActor pointer.
148    * @param[in]  internal  A pointer to the internal CustomActor.
149    */
150   explicit DALI_INTERNAL Slider( Dali::Internal::CustomActor* internal );
151 };
152
153 } // namespace Toolkit
154
155 } // namespace Dali
156
157 #endif // __DALI_TOOLKIT_SLIDER_H__