ed4ceb2d7629b99126022adf553971b7fd2a7e9d
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / progress-bar / progress-bar.h
1 #ifndef DALI_TOOLKIT_PROGRESS_BAR_H
2 #define DALI_TOOLKIT_PROGRESS_BAR_H
3
4 /*
5  * Copyright (c) 2017 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 ProgressBar;
33 }
34 /**
35  * @addtogroup dali_toolkit_controls_progress_bar
36  * @{
37  */
38
39 /**
40  * @brief ProgressBar is a control to give the user an indication of the progress of an operation.
41  *
42  * Signals
43  * | %Signal Name      | Method                        |
44  * |-------------------|-------------------------------|
45  * | valueChanged      | @ref ValueChangedSignal()     |
46  *
47  * @SINCE_1_2.60
48  */
49
50 class DALI_IMPORT_API ProgressBar : public Control
51 {
52 public:
53
54   // Properties
55
56   /**
57    * @brief The start and end property ranges for this control.
58    * @SINCE_1_2.60
59    */
60   enum PropertyRange
61   {
62     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< Start Index. @SINCE_1_2.60
63     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices. @SINCE_1_2.60
64   };
65
66   /**
67    * @brief Enumeration of properties belonging to the ProgressBar class.
68    * @SINCE_1_2.60
69    */
70   struct Property
71   {
72     /**
73      * @brief Enumeration for the instance of properties belonging to the ProgressBar class.
74      * @SINCE_1_2.60
75      */
76     enum
77     {
78       /**
79        * @brief The progress value of progress bar, progress runs form 0 to 1.
80        * @details Name "progressValue", type Property::FLOAT.
81        * @SINCE_1_2.60
82        * @note Optional. If not supplied, the default is 0.
83        * @note Value should be between 0 to 1.
84        * @note If Value is set to 0, progress bar will be set to beginning.
85        * @note If Value is set to 1, progress bar will be set to end.
86        * @note Any Value outside of the range is ignored.
87        */
88       PROGRESS_VALUE = PROPERTY_START_INDEX,
89
90       /**
91        * @brief The secondary progress value of progress bar, secondary progress runs form 0 to 1.
92        * @details Name "secondaryProgressValue", type Property::FLOAT.
93        * @SINCE_1_2.60
94        * @note Optional. If not supplied, the default is 0.
95        * @note Value should be between 0 to 1.
96        * @note If Value is set to 0, progress bar will be set secondary progress to beginning.
97        * @note If Value is set to 1, progress bar will be set secondary progress to end.
98        * @note Any Value outside of the range is ignored.
99        */
100       SECONDARY_PROGRESS_VALUE,
101
102       /**
103        * @brief Sets the progress-bar as \e indeterminate state.
104        * @details name "indeterminate", type Property::BOOLEAN.
105        * @SINCE_1_2.60
106        */
107       INDETERMINATE,
108
109       /**
110        * @brief The track Visual value of progress bar, it's a full progress area and it's shown behind PROGRESS_VISUAL.
111        * @details Name "trackVisual", type Property::MAP or Property::STRING (url to image).
112        * @SINCE_1_2.60
113        * @note Optional. If not supplied, the default track visual will be shown.
114        */
115       TRACK_VISUAL,
116
117       /**
118        * @brief The progress Visual value of progress bar, size of the progress visual is changed based on PROGRESS_VALUE.
119        * @details Name "progressVisual", type Property::MAP or Property::STRING (url to image).
120        * @SINCE_1_2.60
121        * @note Optional. If not supplied, the default progress visual will be shown.
122        */
123       PROGRESS_VISUAL,
124
125       /**
126        * @brief The secondary progress visual of progress bar, size of the secondary progress visual is changed based on SECONDARY_PROGRESS_VALUE.
127        * @details Name "secondaryProgressVisual", type Property::MAP or Property::STRING (url to image).
128        * @SINCE_1_2.60
129        * @note Optional. If not supplied, the secondary progress visual will not be shown.
130        */
131       SECONDARY_PROGRESS_VISUAL,
132
133       /**
134        * @brief The indeterminate visual of progress bar.
135        * @details Name "inditerminateVisual", type Property::MAP or Property::STRING (url to image).
136        * @SINCE_1_2.60
137        * @note Optional. If not supplied, the default indeterminate visual will be shown.
138        */
139       INDETERMINATE_VISUAL,
140
141       /**
142        * @brief The transition data for indeterminate visual animation.
143        * @details Name "indeterminateVisualAnimation", type Property::MAP or Property::ARRAY.
144        * @SINCE_1_2.60
145        * @note Optional. If not supplied, default animation will be played.
146        */
147       INDETERMINATE_VISUAL_ANIMATION,
148
149       /**
150        * @brief The Label visual of progress bar.
151        * @details Name "labelVisual", type Property::MAP.
152        * @SINCE_1_2.60
153        */
154       LABEL_VISUAL,
155     };
156   };
157
158 public:
159
160   /**
161    * @brief Creates the ProgressBar control.
162    * @SINCE_1_2.60
163    * @return A handle to the ProgressBar control
164    */
165   static ProgressBar New();
166
167   /**
168    * @brief Creates an empty ProgressBar handle.
169    * @SINCE_1_2.60
170    */
171   ProgressBar();
172
173   /**
174    * @brief Copy constructor.
175    *
176    * Creates another handle that points to the same real object.
177    * @SINCE_1_2.60
178    * @param[in] handle Handle to an object
179    */
180   ProgressBar( const ProgressBar& handle );
181
182   /**
183    * @brief Assignment operator.
184    *
185    * Changes this handle to point to another real object.
186    * @SINCE_1_2.60
187    * @param[in] handle Handle to an object
188    * @return A reference to this
189    */
190   ProgressBar& operator=( const ProgressBar& handle );
191
192   /**
193    * @brief Destructor.
194    *
195    * This is non-virtual since derived Handle types must not contain data or virtual methods.
196    * @SINCE_1_2.60
197    */
198   ~ProgressBar();
199
200   /**
201    * @brief Downcast an Object handle to ProgressBar.
202    *
203    * If handle points to a ProgressBar the
204    * downcast produces valid handle. If not the returned handle is left uninitialized.
205    * @SINCE_1_2.60
206    * @param[in] handle Handle to an object
207    * @return handle to a ProgressBar or an uninitialized handle
208    */
209   static ProgressBar DownCast( BaseHandle handle );
210
211 public:  // Signals
212
213   /**
214    * @brief Value changed signal type.
215    * @SINCE_1_2.60
216    */
217   typedef Signal< void ( ProgressBar, float, float ) > ValueChangedSignalType;
218
219   /**
220    * @brief Signal emitted when the ProgressBar value changes.
221    *
222    * A callback of the following type may be connected:
223    * @code
224    *   void YourCallbackName( ProgressBar progressBar, float progressValue, float secondaryProgressValue );
225    * @endcode
226    * @SINCE_1_2.60
227    * @return The signal to connect to
228    */
229   ValueChangedSignalType& ValueChangedSignal();
230
231 public: // Not intended for application developers
232
233   /// @cond internal
234   /**
235    * @brief Creates a handle using the Toolkit::Internal implementation.
236    * @param[in]  implementation  The Control implementation
237    */
238   DALI_INTERNAL ProgressBar(Internal::ProgressBar& implementation);
239
240   /**
241    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
242    * @param[in]  internal  A pointer to the internal CustomActor
243    */
244   explicit DALI_INTERNAL ProgressBar( Dali::Internal::CustomActor* internal );
245   /// @endcond
246 };
247
248 /**
249  * @}
250  */
251 } // namespace Toolkit
252
253 } // namespace Dali
254
255 #endif // DALI_TOOLKIT_PROGRESS_BAR_H