Class Layout
A Layout contains a tree of widgets with a single root
widget.
Layouts will resize to fit the window unless a top
or left
property is found in the root widget.
Layouts are drawn in the order that they were shown, so the most recently shown layout shown will always appear on top.
Other events are sent to layouts in the opposite direction, and are trapped by the first layout that can handle the event (for example, the topmost layer that is focused or hovered).
Functions
Luigi.Layout (data) | Layout constructor. |
Methods
Layout:setMaster (layout) | Set the master layout for this layout. |
Layout:setStyle (rules) | Set the style from a definition table or function. |
Layout:setTheme (rules) | Set the theme from a definition table or function. |
Layout:getStyle () | Get the style from master layout or this layout. |
Layout:getTheme () | Get the theme from master layout or this layout. |
Layout:show () | Show the layout. |
Layout:hide () | Hide the layout. |
Layout:focusNextWidget () | Focus next focusable widget. |
Layout:focusPreviousWidget () | Focus previous focusable widget. |
Layout:getWidgetAt (x, y[, root]) | Get the innermost widget at given coordinates. |
Functions
Methods- Luigi.Layout (data)
-
Layout constructor.
Parameters:
- data table A tree of widget data.
Returns:
-
Layout
A Layout instance.
Methods
- Layout:setMaster (layout)
-
Set the master layout for this layout.
This layout's theme and style will be set the same as the master layout, and widgets added to this layout will be indexed and keyboard-accelerated by the master layout instead of this layout.
Parameters:
- layout Layout Master layout
Returns:
-
Layout
Self
- Layout:setStyle (rules)
-
Set the style from a definition table or function.
Parameters:
- rules table or function Style definition.
Returns:
-
Layout
Self
- Layout:setTheme (rules)
-
Set the theme from a definition table or function.
Parameters:
- rules table or function Theme definition.
- Layout:getStyle ()
-
Get the style from master layout or this layout.
Returns:
-
table
Style table.
- Layout:getTheme ()
-
Get the theme from master layout or this layout.
Returns:
-
table
Theme table.
- Layout:show ()
-
Show the layout.
Hooks all appropriate Love events and callbacks.
- Layout:hide ()
-
Hide the layout.
Unhooks Love events and callbacks.
- Layout:focusNextWidget ()
-
Focus next focusable widget.
Traverses widgets using Widget:getNextNeighbor until a focusable widget is found, and focuses that widget.
Returns:
-
Widget
The widget that was focused, or nil
- Layout:focusPreviousWidget ()
-
Focus previous focusable widget.
Traverses widgets using Widget:getPreviousNeighbor until a focusable widget is found, and focuses that widget.
Returns:
-
Widget
The widget that was focused, or nil
- Layout:getWidgetAt (x, y[, root])
-
Get the innermost widget at given coordinates.
Parameters:
- x number Number of pixels from window's left edge.
- y number Number of pixels from window's top edge.
- root Widget Widget to search within, defaults to layout root. (optional)