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.Diagnostics;
20 namespace ElmSharp.Wearable
23 /// The Circle DateTime Selector is a widget to display and handle datetime value by rotary event
24 /// Inherits <see cref="DateTimeSelector"/>
26 public class CircleDateTimeSelector : DateTimeSelector, IRotaryActionWidget
29 CircleSurface _surface;
32 /// Creates and initializes a new instance of the Circle DateTime class
34 /// <param name="parent">The parent of new Circle DateTime instance</param>
35 /// <param name="surface">The surface for drawing circle features for this widget.</param>
36 public CircleDateTimeSelector(EvasObject parent, CircleSurface surface) : base()
38 Debug.Assert(parent == null || surface == null || parent.IsRealized);
44 /// Gets the handle for Circle Widget.
46 public virtual IntPtr CircleHandle => _circleHandle;
49 /// Gets the handle for Circle Surface used in this widget
51 public virtual CircleSurface CircleSurface => _surface;
54 /// Sets or gets the state of the widget, which might be enabled or disabled.
56 public override bool IsEnabled
60 return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
64 Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
69 /// Sets or gets the color of the marker
71 public Color MarkerColor
76 Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "default", out r, out g, out b, out a);
77 return new Color(r, g, b, a);
81 Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "default", value.R, value.G, value.B, value.A);
86 /// Sets or gets the line width of the marker
88 public int MarkerLineWidth
92 return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "default");
96 Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "default", value);
101 /// Sets or gets the radius at which the center of the marker lies
103 public double MarkerRadius
107 return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "default");
111 Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "default", value);
116 /// Creates a widget handle.
118 /// <param name="parent">Parent EvasObject</param>
119 /// <returns>Handle IntPtr</returns>
120 protected override IntPtr CreateHandle(EvasObject parent)
122 var handle = base.CreateHandle(parent);
124 _circleHandle = Interop.Eext.eext_circle_object_datetime_add(RealHandle == IntPtr.Zero ? Handle : RealHandle , CircleSurface.Handle);