b487029dee483912597b86da33ad9dc485585c1f
[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  * Also progress value percentage is shown as text inside the progress bar.
39  *
40  * Signals
41  * | %Signal Name      | Method                        |
42  * |-------------------|-------------------------------|
43  * | valueChanged      | @ref ValueChangedSignal()     |
44  */
45 class DALI_IMPORT_API ProgressBar : public Control
46 {
47 public:
48
49   // Properties
50
51   /**
52    * @brief The start and end property ranges for this control.
53    */
54   enum PropertyRange
55   {
56     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< Start Index
57     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices
58   };
59
60   /**
61    * @brief An enumeration of properties belonging to the ProgressBar class.
62    */
63   struct Property
64   {
65     enum
66     {
67
68       /**
69        * @brief The progress value of progress bar, progress runs form 0 to 1.
70        * @details Name "progressValue", type Property::FLOAT.
71        * @note Optional. If not supplied, the default is 0.
72        * @note Value should be between 0 to 1.
73        * @note If Value is set to 0, progress bar will be set to beginning.
74        * @note If Value is set to 1, progress bar will be set to end.
75        * @note Any Value outside of the range is ignored.
76        */
77       PROGRESS_VALUE = PROPERTY_START_INDEX,
78
79       /**
80        * @brief The track Visual value of progress bar, it's a full progress area and it's shown behind PROGRESS_VISUAL.
81        * @details Name "trackVisual", type Property::STRING if it is a url, map otherwise.
82        * @note Optional. If not supplied, the default track visual will be shown.
83        */
84       TRACK_VISUAL,
85
86       /**
87        * @brief The progress Visual value of progress bar, size of the progress visual is changed based on PROGRESS_VALUE.
88        * @details Name "progressVisual", type Property::STRING if it is a url, map otherwise.
89        * @note Optional. If not supplied, the default progress visual will be shown.
90        */
91       PROGRESS_VISUAL,
92     };
93   };
94
95 public:
96
97   /**
98    * @brief Creates the ProgressBar control.
99    * @return A handle to the ProgressBar control
100    */
101   static ProgressBar New();
102
103   /**
104    * @brief Creates an empty ProgressBar handle.
105    */
106   ProgressBar();
107
108   /**
109    * @brief Copy constructor.
110    *
111    * Creates another handle that points to the same real object.
112    */
113   ProgressBar( const ProgressBar& handle );
114
115   /**
116    * @brief Assignment operator.
117    *
118    * Changes this handle to point to another real object.
119    */
120   ProgressBar& operator=( const ProgressBar& handle );
121
122   /**
123    * @brief Destructor.
124    *
125    * This is non-virtual since derived Handle types must not contain data or virtual methods.
126    */
127   ~ProgressBar();
128
129   /**
130    * @brief Downcast an Object handle to ProgressBar.
131    *
132    * If handle points to a ProgressBar the
133    * downcast produces valid handle. If not the returned handle is left uninitialized.
134    * @param[in] handle Handle to an object
135    * @return handle to a ProgressBar or an uninitialized handle
136    */
137   static ProgressBar DownCast( BaseHandle handle );
138
139 public:  // Signals
140
141   /**
142    * @brief Value changed signal type.
143    */
144   typedef Signal< void ( ProgressBar, float ) > ValueChangedSignalType;
145
146   /**
147    * @brief Signal emitted when the ProgressBar value changes.
148    *
149    * A callback of the following type may be connected:
150    * @code
151    *   void YourCallbackName( ProgressBar progressBar, float value );
152    * @endcode
153    * @return The signal to connect to
154    */
155   ValueChangedSignalType& ValueChangedSignal();
156
157 public: // Not intended for application developers
158
159   /// @cond internal
160   /**
161    * @brief Creates a handle using the Toolkit::Internal implementation.
162    * @param[in]  implementation  The Control implementation
163    */
164   DALI_INTERNAL ProgressBar(Internal::ProgressBar& implementation);
165
166   /**
167    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
168    * @param[in]  internal  A pointer to the internal CustomActor
169    */
170   explicit DALI_INTERNAL ProgressBar( Dali::Internal::CustomActor* internal );
171   /// @endcond
172 };
173
174 } // namespace Toolkit
175
176 } // namespace Dali
177
178 #endif // DALI_TOOLKIT_PROGRESS_BAR_H