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.
22 /// Enumeration for the Slider's indicator visiblity mode.
24 /// <since_tizen> preview </since_tizen>
25 [Obsolete("This has been deprecated in API12")]
26 public enum SliderIndicatorVisibleMode
29 /// Shows the indicator on mouse down or change in the slider value.
34 /// Always show the indicator.
39 /// Show the indicator on focus.
44 /// Never show the indicator.
50 /// The Slider is a widget that adds a draggable slider widget for selecting the value of something within a range.
52 /// <since_tizen> preview </since_tizen>
53 [Obsolete("This has been deprecated in API12")]
54 public class Slider : Layout
56 double _minimum = 0.0;
57 double _maximum = 1.0;
60 SmartEvent _delayedChanged;
61 SmartEvent _dragStarted;
62 SmartEvent _dragStopped;
65 /// Creates and initializes a new instance of the Slider class.
67 /// <param name="parent">The <see cref="EvasObject"/> to which the new slider will be attached as a child.</param>
68 /// <since_tizen> preview </since_tizen>
69 [Obsolete("This has been deprecated in API12")]
70 public Slider(EvasObject parent) : base(parent)
72 _changed = new SmartEvent(this, this.RealHandle, "changed");
73 _changed.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty);
75 _delayedChanged = new SmartEvent(this, this.RealHandle, "delay,changed");
76 _delayedChanged.On += (s, e) => DelayedValueChanged?.Invoke(this, EventArgs.Empty);
78 _dragStarted = new SmartEvent(this, this.RealHandle, "slider,drag,start");
79 _dragStarted.On += (s, e) => DragStarted?.Invoke(this, EventArgs.Empty);
81 _dragStopped = new SmartEvent(this, this.RealHandle, "slider,drag,stop");
82 _dragStopped.On += (s, e) => DragStopped?.Invoke(this, EventArgs.Empty);
86 /// ValueChanged will be triggered when the Slider value is changed by the user.
88 /// <since_tizen> preview </since_tizen>
89 [Obsolete("This has been deprecated in API12")]
90 public event EventHandler ValueChanged;
93 /// DelayedValueChanged will be triggered when a short time after the value is changed by the user.
94 /// This will be called only when the user stops dragging for a very short period or when they release their finger/mouse,
95 /// so it avoids possibly expensive reactions to the value change.
97 /// <since_tizen> preview </since_tizen>
98 [Obsolete("This has been deprecated in API12")]
99 public event EventHandler DelayedValueChanged;
102 /// DragStarted will be triggered when dragging the Slider indicator around has started.
104 /// <since_tizen> preview </since_tizen>
105 [Obsolete("This has been deprecated in API12")]
106 public event EventHandler DragStarted;
109 /// DragStopped will be triggered when dragging the Slider indicator around has stopped.
111 /// <since_tizen> preview </since_tizen>
112 [Obsolete("This has been deprecated in API12")]
113 public event EventHandler DragStopped;
116 /// Sets or gets the (exact) length of the bar region of a given Slider widget.
119 /// This sets the minimum width (when in the horizontal mode) or height (when in the vertical mode)
120 /// of the actual bar area of the slider object. This in turn affects the object's minimum size.
121 /// Use this when you're not setting other size hints expanding on the given direction
122 /// (like weight and alignment hints), and you would like it to have a specific size.
124 /// <since_tizen> preview </since_tizen>
125 [Obsolete("This has been deprecated in API12")]
130 return Interop.Elementary.elm_slider_span_size_get(RealHandle);
134 Interop.Elementary.elm_slider_span_size_set(RealHandle, value);
139 /// Sets or gets the format string for the indicator label.
142 /// The slider may display its value somewhere other than the unit label,
143 /// for example, above the slider knob that is dragged around. This function sets the format string
144 /// used for this. If null, the indicator label won't be visible. If not, it sets the format string
145 /// for the label text. For the label text floating point value is provided, so the label text can
146 /// display up to 1 floating point value. Note that this is optional. Use a format string
147 /// such as "%1.2f meters" for example, and it displays values like: "3.14 meters" for a value
148 /// equal to 3.14159. By default, the indicator label is disabled.
150 /// <since_tizen> preview </since_tizen>
151 [Obsolete("This has been deprecated in API12")]
152 public string IndicatorFormat
156 return Interop.Elementary.elm_slider_indicator_format_get(RealHandle);
160 Interop.Elementary.elm_slider_indicator_format_set(RealHandle, value);
165 /// Sets or gets the orientation of a given slider widget.
168 /// The orientation may be vertical or horizontal. By default, it's displayed horizontally.
170 /// <since_tizen> preview </since_tizen>
171 [Obsolete("This has been deprecated in API12")]
172 public bool IsHorizontal
176 return Interop.Elementary.elm_slider_horizontal_get(RealHandle);
180 Interop.Elementary.elm_slider_horizontal_set(RealHandle, value);
185 /// Sets or gets the minimum values for the slider.
188 /// This defines the allowed minimum values to be selected by the user.
189 /// If the actual value is less than min, it is updated to min.
190 /// Actual value can be obtained with value. By default, the minimum is equal to 0.0.
192 /// <since_tizen> preview </since_tizen>
193 [Obsolete("This has been deprecated in API12")]
194 public double Minimum
203 Interop.Elementary.elm_slider_min_max_set(RealHandle, _minimum, _maximum);
208 /// Sets or gets the maximum values for the slider.
211 /// This defines the allowed maximum values to be selected by the user.
212 /// If the actual value is bigger then max, it is updated to max.
213 /// Actual value can be obtained with value. By default, minimum is equal to 0.0 and maximum is equal to 1.0.
214 /// Maximum must be greater than minimum, otherwise the behavior is undefined.
216 /// <since_tizen> preview </since_tizen>
217 [Obsolete("This has been deprecated in API12")]
218 public double Maximum
227 Interop.Elementary.elm_slider_min_max_set(RealHandle, _minimum, _maximum);
232 /// Gets or sets the value displayed by the slider.
235 /// Value will be presented on the unit label following format specified with UnitFormat and
236 /// on indicator with IndicatorFormat. The value must be between minimum and maximum values.
238 /// <since_tizen> preview </since_tizen>
239 [Obsolete("This has been deprecated in API12")]
244 return Interop.Elementary.elm_slider_value_get(RealHandle);
248 Interop.Elementary.elm_slider_value_set(RealHandle, value);
253 /// Sets or gets the step by which the slider indicator moves.
256 /// This value is used when the draggable object is moved automatically i.e.,
257 /// in case of a key event when up/down/left/right key is pressed or in case accessibility
258 /// is set and the flick event is used to increase or decrease the slider values.
259 /// By default, the step value is equal to 0.05.
261 /// <since_tizen> preview </since_tizen>
262 [Obsolete("This has been deprecated in API12")]
267 return Interop.Elementary.elm_slider_step_get(RealHandle);
271 Interop.Elementary.elm_slider_step_set(RealHandle, value);
276 /// Gets or sets whether a given slider widget's displaying values are inverted.
279 /// A slider may be inverted, in which case it gets its values inverted,
280 /// with high values being on the left or top, and low values on the right or bottom,
281 /// as opposed to normally have the low values on the former and high values on the latter,
282 /// respectively, for the horizontal and vertical modes.
284 /// <since_tizen> preview </since_tizen>
285 [Obsolete("This has been deprecated in API12")]
286 public bool IsInverted
290 return Interop.Elementary.elm_slider_inverted_get(RealHandle);
294 Interop.Elementary.elm_slider_inverted_set(RealHandle, value);
299 /// Sets or gets whether to enlarge the slider indicator (augmented knob).
302 /// By default, the indicator is bigger when dragged by the user.
303 /// It won't display the values set with IndicatorFormat if you disable the indicator.
305 /// <since_tizen> preview </since_tizen>
306 [Obsolete("This has been deprecated in API12")]
307 public bool IsIndicatorVisible
311 return Interop.Elementary.elm_slider_indicator_show_get(RealHandle);
315 Interop.Elementary.elm_slider_indicator_show_set(RealHandle, value);
320 /// Sets or gets the visible mode of the slider indicator.
322 /// <since_tizen> preview </since_tizen>
323 [Obsolete("This has been deprecated in API12")]
324 public SliderIndicatorVisibleMode IndicatorVisibleMode
328 return (SliderIndicatorVisibleMode)Interop.Elementary.elm_slider_indicator_visible_mode_get(RealHandle);
332 Interop.Elementary.elm_slider_indicator_visible_mode_set(RealHandle, (int)value);
337 /// Sets or gets whether to show the indicator of a slider on focus.
339 /// <since_tizen> preview </since_tizen>
340 [Obsolete("This has been deprecated in API12")]
341 public bool IsIndicatorFocusable
345 return Interop.Elementary.elm_slider_indicator_show_on_focus_get(RealHandle);
349 Interop.Elementary.elm_slider_indicator_show_on_focus_set(RealHandle, value);
354 /// Creates a widget handle.
356 /// <param name="parent">Parent EvasObject.</param>
357 /// <returns>Handle IntPtr.</returns>
358 /// <since_tizen> preview </since_tizen>
359 [Obsolete("This has been deprecated in API12")]
360 protected override IntPtr CreateHandle(EvasObject parent)
362 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
363 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
365 RealHandle = Interop.Elementary.elm_slider_add(handle);
366 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);