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 /// ScrollBar is a UI component that can be linked to the scrollable objects
36 /// indicating the current scroll position of the scrollable object.<br>
38 public class ScrollBar : View
40 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
42 internal ScrollBar(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ScrollBar_SWIGUpcast(cPtr), cMemoryOwn)
44 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
47 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollBar obj)
49 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
53 /// To make ScrollBar instance be disposed.
55 public override void Dispose()
57 if (!Window.IsInstalled())
59 DisposeQueue.Instance.Add(this);
65 if (swigCPtr.Handle != global::System.IntPtr.Zero)
70 NDalicPINVOKE.delete_ScrollBar(swigCPtr);
72 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
74 global::System.GC.SuppressFinalize(this);
80 /// Event arguments that passed via PanFinished event
82 public class PanFinishedEventArgs : EventArgs
87 /// Event arguments that passed via ScrollPositionIntervalReached event
89 public class ScrollPositionIntervalReachedEventArgs : EventArgs
91 private float _currentScrollPosition;
94 /// current scroll position of the scrollable content
96 public float CurrentScrollPosition
100 return _currentScrollPosition;
104 _currentScrollPosition = value;
109 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
110 private delegate void PanFinishedEventCallbackDelegate();
111 private EventHandler<PanFinishedEventArgs> _scrollBarPanFinishedEventHandler;
112 private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
114 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
115 private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
116 private EventHandler<ScrollPositionIntervalReachedEventArgs> _scrollBarScrollPositionIntervalReachedEventHandler;
117 private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
120 /// Event emitted when panning is finished on the scroll indicator.
122 public event EventHandler<PanFinishedEventArgs> PanFinished
126 if (_scrollBarPanFinishedEventHandler == null)
128 _scrollBarPanFinishedEventCallbackDelegate = (OnScrollBarPanFinished);
129 PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
131 _scrollBarPanFinishedEventHandler += value;
135 _scrollBarPanFinishedEventHandler -= value;
136 if (_scrollBarPanFinishedEventHandler == null && PanFinishedSignal().Empty() == false)
138 PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
143 // Callback for ScrollBar PanFinishedSignal
144 private void OnScrollBarPanFinished()
146 PanFinishedEventArgs e = new PanFinishedEventArgs();
148 if (_scrollBarPanFinishedEventHandler != null)
150 //here we send all data to user event handlers
151 _scrollBarPanFinishedEventHandler(this, e);
157 /// Event emitted when the current scroll position of the scrollable content
159 public event EventHandler<ScrollPositionIntervalReachedEventArgs> ScrollPositionIntervalReached
163 if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
165 _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = (OnScrollBarScrollPositionIntervalReached);
166 ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
168 _scrollBarScrollPositionIntervalReachedEventHandler += value;
172 _scrollBarScrollPositionIntervalReachedEventHandler -= value;
173 if (_scrollBarScrollPositionIntervalReachedEventHandler == null && ScrollPositionIntervalReachedSignal().Empty() == false)
175 ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
180 // Callback for ScrollBar ScrollPositionIntervalReachedSignal
181 private void OnScrollBarScrollPositionIntervalReached()
183 ScrollPositionIntervalReachedEventArgs e = new ScrollPositionIntervalReachedEventArgs();
185 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
187 //here we send all data to user event handlers
188 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
193 internal class Property : global::System.IDisposable
195 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
196 protected bool swigCMemOwn;
198 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
200 swigCMemOwn = cMemoryOwn;
201 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
204 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
206 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
211 DisposeQueue.Instance.Add(this);
214 public virtual void Dispose()
216 if (!Window.IsInstalled()) {
217 DisposeQueue.Instance.Add(this);
223 if (swigCPtr.Handle != global::System.IntPtr.Zero)
228 NDalicPINVOKE.delete_ScrollBar_Property(swigCPtr);
230 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
232 global::System.GC.SuppressFinalize(this);
236 internal Property() : this(NDalicPINVOKE.new_ScrollBar_Property(), true)
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 internal static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ScrollBar_Property_SCROLL_DIRECTION_get();
242 internal static readonly int INDICATOR_HEIGHT_POLICY = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get();
243 internal static readonly int INDICATOR_FIXED_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get();
244 internal static readonly int INDICATOR_SHOW_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_SHOW_DURATION_get();
245 internal static readonly int INDICATOR_HIDE_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HIDE_DURATION_get();
246 internal static readonly int SCROLL_POSITION_INTERVALS = NDalicPINVOKE.ScrollBar_Property_SCROLL_POSITION_INTERVALS_get();
247 internal static readonly int INDICATOR_MINIMUM_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get();
248 internal static readonly int INDICATOR_START_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_START_PADDING_get();
249 internal static readonly int INDICATOR_END_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_END_PADDING_get();
254 /// Creates an initialized ScrollBar.
256 /// <param name="direction">The direction of scroll bar (either vertically or horizontally)</param>
257 public ScrollBar(ScrollBar.Direction direction) : this(NDalicPINVOKE.ScrollBar_New__SWIG_0((int)direction), true)
259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 /// Creates an uninitialized ScrollBar
265 public ScrollBar() : this(NDalicPINVOKE.ScrollBar_New__SWIG_1(), true)
267 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 internal ScrollBar(ScrollBar scrollBar) : this(NDalicPINVOKE.new_ScrollBar__SWIG_1(ScrollBar.getCPtr(scrollBar)), true)
272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 internal ScrollBar Assign(ScrollBar scrollBar)
277 ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_Assign(swigCPtr, ScrollBar.getCPtr(scrollBar)), false);
278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283 /// Downcasts a handle to ScrollBar handle.<br>
284 /// If handle points to a ScrollBar, the downcast produces valid handle.<br>
285 /// If not, the returned handle is left uninitialized.<br>
287 /// <param name="handle">Handle to an object</param>
288 /// <returns>Handle to a ScrollBar or an uninitialized handle</returns>
289 public new static ScrollBar DownCast(BaseHandle handle)
291 ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_DownCast(BaseHandle.getCPtr(handle)), true);
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296 internal void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
298 NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302 internal void SetScrollIndicator(View indicator)
304 NDalicPINVOKE.ScrollBar_SetScrollIndicator(swigCPtr, View.getCPtr(indicator));
305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308 internal View GetScrollIndicator()
310 View ret = new View(NDalicPINVOKE.ScrollBar_GetScrollIndicator(swigCPtr), true);
311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315 internal void SetScrollPositionIntervals(VectorFloat positions)
317 NDalicPINVOKE.ScrollBar_SetScrollPositionIntervals(swigCPtr, VectorFloat.getCPtr(positions));
318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 internal VectorFloat GetScrollPositionIntervals()
323 VectorFloat ret = new VectorFloat(NDalicPINVOKE.ScrollBar_GetScrollPositionIntervals(swigCPtr), true);
324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328 internal void SetScrollDirection(ScrollBar.Direction direction)
330 NDalicPINVOKE.ScrollBar_SetScrollDirection(swigCPtr, (int)direction);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334 internal ScrollBar.Direction GetScrollDirection()
336 ScrollBar.Direction ret = (ScrollBar.Direction)NDalicPINVOKE.ScrollBar_GetScrollDirection(swigCPtr);
337 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
341 internal void SetIndicatorHeightPolicy(ScrollBar.IndicatorHeightPolicyType policy)
343 NDalicPINVOKE.ScrollBar_SetIndicatorHeightPolicy(swigCPtr, (int)policy);
344 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
347 internal ScrollBar.IndicatorHeightPolicyType GetIndicatorHeightPolicy()
349 ScrollBar.IndicatorHeightPolicyType ret = (ScrollBar.IndicatorHeightPolicyType)NDalicPINVOKE.ScrollBar_GetIndicatorHeightPolicy(swigCPtr);
350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
354 internal void SetIndicatorFixedHeight(float height)
356 NDalicPINVOKE.ScrollBar_SetIndicatorFixedHeight(swigCPtr, height);
357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
360 internal float GetIndicatorFixedHeight()
362 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorFixedHeight(swigCPtr);
363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367 internal void SetIndicatorShowDuration(float durationSeconds)
369 NDalicPINVOKE.ScrollBar_SetIndicatorShowDuration(swigCPtr, durationSeconds);
370 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
373 internal float GetIndicatorShowDuration()
375 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorShowDuration(swigCPtr);
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380 internal void SetIndicatorHideDuration(float durationSeconds)
382 NDalicPINVOKE.ScrollBar_SetIndicatorHideDuration(swigCPtr, durationSeconds);
383 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
386 internal float GetIndicatorHideDuration()
388 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorHideDuration(swigCPtr);
389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393 internal void ShowIndicator()
395 NDalicPINVOKE.ScrollBar_ShowIndicator(swigCPtr);
396 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
399 internal void HideIndicator()
401 NDalicPINVOKE.ScrollBar_HideIndicator(swigCPtr);
402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 internal VoidSignal PanFinishedSignal()
407 VoidSignal ret = new VoidSignal(NDalicPINVOKE.ScrollBar_PanFinishedSignal(swigCPtr), false);
408 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
412 internal FloatSignal ScrollPositionIntervalReachedSignal()
414 FloatSignal ret = new FloatSignal(NDalicPINVOKE.ScrollBar_ScrollPositionIntervalReachedSignal(swigCPtr), false);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
419 internal enum PropertyRange
421 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
422 PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
426 /// Direction of scroll bar
428 public enum Direction
435 /// Indicator height policy.
437 public enum IndicatorHeightPolicyType
444 /// Direction of scroll bar
446 public Direction ScrollDirection
451 if (GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false)
454 Tizen.Log.Error("NUI", "ScrollDirection get error!");
461 return Direction.Vertical;
463 return Direction.Horizontal;
465 return Direction.Vertical;
470 string valueToString = "";
473 case Direction.Vertical:
475 valueToString = "Vertical";
478 case Direction.Horizontal:
480 valueToString = "Horizontal";
485 valueToString = "Vertical";
489 SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString));
494 /// Indicator height policy.
496 public IndicatorHeightPolicyType IndicatorHeightPolicy
501 if (GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false)
504 Tizen.Log.Error("NUI", "IndicatorHeightPolicy get error!");
511 return IndicatorHeightPolicyType.Variable;
513 return IndicatorHeightPolicyType.Fixed;
515 return IndicatorHeightPolicyType.Variable;
520 string valueToString = "";
523 case IndicatorHeightPolicyType.Variable:
525 valueToString = "Variable";
528 case IndicatorHeightPolicyType.Fixed:
530 valueToString = "Fixed";
535 valueToString = "Variable";
539 SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString));
544 /// the fixed height of scroll indicator.
546 public float IndicatorFixedHeight
551 GetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT).Get(ref temp);
556 SetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT, new Tizen.NUI.PropertyValue(value));
561 /// the duration in seconds for the scroll indicator to become fully visible.
563 public float IndicatorShowDuration
568 GetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION).Get(ref temp);
573 SetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION, new Tizen.NUI.PropertyValue(value));
578 /// the duration in seconds for the scroll indicator to become fully invisible.
580 public float IndicatorHideDuration
585 GetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION).Get(ref temp);
590 SetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION, new Tizen.NUI.PropertyValue(value));
595 /// the list of values to get notification when the current scroll position of the scrollable object goes above or below any of these values.
597 public Tizen.NUI.PropertyArray ScrollPositionIntervals
601 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
602 GetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS).Get(temp);
607 SetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS, new Tizen.NUI.PropertyValue(value));
612 /// The minimum height for a variable size indicator.
614 public float IndicatorMinimumHeight
619 GetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT).Get(ref temp);
624 SetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT, new Tizen.NUI.PropertyValue(value));
629 /// The padding at the start of the indicator. For example, the top if scrollDirection is Vertical.
631 public float IndicatorStartPadding
636 GetProperty(ScrollBar.Property.INDICATOR_START_PADDING).Get(ref temp);
641 SetProperty(ScrollBar.Property.INDICATOR_START_PADDING, new Tizen.NUI.PropertyValue(value));
646 /// The padding at the end of the indicator. For example, the bottom if scrollDirection is Vertical.
648 public float IndicatorEndPadding
653 GetProperty(ScrollBar.Property.INDICATOR_END_PADDING).Get(ref temp);
658 SetProperty(ScrollBar.Property.INDICATOR_END_PADDING, new Tizen.NUI.PropertyValue(value));