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