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