[ElmSharp] Add scroll animation start/stop event for Scroller
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Scroller.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
19 namespace ElmSharp
20 {
21     /// <summary>
22     /// Enumeration for visible type of scrollbar.
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     public enum ScrollBarVisiblePolicy
26     {
27         /// <summary>
28         /// Show scrollbars as needed
29         /// </summary>
30         Auto = 0,
31
32         /// <summary>
33         /// Always show scrollbars
34         /// </summary>
35         Visible,
36
37         /// <summary>
38         /// Never show scrollbars
39         /// </summary>
40         Invisible
41     }
42
43     /// <summary>
44     /// Enumeration for visible type of scrollbar.
45     /// </summary>
46     /// <since_tizen> preview </since_tizen>
47     public enum ScrollBlock
48     {
49         /// <summary>
50         /// Scrolling movement is allowed in both direction.(X axis and Y axis)
51         /// </summary>
52         None = 1,
53
54         /// <summary>
55         /// Scrolling movement is not allowed in Y axis direction.
56         /// </summary>
57         Vertical = 2,
58
59         /// <summary>
60         /// Scrolling movement is not allowed in X axis direction.
61         /// </summary>
62         Horizontal = 4
63     }
64
65     /// <summary>
66     /// Type that controls how the content is scrolled.
67     /// </summary>
68     /// <since_tizen> preview </since_tizen>
69     public enum ScrollSingleDirection
70     {
71         /// <summary>
72         /// Scroll every direction.
73         /// </summary>
74         None,
75
76         /// <summary>
77         /// Scroll single direction if the direction is certain.
78         /// </summary>
79         Soft,
80
81         /// <summary>
82         /// Scroll only single direction.
83         /// </summary>
84         Hard,
85     }
86
87     /// <summary>
88     /// The Scroller is a container that holds and clips a single object and allows you to scroll across it.
89     /// </summary>
90     /// <since_tizen> preview </since_tizen>
91     public class Scroller : Layout
92     {
93         SmartEvent _scroll;
94         SmartEvent _scrollAnimationStart;
95         SmartEvent _scrollAnimationStop;
96         SmartEvent _dragStart;
97         SmartEvent _dragStop;
98         SmartEvent _scrollpage;
99
100         /// <summary>
101         /// Creates and initializes a new instance of the Scroller class.
102         /// </summary>
103         /// <param name="parent">The <see cref="EvasObject"/> to which the new Scroller will be attached as a child.</param>
104         /// <since_tizen> preview </since_tizen>
105         public Scroller(EvasObject parent) : base(parent)
106         {
107         }
108
109         /// <summary>
110         /// Creates and initializes a new instance of the Scroller class.
111         /// </summary>
112         /// <since_tizen> preview </since_tizen>
113         public Scroller() : base()
114         {
115         }
116
117         /// <summary>
118         /// Scrolled will be triggered when the content has been scrolled.
119         /// </summary>
120         /// <since_tizen> preview </since_tizen>
121         public event EventHandler Scrolled
122         {
123             add
124             {
125                 _scroll.On += value;
126             }
127             remove
128             {
129                 _scroll.On -= value;
130             }
131         }
132
133         /// <summary>
134         /// ScrollAnimationStarted will be triggered when the content animation has been started.
135         /// </summary>
136         /// <since_tizen> preview </since_tizen>
137         public event EventHandler ScrollAnimationStarted
138         {
139             add
140             {
141                 _scrollAnimationStart.On += value;
142             }
143             remove
144             {
145                 _scrollAnimationStart.On -= value;
146             }
147         }
148
149         /// <summary>
150         /// ScrollAnimationStopped will be triggered when the content animation has been stopped.
151         /// </summary>
152         /// <since_tizen> preview </since_tizen>
153         public event EventHandler ScrollAnimationStopped
154         {
155             add
156             {
157                 _scrollAnimationStop.On += value;
158             }
159             remove
160             {
161                 _scrollAnimationStop.On -= value;
162             }
163         }
164
165         /// <summary>
166         /// DragStart will be triggered when dragging the contents around has started.
167         /// </summary>
168         /// <since_tizen> preview </since_tizen>
169         public event EventHandler DragStart
170         {
171             add
172             {
173                 _dragStart.On += value;
174             }
175             remove
176             {
177                 _dragStart.On -= value;
178             }
179         }
180
181         /// <summary>
182         /// DragStop will be triggered when dragging the contents around has stopped.
183         /// </summary>
184         /// <since_tizen> preview </since_tizen>
185         public event EventHandler DragStop
186         {
187             add
188             {
189                 _dragStop.On += value;
190             }
191             remove
192             {
193                 _dragStop.On -= value;
194             }
195         }
196
197         /// <summary>
198         /// PageScrolled will be triggered when the visible page has changed.
199         /// </summary>
200         /// <since_tizen> preview </since_tizen>
201         public event EventHandler PageScrolled
202         {
203             add
204             {
205                 _scrollpage.On += value;
206             }
207             remove
208             {
209                 _scrollpage.On -= value;
210             }
211         }
212
213         /// <summary>
214         /// Gets the current region in the content object that is visible through the Scroller.
215         /// </summary>
216         /// <since_tizen> preview </since_tizen>
217         public Rect CurrentRegion
218         {
219             get
220             {
221                 int x, y, w, h;
222                 Interop.Elementary.elm_scroller_region_get(RealHandle, out x, out y, out w, out h);
223                 return new Rect(x, y, w, h);
224             }
225         }
226
227         /// <summary>
228         /// Sets or gets the value of HorizontalScrollBarVisiblePolicy
229         /// </summary>
230         /// <remarks>
231         /// ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden.
232         /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
233         /// </remarks>
234         /// <since_tizen> preview </since_tizen>
235         public virtual ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy
236         {
237             get
238             {
239                 int policy;
240                 Interop.Elementary.elm_scroller_policy_get(RealHandle, out policy, IntPtr.Zero);
241                 return (ScrollBarVisiblePolicy)policy;
242             }
243             set
244             {
245                 ScrollBarVisiblePolicy v = VerticalScrollBarVisiblePolicy;
246                 Interop.Elementary.elm_scroller_policy_set(RealHandle, (int)value, (int)v);
247             }
248         }
249
250         /// <summary>
251         /// Sets or gets the value of VerticalScrollBarVisiblePolicy
252         /// </summary>
253         /// <remarks>
254         /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden.
255         /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
256         /// </remarks>
257         /// <since_tizen> preview </since_tizen>
258         public virtual ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy
259         {
260             get
261             {
262                 int policy;
263                 Interop.Elementary.elm_scroller_policy_get(RealHandle, IntPtr.Zero, out policy);
264                 return (ScrollBarVisiblePolicy)policy;
265             }
266             set
267             {
268                 ScrollBarVisiblePolicy h = HorizontalScrollBarVisiblePolicy;
269                 Interop.Elementary.elm_scroller_policy_set(RealHandle, (int)h, (int)value);
270             }
271         }
272
273         /// <summary>
274         /// Sets or gets the value of ScrollBlock.
275         /// </summary>
276         /// <remarks>
277         /// This function will block scrolling movement  in a given direction.One can disable movements in the X axis, the Y axis or both.
278         /// The default value is ScrollBlock.None, where movements are allowed in both directions.
279         /// </remarks>
280         /// <since_tizen> preview </since_tizen>
281         public ScrollBlock ScrollBlock
282         {
283             get
284             {
285                 return (ScrollBlock)Interop.Elementary.elm_scroller_movement_block_get(RealHandle);
286             }
287             set
288             {
289                 Interop.Elementary.elm_scroller_movement_block_set(RealHandle, (int)value);
290             }
291         }
292
293         /// <summary>
294         /// Sets or gets scroll current page number.
295         /// </summary>
296         /// <remarks>
297         /// Current page means the page which meets the top of the viewport.
298         /// If there are two or more pages in the viewport, it returns the number of the page which meets the top of the viewport.
299         /// The page number starts from 0. 0 is the first page.
300         /// </remarks>
301         /// <since_tizen> preview </since_tizen>
302         public int VerticalPageIndex
303         {
304             get
305             {
306                 int v, h;
307                 Interop.Elementary.elm_scroller_current_page_get(RealHandle, out h, out v);
308                 return v;
309             }
310         }
311
312         /// <summary>
313         /// Sets or gets scroll current page number.
314         /// </summary>
315         /// <remarks>
316         /// Current page means the page which meets the left of the viewport.
317         /// If there are two or more pages in the viewport, it returns the number of the page which meets the left of the viewport.
318         /// The page number starts from 0. 0 is the first page.
319         /// </remarks>
320         /// <since_tizen> preview </since_tizen>
321         public int HorizontalPageIndex
322         {
323             get
324             {
325                 int v, h;
326                 Interop.Elementary.elm_scroller_current_page_get(RealHandle, out h, out v);
327                 return h;
328             }
329         }
330
331         /// <summary>
332         /// Sets or gets the maximum limit of the movable page at vertical direction.
333         /// </summary>
334         /// <since_tizen> preview </since_tizen>
335         public int VerticalPageScrollLimit
336         {
337             get
338             {
339                 int v, h;
340                 Interop.Elementary.elm_scroller_page_scroll_limit_get(RealHandle, out h, out v);
341                 return v;
342             }
343             set
344             {
345                 int h = HorizontalPageScrollLimit;
346                 Interop.Elementary.elm_scroller_page_scroll_limit_set(RealHandle, h, value);
347             }
348         }
349
350         /// <summary>
351         /// Sets or gets the maximum limit of the movable page at horizontal direction.
352         /// </summary>
353         /// <since_tizen> preview </since_tizen>
354         public int HorizontalPageScrollLimit
355         {
356             get
357             {
358                 int v, h;
359                 Interop.Elementary.elm_scroller_page_scroll_limit_get(RealHandle, out h, out v);
360                 return h;
361             }
362             set
363             {
364                 int v = VerticalPageScrollLimit;
365                 Interop.Elementary.elm_scroller_page_scroll_limit_set(RealHandle, value, v);
366             }
367         }
368
369         /// <summary>
370         /// Sets or gets the vertical bounce behaviour.
371         /// When scrolling, the scroller may "bounce" when reaching an edge of the content object.
372         /// This is a visual way to indicate the end has been reached.
373         /// This is enabled by default for both axis.
374         /// This API will set if it is enabled for the given axis with the boolean parameters for each axis.
375         /// </summary>
376         /// <since_tizen> preview </since_tizen>
377         public bool VerticalBounce
378         {
379             get
380             {
381                 bool v, h;
382                 Interop.Elementary.elm_scroller_bounce_get(RealHandle, out h, out v);
383                 return v;
384             }
385             set
386             {
387                 bool h = HorizontalBounce;
388                 Interop.Elementary.elm_scroller_bounce_set(RealHandle, h, value);
389             }
390         }
391
392         /// <summary>
393         /// Sets or gets the horizontal bounce behaviour.
394         /// When scrolling, the scroller may "bounce" when reaching an edge of the content object.
395         /// This is a visual way to indicate the end has been reached.
396         /// This is enabled by default for both axis.
397         /// This API will set if it is enabled for the given axis with the boolean parameters for each axis.
398         /// </summary>
399         /// <since_tizen> preview </since_tizen>
400         public bool HorizontalBounce
401         {
402             get
403             {
404                 bool v, h;
405                 Interop.Elementary.elm_scroller_bounce_get(RealHandle, out h, out v);
406                 return h;
407             }
408             set
409             {
410                 bool v = VerticalBounce;
411                 Interop.Elementary.elm_scroller_bounce_set(RealHandle, value, v);
412             }
413         }
414
415         /// <summary>
416         /// Gets the width of the content object of the scroller.
417         /// </summary>
418         /// <since_tizen> preview </since_tizen>
419         public int ChildWidth
420         {
421             get
422             {
423                 int w, h;
424                 Interop.Elementary.elm_scroller_child_size_get(RealHandle, out w, out h);
425                 return w;
426             }
427         }
428
429         /// <summary>
430         /// Gets the height of the content object of the scroller.
431         /// </summary>
432         /// <since_tizen> preview </since_tizen>
433         public int ChildHeight
434         {
435             get
436             {
437                 int w, h;
438                 Interop.Elementary.elm_scroller_child_size_get(RealHandle, out w, out h);
439                 return h;
440             }
441         }
442
443         /// <summary>
444         /// Set scrolling gravity values for a scroller.
445         /// The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase.
446         /// The scroller will adjust the view to glue itself as follows.
447         /// x=0.0, for staying where it is relative to the left edge of the content x=1.0, for staying where it is relative to the rigth edge of the content y=0.0, for staying where it is relative to the top edge of the content y=1.0, for staying where it is relative to the bottom edge of the content
448         /// Default values for x and y are 0.0
449         /// </summary>
450         /// <since_tizen> preview </since_tizen>
451         public double HorizontalGravity
452         {
453             get
454             {
455                 double v, h;
456                 Interop.Elementary.elm_scroller_gravity_get(RealHandle, out h, out v);
457                 return h;
458             }
459             set
460             {
461                 double v = VerticalGravity;
462                 Interop.Elementary.elm_scroller_gravity_set(RealHandle, value, v);
463             }
464         }
465
466         /// <summary>
467         /// Set scrolling gravity values for a scroller.
468         /// The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase.
469         /// The scroller will adjust the view to glue itself as follows.
470         /// x=0.0, for staying where it is relative to the left edge of the content x=1.0, for staying where it is relative to the rigth edge of the content y=0.0, for staying where it is relative to the top edge of the content y=1.0, for staying where it is relative to the bottom edge of the content
471         /// Default values for x and y are 0.0
472         /// </summary>
473         /// <since_tizen> preview </since_tizen>
474         public double VerticalGravity
475         {
476             get
477             {
478                 double v, h;
479                 Interop.Elementary.elm_scroller_gravity_get(RealHandle, out h, out v);
480                 return v;
481             }
482             set
483             {
484                 double h = HorizontalGravity;
485                 Interop.Elementary.elm_scroller_gravity_set(RealHandle, h, value);
486             }
487         }
488
489         /// <summary>
490         /// Get scroll last page number.
491         /// The page number starts from 0. 0 is the first page. This returns the last page number among the pages.
492         /// </summary>
493         /// <since_tizen> preview </since_tizen>
494         public int LastVerticalPageNumber
495         {
496             get
497             {
498                 int v, h;
499                 Interop.Elementary.elm_scroller_last_page_get(RealHandle, out h, out v);
500                 return v;
501             }
502         }
503
504         /// <summary>
505         /// Get scroll last page number.
506         /// The page number starts from 0. 0 is the first page. This returns the last page number among the pages.
507         /// </summary>
508         /// <since_tizen> preview </since_tizen>
509         public int LastHorizontalPageNumber
510         {
511             get
512             {
513                 int v, h;
514                 Interop.Elementary.elm_scroller_last_page_get(RealHandle, out h, out v);
515                 return h;
516             }
517         }
518
519         /// <summary>
520         /// Set an infinite loop_ for a scroller.
521         /// This function sets the infinite loop vertically.
522         /// If the content is set, it will be shown repeatedly.
523         /// </summary>
524         /// <since_tizen> preview </since_tizen>
525         public bool VerticalLoop
526         {
527             get
528             {
529                 bool v, h;
530                 Interop.Elementary.elm_scroller_loop_get(RealHandle, out h, out v);
531                 return v;
532             }
533             set
534             {
535                 bool h = HorizontalLoop;
536                 Interop.Elementary.elm_scroller_loop_set(RealHandle, h, value);
537             }
538         }
539
540         /// <summary>
541         /// Set an infinite loop_ for a scroller.
542         /// This function sets the infinite loop horizontally.
543         /// If the content is set, it will be shown repeatedly.
544         /// </summary>
545         /// <since_tizen> preview </since_tizen>
546         public bool HorizontalLoop
547         {
548             get
549             {
550                 bool v, h;
551                 Interop.Elementary.elm_scroller_loop_get(RealHandle, out h, out v);
552                 return h;
553             }
554             set
555             {
556                 bool v = VerticalLoop;
557                 Interop.Elementary.elm_scroller_loop_set(RealHandle, value, v);
558             }
559         }
560
561         /// <summary>
562         /// Gets or sets a given scroller widget's scrolling page size, relative to its viewport size.
563         /// </summary>
564         /// <since_tizen> preview </since_tizen>
565         public double VerticalRelativePageSize
566         {
567             get
568             {
569                 double v, h;
570                 Interop.Elementary.elm_scroller_page_relative_get(RealHandle, out h, out v);
571                 return v;
572             }
573             set
574             {
575                 double h = HorizontalRelativePageSize;
576                 Interop.Elementary.elm_scroller_page_relative_set(RealHandle, h, value);
577             }
578         }
579
580         /// <summary>
581         /// Gets or sets a given scroller widget's scrolling page size, relative to its viewport size.
582         /// </summary>
583         /// <since_tizen> preview </since_tizen>
584         public double HorizontalRelativePageSize
585         {
586             get
587             {
588                 double v, h;
589                 Interop.Elementary.elm_scroller_page_relative_get(RealHandle, out h, out v);
590                 return h;
591             }
592             set
593             {
594                 double v = VerticalRelativePageSize;
595                 Interop.Elementary.elm_scroller_page_relative_set(RealHandle, value, v);
596             }
597         }
598
599         /// <summary>
600         /// Gets or Sets the page snapping behavior of a scroller.
601         /// </summary>
602         /// <remarks>
603         /// When scrolling, if a scroller is paged (see VerticalRelativePageSize),
604         /// the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further,
605         /// it will stop at the next page boundaries. This is disabled, by default, for both axis.
606         /// This function will set if it that is enabled or not, for each axis.
607         /// </remarks>
608         /// <since_tizen> preview </since_tizen>
609         public bool VerticalSnap
610         {
611             get
612             {
613                 bool v, h;
614                 Interop.Elementary.elm_scroller_page_snap_get(RealHandle, out h, out v);
615                 return v;
616             }
617             set
618             {
619                 bool h = HorizontalSnap;
620                 Interop.Elementary.elm_scroller_page_snap_set(RealHandle, h, value);
621             }
622         }
623
624         /// <summary>
625         /// Gets or Sets the page snapping behavior of a scroller.
626         /// </summary>
627         /// <remarks>
628         /// When scrolling, if a scroller is paged (see HorizontalRelativePageSize),
629         /// the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further,
630         /// it will stop at the next page boundaries. This is disabled, by default, for both axis.
631         /// This function will set if it that is enabled or not, for each axis.
632         /// </remarks>
633         /// <since_tizen> preview </since_tizen>
634         public bool HorizontalSnap
635         {
636             get
637             {
638                 bool v, h;
639                 Interop.Elementary.elm_scroller_page_snap_get(RealHandle, out h, out v);
640                 return h;
641             }
642             set
643             {
644                 bool v = VerticalSnap;
645                 Interop.Elementary.elm_scroller_page_snap_set(RealHandle, value, v);
646             }
647         }
648
649         /// <summary>
650         /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
651         /// </summary>
652         /// <since_tizen> preview </since_tizen>
653         public int PageHeight
654         {
655             get
656             {
657                 int w, h;
658                 Interop.Elementary.elm_scroller_page_size_get(RealHandle, out w, out h);
659                 return h;
660             }
661             set
662             {
663                 int w = PageWidth;
664                 Interop.Elementary.elm_scroller_page_size_set(RealHandle, w, value);
665             }
666         }
667
668         /// <summary>
669         /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
670         /// </summary>
671         /// <since_tizen> preview </since_tizen>
672         public int PageWidth
673         {
674             get
675             {
676                 int w, h;
677                 Interop.Elementary.elm_scroller_page_size_get(RealHandle, out w, out h);
678                 return w;
679             }
680             set
681             {
682                 int h = PageHeight;
683                 Interop.Elementary.elm_scroller_page_size_set(RealHandle, value, h);
684             }
685         }
686
687         /// <summary>
688         /// Gets or sets the event propagation for a scroller.
689         /// This enables or disables event propagation from the scroller content to the scroller and its parent.
690         /// By default event propagation is enabled.
691         /// </summary>
692         /// <since_tizen> preview </since_tizen>
693         public bool ContentPropagateEvents
694         {
695             get
696             {
697                 return Interop.Elementary.elm_scroller_propagate_events_get(RealHandle);
698             }
699             set
700             {
701                 Interop.Elementary.elm_scroller_propagate_events_set(RealHandle, value);
702             }
703         }
704
705         /// <summary>
706         /// Gets or sets the step size to move scroller by key event.
707         /// </summary>
708         /// <since_tizen> preview </since_tizen>
709         public int HorizontalStepSize
710         {
711             get
712             {
713                 int h, v;
714                 Interop.Elementary.elm_scroller_step_size_get(RealHandle, out h, out v);
715                 return h;
716             }
717             set
718             {
719                 int v = VerticalStepSize;
720                 Interop.Elementary.elm_scroller_step_size_set(RealHandle, value, v);
721             }
722         }
723
724         /// <summary>
725         /// Gets or sets the step size to move scroller by key event.
726         /// </summary>
727         /// <since_tizen> preview </since_tizen>
728         public int VerticalStepSize
729         {
730             get
731             {
732                 int h, v;
733                 Interop.Elementary.elm_scroller_step_size_get(RealHandle, out h, out v);
734                 return v;
735             }
736             set
737             {
738                 int h = HorizontalStepSize;
739                 Interop.Elementary.elm_scroller_step_size_set(RealHandle, h, value);
740             }
741         }
742
743         /// <summary>
744         /// Gets or sets a value whether mouse wheel is enabled or not over the scroller.
745         /// </summary>
746         /// <since_tizen> preview </since_tizen>
747         public bool WheelDisabled
748         {
749             get
750             {
751                 return Interop.Elementary.elm_scroller_wheel_disabled_get(RealHandle);
752             }
753             set
754             {
755                 Interop.Elementary.elm_scroller_wheel_disabled_set(RealHandle, value);
756             }
757         }
758
759         /// <summary>
760         /// Gets or sets the type of single direction scroll.
761         /// </summary>
762         /// <since_tizen> preview </since_tizen>
763         public ScrollSingleDirection SingleDirection
764         {
765             get
766             {
767                 return (ScrollSingleDirection)Interop.Elementary.elm_scroller_single_direction_get(RealHandle);
768             }
769             set
770             {
771                 Interop.Elementary.elm_scroller_single_direction_set(RealHandle, (int)value);
772             }
773         }
774
775         /// <summary>
776         /// Sets the scroller minimum size limited to the minimum size of the content.
777         /// By default the scroller will be as small as its design allows, irrespective of its content.
778         /// This will make the scroller minimum size the right size horizontally and/or vertically to perfectly fit its content in that direction.
779         /// </summary>
780         /// <param name="horizontal">Enable limiting minimum size horizontally</param>
781         /// <param name="vertical">Enable limiting minimum size vertically</param>
782         /// <since_tizen> preview </since_tizen>
783         public void MinimumLimit(bool horizontal, bool vertical)
784         {
785             Interop.Elementary.elm_scroller_content_min_limit(RealHandle, horizontal, vertical);
786         }
787
788         /// <summary>
789         /// Sets the page size to an absolute fixed value, with 0 turning it off for that axis.
790         /// </summary>
791         /// <param name="width">The horizontal page size.</param>
792         /// <param name="height">The vertical page size.</param>
793         /// <since_tizen> preview </since_tizen>
794         public void SetPageSize(int width, int height)
795         {
796             Interop.Elementary.elm_scroller_page_size_set(RealHandle, width, height);
797         }
798
799         /// <summary>
800         /// Sets the scroll page size relative to the viewport size.
801         /// </summary>
802         /// <remarks>
803         /// The scroller is capable of limiting scrolling by the user to "pages".
804         /// That is to jump by and only show a "whole page" at a time as if the continuous area of the scroller
805         /// content is split into page sized pieces. This sets the size of a page relative to the viewport of the scroller.
806         /// 1.0 is "1 viewport" which is the size (horizontally or vertically). 0.0 turns it off in that axis.
807         /// This is mutually exclusive with the page size (see elm_scroller_page_size_set() for more information).
808         /// Likewise 0.5 is "half a viewport". Usable values are normally between 0.0 and 1.0 including 1.0.
809         /// If you only want 1 axis to be page "limited", use 0.0 for the other axis.
810         /// </remarks>
811         /// <param name="width">The horizontal page relative size.</param>
812         /// <param name="height">The vertical page relative size.</param>
813         /// <since_tizen> preview </since_tizen>
814         public void SetPageSize(double width, double height)
815         {
816             Interop.Elementary.elm_scroller_page_relative_set(RealHandle, width, height);
817         }
818
819         /// <summary>
820         /// Shows a specific virtual region within the scroller content object by the page number.
821         /// (0, 0) of the indicated page is located at the top-left corner of the viewport.
822         /// </summary>
823         /// <param name="horizontalPageIndex">The horizontal page number.</param>
824         /// <param name="verticalPageIndex">The vertical page number.</param>
825         /// <param name="animated">True means slider with animation.</param>
826         /// <since_tizen> preview </since_tizen>
827         public void ScrollTo(int horizontalPageIndex, int verticalPageIndex, bool animated)
828         {
829             if (animated)
830             {
831                 Interop.Elementary.elm_scroller_page_bring_in(RealHandle, horizontalPageIndex, verticalPageIndex);
832             }
833             else
834             {
835                 Interop.Elementary.elm_scroller_page_show(RealHandle, horizontalPageIndex, verticalPageIndex);
836             }
837         }
838
839         /// <summary>
840         /// Shows a specific virtual region within the scroller content object.
841         /// </summary>
842         /// <remarks>
843         /// This ensures that all (or part, if it does not fit) of the designated region in the virtual content object ((0, 0)
844         /// starting at the top-left of the virtual content object) is shown within the scroller.
845         /// If set "animated" to true, it will allows the scroller to "smoothly slide" to this location
846         /// (if configuration in general calls for transitions).
847         /// It may not jump immediately to the new location and may take a while and show other content along the way.
848         /// </remarks>
849         /// <param name="region">Rect struct of region.</param>
850         /// <param name="animated">True means allows the scroller to "smoothly slide" to this location.</param>
851         /// <since_tizen> preview </since_tizen>
852         public void ScrollTo(Rect region, bool animated)
853         {
854             if (animated)
855             {
856                 Interop.Elementary.elm_scroller_region_bring_in(RealHandle, region.X, region.Y, region.Width, region.Height);
857             }
858             else
859             {
860                 Interop.Elementary.elm_scroller_region_show(RealHandle, region.X, region.Y, region.Width, region.Height);
861             }
862         }
863
864         /// <summary>
865         /// The callback of Realized Event
866         /// </summary>
867         /// <since_tizen> preview </since_tizen>
868         protected override void OnRealized()
869         {
870             base.OnRealized();
871             _scroll = new SmartEvent(this, this.RealHandle, "scroll");
872             _scrollAnimationStart = new SmartEvent(this, this.RealHandle, "scroll,anim,start");
873             _scrollAnimationStop = new SmartEvent(this, this.RealHandle, "scroll,anim,stop");
874             _dragStart = new SmartEvent(this, this.RealHandle, "scroll,drag,start");
875             _dragStop = new SmartEvent(this, this.RealHandle, "scroll,drag,stop");
876             _scrollpage = new SmartEvent(this, this.RealHandle, "scroll,page,changed");
877         }
878
879         /// <summary>
880         /// Creates a widget handle.
881         /// </summary>
882         /// <param name="parent">Parent EvasObject</param>
883         /// <returns>Handle IntPtr</returns>
884         /// <since_tizen> preview </since_tizen>
885         protected override IntPtr CreateHandle(EvasObject parent)
886         {
887             IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
888             Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
889
890             RealHandle = Interop.Elementary.elm_scroller_add(handle);
891             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
892
893             return handle;
894         }
895     }
896 }