[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / UIComponents / ScrollBar.cs
1 /*
2  * Copyright(c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 using System;
18 using System.ComponentModel;
19 using System.Runtime.InteropServices;
20 using Tizen.NUI.BaseComponents;
21 using Tizen.NUI.Binding;
22
23 namespace Tizen.NUI.UIComponents
24 {
25     /// <summary>
26     /// The ScrollBar is a UI component that can be linked to the scrollable objects
27     /// indicating the current scroll position of the scrollable object.<br />
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public class ScrollBar : View
31     {
32         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
33         [EditorBrowsable(EditorBrowsableState.Never)]
34         public static readonly BindableProperty ScrollDirectionProperty = BindableProperty.Create("ScrollDirection", typeof(Direction), typeof(ScrollBar), Direction.Vertical, propertyChanged: (bindable, oldValue, newValue) =>
35         {
36             var scrollBar = (ScrollBar)bindable;
37             string valueToString = "";
38             if (newValue != null)
39             {
40                 switch ((Direction)newValue)
41                 {
42                     case Direction.Vertical: { valueToString = "Vertical"; break; }
43                     case Direction.Horizontal: { valueToString = "Horizontal"; break; }
44                     default: { valueToString = "Vertical"; break; }
45                 }
46                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString));
47             }
48         },
49         defaultValueCreator: (bindable) =>
50         {
51             var scrollBar = (ScrollBar)bindable;
52             string temp;
53             if (Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false)
54             {
55                 NUILog.Error("ScrollDirection get error!");
56             }
57
58             switch (temp)
59             {
60                 case "Vertical": return Direction.Vertical;
61                 case "Horizontal": return Direction.Horizontal;
62                 default: return Direction.Vertical;
63             }
64         });
65         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
66         [EditorBrowsable(EditorBrowsableState.Never)]
67         public static readonly BindableProperty IndicatorHeightPolicyProperty = BindableProperty.Create("IndicatorHeightPolicy", typeof(IndicatorHeightPolicyType), typeof(ScrollBar), IndicatorHeightPolicyType.Variable, propertyChanged: (bindable, oldValue, newValue) =>
68         {
69             var scrollBar = (ScrollBar)bindable;
70             string valueToString = "";
71             if (newValue != null)
72             {
73                 switch ((IndicatorHeightPolicyType)newValue)
74                 {
75                     case IndicatorHeightPolicyType.Variable: { valueToString = "Variable"; break; }
76                     case IndicatorHeightPolicyType.Fixed: { valueToString = "Fixed"; break; }
77                     default: { valueToString = "Variable"; break; }
78                 }
79                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString));
80             }
81         },
82         defaultValueCreator: (bindable) =>
83         {
84             var scrollBar = (ScrollBar)bindable;
85             string temp;
86             if (Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false)
87             {
88                 NUILog.Error("IndicatorHeightPolicy get error!");
89             }
90
91             switch (temp)
92             {
93                 case "Variable": return IndicatorHeightPolicyType.Variable;
94                 case "Fixed": return IndicatorHeightPolicyType.Fixed;
95                 default: return IndicatorHeightPolicyType.Variable;
96             }
97         });
98         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
99         [EditorBrowsable(EditorBrowsableState.Never)]
100         public static readonly BindableProperty IndicatorFixedHeightProperty = BindableProperty.Create("IndicatorFixedHeight", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
101         {
102             var scrollBar = (ScrollBar)bindable;
103             if (newValue != null)
104             {
105                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_FIXED_HEIGHT, new Tizen.NUI.PropertyValue((float)newValue));
106             }
107         },
108         defaultValueCreator: (bindable) =>
109         {
110             var scrollBar = (ScrollBar)bindable;
111             float temp = 0.0f;
112             Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_FIXED_HEIGHT).Get(out temp);
113             return temp;
114         });
115         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
116         [EditorBrowsable(EditorBrowsableState.Never)]
117         public static readonly BindableProperty IndicatorShowDurationProperty = BindableProperty.Create("IndicatorShowDuration", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
118         {
119             var scrollBar = (ScrollBar)bindable;
120             if (newValue != null)
121             {
122                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_SHOW_DURATION, new Tizen.NUI.PropertyValue((float)newValue));
123             }
124         },
125         defaultValueCreator: (bindable) =>
126         {
127             var scrollBar = (ScrollBar)bindable;
128             float temp = 0.0f;
129             Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_SHOW_DURATION).Get(out temp);
130             return temp;
131         });
132         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
133         [EditorBrowsable(EditorBrowsableState.Never)]
134         public static readonly BindableProperty IndicatorHideDurationProperty = BindableProperty.Create("IndicatorHideDuration", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
135         {
136             var scrollBar = (ScrollBar)bindable;
137             if (newValue != null)
138             {
139                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_HIDE_DURATION, new Tizen.NUI.PropertyValue((float)newValue));
140             }
141         },
142         defaultValueCreator: (bindable) =>
143         {
144             var scrollBar = (ScrollBar)bindable;
145             float temp = 0.0f;
146             Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_HIDE_DURATION).Get(out temp);
147             return temp;
148         });
149         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
150         [EditorBrowsable(EditorBrowsableState.Never)]
151         public static readonly BindableProperty ScrollPositionIntervalsProperty = BindableProperty.Create("ScrollPositionIntervals", typeof(PropertyArray), typeof(ScrollBar), new PropertyArray(), propertyChanged: (bindable, oldValue, newValue) =>
152         {
153             var scrollBar = (ScrollBar)bindable;
154             if (newValue != null)
155             {
156                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.SCROLL_POSITION_INTERVALS, new Tizen.NUI.PropertyValue((PropertyArray)newValue));
157             }
158         },
159         defaultValueCreator: (bindable) =>
160         {
161             var scrollBar = (ScrollBar)bindable;
162             Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
163             Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.SCROLL_POSITION_INTERVALS).Get(temp);
164             return temp;
165         });
166         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
167         [EditorBrowsable(EditorBrowsableState.Never)]
168         public static readonly BindableProperty IndicatorMinimumHeightProperty = BindableProperty.Create("IndicatorMinimumHeight", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
169         {
170             var scrollBar = (ScrollBar)bindable;
171             if (newValue != null)
172             {
173                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT, new Tizen.NUI.PropertyValue((float)newValue));
174             }
175         },
176         defaultValueCreator: (bindable) =>
177         {
178             var scrollBar = (ScrollBar)bindable;
179             float temp = 0.0f;
180             Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT).Get(out temp);
181             return temp;
182         });
183         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
184         [EditorBrowsable(EditorBrowsableState.Never)]
185         public static readonly BindableProperty IndicatorStartPaddingProperty = BindableProperty.Create("IndicatorStartPadding", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
186         {
187             var scrollBar = (ScrollBar)bindable;
188             if (newValue != null)
189             {
190                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_START_PADDING, new Tizen.NUI.PropertyValue((float)newValue));
191             }
192         },
193         defaultValueCreator: (bindable) =>
194         {
195             var scrollBar = (ScrollBar)bindable;
196             float temp = 0.0f;
197             Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_START_PADDING).Get(out temp);
198             return temp;
199         });
200         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
201         [EditorBrowsable(EditorBrowsableState.Never)]
202         public static readonly BindableProperty IndicatorEndPaddingProperty = BindableProperty.Create("IndicatorEndPadding", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
203         {
204             var scrollBar = (ScrollBar)bindable;
205             if (newValue != null)
206             {
207                 Tizen.NUI.Object.SetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_END_PADDING, new Tizen.NUI.PropertyValue((float)newValue));
208             }
209         },
210         defaultValueCreator: (bindable) =>
211         {
212             var scrollBar = (ScrollBar)bindable;
213             float temp = 0.0f;
214             Tizen.NUI.Object.GetProperty(scrollBar.swigCPtr, ScrollBar.Property.INDICATOR_END_PADDING).Get(out temp);
215             return temp;
216         });
217
218         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
219
220         private EventHandler<PanFinishedEventArgs> _scrollBarPanFinishedEventHandler;
221         private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
222
223         private EventHandler<ScrollIntervalEventArgs> _scrollBarScrollPositionIntervalReachedEventHandler;
224         private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
225
226         /// <summary>
227         /// Creates an initialized scrollbar.
228         /// </summary>
229         /// <param name="direction">The direction of the scrollbar (either vertically or horizontally).</param>
230         /// <since_tizen> 3 </since_tizen>
231         public ScrollBar(ScrollBar.Direction direction) : this(Interop.ScrollBar.ScrollBar_New__SWIG_0((int)direction), true)
232         {
233             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234         }
235
236         /// <summary>
237         /// Creates an uninitialized scrollbar.
238         /// </summary>
239         /// <since_tizen> 3 </since_tizen>
240         public ScrollBar() : this(Interop.ScrollBar.ScrollBar_New__SWIG_1(), true)
241         {
242             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243         }
244
245         internal ScrollBar(ScrollBar scrollBar) : this(Interop.ScrollBar.new_ScrollBar__SWIG_1(ScrollBar.getCPtr(scrollBar)), true)
246         {
247             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248         }
249
250         internal ScrollBar(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.ScrollBar.ScrollBar_SWIGUpcast(cPtr), cMemoryOwn)
251         {
252             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
253         }
254
255         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
256         private delegate void PanFinishedEventCallbackDelegate();
257
258         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
259         private delegate void ScrollPositionIntervalReachedEventCallbackDelegate(float position);
260
261         /// <summary>
262         /// The event emitted when panning is finished on the scroll indicator.
263         /// </summary>
264         /// <remarks>Event only emitted when the source of the scroll position properties are set.</remarks>
265         /// <since_tizen> 3 </since_tizen>
266         public event EventHandler<PanFinishedEventArgs> PanFinished
267         {
268             add
269             {
270                 if (_scrollBarPanFinishedEventHandler == null)
271                 {
272                     _scrollBarPanFinishedEventCallbackDelegate = (OnScrollBarPanFinished);
273                     PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
274                 }
275                 _scrollBarPanFinishedEventHandler += value;
276             }
277             remove
278             {
279                 _scrollBarPanFinishedEventHandler -= value;
280                 if (_scrollBarPanFinishedEventHandler == null && PanFinishedSignal().Empty() == false)
281                 {
282                     PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
283                 }
284             }
285         }
286
287         /// <summary>
288         /// This is the event emitted when the current scroll position of the scrollable content goes above or below the values specified by ScrollPositionIntervals property.
289         /// </summary>
290         /// <remarks>Event only emitted when the source of the scroll position properties are set.</remarks>
291         /// <since_tizen> 3 </since_tizen>
292         public event EventHandler<ScrollIntervalEventArgs> ScrollInterval
293         {
294             add
295             {
296                 if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
297                 {
298                     _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = (OnScrollBarScrollPositionIntervalReached);
299                     ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
300                 }
301                 _scrollBarScrollPositionIntervalReachedEventHandler += value;
302             }
303             remove
304             {
305                 _scrollBarScrollPositionIntervalReachedEventHandler -= value;
306                 if (_scrollBarScrollPositionIntervalReachedEventHandler == null && ScrollPositionIntervalReachedSignal().Empty() == false)
307                 {
308                     ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
309                 }
310             }
311         }
312
313         /// <summary>
314         /// The direction of the scrollbar.
315         /// </summary>
316         /// <since_tizen> 3 </since_tizen>
317         public enum Direction
318         {
319             /// <summary>
320             /// Scroll in the vertical direction
321             /// </summary>
322             /// <since_tizen> 3 </since_tizen>
323             Vertical = 0,
324             /// <summary>
325             /// Scroll in the horizontal direction
326             /// </summary>
327             /// <since_tizen> 3 </since_tizen>
328             Horizontal
329         }
330
331         /// <summary>
332         /// The indicator height policy.
333         /// </summary>
334         /// <since_tizen> 3 </since_tizen>
335         public enum IndicatorHeightPolicyType
336         {
337             /// <summary>
338             /// Variable height changed dynamically according to the length of scroll content
339             /// </summary>
340             /// <since_tizen> 3 </since_tizen>
341             Variable = 0,
342             /// <summary>
343             /// Fixed height regardless of the length of scroll content
344             /// </summary>
345             /// <since_tizen> 3 </since_tizen>
346             Fixed
347         }
348
349         /// <summary>
350         /// The direction of the scrollbar.
351         /// </summary>
352         /// <since_tizen> 3 </since_tizen>
353         public Direction ScrollDirection
354         {
355             get
356             {
357
358                 return (Direction)GetValue(ScrollDirectionProperty);
359             }
360             set
361             {
362                 SetValue(ScrollDirectionProperty, value);
363             }
364         }
365
366         /// <summary>
367         /// The indicator height policy.
368         /// </summary>
369         /// <since_tizen> 3 </since_tizen>
370         public IndicatorHeightPolicyType IndicatorHeightPolicy
371         {
372             get
373             {
374                 return (IndicatorHeightPolicyType)GetValue(IndicatorHeightPolicyProperty);
375             }
376             set
377             {
378                 SetValue(IndicatorHeightPolicyProperty, value);
379             }
380         }
381
382         /// <summary>
383         /// The fixed height of the scroll indicator.
384         /// </summary>
385         /// <since_tizen> 3 </since_tizen>
386         public float IndicatorFixedHeight
387         {
388             get
389             {
390                 return (float)GetValue(IndicatorFixedHeightProperty);
391             }
392             set
393             {
394                 SetValue(IndicatorFixedHeightProperty, value);
395             }
396         }
397
398         /// <summary>
399         /// The duration in seconds for the scroll indicator to become fully visible.
400         /// </summary>
401         /// <since_tizen> 3 </since_tizen>
402         public float IndicatorShowDuration
403         {
404             get
405             {
406                 return (float)GetValue(IndicatorShowDurationProperty);
407             }
408             set
409             {
410                 SetValue(IndicatorShowDurationProperty, value);
411             }
412         }
413
414         /// <summary>
415         /// The duration in seconds for the scroll indicator to become fully invisible.
416         /// </summary>
417         /// <since_tizen> 3 </since_tizen>
418         public float IndicatorHideDuration
419         {
420             get
421             {
422                 return (float)GetValue(IndicatorHideDurationProperty);
423             }
424             set
425             {
426                 SetValue(IndicatorHideDurationProperty, value);
427             }
428         }
429
430         /// <summary>
431         /// The list of values to get the notification when the current scroll position of the scrollable object goes above or below any of these values.
432         /// </summary>
433         /// <since_tizen> 3 </since_tizen>
434         public Tizen.NUI.PropertyArray ScrollPositionIntervals
435         {
436             get
437             {
438                 return (PropertyArray)GetValue(ScrollPositionIntervalsProperty);
439             }
440             set
441             {
442                 SetValue(ScrollPositionIntervalsProperty, value);
443             }
444         }
445
446         /// <summary>
447         /// The minimum height for a variable size indicator.
448         /// </summary>
449         /// <since_tizen> 3 </since_tizen>
450         public float IndicatorMinimumHeight
451         {
452             get
453             {
454                 return (float)GetValue(IndicatorMinimumHeightProperty);
455             }
456             set
457             {
458                 SetValue(IndicatorMinimumHeightProperty, value);
459             }
460         }
461
462         /// <summary>
463         /// The padding at the start of the indicator. For example, the top if the scrollDirection is vertical.
464         /// </summary>
465         /// <since_tizen> 3 </since_tizen>
466         public float IndicatorStartPadding
467         {
468             get
469             {
470                 return (float)GetValue(IndicatorStartPaddingProperty);
471             }
472             set
473             {
474                 SetValue(IndicatorStartPaddingProperty, value);
475             }
476         }
477
478         /// <summary>
479         /// The padding at the end of the indicator. For example, the bottom if the scrollDirection is vertical.
480         /// </summary>
481         /// <since_tizen> 3 </since_tizen>
482         public float IndicatorEndPadding
483         {
484             get
485             {
486                 return (float)GetValue(IndicatorEndPaddingProperty);
487             }
488             set
489             {
490                 SetValue(IndicatorEndPaddingProperty, value);
491             }
492         }
493
494         /// <summary>
495         /// Sets the source of the scroll position properties.
496         /// </summary>
497         /// <param name="handle">The handle of the object owing the scroll properties.</param>
498         /// <param name="propertyScrollPosition">The index of the scroll position property(The scroll position, type float).</param>
499         /// <param name="propertyMinScrollPosition">The index of the minimum scroll position property(The minimum scroll position, type float).</param>
500         /// <param name="propertyMaxScrollPosition">The index of the maximum scroll position property(The maximum scroll position, type float).</param>
501         /// <param name="propertyScrollContentSize">The index of the scroll content size property(The size of the scrollable content in actor coordinates, type float).</param>
502         /// <remarks>The handle to the object owing the scroll properties has been initialised and the property index must be valid.</remarks>
503         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
504         [EditorBrowsable(EditorBrowsableState.Never)]
505         public void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
506         {
507             Interop.ScrollBar.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
508             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
509         }
510
511         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollBar obj)
512         {
513             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
514         }
515
516         internal void SetScrollIndicator(View indicator)
517         {
518             Interop.ScrollBar.ScrollBar_SetScrollIndicator(swigCPtr, View.getCPtr(indicator));
519             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520         }
521
522         internal View GetScrollIndicator()
523         {
524             View ret = new View(Interop.ScrollBar.ScrollBar_GetScrollIndicator(swigCPtr), true);
525             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
526             return ret;
527         }
528
529         internal void SetScrollDirection(ScrollBar.Direction direction)
530         {
531             Interop.ScrollBar.ScrollBar_SetScrollDirection(swigCPtr, (int)direction);
532             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533         }
534
535         internal ScrollBar.Direction GetScrollDirection()
536         {
537             ScrollBar.Direction ret = (ScrollBar.Direction)Interop.ScrollBar.ScrollBar_GetScrollDirection(swigCPtr);
538             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539             return ret;
540         }
541
542         internal void SetIndicatorHeightPolicy(ScrollBar.IndicatorHeightPolicyType policy)
543         {
544             Interop.ScrollBar.ScrollBar_SetIndicatorHeightPolicy(swigCPtr, (int)policy);
545             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546         }
547
548         internal ScrollBar.IndicatorHeightPolicyType GetIndicatorHeightPolicy()
549         {
550             ScrollBar.IndicatorHeightPolicyType ret = (ScrollBar.IndicatorHeightPolicyType)Interop.ScrollBar.ScrollBar_GetIndicatorHeightPolicy(swigCPtr);
551             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552             return ret;
553         }
554
555         internal void SetIndicatorFixedHeight(float height)
556         {
557             Interop.ScrollBar.ScrollBar_SetIndicatorFixedHeight(swigCPtr, height);
558             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
559         }
560
561         internal float GetIndicatorFixedHeight()
562         {
563             float ret = Interop.ScrollBar.ScrollBar_GetIndicatorFixedHeight(swigCPtr);
564             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
565             return ret;
566         }
567
568         internal void SetIndicatorShowDuration(float durationSeconds)
569         {
570             Interop.ScrollBar.ScrollBar_SetIndicatorShowDuration(swigCPtr, durationSeconds);
571             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572         }
573
574         internal float GetIndicatorShowDuration()
575         {
576             float ret = Interop.ScrollBar.ScrollBar_GetIndicatorShowDuration(swigCPtr);
577             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
578             return ret;
579         }
580
581         internal void SetIndicatorHideDuration(float durationSeconds)
582         {
583             Interop.ScrollBar.ScrollBar_SetIndicatorHideDuration(swigCPtr, durationSeconds);
584             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585         }
586
587         internal float GetIndicatorHideDuration()
588         {
589             float ret = Interop.ScrollBar.ScrollBar_GetIndicatorHideDuration(swigCPtr);
590             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
591             return ret;
592         }
593
594         internal void ShowIndicator()
595         {
596             Interop.ScrollBar.ScrollBar_ShowIndicator(swigCPtr);
597             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598         }
599
600         internal void HideIndicator()
601         {
602             Interop.ScrollBar.ScrollBar_HideIndicator(swigCPtr);
603             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
604         }
605
606         internal VoidSignal PanFinishedSignal()
607         {
608             VoidSignal ret = new VoidSignal(Interop.ScrollBar.ScrollBar_PanFinishedSignal(swigCPtr), false);
609             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
610             return ret;
611         }
612
613         internal FloatSignal ScrollPositionIntervalReachedSignal()
614         {
615             FloatSignal ret = new FloatSignal(Interop.ScrollBar.ScrollBar_ScrollPositionIntervalReachedSignal(swigCPtr), false);
616             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
617             return ret;
618         }
619
620         /// <summary>
621         /// To dispose the ScrollBar instance.
622         /// </summary>
623         /// <since_tizen> 3 </since_tizen>
624         protected override void Dispose(DisposeTypes type)
625         {
626             if (disposed)
627             {
628                 return;
629             }
630
631             //Release your own unmanaged resources here.
632             //You should not access any managed member here except static instance.
633             //because the execution order of Finalizes is non-deterministic.
634             if (this != null)
635             {
636                 if (_scrollBarScrollPositionIntervalReachedEventCallbackDelegate != null)
637                 {
638                     ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
639                 }
640
641                 if (_scrollBarPanFinishedEventCallbackDelegate != null)
642                 {
643                     PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
644                 }
645             }
646
647             if (swigCPtr.Handle != global::System.IntPtr.Zero)
648             {
649                 if (swigCMemOwn)
650                 {
651                     swigCMemOwn = false;
652                     Interop.ScrollBar.delete_ScrollBar(swigCPtr);
653                 }
654                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
655             }
656
657             base.Dispose(type);
658         }
659
660         // Callback for ScrollBar PanFinishedSignal
661         private void OnScrollBarPanFinished()
662         {
663             PanFinishedEventArgs e = new PanFinishedEventArgs();
664
665             if (_scrollBarPanFinishedEventHandler != null)
666             {
667                 //here we send all data to user event handlers
668                 _scrollBarPanFinishedEventHandler(this, e);
669             }
670         }
671
672
673         // Callback for ScrollBar ScrollPositionIntervalReachedSignal
674         private void OnScrollBarScrollPositionIntervalReached(float position)
675         {
676             ScrollIntervalEventArgs e = new ScrollIntervalEventArgs();
677             e.CurrentScrollPosition = position;
678
679             if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
680             {
681                 //here we send all data to user event handlers
682                 _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
683             }
684         }
685
686
687
688         /// <summary>
689         /// Event arguments that passed via the PanFinished event.
690         /// </summary>
691         /// <since_tizen> 3 </since_tizen>
692         public class PanFinishedEventArgs : EventArgs
693         {
694         }
695
696         /// <summary>
697         /// Event arguments that passed via the ScrollPositionIntervalReached event.
698         /// </summary>
699         /// <since_tizen> 3 </since_tizen>
700         public class ScrollIntervalEventArgs : EventArgs
701         {
702             private float _currentScrollPosition;
703
704             /// <summary>
705             /// The current scroll position of the scrollable content.
706             /// </summary>
707             /// <since_tizen> 3 </since_tizen>
708             public float CurrentScrollPosition
709             {
710                 get
711                 {
712                     return _currentScrollPosition;
713                 }
714                 set
715                 {
716                     _currentScrollPosition = value;
717                 }
718             }
719         }
720
721         internal new class Property
722         {
723             internal static readonly int SCROLL_DIRECTION = Interop.ScrollBar.ScrollBar_Property_SCROLL_DIRECTION_get();
724             internal static readonly int INDICATOR_HEIGHT_POLICY = Interop.ScrollBar.ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get();
725             internal static readonly int INDICATOR_FIXED_HEIGHT = Interop.ScrollBar.ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get();
726             internal static readonly int INDICATOR_SHOW_DURATION = Interop.ScrollBar.ScrollBar_Property_INDICATOR_SHOW_DURATION_get();
727             internal static readonly int INDICATOR_HIDE_DURATION = Interop.ScrollBar.ScrollBar_Property_INDICATOR_HIDE_DURATION_get();
728             internal static readonly int SCROLL_POSITION_INTERVALS = Interop.ScrollBar.ScrollBar_Property_SCROLL_POSITION_INTERVALS_get();
729             internal static readonly int INDICATOR_MINIMUM_HEIGHT = Interop.ScrollBar.ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get();
730             internal static readonly int INDICATOR_START_PADDING = Interop.ScrollBar.ScrollBar_Property_INDICATOR_START_PADDING_get();
731             internal static readonly int INDICATOR_END_PADDING = Interop.ScrollBar.ScrollBar_Property_INDICATOR_END_PADDING_get();
732         }
733     }
734 }