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