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 ScrollIntervalEventArgs : 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<ScrollIntervalEventArgs> _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<ScrollIntervalEventArgs> ScrollInterval
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 ScrollIntervalEventArgs e = new ScrollIntervalEventArgs();
194 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
196 //here we send all data to user event handlers
197 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
202 internal class Property
204 internal static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ScrollBar_Property_SCROLL_DIRECTION_get();
205 internal static readonly int INDICATOR_HEIGHT_POLICY = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get();
206 internal static readonly int INDICATOR_FIXED_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get();
207 internal static readonly int INDICATOR_SHOW_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_SHOW_DURATION_get();
208 internal static readonly int INDICATOR_HIDE_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HIDE_DURATION_get();
209 internal static readonly int SCROLL_POSITION_INTERVALS = NDalicPINVOKE.ScrollBar_Property_SCROLL_POSITION_INTERVALS_get();
210 internal static readonly int INDICATOR_MINIMUM_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get();
211 internal static readonly int INDICATOR_START_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_START_PADDING_get();
212 internal static readonly int INDICATOR_END_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_END_PADDING_get();
216 /// Creates an initialized ScrollBar.
218 /// <param name="direction">The direction of scroll bar (either vertically or horizontally)</param>
219 public ScrollBar(ScrollBar.Direction direction) : this(NDalicPINVOKE.ScrollBar_New__SWIG_0((int)direction), true)
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225 /// Creates an uninitialized ScrollBar
227 public ScrollBar() : this(NDalicPINVOKE.ScrollBar_New__SWIG_1(), true)
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232 internal ScrollBar(ScrollBar scrollBar) : this(NDalicPINVOKE.new_ScrollBar__SWIG_1(ScrollBar.getCPtr(scrollBar)), true)
234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237 internal void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
239 NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243 internal void SetScrollIndicator(View indicator)
245 NDalicPINVOKE.ScrollBar_SetScrollIndicator(swigCPtr, View.getCPtr(indicator));
246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 internal View GetScrollIndicator()
251 View ret = new View(NDalicPINVOKE.ScrollBar_GetScrollIndicator(swigCPtr), true);
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256 internal void SetScrollDirection(ScrollBar.Direction direction)
258 NDalicPINVOKE.ScrollBar_SetScrollDirection(swigCPtr, (int)direction);
259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262 internal ScrollBar.Direction GetScrollDirection()
264 ScrollBar.Direction ret = (ScrollBar.Direction)NDalicPINVOKE.ScrollBar_GetScrollDirection(swigCPtr);
265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269 internal void SetIndicatorHeightPolicy(ScrollBar.IndicatorHeightPolicyType policy)
271 NDalicPINVOKE.ScrollBar_SetIndicatorHeightPolicy(swigCPtr, (int)policy);
272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 internal ScrollBar.IndicatorHeightPolicyType GetIndicatorHeightPolicy()
277 ScrollBar.IndicatorHeightPolicyType ret = (ScrollBar.IndicatorHeightPolicyType)NDalicPINVOKE.ScrollBar_GetIndicatorHeightPolicy(swigCPtr);
278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 internal void SetIndicatorFixedHeight(float height)
284 NDalicPINVOKE.ScrollBar_SetIndicatorFixedHeight(swigCPtr, height);
285 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 internal float GetIndicatorFixedHeight()
290 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorFixedHeight(swigCPtr);
291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 internal void SetIndicatorShowDuration(float durationSeconds)
297 NDalicPINVOKE.ScrollBar_SetIndicatorShowDuration(swigCPtr, durationSeconds);
298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301 internal float GetIndicatorShowDuration()
303 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorShowDuration(swigCPtr);
304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308 internal void SetIndicatorHideDuration(float durationSeconds)
310 NDalicPINVOKE.ScrollBar_SetIndicatorHideDuration(swigCPtr, durationSeconds);
311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314 internal float GetIndicatorHideDuration()
316 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorHideDuration(swigCPtr);
317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 internal void ShowIndicator()
323 NDalicPINVOKE.ScrollBar_ShowIndicator(swigCPtr);
324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327 internal void HideIndicator()
329 NDalicPINVOKE.ScrollBar_HideIndicator(swigCPtr);
330 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333 internal VoidSignal PanFinishedSignal()
335 VoidSignal ret = new VoidSignal(NDalicPINVOKE.ScrollBar_PanFinishedSignal(swigCPtr), false);
336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 internal FloatSignal ScrollPositionIntervalReachedSignal()
342 FloatSignal ret = new FloatSignal(NDalicPINVOKE.ScrollBar_ScrollPositionIntervalReachedSignal(swigCPtr), false);
343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
348 /// Direction of scroll bar
350 public enum Direction
357 /// Indicator height policy.
359 public enum IndicatorHeightPolicyType
366 /// Direction of scroll bar
368 public Direction ScrollDirection
373 if (GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false)
376 Tizen.Log.Error("NUI", "ScrollDirection get error!");
383 return Direction.Vertical;
385 return Direction.Horizontal;
387 return Direction.Vertical;
392 string valueToString = "";
395 case Direction.Vertical:
397 valueToString = "Vertical";
400 case Direction.Horizontal:
402 valueToString = "Horizontal";
407 valueToString = "Vertical";
411 SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString));
416 /// Indicator height policy.
418 public IndicatorHeightPolicyType IndicatorHeightPolicy
423 if (GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false)
426 Tizen.Log.Error("NUI", "IndicatorHeightPolicy get error!");
433 return IndicatorHeightPolicyType.Variable;
435 return IndicatorHeightPolicyType.Fixed;
437 return IndicatorHeightPolicyType.Variable;
442 string valueToString = "";
445 case IndicatorHeightPolicyType.Variable:
447 valueToString = "Variable";
450 case IndicatorHeightPolicyType.Fixed:
452 valueToString = "Fixed";
457 valueToString = "Variable";
461 SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString));
466 /// the fixed height of scroll indicator.
468 public float IndicatorFixedHeight
473 GetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT).Get(out temp);
478 SetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT, new Tizen.NUI.PropertyValue(value));
483 /// the duration in seconds for the scroll indicator to become fully visible.
485 public float IndicatorShowDuration
490 GetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION).Get(out temp);
495 SetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION, new Tizen.NUI.PropertyValue(value));
500 /// the duration in seconds for the scroll indicator to become fully invisible.
502 public float IndicatorHideDuration
507 GetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION).Get(out temp);
512 SetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION, new Tizen.NUI.PropertyValue(value));
517 /// the list of values to get notification when the current scroll position of the scrollable object goes above or below any of these values.
519 public Tizen.NUI.PropertyArray ScrollPositionIntervals
523 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
524 GetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS).Get(temp);
529 SetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS, new Tizen.NUI.PropertyValue(value));
534 /// The minimum height for a variable size indicator.
536 public float IndicatorMinimumHeight
541 GetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT).Get(out temp);
546 SetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT, new Tizen.NUI.PropertyValue(value));
551 /// The padding at the start of the indicator. For example, the top if scrollDirection is Vertical.
553 public float IndicatorStartPadding
558 GetProperty(ScrollBar.Property.INDICATOR_START_PADDING).Get(out temp);
563 SetProperty(ScrollBar.Property.INDICATOR_START_PADDING, new Tizen.NUI.PropertyValue(value));
568 /// The padding at the end of the indicator. For example, the bottom if scrollDirection is Vertical.
570 public float IndicatorEndPadding
575 GetProperty(ScrollBar.Property.INDICATOR_END_PADDING).Get(out temp);
580 SetProperty(ScrollBar.Property.INDICATOR_END_PADDING, new Tizen.NUI.PropertyValue(value));