2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 public enum ScrollBarVisiblePolicy
28 public enum ScrollBlock
35 public class Scroller : Layout
38 SmartEvent _dragStart;
40 SmartEvent _scrollpage;
42 public Scroller(EvasObject parent) : base(parent)
44 _scroll = new SmartEvent(this, "scroll");
45 _dragStart = new SmartEvent(this, "scroll,drag,start");
46 _dragStop = new SmartEvent(this, "scroll,drag,stop");
47 _scrollpage = new SmartEvent(this, "scroll,page,changed");
50 public event EventHandler Scrolled
61 public event EventHandler DragStart
65 _dragStart.On += value;
69 _dragStart.On -= value;
72 public event EventHandler DragStop
76 _dragStop.On += value;
80 _dragStop.On -= value;
83 public event EventHandler PageScrolled
87 _scrollpage.On += value;
91 _scrollpage.On -= value;
95 public Rect CurrentRegion
100 Interop.Elementary.elm_scroller_region_get(Handle, out x, out y, out w, out h);
101 return new Rect(x, y, w, h);
105 public ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy
110 Interop.Elementary.elm_scroller_policy_get(Handle, out policy, IntPtr.Zero);
111 return (ScrollBarVisiblePolicy)policy;
115 ScrollBarVisiblePolicy v = VerticalScrollBarVisiblePolicy;
116 Interop.Elementary.elm_scroller_policy_set(Handle, (int)value, (int)v);
120 public ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy
125 Interop.Elementary.elm_scroller_policy_get(Handle, IntPtr.Zero, out policy);
126 return (ScrollBarVisiblePolicy)policy;
130 ScrollBarVisiblePolicy h = HorizontalScrollBarVisiblePolicy;
131 Interop.Elementary.elm_scroller_policy_set(Handle, (int)h, (int)value);
135 public ScrollBlock ScrollBlock
139 return (ScrollBlock)Interop.Elementary.elm_scroller_movement_block_get(Handle);
143 Interop.Elementary.elm_scroller_movement_block_set(Handle, (int)value);
147 public int VerticalPageIndex
152 Interop.Elementary.elm_scroller_current_page_get(Handle, out h, out v);
157 public int HorizontalPageIndex
162 Interop.Elementary.elm_scroller_current_page_get(Handle, out h, out v);
167 public int VerticalPageScrollLimit
172 Interop.Elementary.elm_scroller_page_scroll_limit_get(Handle, out h, out v);
177 int h = HorizontalPageScrollLimit;
178 Interop.Elementary.elm_scroller_page_scroll_limit_set(Handle, h, value);
182 public int HorizontalPageScrollLimit
187 Interop.Elementary.elm_scroller_page_scroll_limit_get(Handle, out h, out v);
192 int v = VerticalPageScrollLimit;
193 Interop.Elementary.elm_scroller_page_scroll_limit_set(Handle, value, v);
197 public void SetPageSize(int width, int height)
199 Interop.Elementary.elm_scroller_page_size_set(Handle, width, height);
202 public void SetPageSize(double width, double height)
204 Interop.Elementary.elm_scroller_page_relative_set(Handle, width, height);
207 public void ScrollTo(int horizontalPageIndex, int verticalPageIndex, bool animated)
211 Interop.Elementary.elm_scroller_page_bring_in(Handle, horizontalPageIndex, verticalPageIndex);
215 Interop.Elementary.elm_scroller_page_show(Handle, horizontalPageIndex, verticalPageIndex);
219 public void ScrollTo(Rect region, bool animated)
223 Interop.Elementary.elm_scroller_region_bring_in(Handle, region.X, region.Y, region.Width, region.Height);
227 Interop.Elementary.elm_scroller_region_show(Handle, region.X, region.Y, region.Width, region.Height);
231 protected override IntPtr CreateHandle(EvasObject parent)
233 return Interop.Elementary.elm_scroller_add(parent);