a79fcb4271e401bcfaf04d0853f70fb45ce17f69
[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 Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali-toolkit/public-api/controls/control.h>
22
23 namespace Dali DALI_IMPORT_API
24 {
25
26 namespace Toolkit
27 {
28
29 namespace Internal DALI_INTERNAL
30 {
31 class Slider;
32 }
33
34 /**
35  * Slider is a control to enable sliding an indicator between two values
36  */
37 class Slider : public Control
38 {
39 public:
40
41   //Signal Names
42   static const char* const SIGNAL_VALUE_CHANGED;
43   static const char* const SIGNAL_MARK;
44
45   // Properties
46   static const std::string LOWER_BOUND_PROPERTY_NAME;           ///< Property, name "lower-bound",       type FLOAT
47   static const std::string UPPER_BOUND_PROPERTY_NAME;           ///< Property, name "upper-bound",       type FLOAT
48   static const std::string VALUE_PROPERTY_NAME;                 ///< Property, name "value",             type FLOAT
49
50   static const std::string HIT_REGION_PROPERTY_NAME;            ///< Property, name "hit-region",        type VECTOR2
51   static const std::string BACKING_REGION_PROPERTY_NAME;        ///< Property, name "backing-region",    type VECTOR2
52   static const std::string HANDLE_REGION_PROPERTY_NAME;         ///< Property, name "handle-region",     type VECTOR2
53
54   static const std::string BACKING_IMAGE_NAME_PROPERTY_NAME;    ///< Property, name "backing-image-name",  type std::string
55   static const std::string HANDLE_IMAGE_NAME_PROPERTY_NAME;     ///< Property, name "handle-image-name",   type std::string
56   static const std::string PROGRESS_IMAGE_NAME_PROPERTY_NAME;   ///< Property, name "progress-image-name", type std::string
57   static const std::string POPUP_IMAGE_NAME_PROPERTY_NAME;      ///< Property, name "popup-image-name",    type std::string
58   static const std::string POPUP_ARROW_IMAGE_NAME_PROPERTY_NAME; ///< Property, name "popup-arrow-image-name", type std::string
59
60   static const std::string BACKING_SCALE9_BORDER_PROPERTY_NAME;  ///< Property, name "backing-scale9-border",  type VECTOR4
61   static const std::string PROGRESS_SCALE9_BORDER_PROPERTY_NAME; ///< Property, name "progress-scale9-border", type VECTOR4
62   static const std::string POPUP_SCALE9_BORDER_PROPERTY_NAME;    ///< Property, name "popup-scale9-border",    type VECTOR4
63
64   static const std::string DISABLE_COLOR_PROPERTY_NAME;          ///< Property, name "disable-color",    type VECTOR4
65   static const std::string POPUP_TEXT_COLOR_PROPERTY_NAME;       ///< Property, name "popup-text-color", type VECTOR4
66
67   static const std::string VALUE_PRECISION_PROPERTY_NAME;        ///< Property, name "value-precision",  type INT
68
69   static const std::string SHOW_POPUP_PROPERTY_NAME;             ///< Property, name "show-popup",       type BOOLEAN
70   static const std::string SHOW_VALUE_PROPERTY_NAME;             ///< Property, name "show-value",       type BOOLEAN
71
72   static const std::string ENABLED_PROPERTY_NAME;                ///< Property, name "enabled",          type BOOLEAN
73
74   static const std::string MARKS_PROPERTY_NAME;                  ///< Property, name "marks",            type Property::Array<float>
75   static const std::string SNAP_TO_MARKS_PROPERTY_NAME;          ///< Property, name "snap-to-marks",    type BOOLEAN
76   static const std::string MARK_TOLERANCE_PROPERTY_NAME;         ///< Property, name "mark-tolerance",   type FLOAT
77
78 public:
79
80   /**
81    * Create the Slider control
82    * @return A handle to the Slider control.
83    */
84   static Slider New();
85
86   /**
87    * Creates an empty Slider handle
88    */
89   Slider();
90
91   /**
92    * Copy constructor. Creates another handle that points to the same real object
93    */
94   Slider( const Slider& handle );
95
96   /**
97    * Assignment operator. Changes this handle to point to another real object
98    */
99   Slider& operator=( const Slider& handle );
100
101   /**
102    * Virtual destructor.
103    * Dali::Object derived classes typically do not contain member data.
104    */
105   virtual ~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 SignalV2< bool ( Slider, float ) > ValueChangedSignalType;
121   typedef SignalV2< 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 slider handle reaches a mark
130    */
131   MarkSignalType& MarkSignal();
132
133 public: // Not intended for application developers
134
135   /**
136    * Creates a handle using the Toolkit::Internal implementation.
137    * @param[in]  implementation  The Control implementation.
138    */
139   Slider(Internal::Slider& implementation);
140
141   /**
142    * Allows the creation of this Control from an Internal::CustomActor pointer.
143    * @param[in]  internal  A pointer to the internal CustomActor.
144    */
145   Slider( Dali::Internal::CustomActor* internal );
146 };
147
148 } // namespace Toolkit
149
150 } // namespace Dali
151
152 #endif // __DALI_TOOLKIT_SLIDER_H__