[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp.Wearable / ElmSharp.Wearable / CircleSlider.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     /// <summary>
24     /// Circle slider is a circular designed widget used to select a value in a range by the Rotary event.
25     /// </summary>
26     /// <since_tizen> preview </since_tizen>
27     [Obsolete("This has been deprecated in API12")]
28     public class CircleSlider : Widget, IRotaryActionWidget
29     {
30         SmartEvent _changedEvent;
31         CircleSurface _surface;
32
33         /// <summary>
34         /// Creates and initializes a new instance of the CircleSlider class.
35         /// </summary>
36         /// <param name="parent">The EvasObject to which the new CircleSlider will be attached as a child.</param>
37         /// <param name="surface">The surface for drawing the circle features for this widget.</param>
38         /// <since_tizen> preview </since_tizen>
39         [Obsolete("This has been deprecated in API12")]
40         public CircleSlider(EvasObject parent, CircleSurface surface) : base()
41         {
42             Debug.Assert(parent == null || surface == null || parent.IsRealized);
43             _surface = surface;
44             Realize(parent);
45         }
46
47         /// <summary>
48         /// Creates and initializes a new instance of the Circle Slider class.
49         /// </summary>
50         /// <param name="parent">The parent of the new Circle CircleSlider instance.</param>
51         /// <since_tizen> preview </since_tizen>
52         [Obsolete("It is not safe for guess circle surface from parent and create new surface by every new widget")]
53         [EditorBrowsable(EditorBrowsableState.Never)]
54         public CircleSlider(EvasObject parent) : this(parent, CircleSurface.CreateCircleSurface(parent))
55         {
56             ((IRotaryActionWidget)this).Activate();
57         }
58
59         /// <summary>
60         /// Changed will be triggered when the circle slider value changes.
61         /// </summary>
62         /// <since_tizen> preview </since_tizen>
63         [Obsolete("This has been deprecated in API12")]
64         public event EventHandler ValueChanged;
65
66         /// <summary>
67         /// Gets the handle for the Circle widget.
68         /// </summary>
69         /// <since_tizen> preview </since_tizen>
70         [Obsolete("This has been deprecated in API12")]
71         public virtual IntPtr CircleHandle => RealHandle;
72
73         /// <summary>
74         /// Gets the handle for the circle surface used in this widget.
75         /// </summary>
76         /// <since_tizen> preview </since_tizen>
77         [Obsolete("This has been deprecated in API12")]
78         public virtual CircleSurface CircleSurface => _surface;
79
80         /// <summary>
81         /// Sets or gets the step by which the circle slider bar moves.
82         /// </summary>
83         /// <remarks>
84         /// This value is used when the circle slider value is changed by a drag or the Rotary event.
85         /// The value of the slider is increased/decreased by the step value.
86         /// </remarks>
87         /// <since_tizen> preview </since_tizen>
88         [Obsolete("This has been deprecated in API12")]
89         public double Step
90         {
91             get
92             {
93                 return Interop.Eext.eext_circle_object_slider_step_get(CircleHandle);
94             }
95             set
96             {
97                 Interop.Eext.eext_circle_object_slider_step_set(CircleHandle, (double)value);
98             }
99         }
100
101         /// <summary>
102         /// Sets or gets the disabled state of this widget.
103         /// </summary>
104         /// <since_tizen> preview </since_tizen>
105         [Obsolete("Use IsEnabled")]
106         [EditorBrowsable(EditorBrowsableState.Never)]
107         public bool Disabled
108         {
109             get => !IsEnabled;
110             set => IsEnabled = !value;
111         }
112
113         /// <summary>
114         /// Sets or gets the state of the widget, which might be enabled or disabled.
115         /// </summary>
116         /// <since_tizen> preview </since_tizen>
117         [Obsolete("This has been deprecated in API12")]
118         public override bool IsEnabled
119         {
120             get
121             {
122                 return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
123             }
124             set
125             {
126                 Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
127             }
128         }
129
130         /// <summary>
131         /// Sets or gets the color of the circle slider bar.
132         /// </summary>
133         /// <since_tizen> preview </since_tizen>
134         [Obsolete("This has been deprecated in API12")]
135         public Color BarColor
136         {
137             get
138             {
139                 int r = 0;
140                 int g = 0;
141                 int b = 0;
142                 int a = 0;
143                 Interop.Eext.eext_circle_object_color_get(CircleHandle, out r, out g, out b, out a);
144                 return Color.FromRgba(r, g, b, a);
145             }
146             set
147             {
148                 Interop.Eext.eext_circle_object_color_set(CircleHandle, value.R, value.G, value.B, value.A);
149             }
150         }
151
152         /// <summary>
153         /// Sets or gets the color of the circle slider background.
154         /// </summary>
155         /// <since_tizen> preview </since_tizen>
156         [Obsolete("This has been deprecated in API12")]
157         public override Color BackgroundColor
158         {
159             get
160             {
161                 int r = 0;
162                 int g = 0;
163                 int b = 0;
164                 int a = 0;
165                 Interop.Eext.eext_circle_object_item_color_get(CircleHandle, "bg", out r, out g, out b, out a);
166                 return Color.FromRgba(r, g, b, a);
167             }
168             set
169             {
170                 Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "bg", value.R, value.G, value.B, value.A);
171             }
172         }
173
174         /// <summary>
175         /// Sets or gets the line width of the circle slider bar.
176         /// </summary>
177         /// <since_tizen> preview </since_tizen>
178         [Obsolete("This has been deprecated in API12")]
179         public int BarLineWidth
180         {
181             get
182             {
183                 return Interop.Eext.eext_circle_object_line_width_get(CircleHandle);
184             }
185             set
186             {
187                 Interop.Eext.eext_circle_object_line_width_set(CircleHandle, value);
188             }
189         }
190
191         /// <summary>
192         /// Sets or gets the line width of the circle slider background.
193         /// </summary>
194         /// <since_tizen> preview </since_tizen>
195         [Obsolete("This has been deprecated in API12")]
196         public int BackgroundLineWidth
197         {
198             get
199             {
200                 return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "bg");
201             }
202             set
203             {
204                 Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "bg", value);
205             }
206         }
207
208         /// <summary>
209         /// Sets or gets the angle in degree of the circle slider bar.
210         /// </summary>
211         /// <since_tizen> preview </since_tizen>
212         [Obsolete("This has been deprecated in API12")]
213         public double BarAngle
214         {
215             get
216             {
217                 return Interop.Eext.eext_circle_object_angle_get(CircleHandle);
218             }
219             set
220             {
221                 Interop.Eext.eext_circle_object_angle_set(CircleHandle, value);
222             }
223         }
224
225         /// <summary>
226         /// Sets or gets the angle in degree of the circle slider background.
227         /// </summary>
228         /// <since_tizen> preview </since_tizen>
229         [Obsolete("This has been deprecated in API12")]
230         public double BackgroundAngle
231         {
232             get
233             {
234                 return Interop.Eext.eext_circle_object_item_angle_get(CircleHandle, "bg");
235             }
236             set
237             {
238                 Interop.Eext.eext_circle_object_item_angle_set(CircleHandle, "bg", value);
239             }
240         }
241
242         /// <summary>
243         /// Sets or gets the angle offset for the slider bar.
244         /// Offset value means start position of the slider bar.
245         /// </summary>
246         /// <since_tizen> preview </since_tizen>
247         [Obsolete("This has been deprecated in API12")]
248         public double BarAngleOffset
249         {
250             get
251             {
252                 return Interop.Eext.eext_circle_object_angle_offset_get(CircleHandle);
253             }
254             set
255             {
256                 Interop.Eext.eext_circle_object_angle_offset_set(CircleHandle, value);
257             }
258         }
259
260         /// <summary>
261         /// Sets or gets the angle offset for the circle slider background.
262         /// Offset value means start position of the slider background.
263         /// </summary>
264         /// <since_tizen> preview </since_tizen>
265         [Obsolete("This has been deprecated in API12")]
266         public double BackgroundAngleOffset
267         {
268             get
269             {
270                 return Interop.Eext.eext_circle_object_item_angle_offset_get(CircleHandle, "bg");
271             }
272             set
273             {
274                 Interop.Eext.eext_circle_object_item_angle_offset_set(CircleHandle, "bg", value);
275             }
276         }
277
278         /// <summary>
279         /// Sets or gets the minimum angle of the circle slider bar.
280         /// </summary>
281         /// <since_tizen> preview </since_tizen>
282         [Obsolete("This has been deprecated in API12")]
283         public double BarAngleMinimum
284         {
285             get
286             {
287                 double min;
288                 double max;
289                 Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
290                 return min;
291             }
292             set
293             {
294                 double max = BarAngleMaximum;
295                 Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, (double)value, max);
296             }
297         }
298
299         /// <summary>
300         /// Sets or gets the maximum angle of the circle slider bar.
301         /// </summary>
302         /// <since_tizen> preview </since_tizen>
303         [Obsolete("This has been deprecated in API12")]
304         public double BarAngleMaximum
305         {
306             get
307             {
308                 double min;
309                 double max;
310                 Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
311                 return max;
312             }
313             set
314             {
315                 double min = BarAngleMinimum;
316                 Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, min, (double)value);
317             }
318         }
319
320         /// <summary>
321         /// Sets or gets the minimum values for the circle slider.
322         /// </summary>
323         /// <remarks>
324         /// This defines the allowed minimum values to be selected by the user.
325         /// If the actual value is less than the minimum value, it is updated to the minimum value.
326         /// Actual value can be obtained with Value. By default, minimum value is equal to 0.0.
327         /// </remarks>
328         /// <since_tizen> preview </since_tizen>
329         [Obsolete("This has been deprecated in API12")]
330         public double Minimum
331         {
332             get
333             {
334                 double min;
335                 double max;
336                 Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
337                 return min;
338             }
339             set
340             {
341                 double max = Maximum;
342                 Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, (double)value, max);
343             }
344         }
345
346         /// <summary>
347         /// Sets or gets the maximum values for the circle slider.
348         /// </summary>
349         /// <remarks>
350         /// This defines the allowed maximum values to be selected by the user.
351         /// If the actual value is bigger than the maximum value, it is updated to the maximum value.
352         /// Actual value can be obtained with Value. By default, the minimum value is equal to 0.0, and the maximum value is equal to 1.0.
353         /// Maximum must be greater than minimum, otherwise the behavior is undefined.
354         /// </remarks>
355         /// <since_tizen> preview </since_tizen>
356         [Obsolete("This has been deprecated in API12")]
357         public double Maximum
358         {
359             get
360             {
361                 double min;
362                 double max;
363                 Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
364                 return max;
365             }
366             set
367             {
368                 double min = Minimum;
369                 Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, min, (double)value);
370             }
371         }
372
373         /// <summary>
374         /// Gets or sets the value displayed by the circle slider.
375         /// </summary>
376         /// <remarks>
377         /// The value must be between minimum and maximum.
378         /// </remarks>
379         /// <since_tizen> preview </since_tizen>
380         [Obsolete("This has been deprecated in API12")]
381         public double Value
382         {
383             get
384             {
385                 return Interop.Eext.eext_circle_object_value_get(CircleHandle);
386             }
387             set
388             {
389                 Interop.Eext.eext_circle_object_value_set(CircleHandle, (double)value);
390             }
391         }
392
393         /// <summary>
394         /// Gets or sets the radius value for the circle slider bar.
395         /// </summary>
396         /// <since_tizen> preview </since_tizen>
397         [Obsolete("This has been deprecated in API12")]
398         public double BarRadius
399         {
400             get
401             {
402                 return Interop.Eext.eext_circle_object_radius_get(CircleHandle);
403             }
404             set
405             {
406                 Interop.Eext.eext_circle_object_radius_set(CircleHandle, value);
407             }
408         }
409
410         /// <summary>
411         /// Gets or sets the radius value for the circle slider background.
412         /// </summary>
413         /// <since_tizen> preview </since_tizen>
414         [Obsolete("This has been deprecated in API12")]
415         public double BackgroundRadius
416         {
417             get
418             {
419                 return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "bg");
420             }
421             set
422             {
423                 Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "bg", value);
424             }
425         }
426
427         /// <summary>
428         /// The callback of the Realized event.
429         /// </summary>
430         /// <since_tizen> preview </since_tizen>
431         [Obsolete("This has been deprecated in API12")]
432         protected override void OnRealized()
433         {
434             base.OnRealized();
435             _changedEvent = new SmartEvent(this, "value,changed");
436             _changedEvent.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty);
437         }
438
439         /// <summary>
440         /// Creates a widget handle.
441         /// </summary>
442         /// <param name="parent">Parent EvasObject</param>
443         /// <returns>Handle IntPtr.</returns>
444         /// <since_tizen> preview </since_tizen>
445         [Obsolete("This has been deprecated in API12")]
446         protected override IntPtr CreateHandle(EvasObject parent)
447         {
448             return Interop.Eext.eext_circle_object_slider_add(parent, CircleSurface.Handle);
449         }
450     }
451 }