Scroll
Show a part of view with scrollbar.
Module | require("yue.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