Lysa.ui  0.0
Lysa 3D Engine
Grid Class Referenceabstract

Detailed Description

A grid of GridCell with per-row heights, per-column widths and spanning cells. A row or a column sized with zero shares the remaining space with the other automatically sized rows and columns.

Inherits from: Panel

Lua full name: lysa.ui.Grid

Public Member Functions

integer add_row ()
 Appends a row sharing the remaining space and returns its index. More...
 
integer add_row (height: number)
 Appends a row of the given height and returns its index. More...
 
integer add_column ()
 Appends a column sharing the remaining space and returns its index. More...
 
integer add_column (width: number)
 Appends a column of the given width and returns its index. More...
 
nil insert_row (index: integer)
 Inserts a row sharing the remaining space, the rows below being shifted down. More...
 
nil insert_row (index: integer, height: number)
 Inserts a row of the given height, the rows below being shifted down. More...
 
nil insert_column (index: integer)
 Inserts a column sharing the remaining space, the columns at its right being shifted right. More...
 
nil insert_column (index: integer, width: number)
 Inserts a column of the given width, the columns at its right being shifted right. More...
 
nil remove_row (index: integer)
 Removes a row and the cells it displays. More...
 
nil remove_column (index: integer)
 Removes a column and the cells it displays. More...
 
nil remove_all_rows ()
 Removes all the rows and the cells they display, the columns are kept. More...
 
nil clear ()
 Removes all the rows, all the columns and all the cells. More...
 
nil set_row_height (row: integer, height: number)
 Sets the height of a row, zero to share the remaining space. More...
 
number get_row_height (row: integer)
 Returns the height requested for a row, or zero. More...
 
nil set_column_width (column: integer, width: number)
 Sets the width of a column, zero to share the remaining space. More...
 
number get_column_width (column: integer)
 Returns the width requested for a column, or zero. More...
 
number get_row_real_height (row: integer)
 Returns the height currently used by a row. More...
 
number get_column_real_width (column: integer)
 Returns the width currently used by a column. More...
 
number get_row_position (row: integer)
 Returns the Y coordinate of the bottom border of a row. More...
 
number get_column_position (column: integer)
 Returns the X coordinate of the left border of a column. More...
 
GridCell|nil get_cell (row: integer, column: integer)
 Returns the cell displaying a position, spans included, or nil. More...
 
GridCell|nil get_cell_at (x: number, y: number)
 Returns the cell displayed at a position of the UI, or nil. More...
 
boolean merge (row: integer, column: integer, row_span: integer, column_span: integer)
 Merges a rectangle of cells into the cell at its top-left position, destroying the other ones. More...
 
nil split (row: integer, column: integer)
 Removes the span of the cell displaying a position, the freed positions getting new empty cells. More...
 
nil swap_rows (first: integer, second: integer)
 Exchanges two rows, with the widgets they display and their heights. More...
 
nil move_row (from: integer, to: integer)
 Moves a row to another index, with the widgets it displays and its height. More...
 
nil reorder_rows (order: integer[])
 Reorders all the rows, order[1] being the row to display at the top. More...
 
nil reset_grid_color ()
 Draws the lines between the cells with the color of the style. More...
 
nil set_resources (res_cell: string)
 Reloads the visual style: res_cell = cells. More...
 

Properties

integer row_count
 The number of rows. (read-only)
 
integer column_count
 The number of columns. (read-only)
 
GridCell[] cells
 All the cells, in creation order, a spanning cell being listed once. (read-only)
 
boolean grid_visible
 True if the lines between the cells are drawn.
 
lysa.Vector4 grid_color
 The color of the lines drawn between the cells, overriding the color of the style.
 

Member Function Documentation

integer add_row ( )

Appends a row sharing the remaining space and returns its index.

Returns
integer
integer add_row ( number  height)

Appends a row of the given height and returns its index.

Parameters
heightnumber
Returns
integer
integer add_column ( )

Appends a column sharing the remaining space and returns its index.

Returns
integer
integer add_column ( number  width)

Appends a column of the given width and returns its index.

Parameters
widthnumber
Returns
integer
nil insert_row ( integer  index)

Inserts a row sharing the remaining space, the rows below being shifted down.

Parameters
indexinteger
nil insert_row ( integer  index,
number  height)

Inserts a row of the given height, the rows below being shifted down.

Parameters
indexinteger
heightnumber
nil insert_column ( integer  index)

Inserts a column sharing the remaining space, the columns at its right being shifted right.

Parameters
indexinteger
nil insert_column ( integer  index,
number  width)

Inserts a column of the given width, the columns at its right being shifted right.

Parameters
indexinteger
widthnumber
nil remove_row ( integer  index)

Removes a row and the cells it displays.

Parameters
indexinteger
nil remove_column ( integer  index)

Removes a column and the cells it displays.

Parameters
indexinteger
nil remove_all_rows ( )

Removes all the rows and the cells they display, the columns are kept.

nil clear ( )

Removes all the rows, all the columns and all the cells.

nil set_row_height ( integer  row,
number  height)

Sets the height of a row, zero to share the remaining space.

Parameters
rowinteger
heightnumber
number get_row_height ( integer  row)

Returns the height requested for a row, or zero.

Parameters
rowinteger
Returns
number
nil set_column_width ( integer  column,
number  width)

Sets the width of a column, zero to share the remaining space.

Parameters
columninteger
widthnumber
number get_column_width ( integer  column)

Returns the width requested for a column, or zero.

Parameters
columninteger
Returns
number
number get_row_real_height ( integer  row)

Returns the height currently used by a row.

Parameters
rowinteger
Returns
number
number get_column_real_width ( integer  column)

Returns the width currently used by a column.

Parameters
columninteger
Returns
number
number get_row_position ( integer  row)

Returns the Y coordinate of the bottom border of a row.

Parameters
rowinteger
Returns
number
number get_column_position ( integer  column)

Returns the X coordinate of the left border of a column.

Parameters
columninteger
Returns
number
GridCell|nil get_cell ( integer  row,
integer  column)

Returns the cell displaying a position, spans included, or nil.

Parameters
rowinteger
columninteger
Returns
GridCell|nil
GridCell|nil get_cell_at ( number  x,
number  y)

Returns the cell displayed at a position of the UI, or nil.

Parameters
xnumber
ynumber
Returns
GridCell|nil
boolean merge ( integer  row,
integer  column,
integer  row_span,
integer  column_span)

Merges a rectangle of cells into the cell at its top-left position, destroying the other ones.

Parameters
rowinteger
columninteger
row_spaninteger
column_spaninteger
Returns
boolean
nil split ( integer  row,
integer  column)

Removes the span of the cell displaying a position, the freed positions getting new empty cells.

Parameters
rowinteger
columninteger
nil swap_rows ( integer  first,
integer  second)

Exchanges two rows, with the widgets they display and their heights.

Parameters
firstinteger
secondinteger
nil move_row ( integer  from,
integer  to)

Moves a row to another index, with the widgets it displays and its height.

Parameters
frominteger
tointeger
nil reorder_rows ( integer[]  order)

Reorders all the rows, order[1] being the row to display at the top.

Parameters
orderinteger[]
nil reset_grid_color ( )

Draws the lines between the cells with the color of the style.

nil set_resources ( string  res_cell)

Reloads the visual style: res_cell = cells.

Parameters
res_cellstring

Property Documentation

integer row_count

The number of rows. (read-only)

integer column_count

The number of columns. (read-only)

GridCell[] cells

All the cells, in creation order, a spanning cell being listed once. (read-only)

boolean grid_visible

True if the lines between the cells are drawn.

lysa.Vector4 grid_color

The color of the lines drawn between the cells, overriding the color of the style.