Class Widget

Widget class.

Functions

Luigi.Widget (layout[, data]) Widget pseudo-constructor.

Methods

Widget:bubbleEvent (eventName[, data]) Fire an event on this widget and each ancestor.
Widget:setValue (value) Set widget's value property and bubble a Change event.
Widget:getPreviousSibling () Get widget's previous sibling.
Widget:getNextSibling () Get widget's next sibling.
Widget:focus () Attempt to focus the widget.
Widget:getNextNeighbor () Get the next widget, depth-first.
Widget:getPreviousNeighbor () Get the previous widget, depth-first.
Widget:addChild (data) Add a child to this widget.
Widget:getX () Get the widget's X coordinate.
Widget:getY () Get the widget's Y coordinate.
Widget:getWidth () Get the widget's calculated width.
Widget:getHeight () Get the widget's calculated height.
Widget:setWidth (width) Set the widget's width.
Widget:setHeight (height) Set the widget's height.
Widget:getRectangle (useMargin, usePadding) Get two points describing a rectangle within the widget.
Widget:isAt (x, y) Determine whether a point is within a widget.
Widget:reshape () Reshape the widget.


Functions

Methods
Luigi.Widget (layout[, data])
Widget pseudo-constructor.

Parameters:

  • layout Layout The layout this widget belongs to.
  • data table The data definition table for this widget. This table is identical to the constructed widget. (optional)

Returns:

    Widget A Widget instance.

Methods

Widget:bubbleEvent (eventName[, data])
Fire an event on this widget and each ancestor.

If any event handler returns non-nil, stop the event from propagating.

Parameters:

  • eventName string The name of the Event.
  • data table Information about the event to send to handlers. (optional)

Returns:

    mixed The first value returned by an event handler.
Widget:setValue (value)
Set widget's value property and bubble a Change event.

Parameters:

  • value mixed The new value of the widget.

Returns:

    mixed The old value of the widget.
Widget:getPreviousSibling ()
Get widget's previous sibling.

Returns:

    Widget or nil The widget's previous sibling, if any.
Widget:getNextSibling ()
Get widget's next sibling.

Returns:

    Widget or nil The widget's next sibling, if any.
Widget:focus ()
Attempt to focus the widget.

Unfocus currently focused widget, and focus this widget if it's focusable.

Returns:

    boolean true if this widget was focused, else false.
Widget:getNextNeighbor ()
Get the next widget, depth-first.

If the widget has children, returns the first child. Otherwise, returns the next sibling of the nearest possible ancestor. Cycles back around to the layout root from the last widget in the tree.

Returns:

    Widget The next widget in the tree.
Widget:getPreviousNeighbor ()
Get the previous widget, depth-first.

Uses the reverse of the traversal order used by getNextNeighbor. Cycles back around to the last widget in the tree from the layout root.

Returns:

    Widget The previous widget in the tree.
Widget:addChild (data)
Add a child to this widget.

Parameters:

  • data Widget or table A widget or definition table representing a widget.

Returns:

    Widget The newly added child widget.
Widget:getX ()
Get the widget's X coordinate.

Returns:

    number The widget's X coordinate.
Widget:getY ()
Get the widget's Y coordinate.

Returns:

    number The widget's Y coordinate.
Widget:getWidth ()
Get the widget's calculated width.

Returns:

    number The widget's calculated width.
Widget:getHeight ()
Get the widget's calculated height.

Returns:

    number The widget's calculated height.
Widget:setWidth (width)
Set the widget's width.

Limited to space not occupied by siblings.

Parameters:

  • width number The desired width. Actual width may differ.

Returns:

    number The actual width of the widget.
Widget:setHeight (height)
Set the widget's height.

Limited to space not occupied by siblings.

Parameters:

  • height number The desired height. Actual height may differ.

Returns:

    number The actual height of the widget.
Widget:getRectangle (useMargin, usePadding)
Get two points describing a rectangle within the widget.

Parameters:

  • useMargin boolean Whether to adjust the rectangle based on the widget's margin.
  • usePadding boolean Whether to adjust the rectangle based on the widget's padding.

Returns:

  1. number The upper left corner's X position.
  2. number The upper left corner's Y position.
  3. number The lower right corner's X position.
  4. number The lower right corner's Y position.
Widget:isAt (x, y)
Determine whether a point is within a widget.

Parameters:

  • x number The point's X coordinate.
  • y number The point's Y coordinate.

Returns:

    boolean true if the point is within the widget, else false.
Widget:reshape ()
Reshape the widget.

Clears calculated widget dimensions, allowing them to be recalculated, and fires a Reshape event (does not bubble). Called recursively for each child.

When setting a widget's width or height, this function is automatically called on the parent widget.

generated by LDoc 1.4.3 Last updated 2015-11-09 17:17:21