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
24 /// The Circle DateTime Selector is a widget to display and handle datetime value by the Rotary event.
25 /// Inherits <see cref="DateTimeSelector"/>.
27 /// <since_tizen> preview </since_tizen>
28 public class CircleDateTimeSelector : DateTimeSelector, IRotaryActionWidget
31 CircleSurface _surface;
34 /// Creates and initializes a new instance of the Circle DateTime class.
36 /// <param name="parent">The parent of the new Circle DateTime instance.</param>
37 /// <param name="surface">The surface for drawing circle features for this widget.</param>
38 /// <since_tizen> preview </since_tizen>
39 public CircleDateTimeSelector(EvasObject parent, CircleSurface surface) : base()
41 Debug.Assert(parent == null || surface == null || parent.IsRealized);
47 /// Creates and initializes a new instance of the Circle DateTimeSelector class.
49 /// <param name="parent">The parent of the new Circle DateTimeSelector instance.</param>
50 /// <since_tizen> preview </since_tizen>
51 [Obsolete("It is not safe for guess circle surface from parent and create new surface by every new widget")]
52 [EditorBrowsable(EditorBrowsableState.Never)]
53 public CircleDateTimeSelector(EvasObject parent) : this(parent, CircleSurface.CreateCircleSurface(parent))
55 ((IRotaryActionWidget)this).Activate();
59 /// Gets the handle for the Circle widget.
61 /// <since_tizen> preview </since_tizen>
62 public virtual IntPtr CircleHandle => _circleHandle;
65 /// Gets the handle for the circle surface used in this widget.
67 /// <since_tizen> preview </since_tizen>
68 public virtual CircleSurface CircleSurface => _surface;
71 /// Sets or gets the disabled state of this widget.
73 /// <since_tizen> preview </since_tizen>
74 [Obsolete("Use IsEnabled")]
75 [EditorBrowsable(EditorBrowsableState.Never)]
79 set => IsEnabled = !value;
83 /// Sets or gets the state of the widget, which might be enabled or disabled.
85 /// <since_tizen> preview </since_tizen>
86 public override bool IsEnabled
90 return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
94 Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
99 /// Sets or gets the color of the marker.
102 /// MarkerColor is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
104 /// <since_tizen> preview </since_tizen>
105 public Color MarkerColor
110 Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "default", out r, out g, out b, out a);
111 return new Color(r, g, b, a);
115 Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "default", value.R, value.G, value.B, value.A);
120 /// Sets or gets the line width of the marker.
123 /// MarkerLineWidth is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
125 /// <since_tizen> preview </since_tizen>
126 public int MarkerLineWidth
130 return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "default");
134 Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "default", value);
139 /// Sets or gets the radius at which the center of the marker lies.
142 /// MarkerRadius is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
144 /// <since_tizen> preview </since_tizen>
145 public double MarkerRadius
149 return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "default");
153 Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "default", value);
158 /// Creates a widget handle.
160 /// <param name="parent">Parent EvasObject.</param>
161 /// <returns>Handle IntPtr.</returns>
162 /// <since_tizen> preview </since_tizen>
163 protected override IntPtr CreateHandle(EvasObject parent)
165 var handle = base.CreateHandle(parent);
167 _circleHandle = Interop.Eext.eext_circle_object_datetime_add(RealHandle == IntPtr.Zero ? handle : RealHandle , CircleSurface.Handle);