[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Slider.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
19 namespace ElmSharp
20 {
21     /// <summary>
22     /// Enumeration for the Slider's indicator visiblity mode.
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     [Obsolete("This has been deprecated in API12")]
26     public enum SliderIndicatorVisibleMode
27     {
28         /// <summary>
29         /// Shows the indicator on mouse down or change in the slider value.
30         /// </summary>
31         Default,
32
33         /// <summary>
34         /// Always show the indicator.
35         /// </summary>
36         Always,
37
38         /// <summary>
39         /// Show the indicator on focus.
40         /// </summary>
41         OnFocus,
42
43         /// <summary>
44         /// Never show the indicator.
45         /// </summary>
46         None,
47     }
48
49     /// <summary>
50     /// The Slider is a widget that adds a draggable slider widget for selecting the value of something within a range.
51     /// </summary>
52     /// <since_tizen> preview </since_tizen>
53     [Obsolete("This has been deprecated in API12")]
54     public class Slider : Layout
55     {
56         double _minimum = 0.0;
57         double _maximum = 1.0;
58
59         SmartEvent _changed;
60         SmartEvent _delayedChanged;
61         SmartEvent _dragStarted;
62         SmartEvent _dragStopped;
63
64         /// <summary>
65         /// Creates and initializes a new instance of the Slider class.
66         /// </summary>
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)
71         {
72             _changed = new SmartEvent(this, this.RealHandle, "changed");
73             _changed.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty);
74
75             _delayedChanged = new SmartEvent(this, this.RealHandle, "delay,changed");
76             _delayedChanged.On += (s, e) => DelayedValueChanged?.Invoke(this, EventArgs.Empty);
77
78             _dragStarted = new SmartEvent(this, this.RealHandle, "slider,drag,start");
79             _dragStarted.On += (s, e) => DragStarted?.Invoke(this, EventArgs.Empty);
80
81             _dragStopped = new SmartEvent(this, this.RealHandle, "slider,drag,stop");
82             _dragStopped.On += (s, e) => DragStopped?.Invoke(this, EventArgs.Empty);
83         }
84
85         /// <summary>
86         /// ValueChanged will be triggered when the Slider value is changed by the user.
87         /// </summary>
88         /// <since_tizen> preview </since_tizen>
89         [Obsolete("This has been deprecated in API12")]
90         public event EventHandler ValueChanged;
91
92         /// <summary>
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.
96         /// </summary>
97         /// <since_tizen> preview </since_tizen>
98         [Obsolete("This has been deprecated in API12")]
99         public event EventHandler DelayedValueChanged;
100
101         /// <summary>
102         /// DragStarted will be triggered when dragging the Slider indicator around has started.
103         /// </summary>
104         /// <since_tizen> preview </since_tizen>
105         [Obsolete("This has been deprecated in API12")]
106         public event EventHandler DragStarted;
107
108         /// <summary>
109         /// DragStopped will be triggered when dragging the Slider indicator around has stopped.
110         /// </summary>
111         /// <since_tizen> preview </since_tizen>
112         [Obsolete("This has been deprecated in API12")]
113         public event EventHandler DragStopped;
114
115         /// <summary>
116         /// Sets or gets the (exact) length of the bar region of a given Slider widget.
117         /// </summary>
118         /// <remarks>
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.
123         /// </remarks>
124         /// <since_tizen> preview </since_tizen>
125         [Obsolete("This has been deprecated in API12")]
126         public int SpanSize
127         {
128             get
129             {
130                 return Interop.Elementary.elm_slider_span_size_get(RealHandle);
131             }
132             set
133             {
134                 Interop.Elementary.elm_slider_span_size_set(RealHandle, value);
135             }
136         }
137
138         /// <summary>
139         /// Sets or gets the format string for the indicator label.
140         /// </summary>
141         /// <remarks>
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.
149         /// </remarks>
150         /// <since_tizen> preview </since_tizen>
151         [Obsolete("This has been deprecated in API12")]
152         public string IndicatorFormat
153         {
154             get
155             {
156                 return Interop.Elementary.elm_slider_indicator_format_get(RealHandle);
157             }
158             set
159             {
160                 Interop.Elementary.elm_slider_indicator_format_set(RealHandle, value);
161             }
162         }
163
164         /// <summary>
165         /// Sets or gets the orientation of a given slider widget.
166         /// </summary>
167         /// <remarks>
168         /// The orientation may be vertical or horizontal. By default, it's displayed horizontally.
169         /// </remarks>
170         /// <since_tizen> preview </since_tizen>
171         [Obsolete("This has been deprecated in API12")]
172         public bool IsHorizontal
173         {
174             get
175             {
176                 return Interop.Elementary.elm_slider_horizontal_get(RealHandle);
177             }
178             set
179             {
180                 Interop.Elementary.elm_slider_horizontal_set(RealHandle, value);
181             }
182         }
183
184         /// <summary>
185         /// Sets or gets the minimum values for the slider.
186         /// </summary>
187         /// <remarks>
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.
191         /// </remarks>
192         /// <since_tizen> preview </since_tizen>
193         [Obsolete("This has been deprecated in API12")]
194         public double Minimum
195         {
196             get
197             {
198                 return _minimum;
199             }
200             set
201             {
202                 _minimum = value;
203                 Interop.Elementary.elm_slider_min_max_set(RealHandle, _minimum, _maximum);
204             }
205         }
206
207         /// <summary>
208         /// Sets or gets the maximum values for the slider.
209         /// </summary>
210         /// <remarks>
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.
215         /// </remarks>
216         /// <since_tizen> preview </since_tizen>
217         [Obsolete("This has been deprecated in API12")]
218         public double Maximum
219         {
220             get
221             {
222                 return _maximum;
223             }
224             set
225             {
226                 _maximum = value;
227                 Interop.Elementary.elm_slider_min_max_set(RealHandle, _minimum, _maximum);
228             }
229         }
230
231         /// <summary>
232         /// Gets or sets the value displayed by the slider.
233         /// </summary>
234         /// <remarks>
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.
237         /// </remarks>
238         /// <since_tizen> preview </since_tizen>
239         [Obsolete("This has been deprecated in API12")]
240         public double Value
241         {
242             get
243             {
244                 return Interop.Elementary.elm_slider_value_get(RealHandle);
245             }
246             set
247             {
248                 Interop.Elementary.elm_slider_value_set(RealHandle, value);
249             }
250         }
251
252         /// <summary>
253         /// Sets or gets the step by which the slider indicator moves.
254         /// </summary>
255         /// <remarks>
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.
260         /// </remarks>
261         /// <since_tizen> preview </since_tizen>
262         [Obsolete("This has been deprecated in API12")]
263         public double Step
264         {
265             get
266             {
267                 return Interop.Elementary.elm_slider_step_get(RealHandle);
268             }
269             set
270             {
271                 Interop.Elementary.elm_slider_step_set(RealHandle, value);
272             }
273         }
274
275         /// <summary>
276         /// Gets or sets whether a given slider widget's displaying values are inverted.
277         /// </summary>
278         /// <remarks>
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.
283         /// </remarks>
284         /// <since_tizen> preview </since_tizen>
285         [Obsolete("This has been deprecated in API12")]
286         public bool IsInverted
287         {
288             get
289             {
290                 return Interop.Elementary.elm_slider_inverted_get(RealHandle);
291             }
292             set
293             {
294                 Interop.Elementary.elm_slider_inverted_set(RealHandle, value);
295             }
296         }
297
298         /// <summary>
299         /// Sets or gets whether to enlarge the slider indicator (augmented knob).
300         /// </summary>
301         /// <remarks>
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.
304         /// </remarks>
305         /// <since_tizen> preview </since_tizen>
306         [Obsolete("This has been deprecated in API12")]
307         public bool IsIndicatorVisible
308         {
309             get
310             {
311                 return Interop.Elementary.elm_slider_indicator_show_get(RealHandle);
312             }
313             set
314             {
315                 Interop.Elementary.elm_slider_indicator_show_set(RealHandle, value);
316             }
317         }
318
319         /// <summary>
320         /// Sets or gets the visible mode of the slider indicator.
321         /// </summary>
322         /// <since_tizen> preview </since_tizen>
323         [Obsolete("This has been deprecated in API12")]
324         public SliderIndicatorVisibleMode IndicatorVisibleMode
325         {
326             get
327             {
328                 return (SliderIndicatorVisibleMode)Interop.Elementary.elm_slider_indicator_visible_mode_get(RealHandle);
329             }
330             set
331             {
332                 Interop.Elementary.elm_slider_indicator_visible_mode_set(RealHandle, (int)value);
333             }
334         }
335
336         /// <summary>
337         /// Sets or gets whether to show the indicator of a slider on focus.
338         /// </summary>
339         /// <since_tizen> preview </since_tizen>
340         [Obsolete("This has been deprecated in API12")]
341         public bool IsIndicatorFocusable
342         {
343             get
344             {
345                 return Interop.Elementary.elm_slider_indicator_show_on_focus_get(RealHandle);
346             }
347             set
348             {
349                 Interop.Elementary.elm_slider_indicator_show_on_focus_set(RealHandle, value);
350             }
351         }
352
353         /// <summary>
354         /// Creates a widget handle.
355         /// </summary>
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)
361         {
362             IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
363             Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
364
365             RealHandle = Interop.Elementary.elm_slider_add(handle);
366             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
367
368             return handle;
369         }
370     }
371 }