Class Scroller
Definition
- Namespace:
- ElmSharp
- Assembly:
- ElmSharp.dll
The Scroller is a container that holds and clips a single object and allows you to scroll across it.
public class Scroller : Layout, IAccessibleObject
- Inheritance
- Derived
- Implements
Constructors
View SourceScroller()
Creates and initializes a new instance of the Scroller class.
Declaration
public Scroller()
Scroller(EvasObject)
Creates and initializes a new instance of the Scroller class.
Declaration
public Scroller(EvasObject parent)
Parameters
Type | Name | Description |
---|---|---|
EvasObject | parent | The EvasObject to which the new Scroller will be attached as a child. |
Properties
View SourceChildHeight
Gets the height of the content object of the scroller.
Declaration
public int ChildHeight { get; }
Property Value
Type | Description |
---|---|
int |
ChildWidth
Gets the width of the content object of the scroller.
Declaration
public int ChildWidth { get; }
Property Value
Type | Description |
---|---|
int |
ContentPropagateEvents
Gets or sets the event propagation for a scroller. This enables or disables event propagation from the scroller content to the scroller and its parent. By default, event propagation is enabled.
Declaration
public bool ContentPropagateEvents { get; set; }
Property Value
Type | Description |
---|---|
bool |
CurrentRegion
Gets the current region in the content object that is visible through the scroller.
Declaration
public Rect CurrentRegion { get; }
Property Value
Type | Description |
---|---|
Rect |
HorizontalBounce
Sets or gets the horizontal bounce behaviour. When scrolling, the scroller may "bounce" when reaching an edge of the content object. This is a visual way to indicate the end has been reached. This is enabled by default for both axis. This API will set if it is enabled for the given axis with the boolean parameters for each axis.
Declaration
public bool HorizontalBounce { get; set; }
Property Value
Type | Description |
---|---|
bool |
HorizontalGravity
Sets the scrolling gravity values for a scroller. The gravity defines how the scroller will adjust its view when the size of the scroller contents increase. The scroller will adjust the view to glue itself as follows: 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. Default values for x and y are 0.0.
Declaration
public double HorizontalGravity { get; set; }
Property Value
Type | Description |
---|---|
double |
HorizontalLoop
Sets an infinite loop_ for a scroller. This function sets the infinite loop horizontally. If the content is set, it will be shown repeatedly.
Declaration
public bool HorizontalLoop { get; set; }
Property Value
Type | Description |
---|---|
bool |
HorizontalPageIndex
Sets or gets the scroll current page number.
Declaration
public int HorizontalPageIndex { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
Current page means the page which meets the left of the viewport. If there are two or more pages in the viewport, it returns the number of the page which meets the left of the viewport. The page number starts from 0. 0 is the first page.
HorizontalPageScrollLimit
Sets or gets the maximum limit of the movable page at horizontal direction.
Declaration
public int HorizontalPageScrollLimit { get; set; }
Property Value
Type | Description |
---|---|
int |
HorizontalRelativePageSize
Gets or sets a given scroller widget's scrolling page size, relative to its viewport size.
Declaration
public double HorizontalRelativePageSize { get; set; }
Property Value
Type | Description |
---|---|
double |
HorizontalScrollBarVisiblePolicy
Sets or gets the value of HorizontalScrollBarVisiblePolicy.
Declaration
public virtual ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy { get; set; }
Property Value
Type | Description |
---|---|
ScrollBarVisiblePolicy |
Remarks
ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden. ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
HorizontalSnap
Gets or sets the page snapping behavior of a scroller.
Declaration
public bool HorizontalSnap { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When scrolling, if a scroller is paged (see HorizontalRelativePageSize), the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further, it will stop at the next page boundaries. This is disabled, by default, for both axis. This function will set if it that is enabled or not, for each axis.
HorizontalStepSize
Gets or sets the step size to move scroller by key event.
Declaration
public int HorizontalStepSize { get; set; }
Property Value
Type | Description |
---|---|
int |
LastHorizontalPageNumber
Gets the scroll last page number. The page number starts from 0. 0 is the first page. This returns the last page number among the pages.
Declaration
public int LastHorizontalPageNumber { get; }
Property Value
Type | Description |
---|---|
int |
LastVerticalPageNumber
Gets the scroll last page number. The page number starts from 0. 0 is the first page. This returns the last page number among the pages.
Declaration
public int LastVerticalPageNumber { get; }
Property Value
Type | Description |
---|---|
int |
PageHeight
Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
Declaration
public int PageHeight { get; set; }
Property Value
Type | Description |
---|---|
int |
PageWidth
Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
Declaration
public int PageWidth { get; set; }
Property Value
Type | Description |
---|---|
int |
ScrollBlock
Sets or gets the value of ScrollBlock.
Declaration
public ScrollBlock ScrollBlock { get; set; }
Property Value
Type | Description |
---|---|
ScrollBlock |
Remarks
This function will block scrolling movement in a given direction. One can disable movements in the X-axis, the Y-axis, or both. The default value is ScrollBlock.None, where movements are allowed in both directions.
SingleDirection
Gets or sets the type of single direction scroll.
Declaration
public ScrollSingleDirection SingleDirection { get; set; }
Property Value
Type | Description |
---|---|
ScrollSingleDirection |
VerticalBounce
Sets or gets the vertical bounce behaviour. When scrolling, the scroller may "bounce" when reaching an edge of the content object. This is a visual way to indicate the end has been reached. This is enabled by default for both axis. This API will set if it is enabled for the given axis with the boolean parameters for each axis.
Declaration
public bool VerticalBounce { get; set; }
Property Value
Type | Description |
---|---|
bool |
VerticalGravity
Sets the scrolling gravity values for a scroller. The gravity defines how the scroller will adjust its view when the size of the scroller contents increase. The scroller will adjust the view to glue itself as follows: 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. Default values for x and y are 0.0.
Declaration
public double VerticalGravity { get; set; }
Property Value
Type | Description |
---|---|
double |
VerticalLoop
Sets an infinite loop_ for a scroller. This function sets the infinite loop vertically. If the content is set, it will be shown repeatedly.
Declaration
public bool VerticalLoop { get; set; }
Property Value
Type | Description |
---|---|
bool |
VerticalPageIndex
Sets or gets the scroll current page number.
Declaration
public int VerticalPageIndex { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
Current page means the page which meets the top of the viewport. If there are two or more pages in the viewport, it returns the number of the page which meets the top of the viewport. The page number starts from 0. 0 is the first page.
VerticalPageScrollLimit
Sets or gets the maximum limit of the movable page at vertical direction.
Declaration
public int VerticalPageScrollLimit { get; set; }
Property Value
Type | Description |
---|---|
int |
VerticalRelativePageSize
Gets or sets a given scroller widget's scrolling page size, relative to its viewport size.
Declaration
public double VerticalRelativePageSize { get; set; }
Property Value
Type | Description |
---|---|
double |
VerticalScrollBarVisiblePolicy
Sets or gets the value of VerticalScrollBarVisiblePolicy.
Declaration
public virtual ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy { get; set; }
Property Value
Type | Description |
---|---|
ScrollBarVisiblePolicy |
Remarks
ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden. ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
VerticalSnap
Gets or sets the page snapping behavior of a scroller.
Declaration
public bool VerticalSnap { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When scrolling, if a scroller is paged (see VerticalRelativePageSize), the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further, it will stop at the next page boundaries. This is disabled, by default, for both axis. This function will set if it that is enabled or not, for each axis.
VerticalStepSize
Gets or sets the step size to move scroller by key event.
Declaration
public int VerticalStepSize { get; set; }
Property Value
Type | Description |
---|---|
int |
WheelDisabled
Gets or sets a value whether mouse wheel is enabled or not over the scroller.
Declaration
public bool WheelDisabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
View SourceCreateHandle(EvasObject)
Creates a widget handle.
Declaration
protected override IntPtr CreateHandle(EvasObject parent)
Parameters
Type | Name | Description |
---|---|---|
EvasObject | parent | Parent EvasObject. |
Returns
Type | Description |
---|---|
System.IntPtr | Handle IntPtr. |
Overrides
View SourceMinimumLimit(bool, bool)
Sets the scroller minimum size limited to the minimum size of the content. By default, the scroller will be as small as its design allows, irrespective of its content. This will make the scroller minimum size the right size horizontally and/or vertically to perfectly fit its content in that direction.
Declaration
public void MinimumLimit(bool horizontal, bool vertical)
Parameters
Type | Name | Description |
---|---|---|
bool | horizontal | Enable limiting minimum size horizontally. |
bool | vertical | Enable limiting minimum size vertically. |
OnRealized()
The callback of the Realized event.
Declaration
protected override void OnRealized()
Overrides
View SourceScrollTo(Rect, bool)
Shows a specific virtual region within the scroller content object.
Declaration
public void ScrollTo(Rect region, bool animated)
Parameters
Type | Name | Description |
---|---|---|
Rect | region | Rect struct of region. |
bool | animated | True means allows the scroller to "smoothly slide" to this location. |
Remarks
This ensures that all (or part, if it does not fit) of the designated region in the virtual content object ((0, 0) starting at the top-left of the virtual content object) is shown within the scroller. If set "animated" to true, it will allows the scroller to "smoothly slide" to this location (if configuration in general calls for transitions). It may not jump immediately to the new location and may take a while and show other content along the way.
ScrollTo(int, int, bool)
Shows a specific virtual region within the scroller content object by the page number. (0, 0) of the indicated page is located at the top-left corner of the viewport.
Declaration
public void ScrollTo(int horizontalPageIndex, int verticalPageIndex, bool animated)
Parameters
Type | Name | Description |
---|---|---|
int | horizontalPageIndex | The horizontal page number. |
int | verticalPageIndex | The vertical page number. |
bool | animated | True means slider with animation. |
SetPageSize(double, double)
Sets the scroll page size relative to the viewport size.
Declaration
public void SetPageSize(double width, double height)
Parameters
Type | Name | Description |
---|---|---|
double | width | The horizontal page relative size. |
double | height | The vertical page relative size. |
Remarks
The scroller is capable of limiting scrolling by the user to "pages". That is to jump by and only show a "whole page" at a time as if the continuous area of the scroller content is split into page sized pieces. This sets the size of a page relative to the viewport of the scroller. 1.0 is "1 viewport" which is the size (horizontally or vertically). 0.0 turns it off in that axis. This is mutually exclusive with the page size (see elm_scroller_page_size_set() for more information). Likewise 0.5 is "half a viewport". Usable values are normally between 0.0 and 1.0 including 1.0. If you only want 1 axis to be page "limited", use 0.0 for the other axis.
SetPageSize(int, int)
Sets the page size to an absolute fixed value, with 0 turning it off for that axis.
Declaration
public void SetPageSize(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | The horizontal page size. |
int | height | The vertical page size. |
Events
View SourceDragStart
DragStart will be triggered when dragging the contents around has started.
Declaration
public event EventHandler DragStart
Event Type
Type | Description |
---|---|
System.EventHandler |
DragStop
DragStop will be triggered when dragging the contents around has stopped.
Declaration
public event EventHandler DragStop
Event Type
Type | Description |
---|---|
System.EventHandler |
PageScrolled
PageScrolled will be triggered when the visible page has changed.
Declaration
public event EventHandler PageScrolled
Event Type
Type | Description |
---|---|
System.EventHandler |
ScrollAnimationStarted
ScrollAnimationStarted will be triggered when the content animation has been started.
Declaration
public event EventHandler ScrollAnimationStarted
Event Type
Type | Description |
---|---|
System.EventHandler |
ScrollAnimationStopped
ScrollAnimationStopped will be triggered when the content animation has been stopped.
Declaration
public event EventHandler ScrollAnimationStopped
Event Type
Type | Description |
---|---|
System.EventHandler |
Scrolled
Scrolled will be triggered when the content has been scrolled.
Declaration
public event EventHandler Scrolled
Event Type
Type | Description |
---|---|
System.EventHandler |