[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp.Wearable / ElmSharp.Wearable / CircleSpinner.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.ComponentModel;
19 using System.Diagnostics;
20
21 namespace ElmSharp.Wearable
22 {
23
24     /// <summary>
25     /// The Circle Spinner is a widget to display and handle the spinner value by the Rotary event.
26     /// Inherits <see cref="Spinner"/>.
27     /// </summary>
28     /// <since_tizen> preview </since_tizen>
29     [Obsolete("This has been deprecated in API12")]
30     public class CircleSpinner : Spinner, IRotaryActionWidget
31     {
32         IntPtr _circleHandle;
33         double _angleRatio = -1.0;
34         CircleSurface _surface;
35
36         /// <summary>
37         /// Creates and initializes a new instance of the Circle Spinner class.
38         /// </summary>
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()
44         {
45             Debug.Assert(parent == null || surface == null || parent.IsRealized);
46             _surface = surface;
47             Realize(parent);
48         }
49
50         /// <summary>
51         /// Creates and initializes a new instance of the Circle Spinner class.
52         /// </summary>
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))
58         {
59             ((IRotaryActionWidget)this).Activate();
60         }
61
62         /// <summary>
63         /// Gets the handle for Circle widget.
64         /// </summary>
65         /// <since_tizen> preview </since_tizen>
66         [Obsolete("This has been deprecated in API12")]
67         public virtual IntPtr CircleHandle => _circleHandle;
68
69         /// <summary>
70         /// Gets the handle for the circle surface used in this widget.
71         /// </summary>
72         /// <since_tizen> preview </since_tizen>
73         [Obsolete("This has been deprecated in API12")]
74         public virtual CircleSurface CircleSurface => _surface;
75
76         /// <summary>
77         /// Sets or gets the circle spinner angle per each spinner value.
78         /// </summary>
79         /// <since_tizen> preview </since_tizen>
80         [Obsolete("Use Step")]
81         [EditorBrowsable(EditorBrowsableState.Never)]
82         public double AngleRatio
83         {
84             get
85             {
86                 if (_angleRatio <= 0)
87                 {
88                     if (Maximum == Minimum)
89                     {
90                         return 0.0;
91                     }
92                     else
93                     {
94                         return 360 / (Maximum - Minimum);
95                     }
96                 }
97
98                 return _angleRatio;
99             }
100             set
101             {
102                 if (value > 0)
103                 {
104                     if (_angleRatio == value) return;
105
106                     _angleRatio = value;
107
108                     Interop.Eext.eext_circle_object_spinner_angle_set(CircleHandle, _angleRatio);
109                 }
110             }
111         }
112
113         /// <summary>
114         /// Sets or gets the disabled state of this widget.
115         /// </summary>
116         /// <since_tizen> preview </since_tizen>
117         [Obsolete("Use IsEnabled")]
118         [EditorBrowsable(EditorBrowsableState.Never)]
119         public bool Disabled
120         {
121             get => !IsEnabled;
122             set => IsEnabled = !value;
123         }
124
125         /// <summary>
126         /// Sets or gets the state of the widget, which might be enabled or disabled.
127         /// </summary>
128         /// <since_tizen> preview </since_tizen>
129         [Obsolete("This has been deprecated in API12")]
130         public override bool IsEnabled
131         {
132             get
133             {
134                 return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
135             }
136             set
137             {
138                 Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
139             }
140         }
141
142         /// <summary>
143         /// Sets or gets the line width of the marker.
144         /// </summary>
145         /// <remarks>
146         /// MarkerLineWidth is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
147         /// </remarks>
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
151         {
152             get
153             {
154                 return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "default");
155             }
156             set
157             {
158                 Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "default", value);
159             }
160         }
161
162         /// <summary>
163         /// Sets or gets the color of the marker.
164         /// </summary>
165         /// <remarks>
166         /// MarkerColor is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
167         /// </remarks>
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
171         {
172             get
173             {
174                 int r, g, b, a;
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);
177             }
178             set
179             {
180                 Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "default", value.R, value.G, value.B, value.A);
181             }
182         }
183
184         /// <summary>
185         /// Sets or gets the radius at which the center of the marker lies.
186         /// </summary>
187         /// <remarks>
188         /// MarkerRadius is not supported on device or emulator which does not support marker in CircleDatetimeSelector and CircleSpinner.
189         /// </remarks>
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
193         {
194             get
195             {
196                 return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "default");
197             }
198             set
199             {
200                 Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "default", value);
201             }
202         }
203
204         /// <summary>
205         /// Creates a widget handle.
206         /// </summary>
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)
212         {
213             IntPtr handle = base.CreateHandle(parent);
214             _circleHandle = Interop.Eext.eext_circle_object_spinner_add(RealHandle == IntPtr.Zero ? handle : RealHandle, CircleSurface.Handle);
215             return handle;
216         }
217     }
218 }