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