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 protected override void Dispose(DisposeTypes type)
62 if(type == DisposeTypes.Explicit)
65 //Release your own managed resources here.
66 //You should release all of your own disposable objects here.
69 //Release your own unmanaged resources here.
70 //You should not access any managed member here except static instance.
71 //because the execution order of Finalizes is non-deterministic.
73 if (swigCPtr.Handle != global::System.IntPtr.Zero)
78 NDalicPINVOKE.delete_ScrollBar(swigCPtr);
80 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
87 /// Event arguments that passed via PanFinished event
89 public class PanFinishedEventArgs : EventArgs
94 /// Event arguments that passed via ScrollPositionIntervalReached event
96 public class ScrollIntervalEventArgs : EventArgs
98 private float _currentScrollPosition;
101 /// current scroll position of the scrollable content
103 public float CurrentScrollPosition
107 return _currentScrollPosition;
111 _currentScrollPosition = value;
116 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
117 private delegate void PanFinishedEventCallbackDelegate();
118 private EventHandler<PanFinishedEventArgs> _scrollBarPanFinishedEventHandler;
119 private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
121 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
122 private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
123 private EventHandler<ScrollIntervalEventArgs> _scrollBarScrollPositionIntervalReachedEventHandler;
124 private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
127 /// Event emitted when panning is finished on the scroll indicator.
129 public event EventHandler<PanFinishedEventArgs> PanFinished
133 if (_scrollBarPanFinishedEventHandler == null)
135 _scrollBarPanFinishedEventCallbackDelegate = (OnScrollBarPanFinished);
136 PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
138 _scrollBarPanFinishedEventHandler += value;
142 _scrollBarPanFinishedEventHandler -= value;
143 if (_scrollBarPanFinishedEventHandler == null && PanFinishedSignal().Empty() == false)
145 PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
150 // Callback for ScrollBar PanFinishedSignal
151 private void OnScrollBarPanFinished()
153 PanFinishedEventArgs e = new PanFinishedEventArgs();
155 if (_scrollBarPanFinishedEventHandler != null)
157 //here we send all data to user event handlers
158 _scrollBarPanFinishedEventHandler(this, e);
164 /// Event emitted when the current scroll position of the scrollable content
166 public event EventHandler<ScrollIntervalEventArgs> ScrollInterval
170 if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
172 _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = (OnScrollBarScrollPositionIntervalReached);
173 ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
175 _scrollBarScrollPositionIntervalReachedEventHandler += value;
179 _scrollBarScrollPositionIntervalReachedEventHandler -= value;
180 if (_scrollBarScrollPositionIntervalReachedEventHandler == null && ScrollPositionIntervalReachedSignal().Empty() == false)
182 ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
187 // Callback for ScrollBar ScrollPositionIntervalReachedSignal
188 private void OnScrollBarScrollPositionIntervalReached()
190 ScrollIntervalEventArgs e = new ScrollIntervalEventArgs();
192 if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
194 //here we send all data to user event handlers
195 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
200 internal class Property
202 internal static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ScrollBar_Property_SCROLL_DIRECTION_get();
203 internal static readonly int INDICATOR_HEIGHT_POLICY = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get();
204 internal static readonly int INDICATOR_FIXED_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get();
205 internal static readonly int INDICATOR_SHOW_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_SHOW_DURATION_get();
206 internal static readonly int INDICATOR_HIDE_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HIDE_DURATION_get();
207 internal static readonly int SCROLL_POSITION_INTERVALS = NDalicPINVOKE.ScrollBar_Property_SCROLL_POSITION_INTERVALS_get();
208 internal static readonly int INDICATOR_MINIMUM_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get();
209 internal static readonly int INDICATOR_START_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_START_PADDING_get();
210 internal static readonly int INDICATOR_END_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_END_PADDING_get();
214 /// Creates an initialized ScrollBar.
216 /// <param name="direction">The direction of scroll bar (either vertically or horizontally)</param>
217 public ScrollBar(ScrollBar.Direction direction) : this(NDalicPINVOKE.ScrollBar_New__SWIG_0((int)direction), true)
219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223 /// Creates an uninitialized ScrollBar
225 public ScrollBar() : this(NDalicPINVOKE.ScrollBar_New__SWIG_1(), true)
227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230 internal ScrollBar(ScrollBar scrollBar) : this(NDalicPINVOKE.new_ScrollBar__SWIG_1(ScrollBar.getCPtr(scrollBar)), true)
232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 internal void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
237 NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 internal void SetScrollIndicator(View indicator)
243 NDalicPINVOKE.ScrollBar_SetScrollIndicator(swigCPtr, View.getCPtr(indicator));
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 internal View GetScrollIndicator()
249 View ret = new View(NDalicPINVOKE.ScrollBar_GetScrollIndicator(swigCPtr), true);
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254 internal void SetScrollDirection(ScrollBar.Direction direction)
256 NDalicPINVOKE.ScrollBar_SetScrollDirection(swigCPtr, (int)direction);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 internal ScrollBar.Direction GetScrollDirection()
262 ScrollBar.Direction ret = (ScrollBar.Direction)NDalicPINVOKE.ScrollBar_GetScrollDirection(swigCPtr);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 internal void SetIndicatorHeightPolicy(ScrollBar.IndicatorHeightPolicyType policy)
269 NDalicPINVOKE.ScrollBar_SetIndicatorHeightPolicy(swigCPtr, (int)policy);
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 internal ScrollBar.IndicatorHeightPolicyType GetIndicatorHeightPolicy()
275 ScrollBar.IndicatorHeightPolicyType ret = (ScrollBar.IndicatorHeightPolicyType)NDalicPINVOKE.ScrollBar_GetIndicatorHeightPolicy(swigCPtr);
276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280 internal void SetIndicatorFixedHeight(float height)
282 NDalicPINVOKE.ScrollBar_SetIndicatorFixedHeight(swigCPtr, height);
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 internal float GetIndicatorFixedHeight()
288 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorFixedHeight(swigCPtr);
289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293 internal void SetIndicatorShowDuration(float durationSeconds)
295 NDalicPINVOKE.ScrollBar_SetIndicatorShowDuration(swigCPtr, durationSeconds);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
299 internal float GetIndicatorShowDuration()
301 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorShowDuration(swigCPtr);
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306 internal void SetIndicatorHideDuration(float durationSeconds)
308 NDalicPINVOKE.ScrollBar_SetIndicatorHideDuration(swigCPtr, durationSeconds);
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 internal float GetIndicatorHideDuration()
314 float ret = NDalicPINVOKE.ScrollBar_GetIndicatorHideDuration(swigCPtr);
315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
319 internal void ShowIndicator()
321 NDalicPINVOKE.ScrollBar_ShowIndicator(swigCPtr);
322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325 internal void HideIndicator()
327 NDalicPINVOKE.ScrollBar_HideIndicator(swigCPtr);
328 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331 internal VoidSignal PanFinishedSignal()
333 VoidSignal ret = new VoidSignal(NDalicPINVOKE.ScrollBar_PanFinishedSignal(swigCPtr), false);
334 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 internal FloatSignal ScrollPositionIntervalReachedSignal()
340 FloatSignal ret = new FloatSignal(NDalicPINVOKE.ScrollBar_ScrollPositionIntervalReachedSignal(swigCPtr), false);
341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346 /// Direction of scroll bar
348 public enum Direction
355 /// Indicator height policy.
357 public enum IndicatorHeightPolicyType
364 /// Direction of scroll bar
366 public Direction ScrollDirection
371 if (GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false)
374 Tizen.Log.Error("NUI", "ScrollDirection get error!");
381 return Direction.Vertical;
383 return Direction.Horizontal;
385 return Direction.Vertical;
390 string valueToString = "";
393 case Direction.Vertical:
395 valueToString = "Vertical";
398 case Direction.Horizontal:
400 valueToString = "Horizontal";
405 valueToString = "Vertical";
409 SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString));
414 /// Indicator height policy.
416 public IndicatorHeightPolicyType IndicatorHeightPolicy
421 if (GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false)
424 Tizen.Log.Error("NUI", "IndicatorHeightPolicy get error!");
431 return IndicatorHeightPolicyType.Variable;
433 return IndicatorHeightPolicyType.Fixed;
435 return IndicatorHeightPolicyType.Variable;
440 string valueToString = "";
443 case IndicatorHeightPolicyType.Variable:
445 valueToString = "Variable";
448 case IndicatorHeightPolicyType.Fixed:
450 valueToString = "Fixed";
455 valueToString = "Variable";
459 SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString));
464 /// the fixed height of scroll indicator.
466 public float IndicatorFixedHeight
471 GetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT).Get(out temp);
476 SetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT, new Tizen.NUI.PropertyValue(value));
481 /// the duration in seconds for the scroll indicator to become fully visible.
483 public float IndicatorShowDuration
488 GetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION).Get(out temp);
493 SetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION, new Tizen.NUI.PropertyValue(value));
498 /// the duration in seconds for the scroll indicator to become fully invisible.
500 public float IndicatorHideDuration
505 GetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION).Get(out temp);
510 SetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION, new Tizen.NUI.PropertyValue(value));
515 /// the list of values to get notification when the current scroll position of the scrollable object goes above or below any of these values.
517 public Tizen.NUI.PropertyArray ScrollPositionIntervals
521 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
522 GetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS).Get(temp);
527 SetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS, new Tizen.NUI.PropertyValue(value));
532 /// The minimum height for a variable size indicator.
534 public float IndicatorMinimumHeight
539 GetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT).Get(out temp);
544 SetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT, new Tizen.NUI.PropertyValue(value));
549 /// The padding at the start of the indicator. For example, the top if scrollDirection is Vertical.
551 public float IndicatorStartPadding
556 GetProperty(ScrollBar.Property.INDICATOR_START_PADDING).Get(out temp);
561 SetProperty(ScrollBar.Property.INDICATOR_START_PADDING, new Tizen.NUI.PropertyValue(value));
566 /// The padding at the end of the indicator. For example, the bottom if scrollDirection is Vertical.
568 public float IndicatorEndPadding
573 GetProperty(ScrollBar.Property.INDICATOR_END_PADDING).Get(out temp);
578 SetProperty(ScrollBar.Property.INDICATOR_END_PADDING, new Tizen.NUI.PropertyValue(value));