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 protected override void Dispose(DisposeTypes type)
64 if(type == DisposeTypes.Explicit)
67 //Release your own managed resources here.
68 //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_ScrollBar(swigCPtr);
82 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
89 /// Event arguments that passed via PanFinished event
91 public class PanFinishedEventArgs : EventArgs
96 /// Event arguments that passed via ScrollPositionIntervalReached event
98 public class ScrollPositionIntervalReachedEventArgs : EventArgs
100 private float _currentScrollPosition;
103 /// current scroll position of the scrollable content
105 public float CurrentScrollPosition
109 return _currentScrollPosition;
113 _currentScrollPosition = value;
118 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
119 private delegate void PanFinishedEventCallbackDelegate();
120 private EventHandler<PanFinishedEventArgs> _scrollBarPanFinishedEventHandler;
121 private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
123 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
124 private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
125 private EventHandler<ScrollPositionIntervalReachedEventArgs> _scrollBarScrollPositionIntervalReachedEventHandler;
126 private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
129 /// Event emitted when panning is finished on the scroll indicator.
131 public event EventHandler<PanFinishedEventArgs> PanFinished
135 if (_scrollBarPanFinishedEventHandler == null)
137 _scrollBarPanFinishedEventCallbackDelegate = (OnScrollBarPanFinished);
138 PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
140 _scrollBarPanFinishedEventHandler += value;
144 _scrollBarPanFinishedEventHandler -= value;
145 if (_scrollBarPanFinishedEventHandler == null && PanFinishedSignal().Empty() == false)
147 PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
152 // Callback for ScrollBar PanFinishedSignal
153 private void OnScrollBarPanFinished()
155 PanFinishedEventArgs e = new PanFinishedEventArgs();
157 if (_scrollBarPanFinishedEventHandler != null)
159 //here we send all data to user event handlers
160 _scrollBarPanFinishedEventHandler(this, e);
166 /// Event emitted when the current scroll position of the scrollable content
168 public event EventHandler<ScrollPositionIntervalReachedEventArgs> ScrollPositionIntervalReached
172 if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
174 _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = (OnScrollBarScrollPositionIntervalReached);
175 ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
177 _scrollBarScrollPositionIntervalReachedEventHandler += value;
181 _scrollBarScrollPositionIntervalReachedEventHandler -= value;
182 if (_scrollBarScrollPositionIntervalReachedEventHandler == null && ScrollPositionIntervalReachedSignal().Empty() == false)
184 ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
189 // Callback for ScrollBar ScrollPositionIntervalReachedSignal
190 private void OnScrollBarScrollPositionIntervalReached()
192 ScrollPositionIntervalReachedEventArgs e = new ScrollPositionIntervalReachedEventArgs();
194 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
196 //here we send all data to user event handlers
197 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
202 internal class Property : global::System.IDisposable
204 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
205 protected bool swigCMemOwn;
207 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
209 swigCMemOwn = cMemoryOwn;
210 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
213 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
215 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
218 //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam)
220 //A Flag to check who called Dispose(). (By User or DisposeQueue)
221 private bool isDisposeQueued = false;
222 //A Flat to check if it is already disposed.
223 protected bool disposed = false;
229 isDisposeQueued = true;
230 DisposeQueue.Instance.Add(this);
234 public void Dispose()
236 //Throw excpetion if Dispose() is called in separate thread.
237 if (!Window.IsInstalled())
239 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
244 Dispose(DisposeTypes.Implicit);
248 Dispose(DisposeTypes.Explicit);
249 System.GC.SuppressFinalize(this);
253 protected virtual void Dispose(DisposeTypes type)
260 if(type == DisposeTypes.Explicit)
263 //Release your own managed resources here.
264 //You should release all of your own disposable objects here.
267 //Release your own unmanaged resources here.
268 //You should not access any managed member here except static instance.
269 //because the execution order of Finalizes is non-deterministic.
271 if (swigCPtr.Handle != global::System.IntPtr.Zero)
276 NDalicPINVOKE.delete_ScrollBar_Property(swigCPtr);
278 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
283 internal Property() : this(NDalicPINVOKE.new_ScrollBar_Property(), true)
285 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 internal static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ScrollBar_Property_SCROLL_DIRECTION_get();
289 internal static readonly int INDICATOR_HEIGHT_POLICY = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get();
290 internal static readonly int INDICATOR_FIXED_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get();
291 internal static readonly int INDICATOR_SHOW_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_SHOW_DURATION_get();
292 internal static readonly int INDICATOR_HIDE_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HIDE_DURATION_get();
293 internal static readonly int SCROLL_POSITION_INTERVALS = NDalicPINVOKE.ScrollBar_Property_SCROLL_POSITION_INTERVALS_get();
294 internal static readonly int INDICATOR_MINIMUM_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get();
295 internal static readonly int INDICATOR_START_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_START_PADDING_get();
296 internal static readonly int INDICATOR_END_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_END_PADDING_get();
301 /// Creates an initialized ScrollBar.
303 /// <param name="direction">The direction of scroll bar (either vertically or horizontally)</param>
304 public ScrollBar(ScrollBar.Direction direction) : this(NDalicPINVOKE.ScrollBar_New__SWIG_0((int)direction), true)
306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 /// Creates an uninitialized ScrollBar
312 public ScrollBar() : this(NDalicPINVOKE.ScrollBar_New__SWIG_1(), true)
314 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317 internal ScrollBar(ScrollBar scrollBar) : this(NDalicPINVOKE.new_ScrollBar__SWIG_1(ScrollBar.getCPtr(scrollBar)), true)
319 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322 internal ScrollBar Assign(ScrollBar scrollBar)
324 ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_Assign(swigCPtr, ScrollBar.getCPtr(scrollBar)), false);
325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330 /// Downcasts a handle to ScrollBar handle.<br>
331 /// If handle points to a ScrollBar, the downcast produces valid handle.<br>
332 /// If not, the returned handle is left uninitialized.<br>
334 /// <param name="handle">Handle to an object</param>
335 /// <returns>Handle to a ScrollBar or an uninitialized handle</returns>
336 public new static ScrollBar DownCast(BaseHandle handle)
338 ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_DownCast(BaseHandle.getCPtr(handle)), true);
339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 internal void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
345 NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349 internal void SetScrollIndicator(View indicator)
351 NDalicPINVOKE.ScrollBar_SetScrollIndicator(swigCPtr, View.getCPtr(indicator));
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355 internal View GetScrollIndicator()
357 View ret = new View(NDalicPINVOKE.ScrollBar_GetScrollIndicator(swigCPtr), true);
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362 internal void SetScrollDirection(ScrollBar.Direction direction)
364 NDalicPINVOKE.ScrollBar_SetScrollDirection(swigCPtr, (int)direction);
365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368 internal ScrollBar.Direction GetScrollDirection()
370 ScrollBar.Direction ret = (ScrollBar.Direction)NDalicPINVOKE.ScrollBar_GetScrollDirection(swigCPtr);
371 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
375 internal void SetIndicatorHeightPolicy(ScrollBar.IndicatorHeightPolicyType policy)
377 NDalicPINVOKE.ScrollBar_SetIndicatorHeightPolicy(swigCPtr, (int)policy);
378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381 internal ScrollBar.IndicatorHeightPolicyType GetIndicatorHeightPolicy()
383 ScrollBar.IndicatorHeightPolicyType ret = (ScrollBar.IndicatorHeightPolicyType)NDalicPINVOKE.ScrollBar_GetIndicatorHeightPolicy(swigCPtr);
384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388 internal void SetIndicatorFixedHeight(float height)
390 NDalicPINVOKE.ScrollBar_SetIndicatorFixedHeight(swigCPtr, height);
391 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
394 internal float GetIndicatorFixedHeight()
396 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorFixedHeight(swigCPtr);
397 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
401 internal void SetIndicatorShowDuration(float durationSeconds)
403 NDalicPINVOKE.ScrollBar_SetIndicatorShowDuration(swigCPtr, durationSeconds);
404 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407 internal float GetIndicatorShowDuration()
409 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorShowDuration(swigCPtr);
410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414 internal void SetIndicatorHideDuration(float durationSeconds)
416 NDalicPINVOKE.ScrollBar_SetIndicatorHideDuration(swigCPtr, durationSeconds);
417 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
420 internal float GetIndicatorHideDuration()
422 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorHideDuration(swigCPtr);
423 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427 internal void ShowIndicator()
429 NDalicPINVOKE.ScrollBar_ShowIndicator(swigCPtr);
430 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
433 internal void HideIndicator()
435 NDalicPINVOKE.ScrollBar_HideIndicator(swigCPtr);
436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
439 internal VoidSignal PanFinishedSignal()
441 VoidSignal ret = new VoidSignal(NDalicPINVOKE.ScrollBar_PanFinishedSignal(swigCPtr), false);
442 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 internal FloatSignal ScrollPositionIntervalReachedSignal()
448 FloatSignal ret = new FloatSignal(NDalicPINVOKE.ScrollBar_ScrollPositionIntervalReachedSignal(swigCPtr), false);
449 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
453 internal enum PropertyRange
455 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
456 PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
460 /// Direction of scroll bar
462 public enum Direction
469 /// Indicator height policy.
471 public enum IndicatorHeightPolicyType
478 /// Direction of scroll bar
480 public Direction ScrollDirection
485 if (GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false)
488 Tizen.Log.Error("NUI", "ScrollDirection get error!");
495 return Direction.Vertical;
497 return Direction.Horizontal;
499 return Direction.Vertical;
504 string valueToString = "";
507 case Direction.Vertical:
509 valueToString = "Vertical";
512 case Direction.Horizontal:
514 valueToString = "Horizontal";
519 valueToString = "Vertical";
523 SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString));
528 /// Indicator height policy.
530 public IndicatorHeightPolicyType IndicatorHeightPolicy
535 if (GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false)
538 Tizen.Log.Error("NUI", "IndicatorHeightPolicy get error!");
545 return IndicatorHeightPolicyType.Variable;
547 return IndicatorHeightPolicyType.Fixed;
549 return IndicatorHeightPolicyType.Variable;
554 string valueToString = "";
557 case IndicatorHeightPolicyType.Variable:
559 valueToString = "Variable";
562 case IndicatorHeightPolicyType.Fixed:
564 valueToString = "Fixed";
569 valueToString = "Variable";
573 SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString));
578 /// the fixed height of scroll indicator.
580 public float IndicatorFixedHeight
585 GetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT).Get(ref temp);
590 SetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT, new Tizen.NUI.PropertyValue(value));
595 /// the duration in seconds for the scroll indicator to become fully visible.
597 public float IndicatorShowDuration
602 GetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION).Get(ref temp);
607 SetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION, new Tizen.NUI.PropertyValue(value));
612 /// the duration in seconds for the scroll indicator to become fully invisible.
614 public float IndicatorHideDuration
619 GetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION).Get(ref temp);
624 SetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION, new Tizen.NUI.PropertyValue(value));
629 /// the list of values to get notification when the current scroll position of the scrollable object goes above or below any of these values.
631 public Tizen.NUI.PropertyArray ScrollPositionIntervals
635 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
636 GetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS).Get(temp);
641 SetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS, new Tizen.NUI.PropertyValue(value));
646 /// The minimum height for a variable size indicator.
648 public float IndicatorMinimumHeight
653 GetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT).Get(ref temp);
658 SetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT, new Tizen.NUI.PropertyValue(value));
663 /// The padding at the start of the indicator. For example, the top if scrollDirection is Vertical.
665 public float IndicatorStartPadding
670 GetProperty(ScrollBar.Property.INDICATOR_START_PADDING).Get(ref temp);
675 SetProperty(ScrollBar.Property.INDICATOR_START_PADDING, new Tizen.NUI.PropertyValue(value));
680 /// The padding at the end of the indicator. For example, the bottom if scrollDirection is Vertical.
682 public float IndicatorEndPadding
687 GetProperty(ScrollBar.Property.INDICATOR_END_PADDING).Get(ref temp);
692 SetProperty(ScrollBar.Property.INDICATOR_END_PADDING, new Tizen.NUI.PropertyValue(value));