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 /// Circle slider is a circular designed widget used to select a value in a range by the Rotary event.
26 /// <since_tizen> preview </since_tizen>
27 [Obsolete("This has been deprecated in API12")]
28 public class CircleSlider : Widget, IRotaryActionWidget
30 SmartEvent _changedEvent;
31 CircleSurface _surface;
34 /// Creates and initializes a new instance of the CircleSlider class.
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()
42 Debug.Assert(parent == null || surface == null || parent.IsRealized);
48 /// Creates and initializes a new instance of the Circle Slider class.
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))
56 ((IRotaryActionWidget)this).Activate();
60 /// Changed will be triggered when the circle slider value changes.
62 /// <since_tizen> preview </since_tizen>
63 [Obsolete("This has been deprecated in API12")]
64 public event EventHandler ValueChanged;
67 /// Gets the handle for the Circle widget.
69 /// <since_tizen> preview </since_tizen>
70 [Obsolete("This has been deprecated in API12")]
71 public virtual IntPtr CircleHandle => RealHandle;
74 /// Gets the handle for the circle surface used in this widget.
76 /// <since_tizen> preview </since_tizen>
77 [Obsolete("This has been deprecated in API12")]
78 public virtual CircleSurface CircleSurface => _surface;
81 /// Sets or gets the step by which the circle slider bar moves.
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.
87 /// <since_tizen> preview </since_tizen>
88 [Obsolete("This has been deprecated in API12")]
93 return Interop.Eext.eext_circle_object_slider_step_get(CircleHandle);
97 Interop.Eext.eext_circle_object_slider_step_set(CircleHandle, (double)value);
102 /// Sets or gets the disabled state of this widget.
104 /// <since_tizen> preview </since_tizen>
105 [Obsolete("Use IsEnabled")]
106 [EditorBrowsable(EditorBrowsableState.Never)]
110 set => IsEnabled = !value;
114 /// Sets or gets the state of the widget, which might be enabled or disabled.
116 /// <since_tizen> preview </since_tizen>
117 [Obsolete("This has been deprecated in API12")]
118 public override bool IsEnabled
122 return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
126 Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
131 /// Sets or gets the color of the circle slider bar.
133 /// <since_tizen> preview </since_tizen>
134 [Obsolete("This has been deprecated in API12")]
135 public Color BarColor
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);
148 Interop.Eext.eext_circle_object_color_set(CircleHandle, value.R, value.G, value.B, value.A);
153 /// Sets or gets the color of the circle slider background.
155 /// <since_tizen> preview </since_tizen>
156 [Obsolete("This has been deprecated in API12")]
157 public override Color BackgroundColor
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);
170 Interop.Eext.eext_circle_object_item_color_set(CircleHandle, "bg", value.R, value.G, value.B, value.A);
175 /// Sets or gets the line width of the circle slider bar.
177 /// <since_tizen> preview </since_tizen>
178 [Obsolete("This has been deprecated in API12")]
179 public int BarLineWidth
183 return Interop.Eext.eext_circle_object_line_width_get(CircleHandle);
187 Interop.Eext.eext_circle_object_line_width_set(CircleHandle, value);
192 /// Sets or gets the line width of the circle slider background.
194 /// <since_tizen> preview </since_tizen>
195 [Obsolete("This has been deprecated in API12")]
196 public int BackgroundLineWidth
200 return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "bg");
204 Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "bg", value);
209 /// Sets or gets the angle in degree of the circle slider bar.
211 /// <since_tizen> preview </since_tizen>
212 [Obsolete("This has been deprecated in API12")]
213 public double BarAngle
217 return Interop.Eext.eext_circle_object_angle_get(CircleHandle);
221 Interop.Eext.eext_circle_object_angle_set(CircleHandle, value);
226 /// Sets or gets the angle in degree of the circle slider background.
228 /// <since_tizen> preview </since_tizen>
229 [Obsolete("This has been deprecated in API12")]
230 public double BackgroundAngle
234 return Interop.Eext.eext_circle_object_item_angle_get(CircleHandle, "bg");
238 Interop.Eext.eext_circle_object_item_angle_set(CircleHandle, "bg", value);
243 /// Sets or gets the angle offset for the slider bar.
244 /// Offset value means start position of the slider bar.
246 /// <since_tizen> preview </since_tizen>
247 [Obsolete("This has been deprecated in API12")]
248 public double BarAngleOffset
252 return Interop.Eext.eext_circle_object_angle_offset_get(CircleHandle);
256 Interop.Eext.eext_circle_object_angle_offset_set(CircleHandle, value);
261 /// Sets or gets the angle offset for the circle slider background.
262 /// Offset value means start position of the slider background.
264 /// <since_tizen> preview </since_tizen>
265 [Obsolete("This has been deprecated in API12")]
266 public double BackgroundAngleOffset
270 return Interop.Eext.eext_circle_object_item_angle_offset_get(CircleHandle, "bg");
274 Interop.Eext.eext_circle_object_item_angle_offset_set(CircleHandle, "bg", value);
279 /// Sets or gets the minimum angle of the circle slider bar.
281 /// <since_tizen> preview </since_tizen>
282 [Obsolete("This has been deprecated in API12")]
283 public double BarAngleMinimum
289 Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
294 double max = BarAngleMaximum;
295 Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, (double)value, max);
300 /// Sets or gets the maximum angle of the circle slider bar.
302 /// <since_tizen> preview </since_tizen>
303 [Obsolete("This has been deprecated in API12")]
304 public double BarAngleMaximum
310 Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
315 double min = BarAngleMinimum;
316 Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, min, (double)value);
321 /// Sets or gets the minimum values for the circle slider.
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.
328 /// <since_tizen> preview </since_tizen>
329 [Obsolete("This has been deprecated in API12")]
330 public double Minimum
336 Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
341 double max = Maximum;
342 Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, (double)value, max);
347 /// Sets or gets the maximum values for the circle slider.
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.
355 /// <since_tizen> preview </since_tizen>
356 [Obsolete("This has been deprecated in API12")]
357 public double Maximum
363 Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
368 double min = Minimum;
369 Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, min, (double)value);
374 /// Gets or sets the value displayed by the circle slider.
377 /// The value must be between minimum and maximum.
379 /// <since_tizen> preview </since_tizen>
380 [Obsolete("This has been deprecated in API12")]
385 return Interop.Eext.eext_circle_object_value_get(CircleHandle);
389 Interop.Eext.eext_circle_object_value_set(CircleHandle, (double)value);
394 /// Gets or sets the radius value for the circle slider bar.
396 /// <since_tizen> preview </since_tizen>
397 [Obsolete("This has been deprecated in API12")]
398 public double BarRadius
402 return Interop.Eext.eext_circle_object_radius_get(CircleHandle);
406 Interop.Eext.eext_circle_object_radius_set(CircleHandle, value);
411 /// Gets or sets the radius value for the circle slider background.
413 /// <since_tizen> preview </since_tizen>
414 [Obsolete("This has been deprecated in API12")]
415 public double BackgroundRadius
419 return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "bg");
423 Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "bg", value);
428 /// The callback of the Realized event.
430 /// <since_tizen> preview </since_tizen>
431 [Obsolete("This has been deprecated in API12")]
432 protected override void OnRealized()
435 _changedEvent = new SmartEvent(this, "value,changed");
436 _changedEvent.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty);
440 /// Creates a widget handle.
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)
448 return Interop.Eext.eext_circle_object_slider_add(parent, CircleSurface.Handle);