Scroll
Show a part of view with scrollbar.
Module | require("gui") |
Type | Class |
Inherits | View |
The Scroll
view can show an arbitrary content view inside it.
When the content is larger than the Scroll
view, scrollbars will be
optionally showed. When the content view is smaller then the Scroll
view,
the content view will be resized to the size of the Scroll
view.
Class methods
create()
Create a new Scroll
view.
Return
Scroll
Methods
setContentView(view)
Set the content view
.
Parameters
View
view
getContentView()
Return the content view
.
Return
View
setContentSize(size)
Set the size of content view.
Parameters
SizeF
size
getContentSize()
Return the size of content view.
Return
SizeF
setScrollPosition(horizon, vertical)
Scroll to the horizon
and vertical
position.
Parameters
Number
horizonNumber
vertical
getScrollPosition()
Return the horizon and vertical scroll position.
Return
[Number, Number]
getMaximumScrollPosition()
Return the maximum horizon and vertical scroll position.
Return
[Number, Number]
macOS linux
setOverlayScrollbar(overlay)Set whether to use overlay scrolling.
Parameters
Boolean
overlay
macOS linux
isOverlayScrollbar()Return whether overlay scrolling is used.
Return
Boolean
setScrollbarPolicy(hpolicy, vpolicy)
Set the policy for displaying horizontal and vertical scrollbars.
Parameters
Scroll::Policy
hpolicy - Policy for horizontal scrollbar.Scroll::Policy
vpolicy - Policy for vertical scrollbar.
getScrollbarPolicy()
Return the display policy of horizontal and vertical scrollbars.
Return
[Scroll::Policy, Scroll::Policy]
macOS
setScrollElasticity(helasticity, velasticity)Set horizontal and vertical scroll elasticity (bounce).
Parameters
Scroll::Elasticity
helasticity - Horizontal scroll elasticity.Scroll::Elasticity
velasticity - Vertical scroll elasticity.
macOS
getScrollElasticity()Return the horizontal and vertical scroll elasticity.
Return
[Scroll::Elasticity, Scroll::Elasticity]
Events
onScroll(self)
Emitted when the content view is being scrolled.
Parameters
Scroll
self