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);
45 // By default, we do not want the position to use the anchor point
46 PositionUsesAnchorPoint = false;
49 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollBar obj)
51 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
55 /// To make ScrollBar instance be disposed.
57 public override void Dispose()
59 if (!Window.IsInstalled())
61 DisposeQueue.Instance.Add(this);
67 if (swigCPtr.Handle != global::System.IntPtr.Zero)
72 NDalicPINVOKE.delete_ScrollBar(swigCPtr);
74 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
76 global::System.GC.SuppressFinalize(this);
82 /// Event arguments that passed via PanFinished event
84 public class PanFinishedEventArgs : EventArgs
89 /// Event arguments that passed via ScrollPositionIntervalReached event
91 public class ScrollPositionIntervalReachedEventArgs : EventArgs
93 private float _currentScrollPosition;
96 /// current scroll position of the scrollable content
98 public float CurrentScrollPosition
102 return _currentScrollPosition;
106 _currentScrollPosition = value;
111 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
112 private delegate void PanFinishedEventCallbackDelegate();
113 private EventHandler<PanFinishedEventArgs> _scrollBarPanFinishedEventHandler;
114 private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
116 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
117 private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
118 private EventHandler<ScrollPositionIntervalReachedEventArgs> _scrollBarScrollPositionIntervalReachedEventHandler;
119 private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
122 /// Event emitted when panning is finished on the scroll indicator.
124 public event EventHandler<PanFinishedEventArgs> PanFinished
128 if (_scrollBarPanFinishedEventHandler == null)
130 _scrollBarPanFinishedEventCallbackDelegate = (OnScrollBarPanFinished);
131 PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
133 _scrollBarPanFinishedEventHandler += value;
137 _scrollBarPanFinishedEventHandler -= value;
138 if (_scrollBarPanFinishedEventHandler == null && PanFinishedSignal().Empty() == false)
140 PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
145 // Callback for ScrollBar PanFinishedSignal
146 private void OnScrollBarPanFinished()
148 PanFinishedEventArgs e = new PanFinishedEventArgs();
150 if (_scrollBarPanFinishedEventHandler != null)
152 //here we send all data to user event handlers
153 _scrollBarPanFinishedEventHandler(this, e);
159 /// Event emitted when the current scroll position of the scrollable content
161 public event EventHandler<ScrollPositionIntervalReachedEventArgs> ScrollPositionIntervalReached
165 if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
167 _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = (OnScrollBarScrollPositionIntervalReached);
168 ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
170 _scrollBarScrollPositionIntervalReachedEventHandler += value;
174 _scrollBarScrollPositionIntervalReachedEventHandler -= value;
175 if (_scrollBarScrollPositionIntervalReachedEventHandler == null && ScrollPositionIntervalReachedSignal().Empty() == false)
177 ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
182 // Callback for ScrollBar ScrollPositionIntervalReachedSignal
183 private void OnScrollBarScrollPositionIntervalReached()
185 ScrollPositionIntervalReachedEventArgs e = new ScrollPositionIntervalReachedEventArgs();
187 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
189 //here we send all data to user event handlers
190 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
195 internal class Property : global::System.IDisposable
197 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
198 protected bool swigCMemOwn;
200 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
202 swigCMemOwn = cMemoryOwn;
203 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
206 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
208 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
213 DisposeQueue.Instance.Add(this);
216 public virtual void Dispose()
218 if (!Window.IsInstalled()) {
219 DisposeQueue.Instance.Add(this);
225 if (swigCPtr.Handle != global::System.IntPtr.Zero)
230 NDalicPINVOKE.delete_ScrollBar_Property(swigCPtr);
232 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
234 global::System.GC.SuppressFinalize(this);
238 internal Property() : this(NDalicPINVOKE.new_ScrollBar_Property(), true)
240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243 internal static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ScrollBar_Property_SCROLL_DIRECTION_get();
244 internal static readonly int INDICATOR_HEIGHT_POLICY = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get();
245 internal static readonly int INDICATOR_FIXED_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get();
246 internal static readonly int INDICATOR_SHOW_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_SHOW_DURATION_get();
247 internal static readonly int INDICATOR_HIDE_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HIDE_DURATION_get();
248 internal static readonly int SCROLL_POSITION_INTERVALS = NDalicPINVOKE.ScrollBar_Property_SCROLL_POSITION_INTERVALS_get();
249 internal static readonly int INDICATOR_MINIMUM_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get();
250 internal static readonly int INDICATOR_START_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_START_PADDING_get();
251 internal static readonly int INDICATOR_END_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_END_PADDING_get();
256 /// Creates an initialized ScrollBar.
258 /// <param name="direction">The direction of scroll bar (either vertically or horizontally)</param>
259 public ScrollBar(ScrollBar.Direction direction) : this(NDalicPINVOKE.ScrollBar_New__SWIG_0((int)direction), true)
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 /// Creates an uninitialized ScrollBar
267 public ScrollBar() : this(NDalicPINVOKE.ScrollBar_New__SWIG_1(), true)
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 internal ScrollBar(ScrollBar scrollBar) : this(NDalicPINVOKE.new_ScrollBar__SWIG_1(ScrollBar.getCPtr(scrollBar)), true)
274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277 internal ScrollBar Assign(ScrollBar scrollBar)
279 ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_Assign(swigCPtr, ScrollBar.getCPtr(scrollBar)), false);
280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285 /// Downcasts a handle to ScrollBar handle.<br>
286 /// If handle points to a ScrollBar, the downcast produces valid handle.<br>
287 /// If not, the returned handle is left uninitialized.<br>
289 /// <param name="handle">Handle to an object</param>
290 /// <returns>Handle to a ScrollBar or an uninitialized handle</returns>
291 public new static ScrollBar DownCast(BaseHandle handle)
293 ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_DownCast(BaseHandle.getCPtr(handle)), true);
294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 internal void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
300 NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304 internal void SetScrollIndicator(View indicator)
306 NDalicPINVOKE.ScrollBar_SetScrollIndicator(swigCPtr, View.getCPtr(indicator));
307 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 internal View GetScrollIndicator()
312 View ret = new View(NDalicPINVOKE.ScrollBar_GetScrollIndicator(swigCPtr), true);
313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317 internal void SetScrollPositionIntervals(VectorFloat positions)
319 NDalicPINVOKE.ScrollBar_SetScrollPositionIntervals(swigCPtr, VectorFloat.getCPtr(positions));
320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323 internal VectorFloat GetScrollPositionIntervals()
325 VectorFloat ret = new VectorFloat(NDalicPINVOKE.ScrollBar_GetScrollPositionIntervals(swigCPtr), true);
326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330 internal void SetScrollDirection(ScrollBar.Direction direction)
332 NDalicPINVOKE.ScrollBar_SetScrollDirection(swigCPtr, (int)direction);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
336 internal ScrollBar.Direction GetScrollDirection()
338 ScrollBar.Direction ret = (ScrollBar.Direction)NDalicPINVOKE.ScrollBar_GetScrollDirection(swigCPtr);
339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 internal void SetIndicatorHeightPolicy(ScrollBar.IndicatorHeightPolicyType policy)
345 NDalicPINVOKE.ScrollBar_SetIndicatorHeightPolicy(swigCPtr, (int)policy);
346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349 internal ScrollBar.IndicatorHeightPolicyType GetIndicatorHeightPolicy()
351 ScrollBar.IndicatorHeightPolicyType ret = (ScrollBar.IndicatorHeightPolicyType)NDalicPINVOKE.ScrollBar_GetIndicatorHeightPolicy(swigCPtr);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356 internal void SetIndicatorFixedHeight(float height)
358 NDalicPINVOKE.ScrollBar_SetIndicatorFixedHeight(swigCPtr, height);
359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362 internal float GetIndicatorFixedHeight()
364 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorFixedHeight(swigCPtr);
365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369 internal void SetIndicatorShowDuration(float durationSeconds)
371 NDalicPINVOKE.ScrollBar_SetIndicatorShowDuration(swigCPtr, durationSeconds);
372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
375 internal float GetIndicatorShowDuration()
377 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorShowDuration(swigCPtr);
378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
382 internal void SetIndicatorHideDuration(float durationSeconds)
384 NDalicPINVOKE.ScrollBar_SetIndicatorHideDuration(swigCPtr, durationSeconds);
385 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388 internal float GetIndicatorHideDuration()
390 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorHideDuration(swigCPtr);
391 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
395 internal void ShowIndicator()
397 NDalicPINVOKE.ScrollBar_ShowIndicator(swigCPtr);
398 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
401 internal void HideIndicator()
403 NDalicPINVOKE.ScrollBar_HideIndicator(swigCPtr);
404 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407 internal VoidSignal PanFinishedSignal()
409 VoidSignal ret = new VoidSignal(NDalicPINVOKE.ScrollBar_PanFinishedSignal(swigCPtr), false);
410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414 internal FloatSignal ScrollPositionIntervalReachedSignal()
416 FloatSignal ret = new FloatSignal(NDalicPINVOKE.ScrollBar_ScrollPositionIntervalReachedSignal(swigCPtr), false);
417 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 internal enum PropertyRange
423 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
424 PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
428 /// Direction of scroll bar
430 public enum Direction
437 /// Indicator height policy.
439 public enum IndicatorHeightPolicyType
446 /// Direction of scroll bar
448 public Direction ScrollDirection
453 if (GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false)
456 Tizen.Log.Error("NUI", "ScrollDirection get error!");
463 return Direction.Vertical;
465 return Direction.Horizontal;
467 return Direction.Vertical;
472 string valueToString = "";
475 case Direction.Vertical:
477 valueToString = "Vertical";
480 case Direction.Horizontal:
482 valueToString = "Horizontal";
487 valueToString = "Vertical";
491 SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString));
496 /// Indicator height policy.
498 public IndicatorHeightPolicyType IndicatorHeightPolicy
503 if (GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false)
506 Tizen.Log.Error("NUI", "IndicatorHeightPolicy get error!");
513 return IndicatorHeightPolicyType.Variable;
515 return IndicatorHeightPolicyType.Fixed;
517 return IndicatorHeightPolicyType.Variable;
522 string valueToString = "";
525 case IndicatorHeightPolicyType.Variable:
527 valueToString = "Variable";
530 case IndicatorHeightPolicyType.Fixed:
532 valueToString = "Fixed";
537 valueToString = "Variable";
541 SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString));
546 /// the fixed height of scroll indicator.
548 public float IndicatorFixedHeight
553 GetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT).Get(ref temp);
558 SetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT, new Tizen.NUI.PropertyValue(value));
563 /// the duration in seconds for the scroll indicator to become fully visible.
565 public float IndicatorShowDuration
570 GetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION).Get(ref temp);
575 SetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION, new Tizen.NUI.PropertyValue(value));
580 /// the duration in seconds for the scroll indicator to become fully invisible.
582 public float IndicatorHideDuration
587 GetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION).Get(ref temp);
592 SetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION, new Tizen.NUI.PropertyValue(value));
597 /// the list of values to get notification when the current scroll position of the scrollable object goes above or below any of these values.
599 public Tizen.NUI.PropertyArray ScrollPositionIntervals
603 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
604 GetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS).Get(temp);
609 SetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS, new Tizen.NUI.PropertyValue(value));
614 /// The minimum height for a variable size indicator.
616 public float IndicatorMinimumHeight
621 GetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT).Get(ref temp);
626 SetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT, new Tizen.NUI.PropertyValue(value));
631 /// The padding at the start of the indicator. For example, the top if scrollDirection is Vertical.
633 public float IndicatorStartPadding
638 GetProperty(ScrollBar.Property.INDICATOR_START_PADDING).Get(ref temp);
643 SetProperty(ScrollBar.Property.INDICATOR_START_PADDING, new Tizen.NUI.PropertyValue(value));
648 /// The padding at the end of the indicator. For example, the bottom if scrollDirection is Vertical.
650 public float IndicatorEndPadding
655 GetProperty(ScrollBar.Property.INDICATOR_END_PADDING).Get(ref temp);
660 SetProperty(ScrollBar.Property.INDICATOR_END_PADDING, new Tizen.NUI.PropertyValue(value));