Class el.Widget
A GUI Widget.
Is defined with el.object and can be inherrited. Objects must be
instantiateed using object.new
-
Widget.name
-
Widget name (string).
-
Widget.x
-
X position (readonly).
-
Widget.y
-
Y position (readonly).
-
Widget.width
-
Widget width (readonly).
-
Widget.height
-
Widget height (readonly).
-
Widget.visible
-
Widget visibility (bool).
Shows or hides this Widget
-
Widget.opaque
-
Widget is opaque (bool).
If set true you must fill the entire Widget background.
-
Widget:add (widget[, zorder])
-
Add a child widget.
Parameters:
- widget
el.Widget
Widget to add
- zorder
int
Z-order
(optional)
-
Widget:elevate ()
-
Elevate this widget to toplevel status.
-
Widget:bounds ()
-
Returns the bounding box.
-
Widget:setBounds (x, y, w, h)
-
Change the bounding box.
The coords returned is relative to the top/left of the widget's parent.
Parameters:
- x
int
X pos
- y
int
Y pos
- w
int
Width
- h
int
Height
-
Widget:setBounds (bounds)
-
Change the bounding box.
The coords returned is relative to the top/left of the widget's parent.
Parameters:
- bounds
mixed
New bounds as a el.Bounds or table
Usage:
widget:setBounds ({
x = 0,
y = 0,
width = 100,
height = 200
})
-
Widget:localBounds ()
-
Local bounding box.
Same as bounds with zero x and y coords
-
Widget:right ()
-
Widget right edge.
-
Widget:bottom ()
-
Widget bottom edge (int).
-
Widget:screenX ()
-
Widget Screen X position (int).
-
Widget:screenY ()
-
Widget Screen Y position (int).
-
Widget:repaint ()
-
Repaint the entire widget.
-
Widget:repaint (b)
-
Repaint a section.
Parameters:
-
Widget:repaint (x, y, w, h)
-
Repaint section.
Parameters:
-
Widget:resize (w, h)
-
Resize the widget.
Parameters:
- w
int
New width
- h
int
New height
-
Widget:toFront (focus)
-
Bring to front.
Parameters:
- focus
bool
If true, will also try to focus this widget.
-
Widget:toBack ()
-
To Back.
-
Widget:resized ()
-
Called when the widget resizes.
-
Widget:paint (g)
-
Draw your widget here.
Parameters:
-
Widget:mouseMove (ev)
-
Called when the mouse is moving.
Parameters:
-
Widget:mouseEnter (ev)
-
Called when the mouse enters your widget.
Parameters:
-
Widget:mouseExit (ev)
-
Called when the mouse exits your widget.
Parameters:
-
Widget:mouseDrag (ev)
-
Called when the mouse is dragging.
Parameters:
-
Widget:mouseDown (ev)
-
Called when the mouse is pressed down.
Parameters:
-
Widget:mouseUp (ev)
-
Called when the mouse has been released.
Parameters:
-
Widget:mouseDoubleClick (ev)
-
Called when the mouse is double clicked.
Parameters:
-
Widget:mouseWheelMove (ev, details)
-
Called when the mouse is double clicked.
Parameters:
- ev
el.MouseEvent
The event to process
- details
mixed
Wheel info to process
-
Widget:mouseWheelMove (ev, scale)
-
Called when the mouse is double clicked.
Parameters:
- ev
el.MouseEvent
The event to process
- scale
The scale to magnify by, 1.0 being no scale
-
Widget.init ()
-
Initialize the widget.
Override this to customize your widget. Required as an el.object