Lysa.ui  0.0
Lysa 3D Engine
Widget Class Referenceabstract

Detailed Description

The base class for all UI widgets. Provides layout, input handling, and child management.

Lua full name: lysa.ui.Widget

Public Member Functions

boolean is_enabled ()
 Returns true if the widget responds to mouse and keyboard input. More...
 
nil set_pos (x: number, y: number)
 Moves the widget to the given position in its parent's coordinate space. More...
 
nil set_size (width: number, height: number)
 Resizes the widget to the given width and height in virtual screen units. More...
 
nil set_rect (x: number, y: number, width: number, height: number)
 Sets the widget's position and size in one call. More...
 
nil remove (child: Widget)
 Removes and detaches the given direct child widget. More...
 
nil remove_all ()
 Removes and detaches all descendant widgets recursively. More...
 
nil refresh ()
 Forces a full redraw of the widget on the next frame. More...
 
nil resize_children ()
 Triggers a layout pass that repositions and resizes all direct children according to their alignment. More...
 
Widget set_focus (focus: boolean|nil)
 Requests keyboard focus for this widget (pass nil or true to acquire, false to release). Returns the widget itself. More...
 
nil set_children_offset (x: number, y: number)
 Sets the scroll offset applied to children during layout, enabling scrollable content. More...
 
Text create_text (alignment: Alignment, text: string)
 Creates and adds a Text child widget with the given alignment and initial text. More...
 
Text create_text (resource: string, alignment: Alignment, text: string)
 Creates and adds a Text child widget, loading its style from a resource string. More...
 
Panel create_panel (alignment: Alignment)
 Creates and adds a Panel child widget with the given alignment. More...
 
Panel create_panel (resource: string, alignment: Alignment)
 Creates and adds a Panel child widget, loading its style from a resource string. More...
 
Popup create_popup (x: number, y: number)
 Creates and adds a Popup child widget at the given position, rendered on top of siblings. More...
 
Popup create_popup (resource: string, x: number, y: number)
 Creates and adds a Popup child widget at the given position, loading its style from a resource string. More...
 
Tooltip create_tooltip (text: string, x: number, y: number)
 Creates and adds a Tooltip child widget hanging from the given position. More...
 
Tooltip create_tooltip (resource: string, text: string, x: number, y: number)
 Creates and adds a Tooltip child widget hanging from the given position, loading its style from a resource string. More...
 
Box create_box (alignment: Alignment)
 Creates and adds a Box child widget with the given alignment. More...
 
Box create_box (resource: string, alignment: Alignment)
 Creates and adds a Box child widget, loading its style from a resource string. More...
 
Button create_button (alignment: Alignment)
 Creates and adds a Button child widget with the given alignment. More...
 
Button create_button (resource: string, alignment: Alignment)
 Creates and adds a Button child widget, loading its style from a resource string. More...
 
ToggleButton create_toggle_button (alignment: Alignment)
 Creates and adds a ToggleButton child widget with the given alignment. More...
 
ToggleButton create_toggle_button (resource: string, alignment: Alignment)
 Creates and adds a ToggleButton child widget, loading its style from a resource string. More...
 
RadioButton create_radio_button (alignment: Alignment)
 Creates and adds a RadioButton child widget with the given alignment. More...
 
RadioButton create_radio_button (resource: string, alignment: Alignment)
 Creates and adds a RadioButton child widget, loading its style from a resource string. More...
 
HLine create_hline (alignment: Alignment)
 Creates and adds a horizontal Line child widget with the given alignment. More...
 
HLine create_hline (resource: string, alignment: Alignment)
 Creates and adds a horizontal Line child widget, loading its style from a resource string. More...
 
VLine create_vline (alignment: Alignment)
 Creates and adds a vertical Line child widget with the given alignment. More...
 
VLine create_vline (resource: string, alignment: Alignment)
 Creates and adds a vertical Line child widget, loading its style from a resource string. More...
 
Frame create_frame (alignment: Alignment, title: string)
 Creates and adds a Frame child widget with the given alignment and title. More...
 
Frame create_frame (resource: string, alignment: Alignment, title: string)
 Creates and adds a Frame child widget, loading its style from a resource string. More...
 
TextEdit create_text_edit (alignment: Alignment, text: string|nil)
 Creates and adds a TextEdit child widget with the given alignment and optional initial text. More...
 
TextEdit create_text_edit (resource: string, alignment: Alignment, text: string|nil)
 Creates and adds a TextEdit child widget, loading its style from a resource string. More...
 
RichTextArea create_rich_text_area (alignment: Alignment, bbcode: string|nil)
 Creates and adds a RichTextArea child widget with the given alignment and optional BBCode markup. More...
 
RichTextArea create_rich_text_area (resource: string, alignment: Alignment, bbcode: string|nil)
 Creates and adds a RichTextArea child widget, loading its style from a resource string. More...
 
Image create_image (alignment: Alignment)
 Creates and adds an Image child widget with the given alignment. More...
 
Image create_image (resource: string, alignment: Alignment)
 Creates and adds an Image child widget, loading its style from a resource string. More...
 
Image create_image (resource: string, alignment: Alignment, autoresize: boolean, fixedsize: boolean)
 Creates and adds an Image child widget with auto-resize and fixed-size options. More...
 
VScrollBar create_vscrollbar (alignment: Alignment)
 Creates and adds a vertical ScrollBar child widget with the given alignment. More...
 
VScrollBar create_vscrollbar (resource: string, alignment: Alignment)
 Creates and adds a vertical ScrollBar child widget, loading its style from a resource string. More...
 
HScrollBar create_hscrollbar (alignment: Alignment)
 Creates and adds a horizontal ScrollBar child widget with the given alignment. More...
 
HScrollBar create_hscrollbar (resource: string, alignment: Alignment)
 Creates and adds a horizontal ScrollBar child widget, loading its style from a resource string. More...
 
TreeView create_tree_view (alignment: Alignment)
 Creates and adds a TreeView child widget with the given alignment. More...
 
TreeView create_tree_view (resource: string, alignment: Alignment)
 Creates and adds a TreeView child widget, loading its style from a resource string. More...
 
Widget create_widget (alignment: Alignment)
 Creates and adds a transparent container Widget child with the given alignment. More...
 
Widget create_widget (resource: string, alignment: Alignment)
 Creates and adds a transparent container Widget child, loading its style from a resource string. More...
 
ListBox create_list_box (alignment: Alignment)
 Creates and adds a ListBox child widget with the given alignment. More...
 
ListBox create_list_box (resource: string, alignment: Alignment)
 Creates and adds a ListBox child widget, loading its style from a resource string. More...
 
ProgressBar create_progress_bar (alignment: Alignment)
 Creates and adds a ProgressBar child widget with the given alignment. More...
 
ProgressBar create_progress_bar (resource: string, alignment: Alignment)
 Creates and adds a ProgressBar child widget, loading its style from a resource string. More...
 
VProgressBar create_vprogress_bar (alignment: Alignment)
 Creates and adds a vertical ProgressBar child widget with the given alignment. More...
 
VProgressBar create_vprogress_bar (resource: string, alignment: Alignment)
 Creates and adds a vertical ProgressBar child widget, loading its style from a resource string. More...
 
HProgressBar create_hprogress_bar (alignment: Alignment)
 Creates and adds a horizontal ProgressBar child widget with the given alignment. More...
 
HProgressBar create_hprogress_bar (resource: string, alignment: Alignment)
 Creates and adds a horizontal ProgressBar child widget, loading its style from a resource string. More...
 
ScrollBox create_scroll_box (alignment: Alignment)
 Creates and adds a ScrollBox child widget with the given alignment. More...
 
ScrollBox create_scroll_box (resource: string, alignment: Alignment)
 Creates and adds a ScrollBox child widget, loading its style from a resource string. More...
 
CheckBox create_check_box (alignment: Alignment)
 Creates and adds a CheckBox child widget with the given alignment. More...
 
CheckBox create_check_box (resource: string, alignment: Alignment)
 Creates and adds a CheckBox child widget, loading its style from a resource string. More...
 
CheckMark create_check_mark (alignment: Alignment)
 Creates and adds a CheckMark child widget with the given alignment. More...
 
CheckMark create_check_mark (resource: string, alignment: Alignment)
 Creates and adds a CheckMark child widget, loading its style from a resource string. More...
 
CrossMark create_cross_mark (alignment: Alignment)
 Creates and adds a CrossMark child widget with the given alignment. More...
 
CrossMark create_cross_mark (resource: string, alignment: Alignment)
 Creates and adds a CrossMark child widget, loading its style from a resource string. More...
 
Arrow create_arrow (alignment: Alignment, orientation: ArrowOrientation)
 Creates and adds an Arrow child widget pointing to the given direction. More...
 
Arrow create_arrow (resource: string, alignment: Alignment, orientation: ArrowOrientation)
 Creates and adds an Arrow child widget, loading its style from a resource string. More...
 
Menu create_menu (alignment: Alignment)
 Creates and adds a Menu child widget with the given alignment. More...
 
Menu create_menu (resource: string, alignment: Alignment)
 Creates and adds a Menu child widget, loading its style from a resource string. More...
 
TabBar create_tab_bar (alignment: Alignment)
 Creates and adds a TabBar child widget with the given alignment. More...
 
TabBar create_tab_bar (resource: string, alignment: Alignment)
 Creates and adds a TabBar child widget, loading its style from a resource string. More...
 
TabContainer create_tab_container (alignment: Alignment)
 Creates and adds a TabContainer child widget with the given alignment. More...
 
TabContainer create_tab_container (resource: string, alignment: Alignment)
 Creates and adds a TabContainer child widget, loading its style from a resource string. More...
 
Grid create_grid (alignment: Alignment)
 Creates and adds an empty Grid child widget with the given alignment. More...
 
Grid create_grid (alignment: Alignment, rows: integer, columns: integer)
 Creates and adds a Grid child widget with the given number of rows and columns. More...
 
Grid create_grid (resource: string, alignment: Alignment, rows: integer, columns: integer)
 Creates and adds a Grid child widget, loading its style from a resource string. More...
 
Table create_table (alignment: Alignment)
 Creates and adds a Table child widget with the given alignment. More...
 
Table create_table (resource: string, alignment: Alignment)
 Creates and adds a Table child widget, loading its style from a resource string. More...
 
FoldableContainer create_foldable_container (alignment: Alignment)
 Creates and adds a FoldableContainer child widget with the given alignment. More...
 
FoldableContainer create_foldable_container (resource: string, alignment: Alignment)
 Creates and adds a FoldableContainer child widget, loading its style from a resource string. More...
 
HSlider create_hslider (alignment: Alignment)
 Creates and adds a horizontal Slider child widget with the given alignment. More...
 
HSlider create_hslider (resource: string, alignment: Alignment)
 Creates and adds a horizontal Slider child widget, loading its style from a resource string. More...
 
VSlider create_vslider (alignment: Alignment)
 Creates and adds a vertical Slider child widget with the given alignment. More...
 
VSlider create_vslider (resource: string, alignment: Alignment)
 Creates and adds a vertical Slider child widget, loading its style from a resource string. More...
 
HColorSlider create_hcolor_slider (alignment: Alignment)
 Creates and adds a horizontal ColorSlider child widget with the given alignment. More...
 
HColorSlider create_hcolor_slider (resource: string, alignment: Alignment)
 Creates and adds a horizontal ColorSlider child widget, loading its style from a resource string. More...
 
VColorSlider create_vcolor_slider (alignment: Alignment)
 Creates and adds a vertical ColorSlider child widget with the given alignment. More...
 
VColorSlider create_vcolor_slider (resource: string, alignment: Alignment)
 Creates and adds a vertical ColorSlider child widget, loading its style from a resource string. More...
 
Knob create_knob (alignment: Alignment)
 Creates and adds a Knob child widget with the given alignment. More...
 
Knob create_knob (resource: string, alignment: Alignment)
 Creates and adds a Knob child widget, loading its style from a resource string. More...
 
ColorWheel create_color_wheel (alignment: Alignment)
 Creates and adds a ColorWheel child widget with the given alignment. More...
 
ColorWheel create_color_wheel (resource: string, alignment: Alignment)
 Creates and adds a ColorWheel child widget, loading its style from a resource string. More...
 
ColorPicker create_color_picker (alignment: Alignment)
 Creates and adds a ColorPicker child widget with the given alignment. More...
 
ColorPicker create_color_picker (resource: string, alignment: Alignment)
 Creates and adds a ColorPicker child widget, loading its style from a resource string. More...
 
ColorPickerButton create_color_picker_button (alignment: Alignment)
 Creates and adds a ColorPickerButton child widget with the given alignment. More...
 
ColorPickerButton create_color_picker_button (resource: string, alignment: Alignment)
 Creates and adds a ColorPickerButton child widget, loading its style from a resource string. More...
 
SpinBox create_spin_box (alignment: Alignment)
 Creates and adds a SpinBox child widget with the given alignment. More...
 
SpinBox create_spin_box (resource: string, alignment: Alignment)
 Creates and adds a SpinBox child widget, loading its style from a resource string. More...
 
SpinButtons create_spin_buttons (alignment: Alignment)
 Creates and adds a SpinButtons child widget with the given alignment. More...
 
SpinButtons create_spin_buttons (resource: string, alignment: Alignment)
 Creates and adds a SpinButtons child widget, loading its style from a resource string. More...
 
DropDownList create_drop_down_list (alignment: Alignment)
 Creates and adds a DropDownList child widget with the given alignment. More...
 
DropDownList create_drop_down_list (resource: string, alignment: Alignment)
 Creates and adds a DropDownList child widget, loading its style from a resource string. More...
 
IconImage create_icon_image (alignment: Alignment)
 Creates and adds an IconImage child widget with the given alignment. More...
 
IconImage create_icon_image (resource: string, alignment: Alignment)
 Creates and adds an IconImage child widget, loading its style from a resource string. More...
 
IconSVG create_icon_svg (alignment: Alignment)
 Creates and adds an IconSVG child widget with the given alignment. More...
 
IconSVG create_icon_svg (resource: string, alignment: Alignment)
 Creates and adds an IconSVG child widget, loading its style from a resource string. More...
 
Widget add_child (child: Widget, alignment: integer, resource: string|nil)
 Adds a pre-constructed child widget with the given alignment and optional resource string. More...
 

Properties

integer id
 The unique ID
 
integer type
 The concrete widget type (see lysa.ui.WidgetType). (read-only)
 
Widget[] children
 Ordered list of direct child widgets.
 
boolean visible
 True if the widget is visible; false hides it and all its children.
 
any user_data
 Lua user data.
 
boolean enabled
 Enables or disables the widget's response to input events (pass nil or true to enable, false to disable).
 
number width
 The widget width in virtual screen units.
 
number height
 The widget height in virtual screen units.
 
lysa.Rect rect
 The current position and size of the widget as a Rect.
 
integer alignment
 The current placement alignment within the parent (see lysa.ui.Alignment).
 
lysa.Font font
 The font used to render text within this widget.
 
number font_scale
 The scale factor applied to the widget's font.
 
boolean focused
 True if this widget currently holds keyboard focus. (read-only)
 
Widget|nil parent
 The direct parent widget, or nil if this is a root widget. (read-only)
 
number padding
 Spacing in virtual screen units between children during layout.
 
number vborder
 Vertical inset between the widget edges and its content area.
 
number hborder
 Horizontal inset between the widget edges and its content area.
 
boolean draw_background
 False if the widget's background should be drawn transparently.
 
boolean pushed
 True if the widget is currently in a pressed state (e.g. mouse button held down over it).
 
boolean pointed
 True if the mouse cursor is currently over this widget. (read-only)
 
boolean freezed
 True if the widget ignores all input events without being visually disabled.
 
boolean overlapping
 True if this widget visually overlaps one or more siblings. (read-only)
 
lysa.Rect children_rect
 The smallest Rect enclosing all direct children. (read-only)
 
integer group_index
 User-defined integer tag used to identify widgets within a logical group.
 
number transparency
 Global alpha multiplier for the widget (0.0 = fully transparent, 1.0 = opaque).
 
boolean consume_mouse_event
 When true, mouse events are consumed by this widget and not propagated to its parent.
 
number children_offset_x
 Horizontal scroll offset subtracted from child positions during layout (read-only; use set_children_offset to change).
 
number children_offset_y
 Vertical scroll offset subtracted from child positions during layout (read-only; use set_children_offset to change).
 

Member Function Documentation

boolean is_enabled ( )

Returns true if the widget responds to mouse and keyboard input.

Returns
boolean
nil set_pos ( number  x,
number  y)

Moves the widget to the given position in its parent's coordinate space.

Parameters
xnumber
ynumber
nil set_size ( number  width,
number  height)

Resizes the widget to the given width and height in virtual screen units.

Parameters
widthnumber
heightnumber
nil set_rect ( number  x,
number  y,
number  width,
number  height)

Sets the widget's position and size in one call.

Parameters
xnumber
ynumber
widthnumber
heightnumber
nil remove ( Widget  child)

Removes and detaches the given direct child widget.

Parameters
childWidget
nil remove_all ( )

Removes and detaches all descendant widgets recursively.

nil refresh ( )

Forces a full redraw of the widget on the next frame.

nil resize_children ( )

Triggers a layout pass that repositions and resizes all direct children according to their alignment.

Widget set_focus ( boolean|nil  focus)

Requests keyboard focus for this widget (pass nil or true to acquire, false to release). Returns the widget itself.

Parameters
focusboolean|nil
Returns
Widget
nil set_children_offset ( number  x,
number  y)

Sets the scroll offset applied to children during layout, enabling scrollable content.

Parameters
xnumber
ynumber
Text create_text ( Alignment  alignment,
string  text)

Creates and adds a Text child widget with the given alignment and initial text.

Parameters
alignmentAlignment
textstring
Returns
Text
Text create_text ( string  resource,
Alignment  alignment,
string  text)

Creates and adds a Text child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
textstring
Returns
Text
Panel create_panel ( Alignment  alignment)

Creates and adds a Panel child widget with the given alignment.

Parameters
alignmentAlignment
Returns
Panel
Panel create_panel ( string  resource,
Alignment  alignment)

Creates and adds a Panel child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Panel
Popup create_popup ( number  x,
number  y)

Creates and adds a Popup child widget at the given position, rendered on top of siblings.

Parameters
xnumber
ynumber
Returns
Popup
Popup create_popup ( string  resource,
number  x,
number  y)

Creates and adds a Popup child widget at the given position, loading its style from a resource string.

Parameters
resourcestring
xnumber
ynumber
Returns
Popup
Tooltip create_tooltip ( string  text,
number  x,
number  y)

Creates and adds a Tooltip child widget hanging from the given position.

Parameters
textstring
xnumber
ynumber
Returns
Tooltip
Tooltip create_tooltip ( string  resource,
string  text,
number  x,
number  y)

Creates and adds a Tooltip child widget hanging from the given position, loading its style from a resource string.

Parameters
resourcestring
textstring
xnumber
ynumber
Returns
Tooltip
Box create_box ( Alignment  alignment)

Creates and adds a Box child widget with the given alignment.

Parameters
alignmentAlignment
Returns
Box
Box create_box ( string  resource,
Alignment  alignment)

Creates and adds a Box child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Box
Button create_button ( Alignment  alignment)

Creates and adds a Button child widget with the given alignment.

Parameters
alignmentAlignment
Returns
Button
Button create_button ( string  resource,
Alignment  alignment)

Creates and adds a Button child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Button
ToggleButton create_toggle_button ( Alignment  alignment)

Creates and adds a ToggleButton child widget with the given alignment.

Parameters
alignmentAlignment
Returns
ToggleButton
ToggleButton create_toggle_button ( string  resource,
Alignment  alignment)

Creates and adds a ToggleButton child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
ToggleButton
RadioButton create_radio_button ( Alignment  alignment)

Creates and adds a RadioButton child widget with the given alignment.

Parameters
alignmentAlignment
Returns
RadioButton
RadioButton create_radio_button ( string  resource,
Alignment  alignment)

Creates and adds a RadioButton child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
RadioButton
HLine create_hline ( Alignment  alignment)

Creates and adds a horizontal Line child widget with the given alignment.

Parameters
alignmentAlignment
Returns
HLine
HLine create_hline ( string  resource,
Alignment  alignment)

Creates and adds a horizontal Line child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
HLine
VLine create_vline ( Alignment  alignment)

Creates and adds a vertical Line child widget with the given alignment.

Parameters
alignmentAlignment
Returns
VLine
VLine create_vline ( string  resource,
Alignment  alignment)

Creates and adds a vertical Line child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
VLine
Frame create_frame ( Alignment  alignment,
string  title)

Creates and adds a Frame child widget with the given alignment and title.

Parameters
alignmentAlignment
titlestring
Returns
Frame
Frame create_frame ( string  resource,
Alignment  alignment,
string  title)

Creates and adds a Frame child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
titlestring
Returns
Frame
TextEdit create_text_edit ( Alignment  alignment,
string|nil  text)

Creates and adds a TextEdit child widget with the given alignment and optional initial text.

Parameters
alignmentAlignment
textstring|nil
Returns
TextEdit
TextEdit create_text_edit ( string  resource,
Alignment  alignment,
string|nil  text)

Creates and adds a TextEdit child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
textstring|nil
Returns
TextEdit
RichTextArea create_rich_text_area ( Alignment  alignment,
string|nil  bbcode)

Creates and adds a RichTextArea child widget with the given alignment and optional BBCode markup.

Parameters
alignmentAlignment
bbcodestring|nil
Returns
RichTextArea
RichTextArea create_rich_text_area ( string  resource,
Alignment  alignment,
string|nil  bbcode)

Creates and adds a RichTextArea child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
bbcodestring|nil
Returns
RichTextArea
Image create_image ( Alignment  alignment)

Creates and adds an Image child widget with the given alignment.

Parameters
alignmentAlignment
Returns
Image
Image create_image ( string  resource,
Alignment  alignment)

Creates and adds an Image child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Image
Image create_image ( string  resource,
Alignment  alignment,
boolean  autoresize,
boolean  fixedsize)

Creates and adds an Image child widget with auto-resize and fixed-size options.

Parameters
resourcestring
alignmentAlignment
autoresizeboolean
fixedsizeboolean
Returns
Image
VScrollBar create_vscrollbar ( Alignment  alignment)

Creates and adds a vertical ScrollBar child widget with the given alignment.

Parameters
alignmentAlignment
Returns
VScrollBar
VScrollBar create_vscrollbar ( string  resource,
Alignment  alignment)

Creates and adds a vertical ScrollBar child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
VScrollBar
HScrollBar create_hscrollbar ( Alignment  alignment)

Creates and adds a horizontal ScrollBar child widget with the given alignment.

Parameters
alignmentAlignment
Returns
HScrollBar
HScrollBar create_hscrollbar ( string  resource,
Alignment  alignment)

Creates and adds a horizontal ScrollBar child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
HScrollBar
TreeView create_tree_view ( Alignment  alignment)

Creates and adds a TreeView child widget with the given alignment.

Parameters
alignmentAlignment
Returns
TreeView
TreeView create_tree_view ( string  resource,
Alignment  alignment)

Creates and adds a TreeView child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
TreeView
Widget create_widget ( Alignment  alignment)

Creates and adds a transparent container Widget child with the given alignment.

Parameters
alignmentAlignment
Returns
Widget
Widget create_widget ( string  resource,
Alignment  alignment)

Creates and adds a transparent container Widget child, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Widget
ListBox create_list_box ( Alignment  alignment)

Creates and adds a ListBox child widget with the given alignment.

Parameters
alignmentAlignment
Returns
ListBox
ListBox create_list_box ( string  resource,
Alignment  alignment)

Creates and adds a ListBox child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
ListBox
ProgressBar create_progress_bar ( Alignment  alignment)

Creates and adds a ProgressBar child widget with the given alignment.

Parameters
alignmentAlignment
Returns
ProgressBar
ProgressBar create_progress_bar ( string  resource,
Alignment  alignment)

Creates and adds a ProgressBar child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
ProgressBar
VProgressBar create_vprogress_bar ( Alignment  alignment)

Creates and adds a vertical ProgressBar child widget with the given alignment.

Parameters
alignmentAlignment
Returns
VProgressBar
VProgressBar create_vprogress_bar ( string  resource,
Alignment  alignment)

Creates and adds a vertical ProgressBar child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
VProgressBar
HProgressBar create_hprogress_bar ( Alignment  alignment)

Creates and adds a horizontal ProgressBar child widget with the given alignment.

Parameters
alignmentAlignment
Returns
HProgressBar
HProgressBar create_hprogress_bar ( string  resource,
Alignment  alignment)

Creates and adds a horizontal ProgressBar child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
HProgressBar
ScrollBox create_scroll_box ( Alignment  alignment)

Creates and adds a ScrollBox child widget with the given alignment.

Parameters
alignmentAlignment
Returns
ScrollBox
ScrollBox create_scroll_box ( string  resource,
Alignment  alignment)

Creates and adds a ScrollBox child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
ScrollBox
CheckBox create_check_box ( Alignment  alignment)

Creates and adds a CheckBox child widget with the given alignment.

Parameters
alignmentAlignment
Returns
CheckBox
CheckBox create_check_box ( string  resource,
Alignment  alignment)

Creates and adds a CheckBox child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
CheckBox
CheckMark create_check_mark ( Alignment  alignment)

Creates and adds a CheckMark child widget with the given alignment.

Parameters
alignmentAlignment
Returns
CheckMark
CheckMark create_check_mark ( string  resource,
Alignment  alignment)

Creates and adds a CheckMark child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
CheckMark
CrossMark create_cross_mark ( Alignment  alignment)

Creates and adds a CrossMark child widget with the given alignment.

Parameters
alignmentAlignment
Returns
CrossMark
CrossMark create_cross_mark ( string  resource,
Alignment  alignment)

Creates and adds a CrossMark child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
CrossMark
Arrow create_arrow ( Alignment  alignment,
ArrowOrientation  orientation)

Creates and adds an Arrow child widget pointing to the given direction.

Parameters
alignmentAlignment
orientationArrowOrientation
Returns
Arrow
Arrow create_arrow ( string  resource,
Alignment  alignment,
ArrowOrientation  orientation)

Creates and adds an Arrow child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
orientationArrowOrientation
Returns
Arrow
Menu create_menu ( Alignment  alignment)

Creates and adds a Menu child widget with the given alignment.

Parameters
alignmentAlignment
Returns
Menu
Menu create_menu ( string  resource,
Alignment  alignment)

Creates and adds a Menu child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Menu
TabBar create_tab_bar ( Alignment  alignment)

Creates and adds a TabBar child widget with the given alignment.

Parameters
alignmentAlignment
Returns
TabBar
TabBar create_tab_bar ( string  resource,
Alignment  alignment)

Creates and adds a TabBar child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
TabBar
TabContainer create_tab_container ( Alignment  alignment)

Creates and adds a TabContainer child widget with the given alignment.

Parameters
alignmentAlignment
Returns
TabContainer
TabContainer create_tab_container ( string  resource,
Alignment  alignment)

Creates and adds a TabContainer child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
TabContainer
Grid create_grid ( Alignment  alignment)

Creates and adds an empty Grid child widget with the given alignment.

Parameters
alignmentAlignment
Returns
Grid
Grid create_grid ( Alignment  alignment,
integer  rows,
integer  columns)

Creates and adds a Grid child widget with the given number of rows and columns.

Parameters
alignmentAlignment
rowsinteger
columnsinteger
Returns
Grid
Grid create_grid ( string  resource,
Alignment  alignment,
integer  rows,
integer  columns)

Creates and adds a Grid child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
rowsinteger
columnsinteger
Returns
Grid
Table create_table ( Alignment  alignment)

Creates and adds a Table child widget with the given alignment.

Parameters
alignmentAlignment
Returns
Table
Table create_table ( string  resource,
Alignment  alignment)

Creates and adds a Table child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Table
FoldableContainer create_foldable_container ( Alignment  alignment)

Creates and adds a FoldableContainer child widget with the given alignment.

Parameters
alignmentAlignment
Returns
FoldableContainer
FoldableContainer create_foldable_container ( string  resource,
Alignment  alignment)

Creates and adds a FoldableContainer child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
FoldableContainer
HSlider create_hslider ( Alignment  alignment)

Creates and adds a horizontal Slider child widget with the given alignment.

Parameters
alignmentAlignment
Returns
HSlider
HSlider create_hslider ( string  resource,
Alignment  alignment)

Creates and adds a horizontal Slider child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
HSlider
VSlider create_vslider ( Alignment  alignment)

Creates and adds a vertical Slider child widget with the given alignment.

Parameters
alignmentAlignment
Returns
VSlider
VSlider create_vslider ( string  resource,
Alignment  alignment)

Creates and adds a vertical Slider child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
VSlider
HColorSlider create_hcolor_slider ( Alignment  alignment)

Creates and adds a horizontal ColorSlider child widget with the given alignment.

Parameters
alignmentAlignment
Returns
HColorSlider
HColorSlider create_hcolor_slider ( string  resource,
Alignment  alignment)

Creates and adds a horizontal ColorSlider child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
HColorSlider
VColorSlider create_vcolor_slider ( Alignment  alignment)

Creates and adds a vertical ColorSlider child widget with the given alignment.

Parameters
alignmentAlignment
Returns
VColorSlider
VColorSlider create_vcolor_slider ( string  resource,
Alignment  alignment)

Creates and adds a vertical ColorSlider child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
VColorSlider
Knob create_knob ( Alignment  alignment)

Creates and adds a Knob child widget with the given alignment.

Parameters
alignmentAlignment
Returns
Knob
Knob create_knob ( string  resource,
Alignment  alignment)

Creates and adds a Knob child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Knob
ColorWheel create_color_wheel ( Alignment  alignment)

Creates and adds a ColorWheel child widget with the given alignment.

Parameters
alignmentAlignment
Returns
ColorWheel
ColorWheel create_color_wheel ( string  resource,
Alignment  alignment)

Creates and adds a ColorWheel child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
ColorWheel
ColorPicker create_color_picker ( Alignment  alignment)

Creates and adds a ColorPicker child widget with the given alignment.

Parameters
alignmentAlignment
Returns
ColorPicker
ColorPicker create_color_picker ( string  resource,
Alignment  alignment)

Creates and adds a ColorPicker child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
ColorPicker
ColorPickerButton create_color_picker_button ( Alignment  alignment)

Creates and adds a ColorPickerButton child widget with the given alignment.

Parameters
alignmentAlignment
Returns
ColorPickerButton
ColorPickerButton create_color_picker_button ( string  resource,
Alignment  alignment)

Creates and adds a ColorPickerButton child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
ColorPickerButton
SpinBox create_spin_box ( Alignment  alignment)

Creates and adds a SpinBox child widget with the given alignment.

Parameters
alignmentAlignment
Returns
SpinBox
SpinBox create_spin_box ( string  resource,
Alignment  alignment)

Creates and adds a SpinBox child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
SpinBox
SpinButtons create_spin_buttons ( Alignment  alignment)

Creates and adds a SpinButtons child widget with the given alignment.

Parameters
alignmentAlignment
Returns
SpinButtons
SpinButtons create_spin_buttons ( string  resource,
Alignment  alignment)

Creates and adds a SpinButtons child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
SpinButtons
DropDownList create_drop_down_list ( Alignment  alignment)

Creates and adds a DropDownList child widget with the given alignment.

Parameters
alignmentAlignment
Returns
DropDownList
DropDownList create_drop_down_list ( string  resource,
Alignment  alignment)

Creates and adds a DropDownList child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
DropDownList
IconImage create_icon_image ( Alignment  alignment)

Creates and adds an IconImage child widget with the given alignment.

Parameters
alignmentAlignment
Returns
IconImage
IconImage create_icon_image ( string  resource,
Alignment  alignment)

Creates and adds an IconImage child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
IconImage
IconSVG create_icon_svg ( Alignment  alignment)

Creates and adds an IconSVG child widget with the given alignment.

Parameters
alignmentAlignment
Returns
IconSVG
IconSVG create_icon_svg ( string  resource,
Alignment  alignment)

Creates and adds an IconSVG child widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
IconSVG
Widget add_child ( Widget  child,
integer  alignment,
string|nil  resource)

Adds a pre-constructed child widget with the given alignment and optional resource string.

Parameters
childWidget
alignmentinteger
resourcestring|nil
Returns
Widget

Property Documentation

integer id

The unique ID

integer type

The concrete widget type (see lysa.ui.WidgetType). (read-only)

Widget[] children

Ordered list of direct child widgets.

boolean visible

True if the widget is visible; false hides it and all its children.

any user_data

Lua user data.

boolean enabled

Enables or disables the widget's response to input events (pass nil or true to enable, false to disable).

number width

The widget width in virtual screen units.

number height

The widget height in virtual screen units.

lysa.Rect rect

The current position and size of the widget as a Rect.

integer alignment

The current placement alignment within the parent (see lysa.ui.Alignment).

lysa.Font font

The font used to render text within this widget.

number font_scale

The scale factor applied to the widget's font.

boolean focused

True if this widget currently holds keyboard focus. (read-only)

Widget|nil parent

The direct parent widget, or nil if this is a root widget. (read-only)

number padding

Spacing in virtual screen units between children during layout.

number vborder

Vertical inset between the widget edges and its content area.

number hborder

Horizontal inset between the widget edges and its content area.

boolean draw_background

False if the widget's background should be drawn transparently.

boolean pushed

True if the widget is currently in a pressed state (e.g. mouse button held down over it).

boolean pointed

True if the mouse cursor is currently over this widget. (read-only)

boolean freezed

True if the widget ignores all input events without being visually disabled.

boolean overlapping

True if this widget visually overlaps one or more siblings. (read-only)

lysa.Rect children_rect

The smallest Rect enclosing all direct children. (read-only)

integer group_index

User-defined integer tag used to identify widgets within a logical group.

number transparency

Global alpha multiplier for the widget (0.0 = fully transparent, 1.0 = opaque).

boolean consume_mouse_event

When true, mouse events are consumed by this widget and not propagated to its parent.

number children_offset_x

Horizontal scroll offset subtracted from child positions during layout (read-only; use set_children_offset to change).

number children_offset_y

Vertical scroll offset subtracted from child positions during layout (read-only; use set_children_offset to change).