Container
Drawable view with child views.
Module | require("yue.gui") |
Type | Class |
Inherits | View |
The Container
view is mainly used for two purposes:
- Show custom drawn content;
- Display a collection of child views.
Note that the index
counts from 1
, following lua's convention.
Class methods
create()
Create a new container view.
Return
Container
Methods
getpreferredsize()
Get the minimum size to show all children of the view.
Note that if the view is using a flex-wrap: wrap
style, this method
might return a extremely wide/high size since it does not know the best
width/height to show the children.
Return
SizeF
getpreferredheightforwidth(width)
Return the minimum height to show all child of the view for the width
.
Parameters
number
width
Return
number
getpreferredwidthforheight(height)
Return the minimum width to show all child of the view for the height
.
Parameters
number
height
Return
number
addchildview(view)
Append a child view
to the container.
This method will silently fail if the view
already has a parent.
Parameters
View
view
addchildviewat(view, index)
Add a child view
to the container at index
.
This method will silently fail if the view
already has a parent.
Parameters
View
viewinteger
index
removechildview(view)
Remove a child view
from this container.
This method will silently fail if the view
is not a child of the
container.
Parameters
View
view
childcount()
Return the count of children in the container.
Return
integer
childat(index)
Return the child view
at index
.
This method will silently fail if the index
is out of range.
Parameters
integer
index
Return
View
Events
ondraw(self, painter, dirty)
Emitted when button the operating system or application requests to draw a portion of the view.
Parameters
Container
selfPainter
painter - The drawing context of the view.RectF
dirty - The area in the view to draw on.