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;
34 /// ScrollBar is a UI component that can be linked to the scrollable objects
35 /// indicating the current scroll position of the scrollable object.<br>
37 public class ScrollBar : View
39 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
41 internal ScrollBar(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ScrollBar_SWIGUpcast(cPtr), cMemoryOwn)
43 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
46 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollBar obj)
48 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
53 DisposeQueue.Instance.Add(this);
57 /// To make ScrollBar instance be disposed.
59 public override void Dispose()
61 if (!Stage.IsInstalled())
63 DisposeQueue.Instance.Add(this);
69 if (swigCPtr.Handle != global::System.IntPtr.Zero)
74 NDalicPINVOKE.delete_ScrollBar(swigCPtr);
76 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78 global::System.GC.SuppressFinalize(this);
84 /// Event arguments that passed via PanFinished event
86 public class PanFinishedEventArgs : EventArgs
91 /// Event arguments that passed via ScrollPositionIntervalReached event
93 public class ScrollPositionIntervalReachedEventArgs : EventArgs
95 private float _currentScrollPosition;
98 /// current scroll position of the scrollable content
100 public float CurrentScrollPosition
104 return _currentScrollPosition;
108 _currentScrollPosition = value;
113 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
114 private delegate void PanFinishedEventCallbackDelegate();
115 private EventHandler<PanFinishedEventArgs> _scrollBarPanFinishedEventHandler;
116 private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
118 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
119 private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
120 private EventHandler<ScrollPositionIntervalReachedEventArgs> _scrollBarScrollPositionIntervalReachedEventHandler;
121 private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
124 /// Event emitted when panning is finished on the scroll indicator.
126 public event EventHandler<PanFinishedEventArgs> PanFinished
130 if (_scrollBarPanFinishedEventHandler == null)
132 _scrollBarPanFinishedEventCallbackDelegate = (OnScrollBarPanFinished);
133 PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
135 _scrollBarPanFinishedEventHandler += value;
139 _scrollBarPanFinishedEventHandler -= value;
140 if (_scrollBarPanFinishedEventHandler == null && PanFinishedSignal().Empty() == false)
142 PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
147 // Callback for ScrollBar PanFinishedSignal
148 private void OnScrollBarPanFinished()
150 PanFinishedEventArgs e = new PanFinishedEventArgs();
152 if (_scrollBarPanFinishedEventHandler != null)
154 //here we send all data to user event handlers
155 _scrollBarPanFinishedEventHandler(this, e);
161 /// Event emitted when the current scroll position of the scrollable content
163 public event EventHandler<ScrollPositionIntervalReachedEventArgs> ScrollPositionIntervalReached
167 if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
169 _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = (OnScrollBarScrollPositionIntervalReached);
170 ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
172 _scrollBarScrollPositionIntervalReachedEventHandler += value;
176 _scrollBarScrollPositionIntervalReachedEventHandler -= value;
177 if (_scrollBarScrollPositionIntervalReachedEventHandler == null && ScrollPositionIntervalReachedSignal().Empty() == false)
179 ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
184 // Callback for ScrollBar ScrollPositionIntervalReachedSignal
185 private void OnScrollBarScrollPositionIntervalReached()
187 ScrollPositionIntervalReachedEventArgs e = new ScrollPositionIntervalReachedEventArgs();
189 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
191 //here we send all data to user event handlers
192 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
197 internal class Property : global::System.IDisposable
199 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
200 protected bool swigCMemOwn;
202 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
204 swigCMemOwn = cMemoryOwn;
205 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
208 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
210 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
218 public virtual void Dispose()
222 if (swigCPtr.Handle != global::System.IntPtr.Zero)
227 NDalicPINVOKE.delete_ScrollBar_Property(swigCPtr);
229 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
231 global::System.GC.SuppressFinalize(this);
235 internal Property() : this(NDalicPINVOKE.new_ScrollBar_Property(), true)
237 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240 internal static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ScrollBar_Property_SCROLL_DIRECTION_get();
241 internal static readonly int INDICATOR_HEIGHT_POLICY = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get();
242 internal static readonly int INDICATOR_FIXED_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get();
243 internal static readonly int INDICATOR_SHOW_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_SHOW_DURATION_get();
244 internal static readonly int INDICATOR_HIDE_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HIDE_DURATION_get();
245 internal static readonly int SCROLL_POSITION_INTERVALS = NDalicPINVOKE.ScrollBar_Property_SCROLL_POSITION_INTERVALS_get();
246 internal static readonly int INDICATOR_MINIMUM_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get();
247 internal static readonly int INDICATOR_START_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_START_PADDING_get();
248 internal static readonly int INDICATOR_END_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_END_PADDING_get();
253 /// Creates an initialized ScrollBar.
255 /// <param name="direction">The direction of scroll bar (either vertically or horizontally)</param>
256 public ScrollBar(ScrollBar.Direction direction) : this(NDalicPINVOKE.ScrollBar_New__SWIG_0((int)direction), true)
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262 /// Creates an uninitialized ScrollBar
264 public ScrollBar() : this(NDalicPINVOKE.ScrollBar_New__SWIG_1(), true)
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269 internal ScrollBar(ScrollBar scrollBar) : this(NDalicPINVOKE.new_ScrollBar__SWIG_1(ScrollBar.getCPtr(scrollBar)), true)
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274 internal ScrollBar Assign(ScrollBar scrollBar)
276 ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_Assign(swigCPtr, ScrollBar.getCPtr(scrollBar)), false);
277 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 /// Downcasts a handle to ScrollBar handle.<br>
283 /// If handle points to a ScrollBar, the downcast produces valid handle.<br>
284 /// If not, the returned handle is left uninitialized.<br>
286 /// <param name="handle">Handle to an object</param>
287 /// <returns>Handle to a ScrollBar or an uninitialized handle</returns>
288 public new static ScrollBar DownCast(BaseHandle handle)
290 ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_DownCast(BaseHandle.getCPtr(handle)), true);
291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 internal void SetScrollPropertySource(Handle handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
297 NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Handle.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301 internal void SetScrollIndicator(Actor indicator)
303 NDalicPINVOKE.ScrollBar_SetScrollIndicator(swigCPtr, Actor.getCPtr(indicator));
304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 internal Actor GetScrollIndicator()
309 Actor ret = new Actor(NDalicPINVOKE.ScrollBar_GetScrollIndicator(swigCPtr), true);
310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314 internal void SetScrollPositionIntervals(VectorFloat positions)
316 NDalicPINVOKE.ScrollBar_SetScrollPositionIntervals(swigCPtr, VectorFloat.getCPtr(positions));
317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
320 internal VectorFloat GetScrollPositionIntervals()
322 VectorFloat ret = new VectorFloat(NDalicPINVOKE.ScrollBar_GetScrollPositionIntervals(swigCPtr), true);
323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327 internal void SetScrollDirection(ScrollBar.Direction direction)
329 NDalicPINVOKE.ScrollBar_SetScrollDirection(swigCPtr, (int)direction);
330 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333 internal ScrollBar.Direction GetScrollDirection()
335 ScrollBar.Direction ret = (ScrollBar.Direction)NDalicPINVOKE.ScrollBar_GetScrollDirection(swigCPtr);
336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 internal void SetIndicatorHeightPolicy(ScrollBar.IndicatorHeightPolicyType policy)
342 NDalicPINVOKE.ScrollBar_SetIndicatorHeightPolicy(swigCPtr, (int)policy);
343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346 internal ScrollBar.IndicatorHeightPolicyType GetIndicatorHeightPolicy()
348 ScrollBar.IndicatorHeightPolicyType ret = (ScrollBar.IndicatorHeightPolicyType)NDalicPINVOKE.ScrollBar_GetIndicatorHeightPolicy(swigCPtr);
349 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
353 internal void SetIndicatorFixedHeight(float height)
355 NDalicPINVOKE.ScrollBar_SetIndicatorFixedHeight(swigCPtr, height);
356 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
359 internal float GetIndicatorFixedHeight()
361 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorFixedHeight(swigCPtr);
362 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
366 internal void SetIndicatorShowDuration(float durationSeconds)
368 NDalicPINVOKE.ScrollBar_SetIndicatorShowDuration(swigCPtr, durationSeconds);
369 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
372 internal float GetIndicatorShowDuration()
374 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorShowDuration(swigCPtr);
375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379 internal void SetIndicatorHideDuration(float durationSeconds)
381 NDalicPINVOKE.ScrollBar_SetIndicatorHideDuration(swigCPtr, durationSeconds);
382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
385 internal float GetIndicatorHideDuration()
387 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorHideDuration(swigCPtr);
388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 internal void ShowIndicator()
394 NDalicPINVOKE.ScrollBar_ShowIndicator(swigCPtr);
395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 internal void HideIndicator()
400 NDalicPINVOKE.ScrollBar_HideIndicator(swigCPtr);
401 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404 internal VoidSignal PanFinishedSignal()
406 VoidSignal ret = new VoidSignal(NDalicPINVOKE.ScrollBar_PanFinishedSignal(swigCPtr), false);
407 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
411 internal FloatSignal ScrollPositionIntervalReachedSignal()
413 FloatSignal ret = new FloatSignal(NDalicPINVOKE.ScrollBar_ScrollPositionIntervalReachedSignal(swigCPtr), false);
414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
418 internal enum PropertyRange
420 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
421 PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
425 /// Direction of scroll bar
427 public enum Direction
434 /// Indicator height policy.
436 public enum IndicatorHeightPolicyType
443 /// Direction of scroll bar
445 public Direction ScrollDirection
450 if (GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false)
452 //Tizen.Log.Error("NUI", "ScrollDirection get error!");
458 return Direction.Vertical;
460 return Direction.Horizontal;
462 return Direction.Vertical;
467 string valueToString = "";
470 case Direction.Vertical:
472 valueToString = "Vertical";
475 case Direction.Horizontal:
477 valueToString = "Horizontal";
482 valueToString = "Vertical";
486 SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString));
491 /// Indicator height policy.
493 public IndicatorHeightPolicyType IndicatorHeightPolicy
498 if (GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false)
500 //Tizen.Log.Error("NUI", "IndicatorHeightPolicy get error!");
506 return IndicatorHeightPolicyType.Variable;
508 return IndicatorHeightPolicyType.Fixed;
510 return IndicatorHeightPolicyType.Variable;
515 string valueToString = "";
518 case IndicatorHeightPolicyType.Variable:
520 valueToString = "Variable";
523 case IndicatorHeightPolicyType.Fixed:
525 valueToString = "Fixed";
530 valueToString = "Variable";
534 SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString));
539 /// the fixed height of scroll indicator.
541 public float IndicatorFixedHeight
546 GetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT).Get(ref temp);
551 SetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT, new Tizen.NUI.PropertyValue(value));
556 /// the duration in seconds for the scroll indicator to become fully visible.
558 public float IndicatorShowDuration
563 GetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION).Get(ref temp);
568 SetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION, new Tizen.NUI.PropertyValue(value));
573 /// the duration in seconds for the scroll indicator to become fully invisible.
575 public float IndicatorHideDuration
580 GetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION).Get(ref temp);
585 SetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION, new Tizen.NUI.PropertyValue(value));
590 /// the list of values to get notification when the current scroll position of the scrollable object goes above or below any of these values.
592 public Tizen.NUI.PropertyArray ScrollPositionIntervals
596 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
597 GetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS).Get(temp);
602 SetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS, new Tizen.NUI.PropertyValue(value));
607 /// The minimum height for a variable size indicator.
609 public float IndicatorMinimumHeight
614 GetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT).Get(ref temp);
619 SetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT, new Tizen.NUI.PropertyValue(value));
624 /// The padding at the start of the indicator. For example, the top if scrollDirection is Vertical.
626 public float IndicatorStartPadding
631 GetProperty(ScrollBar.Property.INDICATOR_START_PADDING).Get(ref temp);
636 SetProperty(ScrollBar.Property.INDICATOR_START_PADDING, new Tizen.NUI.PropertyValue(value));
641 /// The padding at the end of the indicator. For example, the bottom if scrollDirection is Vertical.
643 public float IndicatorEndPadding
648 GetProperty(ScrollBar.Property.INDICATOR_END_PADDING).Get(ref temp);
653 SetProperty(ScrollBar.Property.INDICATOR_END_PADDING, new Tizen.NUI.PropertyValue(value));