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