2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.ComponentModel;
19 using System.Diagnostics;
21 namespace ElmSharp.Wearable
25 /// The Circle ProgressBar is a widget for visually representing the progress status of a given job/task with the circular design.
27 /// <since_tizen> preview </since_tizen>
28 public class CircleProgressBar : Widget, ICircleWidget
30 CircleSurface _surface;
33 /// Creates and initializes a new instance of the Circle Progressbar class.
35 /// <param name="parent">The parent of new Circle Progressbar instance</param>
36 /// <param name="surface">The surface for drawing circle features for this widget.</param>
37 /// <since_tizen> preview </since_tizen>
38 public CircleProgressBar(EvasObject parent, CircleSurface surface) : base()
40 Debug.Assert(parent == null || surface == null || parent.IsRealized);
46 /// Creates and initializes a new instance of the Circle Progressbar class.
48 /// <param name="parent">The parent of new Circle Progressbar instance</param>
49 /// <since_tizen> preview </since_tizen>
50 [Obsolete("It is not safe for guess circle surface from parent and create new surface by every new widget")]
51 [EditorBrowsable(EditorBrowsableState.Never)]
52 public CircleProgressBar(EvasObject parent) : this(parent, CircleSurface.CreateCircleSurface(parent))
57 /// Gets the handle for Circle Widget.
59 /// <since_tizen> preview </since_tizen>
60 public virtual IntPtr CircleHandle => Handle;
63 /// Gets the handle for Circle Surface used in this widget
65 /// <since_tizen> preview </since_tizen>
66 public virtual CircleSurface CircleSurface => _surface;
69 /// Sets or gets disabled state of this widget.
71 /// <since_tizen> preview </since_tizen>
72 [Obsolete("Use IsEnabled")]
73 [EditorBrowsable(EditorBrowsableState.Never)]
77 set => IsEnabled = !value;
81 /// Sets or gets the state of the widget, which might be enabled or disabled.
83 /// <since_tizen> preview </since_tizen>
84 public override bool IsEnabled
88 return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
92 Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
97 /// Sets or gets the value of ProgressBar.
99 /// <since_tizen> preview </since_tizen>
104 return Interop.Eext.eext_circle_object_value_get(CircleHandle);
108 Interop.Eext.eext_circle_object_value_set(CircleHandle, value);
113 /// Sets or gets the maximum value of ProgressBar.
115 /// <since_tizen> preview </since_tizen>
116 public double Maximum
122 Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
127 double min = Minimum;
128 Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, min, value);
133 /// Sets or gets the minimum value of ProgressBar.
135 /// <since_tizen> preview </since_tizen>
136 public double Minimum
142 Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
147 double max = Maximum;
148 Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, value, max);
153 /// Sets or gets the angle value of ProgressBar.
155 /// <since_tizen> preview </since_tizen>
156 public double BarAngle
160 return Interop.Eext.eext_circle_object_angle_get(CircleHandle);
164 Interop.Eext.eext_circle_object_angle_set(CircleHandle, value);
169 /// Sets or gets the angle value of Background ProgressBar.
171 /// <since_tizen> preview </since_tizen>
172 public double BackgroundAngle
176 return Interop.Eext.eext_circle_object_item_angle_get(CircleHandle, "bg");
180 Interop.Eext.eext_circle_object_item_angle_set(CircleHandle, "bg", value);
185 /// Sets or gets the angle offset value of ProgressBar.
187 /// <since_tizen> preview </since_tizen>
188 public double BarAngleOffset
192 return Interop.Eext.eext_circle_object_angle_offset_get(CircleHandle);
196 Interop.Eext.eext_circle_object_angle_offset_set(CircleHandle, value);
201 /// Sets or gets the angle offset value of Background ProgressBar.
203 /// <since_tizen> preview </since_tizen>
204 public double BackgroundAngleOffset
208 return Interop.Eext.eext_circle_object_item_angle_offset_get(CircleHandle, "bg");
212 Interop.Eext.eext_circle_object_item_angle_offset_set(CircleHandle, "bg", value);
217 /// Sets or gets the maximum angle value of ProgressBar.
219 /// <since_tizen> preview </since_tizen>
220 public double BarAngleMaximum
226 Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
231 double min = BarAngleMinimum;
232 Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, min, value);
237 /// Sets or gets the minimum angle value of ProgressBar.
239 /// <since_tizen> preview </since_tizen>
240 public double BarAngleMinimum
246 Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
251 double max = BarAngleMaximum;
252 Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, value, max);
257 /// Sets or gets color of ProgressBar.
259 /// <since_tizen> preview </since_tizen>
260 public Color BarColor
268 Interop.Eext.eext_circle_object_color_get(CircleHandle, out r, out g, out b, out a);
269 return Color.FromRgba(r, g, b, a);
273 Interop.Eext.eext_circle_object_color_set(CircleHandle, value.R, value.G, value.B, value.A);
278 /// Sets or gets color of Background ProgressBar.
280 /// <since_tizen> preview </since_tizen>
281 public override Color BackgroundColor
289 Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "bg", out r, out g, out b, out a);
290 return Color.FromRgba(r, g, b, a);
294 Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "bg", value.R, value.G, value.B, value.A);
299 /// Sets or gets line width of ProgressBar.
301 /// <since_tizen> preview </since_tizen>
302 public int BarLineWidth
306 return Interop.Eext.eext_circle_object_line_width_get(CircleHandle);
310 Interop.Eext.eext_circle_object_line_width_set(CircleHandle, value);
315 /// Sets or gets line width of Background ProgressBar.
317 /// <since_tizen> preview </since_tizen>
318 public int BackgroundLineWidth
322 return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "bg");
326 Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "bg", value);
331 /// Sets or gets radius of ProgressBar.
333 /// <since_tizen> preview </since_tizen>
334 public double BarRadius
338 return Interop.Eext.eext_circle_object_radius_get(CircleHandle);
342 Interop.Eext.eext_circle_object_radius_set(CircleHandle, value);
347 /// Sets or gets radius of Background ProgressBar.
349 /// <since_tizen> preview </since_tizen>
350 public double BackgroundRadius
354 return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "bg");
358 Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "bg", value);
363 /// Creates a widget handle.
365 /// <param name="parent">Parent EvasObject</param>
366 /// <returns>Handle IntPtr</returns>
367 /// <since_tizen> preview </since_tizen>
368 protected override IntPtr CreateHandle(EvasObject parent)
370 return Interop.Eext.eext_circle_object_progressbar_add(parent, CircleSurface.Handle);