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 Spinner is a widget to display and handle spinner value by rotary event
24 /// Inherits <see cref="Spinner"/>.
26 public class CircleSpinner : Spinner
28 private IntPtr _circleHandle;
29 private double _angleRatio = 1.0;
32 /// Creates and initializes a new instance of the Circle Spinner class.
34 /// <param name="parent">The parent of new Circle Spinner instance</param>
35 public CircleSpinner(EvasObject parent) : base(parent)
40 /// Sets or gets the circle spinner angle per each spinner value.
42 public double AngleRatio
51 Interop.Eext.eext_circle_object_spinner_angle_set(_circleHandle, _angleRatio);
56 /// Sets or gets disabled state of the circle spinner object.
62 return Interop.Eext.eext_circle_object_disabled_get(_circleHandle); ;
66 Interop.Eext.eext_circle_object_disabled_set(_circleHandle, value);
71 /// Sets or gets the line width of the marker
73 public int MarkerLineWidth
77 return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "default");
81 Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "default", value);
86 /// Sets or gets the color of the marker
88 public Color MarkerColor
93 Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "default", out r, out g, out b, out a);
94 return new Color(r, g, b, a);
98 Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "default", value.R, value.G, value.B, value.A);
103 /// Sets or gets the radius at which the center of the marker lies
105 public double MarkerRadius
109 return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "default");
113 Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "default", value);
117 protected override IntPtr CreateHandle(EvasObject parent)
119 IntPtr handle = base.CreateHandle(parent);
121 IntPtr surface = IntPtr.Zero;
123 if (parent is Conformant)
125 surface = Interop.Eext.eext_circle_surface_conformant_add(parent.Handle);
127 else if (parent is Naviframe)
129 surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
131 else if (parent is Layout)
133 surface = Interop.Eext.eext_circle_surface_layout_add(parent.Handle);
136 _circleHandle = Interop.Eext.eext_circle_object_spinner_add(RealHandle, surface);
137 if (surface == IntPtr.Zero)
139 EvasObject p = parent;
140 while (!(p is Window))
144 var w = (p as Window).ScreenSize.Width;
145 var h = (p as Window).ScreenSize.Height;
146 Interop.Evas.evas_object_resize(_circleHandle, w, h);
149 Interop.Eext.eext_rotary_object_event_activated_set(_circleHandle, true);