/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.ComponentModel; using System.Diagnostics; namespace ElmSharp.Wearable { /// /// The Circle DateTime Selector is a widget to display and handle datetime value by the Rotary event. /// Inherits . /// /// preview [Obsolete("This has been deprecated in API12")] public class CircleDateTimeSelector : DateTimeSelector, IRotaryActionWidget { IntPtr _circleHandle; CircleSurface _surface; /// /// Creates and initializes a new instance of the Circle DateTime class. /// /// The parent of the new Circle DateTime instance. /// The surface for drawing circle features for this widget. /// preview [Obsolete("This has been deprecated in API12")] public CircleDateTimeSelector(EvasObject parent, CircleSurface surface) : base() { Debug.Assert(parent == null || surface == null || parent.IsRealized); _surface = surface; Realize(parent); } /// /// Creates and initializes a new instance of the Circle DateTimeSelector class. /// /// The parent of the new Circle DateTimeSelector instance. /// preview [Obsolete("It is not safe for guess circle surface from parent and create new surface by every new widget")] [EditorBrowsable(EditorBrowsableState.Never)] public CircleDateTimeSelector(EvasObject parent) : this(parent, CircleSurface.CreateCircleSurface(parent)) { ((IRotaryActionWidget)this).Activate(); } /// /// Gets the handle for the Circle widget. /// /// preview [Obsolete("This has been deprecated in API12")] public virtual IntPtr CircleHandle => _circleHandle; /// /// Gets the handle for the circle surface used in this widget. /// /// preview [Obsolete("This has been deprecated in API12")] public virtual CircleSurface CircleSurface => _surface; /// /// Sets or gets the disabled state of this widget. /// /// preview [Obsolete("Use IsEnabled")] [EditorBrowsable(EditorBrowsableState.Never)] public bool Disabled { get => !IsEnabled; set => IsEnabled = !value; } /// /// Sets or gets the state of the widget, which might be enabled or disabled. /// /// preview [Obsolete("This has been deprecated in API12")] public override bool IsEnabled { get { return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle); } set { Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value); } } /// /// Sets or gets the color of the marker. /// /// /// MarkerColor is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner. /// /// preview [Obsolete("MarkerColor is obsolete as of version 6.0.0 and is no longer supported")] public Color MarkerColor { get { int r, g, b, a; Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "default", out r, out g, out b, out a); return new Color(r, g, b, a); } set { Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "default", value.R, value.G, value.B, value.A); } } /// /// Sets or gets the line width of the marker. /// /// /// MarkerLineWidth is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner. /// /// preview [Obsolete("MarkerLineWidth is obsolete as of version 6.0.0 and is no longer supported")] public int MarkerLineWidth { get { return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "default"); } set { Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "default", value); } } /// /// Sets or gets the radius at which the center of the marker lies. /// /// /// MarkerRadius is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner. /// /// preview [Obsolete("MarkerRadius is obsolete as of version 6.0.0 and is no longer supported")] public double MarkerRadius { get { return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "default"); } set { Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "default", value); } } /// /// Creates a widget handle. /// /// Parent EvasObject. /// Handle IntPtr. /// preview [Obsolete("This has been deprecated in API12")] protected override IntPtr CreateHandle(EvasObject parent) { var handle = base.CreateHandle(parent); _circleHandle = Interop.Eext.eext_circle_object_datetime_add(RealHandle == IntPtr.Zero ? handle : RealHandle, CircleSurface.Handle); return handle; } } }