[ElmSharp*] Add Scrollable interface
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / IScrollable.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace ElmSharp
6 {
7     /// <summary>
8     /// Interface for all other scrollable widgets
9     /// </summary>
10     public interface IScrollable
11     {
12
13         /// <summary>
14         /// Scrolled will be triggered when the content has been scrolled.
15         /// </summary>
16         event EventHandler Scrolled;
17
18         /// <summary>
19         /// DragStart will be triggered when dragging the contents around has started.
20         /// </summary>
21         event EventHandler DragStart;
22
23         /// <summary>
24         /// DragStop will be triggered when dragging the contents around has stopped.
25         /// </summary>
26         event EventHandler DragStop;
27
28         /// <summary>
29         /// PageScrolled will be triggered when the visible page has changed.
30         /// </summary>
31         event EventHandler PageScrolled;
32
33         /// <summary>
34         /// Set scrolling gravity values for a scroller.
35         /// The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase.
36         /// The scroller will adjust the view to glue itself as follows.
37         /// 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
38         /// Default values for x and y are 0.0
39         /// </summary>
40         double VerticalGravity { get; set; }
41
42         /// <summary>
43         /// Set scrolling gravity values for a scroller.
44         /// The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase.
45         /// The scroller will adjust the view to glue itself as follows.
46         /// 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
47         /// Default values for x and y are 0.0
48         /// </summary>
49         double HorizontalGravity { get; set; }
50
51         /// <summary>
52         /// Sets or gets the vertical bounce behaviour.
53         /// When scrolling, the scroller may "bounce" when reaching an edge of the content object.
54         /// This is a visual way to indicate the end has been reached.
55         /// This is enabled by default for both axis.
56         /// This API will set if it is enabled for the given axis with the boolean parameters for each axis.
57         /// </summary>
58         bool VerticalBounce { get; set; }
59
60         /// <summary>
61         /// Sets or gets the horizontal bounce behaviour.
62         /// When scrolling, the scroller may "bounce" when reaching an edge of the content object.
63         /// This is a visual way to indicate the end has been reached.
64         /// This is enabled by default for both axis.
65         /// This API will set if it is enabled for the given axis with the boolean parameters for each axis.
66         /// </summary>
67         bool HorizontalBounce { get; set; }
68
69         /// <summary>
70         /// Gets or sets a value whether mouse wheel is enabled or not over the scroller.
71         /// </summary>
72         bool WheelDisabled { get; set; }
73
74         /// <summary>
75         /// Sets or gets the value of ScrollBlock.
76         /// </summary>
77         /// <remarks>
78         /// This function will block scrolling movement  in a given direction.One can disable movements in the X axis, the Y axis or both.
79         /// The default value is ScrollBlock.None, where movements are allowed in both directions.
80         /// </remarks>
81         ScrollBlock ScrollBlock { get; set; }
82
83         /// <summary>
84         /// Sets or gets the value of VerticalScrollBarVisiblePolicy
85         /// </summary>
86         /// <remarks>
87         /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden.
88         /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
89         /// </remarks>
90         ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy { get; set; }
91
92         /// <summary>
93         /// Sets or gets the value of HorizontalScrollBarVisiblePolicy
94         /// </summary>
95         /// <remarks>
96         /// ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden.
97         /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
98         /// </remarks>
99         ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy { get; set; }
100
101         /// <summary>
102         /// Gets the current region in the content object that is visible through the Scroller.
103         /// </summary>
104         Rect CurrentRegion { get; }
105
106         /// <summary>
107         /// Sets or gets the maximum limit of the movable page at vertical direction.
108         /// </summary>
109         int VerticalPageScrollLimit { get; set; }
110
111         /// <summary>
112         /// Sets or gets the maximum limit of the movable page at horizontal direction.
113         /// </summary>
114         int HorizontalPageScrollLimit { get; set; }
115
116         /// <summary>
117         /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
118         /// </summary>
119         int HorizontalPageSize { get; set; }
120
121         /// <summary>
122         /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
123         /// </summary>
124         int VerticalPageSize { get; set; }
125
126         /// <summary>
127         /// Gets or Sets the page snapping behavior of a scroller.
128         /// </summary>
129         /// <remarks>
130         /// When scrolling, if a scroller is paged (see VerticalRelativePageSize),
131         /// the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further,
132         /// it will stop at the next page boundaries. This is disabled, by default, for both axis.
133         /// This function will set if it that is enabled or not, for each axis.
134         /// </remarks>
135         bool VerticalSnap { get; set; }
136
137         /// <summary>
138         /// Gets or Sets the page snapping behavior of a scroller.
139         /// </summary>
140         /// <remarks>
141         /// When scrolling, if a scroller is paged (see HorizontalRelativePageSize),
142         /// the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further,
143         /// it will stop at the next page boundaries. This is disabled, by default, for both axis.
144         /// This function will set if it that is enabled or not, for each axis.
145         /// </remarks>
146         bool HorizontalSnap { get; set; }
147
148         /// <summary>
149         /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
150         /// </summary>
151         int PageHeight { get; set; }
152
153         /// <summary>
154         /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
155         /// </summary>
156         int PageWidth { get; set; }
157
158         /// <summary>
159         /// Gets or sets the type of single direction scroll.
160         /// </summary>
161         ScrollSingleDirection SingleDirection { get; set; }
162
163         /// <summary>
164         /// Gets or sets the step size to move scroller by key event.
165         /// </summary>
166         int HorizontalStepSize { get; set; }
167
168         /// <summary>
169         /// Gets or sets the step size to move scroller by key event.
170         /// </summary>
171         int VerticalStepSize { get; set; }
172
173         /// <summary>
174         /// Set an infinite loop_ for a scroller.
175         /// This function sets the infinite loop vertically.
176         /// If the content is set, it will be shown repeatedly.
177         /// </summary>
178         bool VerticalLoop { get; set; }
179
180         /// <summary>
181         /// Set an infinite loop_ for a scroller.
182         /// This function sets the infinite loop horizontally.
183         /// If the content is set, it will be shown repeatedly.
184         /// </summary>
185         bool HorizontalLoop { get; set; }
186
187         /// <summary>
188         /// Gets or sets a given scroller widget's scrolling page size, relative to its viewport size.
189         /// </summary>
190         double VerticalRelativePageSize { get; set; }
191
192         /// <summary>
193         /// Gets or sets a given scroller widget's scrolling page size, relative to its viewport size.
194         /// </summary>
195         double HorizontalRelativePageSize { get; set; }
196
197         /// <summary>
198         /// Get scroll last page number.
199         /// The page number starts from 0. 0 is the first page. This returns the last page number among the pages.
200         /// </summary>
201         int LastVerticalPageNumber { get; }
202
203         /// <summary>
204         /// Get scroll last page number.
205         /// The page number starts from 0. 0 is the first page. This returns the last page number among the pages.
206         /// </summary>
207         int LastHorizontalPageNumber { get; }
208
209         /// <summary>
210         /// Sets or gets scroll current page number.
211         /// </summary>
212         /// <remarks>
213         /// Current page means the page which meets the top of the viewport.
214         /// If there are two or more pages in the viewport, it returns the number of the page which meets the top of the viewport.
215         /// The page number starts from 0. 0 is the first page.
216         /// </remarks>
217         int VerticalPageIndex { get; }
218
219         /// <summary>
220         /// Sets or gets scroll current page number.
221         /// </summary>
222         /// <remarks>
223         /// Current page means the page which meets the left of the viewport.
224         /// If there are two or more pages in the viewport, it returns the number of the page which meets the left of the viewport.
225         /// The page number starts from 0. 0 is the first page.
226         /// </remarks>
227         int HorizontalPageIndex { get; }
228
229         /// <summary>
230         /// Gets the width of the content object of the scroller.
231         /// </summary>
232         int ChildWidth { get; }
233
234         /// <summary>
235         /// Gets the height of the content object of the scroller.
236         /// </summary>
237         int ChildHeight { get; }
238
239         /// <summary>
240         /// Sets the scroller minimum size limited to the minimum size of the content.
241         /// By default the scroller will be as small as its design allows, irrespective of its content.
242         /// This will make the scroller minimum size the right size horizontally and/or vertically to perfectly fit its content in that direction.
243         /// </summary>
244         /// <param name="horizontal">Enable limiting minimum size horizontally</param>
245         /// <param name="vertical">Enable limiting minimum size vertically</param>
246         void MinimumLimit(bool horizontal, bool vertical);
247
248         /// <summary>
249         /// Shows a specific virtual region within the scroller content object by the page number.
250         /// (0, 0) of the indicated page is located at the top-left corner of the viewport.
251         /// </summary>
252         /// <param name="horizontalPageIndex">The horizontal page number.</param>
253         /// <param name="verticalPageIndex">The vertical page number.</param>
254         /// <param name="animated">True means slider with animation.</param>
255         void ScrollTo(int horizontalPageIndex, int verticalPageIndex, bool animated);
256
257         /// <summary>
258         /// Shows a specific virtual region within the scroller content object.
259         /// </summary>
260         /// <remarks>
261         /// This ensures that all (or part, if it does not fit) of the designated region in the virtual content object ((0, 0)
262         /// starting at the top-left of the virtual content object) is shown within the scroller.
263         /// If set "animated" to true, it will allows the scroller to "smoothly slide" to this location
264         /// (if configuration in general calls for transitions).
265         /// It may not jump immediately to the new location and may take a while and show other content along the way.
266         /// </remarks>
267         /// <param name="region">Rect struct of region.</param>
268         /// <param name="animated">True means allows the scroller to "smoothly slide" to this location.</param>
269         void ScrollTo(Rect region, bool animated);
270     }
271
272     /// <summary>
273     /// Enumeration for visible type of scrollbar.
274     /// </summary>
275     public enum ScrollBarVisiblePolicy
276     {
277         /// <summary>
278         /// Show scrollbars as needed
279         /// </summary>
280         Auto = 0,
281
282         /// <summary>
283         /// Always show scrollbars
284         /// </summary>
285         Visible,
286
287         /// <summary>
288         /// Never show scrollbars
289         /// </summary>
290         Invisible
291     }
292
293     /// <summary>
294     /// Enumeration for visible type of scrollbar.
295     /// </summary>
296     public enum ScrollBlock
297     {
298         /// <summary>
299         /// Scrolling movement is allowed in both direction.(X axis and Y axis)
300         /// </summary>
301         None = 1,
302
303         /// <summary>
304         /// Scrolling movement is not allowed in Y axis direction.
305         /// </summary>
306         Vertical = 2,
307
308         /// <summary>
309         /// Scrolling movement is not allowed in X axis direction.
310         /// </summary>
311         Horizontal = 4
312     }
313
314     /// <summary>
315     /// Type that controls how the content is scrolled.
316     /// </summary>
317     public enum ScrollSingleDirection
318     {
319         /// <summary>
320         /// Scroll every direction.
321         /// </summary>
322         None,
323
324         /// <summary>
325         /// Scroll single direction if the direction is certain.
326         /// </summary>
327         Soft,
328
329         /// <summary>
330         /// Scroll only single direction.
331         /// </summary>
332         Hard,
333     }
334 }