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 Spinner is a widget to display and handle the spinner value by the Rotary event.
26 /// Inherits <see cref="Spinner"/>.
28 /// <since_tizen> preview </since_tizen>
29 [Obsolete("This has been deprecated in API12")]
30 public class CircleSpinner : Spinner, IRotaryActionWidget
33 double _angleRatio = -1.0;
34 CircleSurface _surface;
37 /// Creates and initializes a new instance of the Circle Spinner class.
39 /// <param name="parent">The parent of the new Circle Spinner instance.</param>
40 /// <param name="surface">The surface for drawing circle features for this widget.</param>
41 /// <since_tizen> preview </since_tizen>
42 [Obsolete("This has been deprecated in API12")]
43 public CircleSpinner(EvasObject parent, CircleSurface surface) : base()
45 Debug.Assert(parent == null || surface == null || parent.IsRealized);
51 /// Creates and initializes a new instance of the Circle Spinner class.
53 /// <param name="parent">The parent of the new Circle Spinner instance.</param>
54 /// <since_tizen> preview </since_tizen>
55 [Obsolete("It is not safe for guess circle surface from parent and create new surface by every new widget")]
56 [EditorBrowsable(EditorBrowsableState.Never)]
57 public CircleSpinner(EvasObject parent) : this(parent, CircleSurface.CreateCircleSurface(parent))
59 ((IRotaryActionWidget)this).Activate();
63 /// Gets the handle for Circle widget.
65 /// <since_tizen> preview </since_tizen>
66 [Obsolete("This has been deprecated in API12")]
67 public virtual IntPtr CircleHandle => _circleHandle;
70 /// Gets the handle for the circle surface used in this widget.
72 /// <since_tizen> preview </since_tizen>
73 [Obsolete("This has been deprecated in API12")]
74 public virtual CircleSurface CircleSurface => _surface;
77 /// Sets or gets the circle spinner angle per each spinner value.
79 /// <since_tizen> preview </since_tizen>
80 [Obsolete("Use Step")]
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public double AngleRatio
88 if (Maximum == Minimum)
94 return 360 / (Maximum - Minimum);
104 if (_angleRatio == value) return;
108 Interop.Eext.eext_circle_object_spinner_angle_set(CircleHandle, _angleRatio);
114 /// Sets or gets the disabled state of this widget.
116 /// <since_tizen> preview </since_tizen>
117 [Obsolete("Use IsEnabled")]
118 [EditorBrowsable(EditorBrowsableState.Never)]
122 set => IsEnabled = !value;
126 /// Sets or gets the state of the widget, which might be enabled or disabled.
128 /// <since_tizen> preview </since_tizen>
129 [Obsolete("This has been deprecated in API12")]
130 public override bool IsEnabled
134 return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
138 Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
143 /// Sets or gets the line width of the marker.
146 /// MarkerLineWidth is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
148 /// <since_tizen> preview </since_tizen>
149 [Obsolete("MarkerLineWidth is obsolete as of version 6.0.0 and is no longer supported")]
150 public int MarkerLineWidth
154 return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "default");
158 Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "default", value);
163 /// Sets or gets the color of the marker.
166 /// MarkerColor is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
168 /// <since_tizen> preview </since_tizen>
169 [Obsolete("MarkerColor is obsolete as of version 6.0.0 and is no longer supported")]
170 public Color MarkerColor
175 Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "default", out r, out g, out b, out a);
176 return new Color(r, g, b, a);
180 Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "default", value.R, value.G, value.B, value.A);
185 /// Sets or gets the radius at which the center of the marker lies.
188 /// MarkerRadius is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
190 /// <since_tizen> preview </since_tizen>
191 [Obsolete("MarkerRadius is obsolete as of version 6.0.0 and is no longer supported")]
192 public double MarkerRadius
196 return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "default");
200 Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "default", value);
205 /// Creates a widget handle.
207 /// <param name="parent">Parent EvasObject.</param>
208 /// <returns>Handle IntPtr.</returns>
209 /// <since_tizen> preview </since_tizen>
210 [Obsolete("This has been deprecated in API12")]
211 protected override IntPtr CreateHandle(EvasObject parent)
213 IntPtr handle = base.CreateHandle(parent);
214 _circleHandle = Interop.Eext.eext_circle_object_spinner_add(RealHandle == IntPtr.Zero ? handle : RealHandle, CircleSurface.Handle);