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