Class el.Widget

A GUI Widget.

Is defined with el.object and can be inherrited. Objects must be instantiateed using object.new

Attributes

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).
Widget.opaque Widget is opaque (bool).

Methods

Widget:add (widget[, zorder]) Add a child widget.
Widget:elevate () Elevate this widget to toplevel status.
Widget:bounds () Returns the bounding box.
Widget:setBounds (x, y, w, h) Change the bounding box.
Widget:setBounds (bounds) Change the bounding box.
Widget:localBounds () Local bounding box.
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.
Widget:repaint (x, y, w, h) Repaint section.
Widget:resize (w, h) Resize the widget.
Widget:toFront (focus) Bring to front.
Widget:toBack () To Back.

Handlers

Widget:resized () Called when the widget resizes.
Widget:paint (g) Draw your widget here.
Widget:mouseMove (ev) Called when the mouse is moving.
Widget:mouseEnter (ev) Called when the mouse enters your widget.
Widget:mouseExit (ev) Called when the mouse exits your widget.
Widget:mouseDrag (ev) Called when the mouse is dragging.
Widget:mouseDown (ev) Called when the mouse is pressed down.
Widget:mouseUp (ev) Called when the mouse has been released.
Widget:mouseDoubleClick (ev) Called when the mouse is double clicked.
Widget:mouseWheelMove (ev, details) Called when the mouse is double clicked.
Widget:mouseWheelMove (ev, scale) Called when the mouse is double clicked.

Class Methods

Widget.init () Initialize the widget.


Attributes

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.

Methods

Widget:add (widget[, zorder])
Add a child widget.

Parameters:

  • widget el.Widget Widget to add
  • zorder integer 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 integer X pos
  • y integer Y pos
  • w integer Width
  • h integer 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:

    -- Can also set a table. e.g.
    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:

  • x integer
  • y integer
  • w integer
  • h integer
Widget:resize (w, h)
Resize the widget.

Parameters:

  • w integer New width
  • h integer New height
Widget:toFront (focus)
Bring to front.

Parameters:

  • focus boolean If true, will also try to focus this widget.
Widget:toBack ()
To Back.

Handlers

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

Class Methods

Widget.init ()
Initialize the widget. Override this to customize your widget. Required as an el.object
generated by LDoc 1.5.0 Last updated 2024-02-18 20:31:17