[ElmSharp] Fix XML documentation warnings.
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / ProgressBar.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace ElmSharp
20 {
21     /// <summary>
22     /// The ProgressBar is a widget for visually representing the progress status of a given job/task.
23     /// </summary>
24     public class ProgressBar : Layout
25     {
26         SmartEvent _changed;
27
28         /// <summary>
29         /// Creates and initializes a new instance of the ProgressBar class.
30         /// </summary>
31         /// <param name="parent">The EvasObject to which the new ProgressBar will be attached as a child.</param>
32         public ProgressBar(EvasObject parent) : base(parent)
33         {
34             _changed = new SmartEvent(this, this.RealHandle, "changed");
35             _changed.On += (s, e) =>
36             {
37                 ValueChanged?.Invoke(this, EventArgs.Empty);
38             };
39         }
40
41         /// <summary>
42         /// ValueChanged will be triggered when value of ProgressBar change.
43         /// </summary>
44         public event EventHandler ValueChanged;
45
46         /// <summary>
47         /// Sets or gets the value wheather a given ProgressBar widget is at the "pulsing mode".
48         /// </summary>
49         /// <remarks>
50         /// By default, progress bars display values from low to high value boundaries.
51         /// There are, though, contexts in which the progress of a given task is unknown.
52         /// For such cases, one can set a progress bar widget to a "pulsing state",
53         /// to give the user an idea that some computation is being held,
54         /// but without exact progress values. In the default theme,
55         /// it animates its bar with the contents filling in constantly and back to non-filled, in a loop.
56         /// </remarks>
57         public bool IsPulseMode
58         {
59             get
60             {
61                 return Interop.Elementary.elm_progressbar_pulse_get(RealHandle);
62             }
63             set
64             {
65                 Interop.Elementary.elm_progressbar_pulse_set(RealHandle, value);
66             }
67         }
68
69         /// <summary>
70         /// Sets or gets the value of ProgressBar.
71         /// </summary>
72         /// <remarks>
73         /// Use this property to set the progress bar levels.
74         /// If you pass a value out of the specified range(0.0~1.0),
75         /// it is interpreted as the closest of the boundary values in the range.
76         /// </remarks>
77         public double Value
78         {
79             get
80             {
81                 return Interop.Elementary.elm_progressbar_value_get(RealHandle);
82             }
83             set
84             {
85                 Interop.Elementary.elm_progressbar_value_set(RealHandle, value);
86             }
87         }
88
89         /// <summary>
90         /// Sets or gets the span value of ProgressBar.
91         /// </summary>
92         public int SpanSize
93         {
94             get
95             {
96                 return Interop.Elementary.elm_progressbar_span_size_get(RealHandle);
97             }
98             set
99             {
100                 Interop.Elementary.elm_progressbar_span_size_set(RealHandle, value);
101             }
102         }
103
104         /// <summary>
105         /// Sets or gets the value wheather a given ProgressBar widget is horizontal.
106         /// </summary>
107         public bool IsHorizontal
108         {
109             get
110             {
111                 return Interop.Elementary.elm_progressbar_horizontal_get(RealHandle);
112             }
113             set
114             {
115                 Interop.Elementary.elm_progressbar_horizontal_set(RealHandle, value);
116             }
117         }
118
119         /// <summary>
120         /// Sets or gets the value whether a given progress bar widget's displaying values are inverted.
121         /// </summary>
122         public bool IsInverted
123         {
124             get
125             {
126                 return Interop.Elementary.elm_progressbar_inverted_get(RealHandle);
127             }
128             set
129             {
130                 Interop.Elementary.elm_progressbar_inverted_set(RealHandle, value);
131             }
132         }
133
134         /// <summary>
135         /// Sets or gets format string for a given progress bar widget's units label.
136         /// </summary>
137         /// <remarks>
138         /// If NULL is passed on format, it makes obj units area to be hidden completely.
139         /// If not, it sets the format string for the units label's text.
140         /// The units label is provided with a floating point value, so the units text displays at most one floating point value.
141         /// Note that the units label is optional. Use a format string such as "%1.2f meters" for example.
142         /// </remarks>
143         public string UnitFormat
144         {
145             get
146             {
147                 return Interop.Elementary.elm_progressbar_unit_format_get(RealHandle);
148             }
149             set
150             {
151                 Interop.Elementary.elm_progressbar_unit_format_set(RealHandle, value);
152             }
153         }
154
155         /// <summary>
156         /// Starts a given progress bar "pulsing" animation, if its under that mode.
157         /// </summary>
158         public void PlayPulse()
159         {
160             Interop.Elementary.elm_progressbar_pulse(RealHandle, true);
161         }
162
163         /// <summary>
164         /// Stops a given progress bar "pulsing" animation, if its under that mode.
165         /// </summary>
166         [Obsolete("use StopPulse instead")]
167         public void StopPluse()
168         {
169             Interop.Elementary.elm_progressbar_pulse(RealHandle, false);
170         }
171
172         /// <summary>
173         /// Stops a given progress bar "pulsing" animation, if its under that mode.
174         /// </summary>
175         public void StopPulse()
176         {
177             Interop.Elementary.elm_progressbar_pulse(RealHandle, false);
178         }
179
180         /// <summary>
181         /// Gets the part value of the given part of the Progressbar.
182         /// </summary>
183         /// <param name="part">Part of the Progressbar.</param>
184         /// <returns>Returns value range is from 0.0 to 1.0.</returns>
185         public double GetPartValue(string part)
186         {
187             return Interop.Elementary.elm_progressbar_part_value_get(RealHandle, part);
188         }
189
190         /// <summary>
191         /// Sets or gets the general or main color of the given Progressbar.
192         /// </summary>
193         public override Color Color
194         {
195             get
196             {
197                 return GetPartColor("bar");
198             }
199             set
200             {
201                 SetPartColor("bar", value);
202             }
203         }
204
205         /// <summary>
206         /// Sets the part value of the give part of the Progressbar.
207         /// </summary>
208         /// <param name="part">Part of the Progressbar.</param>
209         /// <param name="value">Value range is from 0.0 to 1.0.</param>
210         public void SetPartValue(string part, double value)
211         {
212             Interop.Elementary.elm_progressbar_part_value_set(RealHandle, part, value);
213         }
214
215         /// <summary>
216         /// Creates a widget handle.
217         /// </summary>
218         /// <param name="parent">Parent EvasObject</param>
219         /// <returns>Handle IntPtr</returns>
220         protected override IntPtr CreateHandle(EvasObject parent)
221         {
222             IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
223             Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
224
225             RealHandle = Interop.Elementary.elm_progressbar_add(handle);
226             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
227
228             return handle;
229         }
230     }
231 }