1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
20 // This file was automatically generated by SWIG (http://www.swig.org).
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
27 namespace Tizen.NUI.UIComponents
31 using System.Runtime.InteropServices;
32 using Tizen.NUI.BaseComponents;
35 /// Slider is a control to enable sliding an indicator between two values.
37 internal class Slider : View
39 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
41 internal Slider(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Slider_SWIGUpcast(cPtr), cMemoryOwn)
43 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
44 // By default, we do not want the position to use the anchor point
45 PositionUsesAnchorPoint = false;
48 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Slider obj)
50 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
56 protected override void Dispose(DisposeTypes type)
63 if (type == DisposeTypes.Explicit)
66 //Release your own managed resources here.
67 //You should release all of your own disposable objects here.
71 //Release your own unmanaged resources here.
72 //You should not access any managed member here except static instance.
73 //because the execution order of Finalizes is non-deterministic.
75 if (swigCPtr.Handle != global::System.IntPtr.Zero)
80 NDalicPINVOKE.delete_Slider(swigCPtr);
82 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
89 /// Value changed event arguments.
91 public class ValueChangedEventArgs : EventArgs
93 private Slider _slider;
94 private float _slideValue;
114 public float SlideValue
128 /// Sliding finished event arguments.
130 public class SlidingFinishedEventArgs : EventArgs
132 private Slider _slider;
133 private float _slideValue;
153 public float SlideValue
167 /// Mark reached event arguments.
169 public class MarkReachedEventArgs : EventArgs
171 private Slider _slider;
172 private int _slideValue;
192 public int SlideValue
206 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
207 private delegate bool ValueChangedCallbackDelegate(IntPtr slider, float slideValue);
208 private EventHandlerWithReturnType<object, ValueChangedEventArgs, bool> _sliderValueChangedEventHandler;
209 private ValueChangedCallbackDelegate _sliderValueChangedCallbackDelegate;
211 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
212 private delegate bool SlidingFinishedCallbackDelegate(IntPtr slider, float slideValue);
213 private EventHandlerWithReturnType<object, SlidingFinishedEventArgs, bool> _sliderSlidingFinishedEventHandler;
214 private SlidingFinishedCallbackDelegate _sliderSlidingFinishedCallbackDelegate;
216 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
217 private delegate bool MarkReachedCallbackDelegate(IntPtr slider, int slideValue);
218 private EventHandlerWithReturnType<object, MarkReachedEventArgs, bool> _sliderMarkReachedEventHandler;
219 private MarkReachedCallbackDelegate _sliderMarkReachedCallbackDelegate;
222 /// Event emitted when the slider value changes.
224 public event EventHandlerWithReturnType<object, ValueChangedEventArgs, bool> ValueChanged
228 if (_sliderValueChangedEventHandler == null)
230 _sliderValueChangedCallbackDelegate = (OnValueChanged);
231 ValueChangedSignal().Connect(_sliderValueChangedCallbackDelegate);
233 _sliderValueChangedEventHandler += value;
237 _sliderValueChangedEventHandler -= value;
238 if (_sliderValueChangedEventHandler == null && ValueChangedSignal().Empty() == false)
240 ValueChangedSignal().Disconnect(_sliderValueChangedCallbackDelegate);
245 // Callback for Slider ValueChanged signal
246 private bool OnValueChanged(IntPtr slider, float slideValue)
248 ValueChangedEventArgs e = new ValueChangedEventArgs();
250 // Populate all members of "e" (ValueChangedEventArgs) with real page
251 e.Slider = Slider.GetSliderFromPtr(slider);
252 e.SlideValue = slideValue;
254 if (_sliderValueChangedEventHandler != null)
256 //here we send all page to user event handlers
257 return _sliderValueChangedEventHandler(this, e);
263 /// Event emitted when the sliding is finished.
265 public event EventHandlerWithReturnType<object, SlidingFinishedEventArgs, bool> SlidingFinished
269 if (_sliderSlidingFinishedEventHandler == null)
271 _sliderSlidingFinishedCallbackDelegate = (OnSlidingFinished);
272 SlidingFinishedSignal().Connect(_sliderSlidingFinishedCallbackDelegate);
274 _sliderSlidingFinishedEventHandler += value;
278 _sliderSlidingFinishedEventHandler -= value;
279 if (_sliderSlidingFinishedEventHandler == null && SlidingFinishedSignal().Empty() == false)
281 SlidingFinishedSignal().Disconnect(_sliderSlidingFinishedCallbackDelegate);
286 // Callback for Slider SlidingFinished signal
287 private bool OnSlidingFinished(IntPtr slider, float slideValue)
289 SlidingFinishedEventArgs e = new SlidingFinishedEventArgs();
291 // Populate all members of "e" (SlidingFinishedEventArgs) with real page
292 e.Slider = Slider.GetSliderFromPtr(slider);
293 e.SlideValue = slideValue;
295 if (_sliderSlidingFinishedEventHandler != null)
297 //here we send all page to user event handlers
298 return _sliderSlidingFinishedEventHandler(this, e);
304 /// Event emitted when the slider handle reaches a mark.
306 public event EventHandlerWithReturnType<object, MarkReachedEventArgs, bool> MarkReached
310 if (_sliderMarkReachedEventHandler == null)
312 _sliderMarkReachedCallbackDelegate = (OnMarkReached);
313 MarkReachedSignal().Connect(_sliderMarkReachedCallbackDelegate);
315 _sliderMarkReachedEventHandler += value;
319 _sliderMarkReachedEventHandler -= value;
320 if (_sliderMarkReachedEventHandler == null && MarkReachedSignal().Empty() == false)
322 MarkReachedSignal().Disconnect(_sliderMarkReachedCallbackDelegate);
327 // Callback for Slider MarkReached signal
328 private bool OnMarkReached(IntPtr slider, int slideValue)
330 MarkReachedEventArgs e = new MarkReachedEventArgs();
332 // Populate all members of "e" (MarkReachedEventArgs) with real page
333 e.Slider = Slider.GetSliderFromPtr(slider);
334 e.SlideValue = slideValue;
336 if (_sliderMarkReachedEventHandler != null)
338 //here we send all page to user event handlers
339 return _sliderMarkReachedEventHandler(this, e);
345 /// Get Slider from the pointer.
347 /// <param name="cPtr">The pointer of Slider</param>
348 /// <returns>Object of Slider type</returns>
349 internal static Slider GetSliderFromPtr(global::System.IntPtr cPtr)
351 Slider ret = new Slider(cPtr, false);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356 internal class Property : global::System.IDisposable
358 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
359 protected bool swigCMemOwn;
361 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
363 swigCMemOwn = cMemoryOwn;
364 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
367 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
369 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
372 //A Flag to check who called Dispose(). (By User or DisposeQueue)
\r
373 private bool isDisposeQueued = false;
\r
374 //A Flat to check if it is already disposed.
\r
375 protected bool disposed = false;
379 if (!isDisposeQueued)
\r
381 isDisposeQueued = true;
\r
382 DisposeQueue.Instance.Add(this);
\r
386 public void Dispose()
\r
388 //Throw excpetion if Dispose() is called in separate thread.
\r
389 if (!Window.IsInstalled())
\r
391 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
\r
394 if (isDisposeQueued)
\r
396 Dispose(DisposeTypes.Implicit);
\r
400 Dispose(DisposeTypes.Explicit);
\r
401 System.GC.SuppressFinalize(this);
\r
405 protected virtual void Dispose(DisposeTypes type)
\r
412 if (type == DisposeTypes.Explicit)
\r
415 //Release your own managed resources here.
\r
416 //You should release all of your own disposable objects here.
\r
420 //Release your own unmanaged resources here.
\r
421 //You should not access any managed member here except static instance.
\r
422 //because the execution order of Finalizes is non-deterministic.
\r
424 if (swigCPtr.Handle != global::System.IntPtr.Zero)
\r
428 swigCMemOwn = false;
\r
429 NDalicPINVOKE.delete_Slider_Property(swigCPtr);
\r
431 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
\r
437 internal Property() : this(NDalicPINVOKE.new_Slider_Property(), true)
439 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
442 internal static readonly int LOWER_BOUND = NDalicPINVOKE.Slider_Property_LOWER_BOUND_get();
443 internal static readonly int UPPER_BOUND = NDalicPINVOKE.Slider_Property_UPPER_BOUND_get();
444 internal static readonly int VALUE = NDalicPINVOKE.Slider_Property_VALUE_get();
445 internal static readonly int TRACK_VISUAL = NDalicPINVOKE.Slider_Property_TRACK_VISUAL_get();
446 internal static readonly int HANDLE_VISUAL = NDalicPINVOKE.Slider_Property_HANDLE_VISUAL_get();
447 internal static readonly int PROGRESS_VISUAL = NDalicPINVOKE.Slider_Property_PROGRESS_VISUAL_get();
448 internal static readonly int POPUP_VISUAL = NDalicPINVOKE.Slider_Property_POPUP_VISUAL_get();
449 internal static readonly int POPUP_ARROW_VISUAL = NDalicPINVOKE.Slider_Property_POPUP_ARROW_VISUAL_get();
450 internal static readonly int DISABLED_COLOR = NDalicPINVOKE.Slider_Property_DISABLED_COLOR_get();
451 internal static readonly int VALUE_PRECISION = NDalicPINVOKE.Slider_Property_VALUE_PRECISION_get();
452 internal static readonly int SHOW_POPUP = NDalicPINVOKE.Slider_Property_SHOW_POPUP_get();
453 internal static readonly int SHOW_VALUE = NDalicPINVOKE.Slider_Property_SHOW_VALUE_get();
454 internal static readonly int MARKS = NDalicPINVOKE.Slider_Property_MARKS_get();
455 internal static readonly int SNAP_TO_MARKS = NDalicPINVOKE.Slider_Property_SNAP_TO_MARKS_get();
456 internal static readonly int MARK_TOLERANCE = NDalicPINVOKE.Slider_Property_MARK_TOLERANCE_get();
461 /// Creates the Slider control.
463 public Slider() : this(NDalicPINVOKE.Slider_New(), true)
465 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
468 internal Slider(Slider handle) : this(NDalicPINVOKE.new_Slider__SWIG_1(Slider.getCPtr(handle)), true)
470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
473 internal Slider Assign(Slider handle)
475 Slider ret = new Slider(NDalicPINVOKE.Slider_Assign(swigCPtr, Slider.getCPtr(handle)), false);
476 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
481 /// Downcasts an Object handle to Slider.<br>
482 /// If handle points to a Slider, the downcast produces valid handle.<br>
483 /// If not, the returned handle is left uninitialized.<br>
485 /// <param name="handle">Handle to an object</param>
486 /// <returns>Handle to a Slider or an uninitialized handle</returns>
487 public new static Slider DownCast(BaseHandle handle)
489 Slider ret = new Slider(NDalicPINVOKE.Slider_DownCast(BaseHandle.getCPtr(handle)), true);
490 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
494 internal SliderValueChangedSignal ValueChangedSignal()
496 SliderValueChangedSignal ret = new SliderValueChangedSignal(NDalicPINVOKE.Slider_ValueChangedSignal(swigCPtr), false);
497 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
501 internal SliderValueChangedSignal SlidingFinishedSignal()
503 SliderValueChangedSignal ret = new SliderValueChangedSignal(NDalicPINVOKE.Slider_SlidingFinishedSignal(swigCPtr), false);
504 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
508 internal SliderMarkReachedSignal MarkReachedSignal()
510 SliderMarkReachedSignal ret = new SliderMarkReachedSignal(NDalicPINVOKE.Slider_MarkReachedSignal(swigCPtr), false);
511 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
516 /// Lower bound property
518 public float LowerBound
523 GetProperty(Slider.Property.LOWER_BOUND).Get(out temp);
528 SetProperty(Slider.Property.LOWER_BOUND, new Tizen.NUI.PropertyValue(value));
533 /// Upper bound property
535 public float UpperBound
540 GetProperty(Slider.Property.UPPER_BOUND).Get(out temp);
545 SetProperty(Slider.Property.UPPER_BOUND, new Tizen.NUI.PropertyValue(value));
557 GetProperty(Slider.Property.VALUE).Get(out temp);
562 SetProperty(Slider.Property.VALUE, new Tizen.NUI.PropertyValue(value));
567 /// Track visual property
569 public PropertyMap TrackVisual
573 PropertyMap temp = new PropertyMap();
574 GetProperty(Slider.Property.TRACK_VISUAL).Get(temp);
579 SetProperty(Slider.Property.TRACK_VISUAL, new Tizen.NUI.PropertyValue(value));
584 /// Handle visual property
586 public PropertyMap HandleVisual
590 PropertyMap temp = new PropertyMap();
591 GetProperty(Slider.Property.HANDLE_VISUAL).Get(temp);
596 SetProperty(Slider.Property.HANDLE_VISUAL, new Tizen.NUI.PropertyValue(value));
601 /// Progress visual property
603 public PropertyMap ProgressVisual
607 PropertyMap temp = new PropertyMap();
608 GetProperty(Slider.Property.PROGRESS_VISUAL).Get(temp);
613 SetProperty(Slider.Property.PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value));
618 /// Popup visual property
620 public PropertyMap PopupVisual
624 PropertyMap temp = new PropertyMap();
625 GetProperty(Slider.Property.POPUP_VISUAL).Get(temp);
630 SetProperty(Slider.Property.POPUP_VISUAL, new Tizen.NUI.PropertyValue(value));
635 /// Popup arrow visual property
637 public PropertyMap PopupArrowVisual
641 PropertyMap temp = new PropertyMap();
642 GetProperty(Slider.Property.POPUP_ARROW_VISUAL).Get(temp);
647 SetProperty(Slider.Property.POPUP_ARROW_VISUAL, new Tizen.NUI.PropertyValue(value));
652 /// Disable color property
654 public Vector4 DisabledColor
658 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
659 GetProperty(Slider.Property.DISABLED_COLOR).Get(temp);
664 SetProperty(Slider.Property.DISABLED_COLOR, new Tizen.NUI.PropertyValue(value));
669 /// Value presicion property
671 public int ValuePrecision
676 GetProperty(Slider.Property.VALUE_PRECISION).Get(out temp);
681 SetProperty(Slider.Property.VALUE_PRECISION, new Tizen.NUI.PropertyValue(value));
686 /// Show popup property
688 public bool ShowPopup
693 GetProperty(Slider.Property.SHOW_POPUP).Get(out temp);
698 SetProperty(Slider.Property.SHOW_POPUP, new Tizen.NUI.PropertyValue(value));
703 /// Show value property
705 public bool ShowValue
710 GetProperty(Slider.Property.SHOW_VALUE).Get(out temp);
715 SetProperty(Slider.Property.SHOW_VALUE, new Tizen.NUI.PropertyValue(value));
722 public Tizen.NUI.PropertyArray Marks
726 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
727 GetProperty(Slider.Property.MARKS).Get(temp);
732 SetProperty(Slider.Property.MARKS, new Tizen.NUI.PropertyValue(value));
737 /// Snap to marks property
739 public bool SnapToMarks
744 GetProperty(Slider.Property.SNAP_TO_MARKS).Get(out temp);
749 SetProperty(Slider.Property.SNAP_TO_MARKS, new Tizen.NUI.PropertyValue(value));
754 /// Mark tolerance property
756 public float MarkTolerance
761 GetProperty(Slider.Property.MARK_TOLERANCE).Get(out temp);
766 SetProperty(Slider.Property.MARK_TOLERANCE, new Tizen.NUI.PropertyValue(value));