Websites Navigation: Airbit | Shop | m-shell.net
Languages: EN | DE

Class abguibase.Box

is abguibase.Widget
Known direct subclasses: abfilegui.FileChooser
A box capable of holding child widgets. This is the normal class to create nested widget hierarchies, and also to layout its children when setting its rectangle.

A box lays its widgets out in a grid of rows with a predefined number of columns. The width of the columns and height of the rows depends on the desired size of the children they contain. Extra space is distributed among the columns and rows, missing space is taken away. The horizontal and vertical weight of each child when added via add() determines how much of the extra or missing space is assigned to it.

Between rows and columns there is a configurable Box.gap of a fixed number of pixels. It defaults to 1. Note that the Widget.inset for boxes defaults to 0.

Constructor

function init(columns=1)
Overridesabguibase.Widget.init()
Initialize a new Box.
Parameters:
columns – the number of columns (widgets) per row.

Fields

children An array of the children of this box.
columns The number of columns of the grid with the children.
gap The gap between child widgets (in pixels).
weights The horizontal and vertical weight of each child.

Functions

add(w:abguibase.Widget, hweight=1, vweight=1) Add a child widget to this box.
addHFiller(hweight=...) Add a horizontal filler widget to this box.
addVFiller(vweight=...) Add a vertical filler widget to this box.
childAt(x, y):abguibase.Widget Get the child at a given point.
desiredSize() [Inherited comment] Compute the desired size of this widget, including the insets.
fullDraw() Draw this widget and all its children.
handled(event) Handle an ui.cmd() event, or have a child handle it.
moveBy(dx, dy) Move this widget and all its children by a vector.
remove(w:abguibase.Widget) Remove a child widget from this box.
setAlpha(alpha) Set the alpha on this box and all its children.
setRect(x, y, w=..., h=...) Set this widget's rectangle, i.e. lay it and its children out on the canvas.
validate() Validate this widget and all its children.
function add(w:abguibase.Widget, hweight=1, vweight=1)
Add a child widget to this box.
Parameters:
w – the child widget to add.
hweight – the horizontal weight when distributing space.
vweight – the vertical weight when distributing space.
function addHFiller(hweight=10000)
Add a horizontal filler widget to this box.
Parameters:
hweight – the default horizontal weight. This should normally be large.
function addVFiller(vweight=10000)
Add a vertical filler widget to this box.
Parameters:
vweight – the default vertical weight. This should normally be large.
function remove(w:abguibase.Widget)
Remove a child widget from this box.
Parameters:
w – the child widget to remove.
function setAlpha(alpha)
Set the alpha on this box and all its children.
Parameters:
alpha – the transparency value.
function fullDraw()
Overridesabguibase.Widget.fullDraw()
Draw this widget and all its children.
function validate()
Overridesabguibase.Widget.validate()
Validate this widget and all its children.
function moveBy(dx, dy)
Overridesabguibase.Widget.moveBy()
Move this widget and all its children by a vector.
Parameters:
dx – the x component of the vector.
dy – the y component of the vector.
function childAt(x, y):abguibase.Widget
Get the child at a given point.
Parameters:
x – the x coordinate of the point.
y – the y coordinate of the point.
Returns:the first child containing (x,y), or null if there is no such child.
function handled(event)
Overridesabguibase.Widget.handled()
Handle an ui.cmd() event, or have a child handle it.
Parameters:
event – the event to handle.
Returns:true if this widget or one of its children handled the event.
function desiredSize()
Overridesabguibase.Widget.desiredSize()
[Inherited comment] Compute the desired size of this widget, including the insets.
Returns:the size, as [width, height], or null if there is no desired size.
function setRect(x, y, w=null, h=null)
Overridesabguibase.Widget.setRect()
Set this widget's rectangle, i.e. lay it and its children out on the canvas.
Parameters:
x – the x coordinate of the top left corner.
y – the y coordinate of the top left corner.
w – the width of the rectangle. null to use the desired width.
h – the height of the rectangle. null to use the desired height.
mShell Home  > Documentation  > mdoc