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