Lysa.ui  0.0
Lysa 3D Engine
Window Class Referenceabstract

Detailed Description

A UI window that owns a root Widget hierarchy and is managed by the WindowManager.

Lua full name: lysa.ui.Window

Public Member Functions

nil set_widget (child: Widget|nil, resources: string|nil, padding: number|nil)
 Replaces the root widget. Call set_widget(nil) first if a layout was previously applied. More...
 
nil set_focused_widget (widget: Widget)
 Moves keyboard focus to the specified widget within this window. More...
 
nil set_pos (x: number, y: number)
 Moves the window's bottom-left corner to the given position. More...
 
nil close ()
 Closes and removes the window (effective at the start of the next frame). More...
 
nil show ()
 Makes the window visible (effective at the start of the next frame). More...
 
nil hide ()
 Hides the window without destroying it (effective at the start of the next frame). More...
 
nil set_transparency (alpha: number)
 Sets the global alpha transparency for the entire window (0.0 = invisible, 1.0 = fully opaque). More...
 
nil set_minimum_size (width: number, height: number)
 Sets the minimum dimensions the user can resize the window to (default 2×2). More...
 
nil set_maximum_size (width: number, height: number)
 Sets the maximum dimensions the user can resize the window to. More...
 
nil refresh ()
 Forces a full redraw of all widgets in this window at the start of the next frame. More...
 
Widget add_child (child: Widget, alignment: integer, resource: string|nil)
 Adds a pre-constructed widget to the root widget with the given alignment and optional resource string. More...
 
nil remove_child (child: Widget)
 Removes the given widget from the root widget. More...
 
Text create_text (alignment: Alignment, text: string)
 Creates and adds a Text widget. More...
 
Text create_text (resource: string, alignment: Alignment, text: string)
 Creates and adds a Text widget, loading its style from a resource string. More...
 
Panel create_panel (alignment: Alignment)
 Creates and adds a Panel widget. More...
 
Panel create_panel (resource: string, alignment: Alignment)
 Creates and adds a Panel widget, loading its style from a resource string. More...
 
Popup create_popup (x: number, y: number)
 Creates and adds a Popup 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 widget at the given position, loading its style from a resource string. More...
 
Box create_box (alignment: Alignment)
 Creates and adds a Box widget (bordered panel). More...
 
Box create_box (resource: string, alignment: Alignment)
 Creates and adds a Box widget (bordered panel), loading its style from a resource string. More...
 
Button create_button (alignment: Alignment)
 Creates and adds a Button widget. More...
 
Button create_button (resource: string, alignment: Alignment)
 Creates and adds a Button widget, loading its style from a resource string. More...
 
ToggleButton create_toggle_button (alignment: Alignment)
 Creates and adds a ToggleButton widget. More...
 
ToggleButton create_toggle_button (resource: string, alignment: Alignment)
 Creates and adds a ToggleButton widget, loading its style from a resource string. More...
 
HLine create_hline (alignment: Alignment)
 Creates and adds a horizontal Line widget. More...
 
HLine create_hline (resource: string, alignment: Alignment)
 Creates and adds a horizontal Line widget, loading its style from a resource string. More...
 
VLine create_vline (alignment: Alignment)
 Creates and adds a vertical Line widget. More...
 
VLine create_vline (resource: string, alignment: Alignment)
 Creates and adds a vertical Line widget, loading its style from a resource string. More...
 
Frame create_frame (alignment: Alignment, title: string)
 Creates and adds a Frame widget with the given title. More...
 
Frame create_frame (resource: string, alignment: Alignment, title: string)
 Creates and adds a Frame widget with the given title, loading its style from a resource string. More...
 
TextEdit create_text_edit (alignment: Alignment, text: string|nil)
 Creates and adds a TextEdit widget with optional initial text. More...
 
TextEdit create_text_edit (resource: string, alignment: Alignment, text: string|nil)
 Creates and adds a TextEdit widget, loading its style from a resource string. More...
 
Image create_image (alignment: Alignment)
 Creates and adds an Image widget. More...
 
Image create_image (resource: string, alignment: Alignment)
 Creates and adds an Image 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 widget with auto-resize and fixed-size options. More...
 
VScrollBar create_vscrollbar (alignment: Alignment)
 Creates and adds a vertical ScrollBar widget. More...
 
VScrollBar create_vscrollbar (resource: string, alignment: Alignment)
 Creates and adds a vertical ScrollBar widget, loading its style from a resource string. More...
 
HScrollBar create_hscrollbar (alignment: Alignment)
 Creates and adds a horizontal ScrollBar widget. More...
 
HScrollBar create_hscrollbar (resource: string, alignment: Alignment)
 Creates and adds a horizontal ScrollBar widget, loading its style from a resource string. More...
 
TreeView create_tree_view (alignment: Alignment)
 Creates and adds a TreeView widget. More...
 
TreeView create_tree_view (resource: string, alignment: Alignment)
 Creates and adds a TreeView widget, loading its style from a resource string. More...
 
Widget create_widget (alignment: Alignment)
 Creates and adds a transparent container Widget. More...
 
Widget create_widget (resource: string, alignment: Alignment)
 Creates and adds a transparent container Widget, loading its style from a resource string. More...
 
ListBox create_list_box (alignment: Alignment)
 Creates and adds a ListBox widget. More...
 
ListBox create_list_box (resource: string, alignment: Alignment)
 Creates and adds a ListBox widget, loading its style from a resource string. More...
 
ProgressBar create_progress_bar (alignment: Alignment)
 Creates and adds a ProgressBar widget. More...
 
ProgressBar create_progress_bar (resource: string, alignment: Alignment)
 Creates and adds a ProgressBar widget, loading its style from a resource string. More...
 
VProgressBar create_vprogress_bar (alignment: Alignment)
 Creates and adds a vertical ProgressBar widget. More...
 
VProgressBar create_vprogress_bar (resource: string, alignment: Alignment)
 Creates and adds a vertical ProgressBar widget, loading its style from a resource string. More...
 
HProgressBar create_hprogress_bar (alignment: Alignment)
 Creates and adds a horizontal ProgressBar widget. More...
 
HProgressBar create_hprogress_bar (resource: string, alignment: Alignment)
 Creates and adds a horizontal ProgressBar widget, loading its style from a resource string. More...
 
ScrollBox create_scroll_box (alignment: Alignment)
 Creates and adds a ScrollBox widget. More...
 
ScrollBox create_scroll_box (resource: string, alignment: Alignment)
 Creates and adds a ScrollBox widget, loading its style from a resource string. More...
 

Properties

integer resizeable_borders
 Bitmask of which window borders are user-resizable (see lysa.ui.ResizeableBorder).
 
Widget widget
 The root widget that covers the entire client area of the window. (read-only)
 
any style
 The currently active style layout object, or nil if no layout has been applied.
 
number width
 Client area width in virtual screen units.
 
number height
 Client area height in virtual screen units.
 
lysa.Rect rect
 Client area position and size as a Rect.
 
number x
 Current X position of the window's bottom-left corner.
 
number y
 Current Y position of the window's bottom-left corner.
 
boolean visible
 Whether the window is visible; changes take effect at the start of the next frame.
 
number minimum_width
 The minimum width the window can be resized to. (read-only)
 
number minimum_height
 The minimum height the window can be resized to. (read-only)
 
number maximum_width
 The maximum width the window can be resized to. (read-only)
 
number maximum_height
 The maximum height the window can be resized to. (read-only)
 
number aspect_ratio
 Aspect ratio (width / height) of the Window client area. (read-only)
 
lysa.Font font
 The default font applied to widgets that do not specify their own.
 
number font_scale
 The default font scale applied to widgets that do not specify their own.
 
lysa.float4 text_color
 The default text RGBA color applied to widgets that do not specify their own.
 

Member Function Documentation

nil set_widget ( Widget|nil  child,
string|nil  resources,
number|nil  padding)

Replaces the root widget. Call set_widget(nil) first if a layout was previously applied.

Parameters
childWidget|nil
resourcesstring|nil
paddingnumber|nil
nil set_focused_widget ( Widget  widget)

Moves keyboard focus to the specified widget within this window.

Parameters
widgetWidget
nil set_pos ( number  x,
number  y)

Moves the window's bottom-left corner to the given position.

Parameters
xnumber
ynumber
nil close ( )

Closes and removes the window (effective at the start of the next frame).

nil show ( )

Makes the window visible (effective at the start of the next frame).

nil hide ( )

Hides the window without destroying it (effective at the start of the next frame).

nil set_transparency ( number  alpha)

Sets the global alpha transparency for the entire window (0.0 = invisible, 1.0 = fully opaque).

Parameters
alphanumber
nil set_minimum_size ( number  width,
number  height)

Sets the minimum dimensions the user can resize the window to (default 2×2).

Parameters
widthnumber
heightnumber
nil set_maximum_size ( number  width,
number  height)

Sets the maximum dimensions the user can resize the window to.

Parameters
widthnumber
heightnumber
nil refresh ( )

Forces a full redraw of all widgets in this window at the start of the next frame.

Widget add_child ( Widget  child,
integer  alignment,
string|nil  resource)

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

Parameters
childWidget
alignmentinteger
resourcestring|nil
Returns
Widget
nil remove_child ( Widget  child)

Removes the given widget from the root widget.

Parameters
childWidget
Text create_text ( Alignment  alignment,
string  text)

Creates and adds a Text widget.

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

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

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

Creates and adds a Panel widget.

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

Creates and adds a Panel 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 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 widget at the given position, loading its style from a resource string.

Parameters
resourcestring
xnumber
ynumber
Returns
Popup
Box create_box ( Alignment  alignment)

Creates and adds a Box widget (bordered panel).

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

Creates and adds a Box widget (bordered panel), loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
Returns
Box
Button create_button ( Alignment  alignment)

Creates and adds a Button widget.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
Button
ToggleButton create_toggle_button ( Alignment  alignment)

Creates and adds a ToggleButton widget.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
ToggleButton
HLine create_hline ( Alignment  alignment)

Creates and adds a horizontal Line widget.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
HLine
VLine create_vline ( Alignment  alignment)

Creates and adds a vertical Line widget.

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

Creates and adds a vertical Line 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 widget with the given title.

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

Creates and adds a Frame widget with the given title, 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 widget with 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 widget, loading its style from a resource string.

Parameters
resourcestring
alignmentAlignment
textstring|nil
Returns
TextEdit
Image create_image ( Alignment  alignment)

Creates and adds an Image widget.

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

Creates and adds an Image 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 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 widget.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
VScrollBar
HScrollBar create_hscrollbar ( Alignment  alignment)

Creates and adds a horizontal ScrollBar widget.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
HScrollBar
TreeView create_tree_view ( Alignment  alignment)

Creates and adds a TreeView widget.

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

Creates and adds a TreeView 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.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
Widget
ListBox create_list_box ( Alignment  alignment)

Creates and adds a ListBox widget.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
ListBox
ProgressBar create_progress_bar ( Alignment  alignment)

Creates and adds a ProgressBar widget.

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

Creates and adds a ProgressBar 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 widget.

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

Creates and adds a vertical ProgressBar 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 widget.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
HProgressBar
ScrollBox create_scroll_box ( Alignment  alignment)

Creates and adds a ScrollBox widget.

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

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

Parameters
resourcestring
alignmentAlignment
Returns
ScrollBox

Property Documentation

integer resizeable_borders

Bitmask of which window borders are user-resizable (see lysa.ui.ResizeableBorder).

Widget widget

The root widget that covers the entire client area of the window. (read-only)

any style

The currently active style layout object, or nil if no layout has been applied.

number width

Client area width in virtual screen units.

number height

Client area height in virtual screen units.

lysa.Rect rect

Client area position and size as a Rect.

number x

Current X position of the window's bottom-left corner.

number y

Current Y position of the window's bottom-left corner.

boolean visible

Whether the window is visible; changes take effect at the start of the next frame.

number minimum_width

The minimum width the window can be resized to. (read-only)

number minimum_height

The minimum height the window can be resized to. (read-only)

number maximum_width

The maximum width the window can be resized to. (read-only)

number maximum_height

The maximum height the window can be resized to. (read-only)

number aspect_ratio

Aspect ratio (width / height) of the Window client area. (read-only)

lysa.Font font

The default font applied to widgets that do not specify their own.

number font_scale

The default font scale applied to widgets that do not specify their own.

lysa.float4 text_color

The default text RGBA color applied to widgets that do not specify their own.