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.
19 namespace ElmSharp.Wearable
23 /// The Circle ProgressBar is a widget for visually representing the progress status of a given job/task with the circular design.
25 public class CircleProgressBar : EvasObject
27 private IntPtr _circleHandle;
30 /// Creates and initializes a new instance of the Circle Progressbar class.
32 /// <param name="parent">The parent of new Circle Progressbar instance</param>
33 public CircleProgressBar(EvasObject parent) : base(parent)
39 /// Sets or gets the value of ProgressBar.
45 return Interop.Eext.eext_circle_object_value_get(_circleHandle);
49 Interop.Eext.eext_circle_object_value_set(_circleHandle, value);
54 /// Sets or gets the maximum value of ProgressBar.
62 Interop.Eext.eext_circle_object_value_min_max_get(_circleHandle, out min, out max);
68 Interop.Eext.eext_circle_object_value_min_max_set(_circleHandle, min, value);
73 /// Sets or gets the minimum value of ProgressBar.
81 Interop.Eext.eext_circle_object_value_min_max_get(_circleHandle, out min, out max);
87 Interop.Eext.eext_circle_object_value_min_max_set(_circleHandle, value, max);
92 /// Sets or gets the angle value of ProgressBar.
94 public double BarAngle
98 return Interop.Eext.eext_circle_object_angle_get(_circleHandle);
102 Interop.Eext.eext_circle_object_angle_set(_circleHandle, value);
107 /// Sets or gets the angle value of Background ProgressBar.
109 public double BackgroundAngle
113 return Interop.Eext.eext_circle_object_item_angle_get(_circleHandle, "bg");
117 Interop.Eext.eext_circle_object_item_angle_set(_circleHandle, "bg", value);
122 /// Sets or gets the angle offset value of ProgressBar.
124 public double BarAngleOffset
128 return Interop.Eext.eext_circle_object_angle_offset_get(_circleHandle);
132 Interop.Eext.eext_circle_object_angle_offset_set(_circleHandle, value);
137 /// Sets or gets the angle offset value of Background ProgressBar.
139 public double BackgroundAngleOffset
143 return Interop.Eext.eext_circle_object_item_angle_offset_get(_circleHandle, "bg");
147 Interop.Eext.eext_circle_object_item_angle_offset_set(_circleHandle, "bg", value);
152 /// Sets or gets the maximum angle value of ProgressBar.
154 public double BarAngleMaximum
160 Interop.Eext.eext_circle_object_angle_min_max_get(_circleHandle, out min, out max);
165 double min = BarAngleMinimum;
166 Interop.Eext.eext_circle_object_angle_min_max_set(_circleHandle, min, value);
171 /// Sets or gets the minimum angle value of ProgressBar.
173 public double BarAngleMinimum
179 Interop.Eext.eext_circle_object_angle_min_max_get(_circleHandle, out min, out max);
184 double max = BarAngleMaximum;
185 Interop.Eext.eext_circle_object_angle_min_max_set(_circleHandle, value, max);
190 /// Sets or gets disable status of Circle ProgressBar.
196 return Interop.Eext.eext_circle_object_disabled_get(_circleHandle);
200 Interop.Eext.eext_circle_object_disabled_set(_circleHandle, value);
205 /// Sets or gets color of ProgressBar.
207 public Color BarColor
215 Interop.Eext.eext_circle_object_color_get(_circleHandle, out r, out g, out b, out a);
216 return Color.FromRgba(r, g, b, a);
220 Interop.Eext.eext_circle_object_color_set(_circleHandle, value.R, value.G, value.B, value.A);
225 /// Sets or gets color of Background ProgressBar.
227 public Color BackgroundColor
235 Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "bg", out r, out g, out b, out a);
236 return Color.FromRgba(r, g, b, a);
240 Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "bg", value.R, value.G, value.B, value.A);
245 /// Sets or gets line width of ProgressBar.
247 public int BarLineWidth
251 return Interop.Eext.eext_circle_object_line_width_get(_circleHandle); ;
255 Interop.Eext.eext_circle_object_line_width_set(_circleHandle, value);
260 /// Sets or gets line width of Background ProgressBar.
262 public int BackgroundLineWidth
266 return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "bg");
270 Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "bg", value);
275 /// Sets or gets radius of ProgressBar.
277 public double BarRadius
281 return Interop.Eext.eext_circle_object_radius_get(_circleHandle); ;
285 Interop.Eext.eext_circle_object_radius_set(_circleHandle, value);
290 /// Sets or gets radius of Background ProgressBar.
292 public double BackgroundRadius
296 return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "bg"); ;
300 Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "bg", value);
304 protected override IntPtr CreateHandle(EvasObject parent)
306 IntPtr surface = IntPtr.Zero;
308 if (parent is Conformant)
310 surface = Interop.Eext.eext_circle_surface_conformant_add(parent.Handle);
312 else if (parent is Layout)
314 surface = Interop.Eext.eext_circle_surface_layout_add(parent.Handle);
316 else if (parent is Naviframe)
318 surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
321 _circleHandle = Interop.Eext.eext_circle_object_progressbar_add(parent.Handle, surface);
322 if (surface == IntPtr.Zero)
324 EvasObject p = parent;
325 while (!(p is Window))
329 var w = (p as Window).ScreenSize.Width;
330 var h = (p as Window).ScreenSize.Height;
331 Interop.Evas.evas_object_resize(_circleHandle, w, h);
334 Interop.Eext.eext_rotary_object_event_activated_set(_circleHandle, true);
335 return parent.Handle;