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

Class abguibase.Widget

Known direct subclasses: abguibase.Box, abgui.Label, abgui.Image, abgui.Table, abgui.ProgressBar
The base class of all widgets.

Constructor

function init()
Iniitialize a new widget, assigning defaults.

Fields

alpha The alpha blending used when drawing over the parent. Default is 0 (no blending). See also Box.setAlpha().
bg:abguibase.Background The background to draw, null for no background (transparent widget).
desiredSize The desired size, null to compute it
fg The foreground color
inset The inset of the content (pixels on each of the four sides), 0 for none
parent:abguibase.Widget The parent widget in the hierarchy
rect The (absolute) position and size of this widget as [x, y, w, h]
valid Whether this widget view is valid; false if it requires redrawing.
visible Whether this widget is visible

Functions

desiredSize() Compute the desired size of this widget, including the insets.
draw() Draw this widget.
drawFocus() Draw the focus.
focusable() Check whether this widget can get the focus.
fullDraw() Fully draw this widget.
gotFocus() Called when this widget got the focus.
handled(event) Handle an ui.cmd() event.
hasFocus() Check whether this widget has the focus.
hide() Hide this widget, i.e. make it invisible.
invalidate() Make this widget invalid, i.e. request it being redrawn.
lostFocus() Called when this widget lost the focus.
moveBy(dx, dy) Move this widget by a vector.
moveTo(x, y) Move this widget to a location.
requestFocus() Request the focus on this widget.
setCentered(x=0, y=0, w=..., h=...) Center this widget in a rectangle, using the desired size if possible, otherwise squeezing it into the available space.
setRect(x, y, w=..., h=...) Set this widget's rectangle, i.e. lay it out on the canvas.
show() Show this widget, i.e. make it visible.
validate() Make this widget valid, i.e. redraw it if required.
function draw()
Draw this widget. The clip rectangle is set to this widget's rectangle. Override in subclasses to draw their specific view. The default implementation draws the focus.
function fullDraw()
Fully draw this widget. This may be called anytime to redraw.
function invalidate()
Make this widget invalid, i.e. request it being redrawn.
function validate()
Make this widget valid, i.e. redraw it if required.
function show()
Show this widget, i.e. make it visible.
function hide()
Hide this widget, i.e. make it invisible.
function focusable()
Check whether this widget can get the focus. Override in subclasses allowing input. The default implementation returns false.
Returns:true if this widget can get the focus.
function requestFocus()
Request the focus on this widget.
function hasFocus()
Check whether this widget has the focus.
Returns:true if this widget has the focus.
function gotFocus()
Called when this widget got the focus. The default implementation does nothing.
function lostFocus()
Called when this widget lost the focus. The default implementation does nothing.
function drawFocus()
Draw the focus. The default implementation draws a rounded rectangle around the widget.
function handled(event)
Handle an ui.cmd() event.
Parameters:
event – the event to handle, one of the values returned by ui.cmd(). Pointer events will also contain an array element "prevbuttons" to allow to check for button presses or releases.
Returns:true if this widget handled the event.
function moveBy(dx, dy)
Move this widget by a vector.
Parameters:
dx – the x component of the vector.
dy – the y component of the vector.
function moveTo(x, y)
Move this widget to a location.
Parameters:
x – the new x coordinate.
y – the new y coordinate.
function desiredSize()
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)
Set this widget's rectangle, i.e. lay it 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.
function setCentered(x=0, y=0, w=graph.size()[0], h=graph.size()[1])
Center this widget in a rectangle, using the desired size if possible, otherwise squeezing it into the available space.
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.
h – the height of the rectangle.
mShell Home  > Documentation  > mdoc