Lysa.ui  0.0
Lysa 3D Engine
Table Class Referenceabstract

Detailed Description

A Grid with a row of column headers. Clicking a sortable header fires OnSortColumn, dragging the right border of a resizable header fires OnResizeColumn. The rows are never reordered by the table itself.

Inherits from: Widget

Lua full name: lysa.ui.Table

Public Member Functions

integer add_column (title: string)
 Appends a sortable and resizable column sharing the remaining space and returns its index. More...
 
integer add_column (title: string, width: number)
 Appends a column of the given width and returns its index. More...
 
integer add_column (title: string, width: number, sortable: boolean, resizable: boolean)
 Appends a column and returns its index. More...
 
nil remove_column (index: integer)
 Removes a column, its header and the cells it displays. More...
 
nil remove_all_columns ()
 Removes all the columns, their headers and all the cells. More...
 
Button|nil get_column_header (index: integer)
 Returns the clickable header of a column, or nil for an invalid index. More...
 
Widget|nil get_column_title (index: integer)
 Returns the widget displayed by the header of a column, or nil. More...
 
integer get_column_at (x: number)
 Returns the index of the column displayed at a position, or NO_COLUMN. More...
 
nil set_column_width (index: integer, width: number)
 Sets the width of a column, zero to share the remaining space. More...
 
number get_column_width (index: integer)
 Returns the width currently used by a column. More...
 
nil set_column_sortable (index: integer, sortable: boolean)
 Sets whether clicking the header of a column sorts the table. More...
 
boolean is_column_sortable (index: integer)
 Returns true if clicking the header of a column sorts the table. More...
 
nil set_column_resizable (index: integer, resizable: boolean)
 Sets whether the width of a column can be changed with the mouse. More...
 
boolean is_column_resizable (index: integer)
 Returns true if the width of a column can be changed with the mouse. More...
 
integer add_row ()
 Appends a row of the default height and returns its index. More...
 
integer add_row (height: number)
 Appends a row of the given height and returns its index. More...
 
nil insert_row (index: integer)
 Inserts a row of the default height, 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 remove_row (index: integer)
 Removes a row 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 set_row_height (index: integer, height: number)
 Sets the height of a row, zero to share the remaining space. More...
 
number get_row_height (index: integer)
 Returns the height requested for a row. More...
 
GridCell|nil get_cell (row: integer, column: integer)
 Returns the cell at a position of the table, or nil. More...
 
nil sort (column: integer, order: SortOrder)
 Changes the sorted column and the sort direction, then fires OnSortColumn without reordering the rows. More...
 
nil set_resources (res_header: string, res_grid: string, res_arrow: string)
 Reloads the visual style: res_header = headers, res_grid = grid, res_arrow = sort indicators. More...
 

Properties

integer NO_COLUMN
 Sentinel value used when no column is sorted or found.
 
integer column_count
 The number of columns. (read-only)
 
integer row_count
 The number of rows. (read-only)
 
integer sorted_column
 The index of the sorted column, or NO_COLUMN. (read-only)
 
integer sort_order
 The direction of the sort of the sorted column (see lysa.ui.SortOrder). (read-only)
 
number header_height
 The height of the row of headers, zero to compute it from the height of the titles.
 
number grip_width
 The width of the area used to drag the border between two columns.
 
number default_row_height
 The height given to the rows added without an explicit height.
 
Grid grid
 The grid displaying the content of the table. (read-only)
 
Widget header
 The widget holding the headers of the columns. (read-only)
 

Member Function Documentation

integer add_column ( string  title)

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

Parameters
titlestring
Returns
integer
integer add_column ( string  title,
number  width)

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

Parameters
titlestring
widthnumber
Returns
integer
integer add_column ( string  title,
number  width,
boolean  sortable,
boolean  resizable)

Appends a column and returns its index.

Parameters
titlestring
widthnumber
sortableboolean
resizableboolean
Returns
integer
nil remove_column ( integer  index)

Removes a column, its header and the cells it displays.

Parameters
indexinteger
nil remove_all_columns ( )

Removes all the columns, their headers and all the cells.

Button|nil get_column_header ( integer  index)

Returns the clickable header of a column, or nil for an invalid index.

Parameters
indexinteger
Returns
Button|nil
Widget|nil get_column_title ( integer  index)

Returns the widget displayed by the header of a column, or nil.

Parameters
indexinteger
Returns
Widget|nil
integer get_column_at ( number  x)

Returns the index of the column displayed at a position, or NO_COLUMN.

Parameters
xnumber
Returns
integer
nil set_column_width ( integer  index,
number  width)

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

Parameters
indexinteger
widthnumber
number get_column_width ( integer  index)

Returns the width currently used by a column.

Parameters
indexinteger
Returns
number
nil set_column_sortable ( integer  index,
boolean  sortable)

Sets whether clicking the header of a column sorts the table.

Parameters
indexinteger
sortableboolean
boolean is_column_sortable ( integer  index)

Returns true if clicking the header of a column sorts the table.

Parameters
indexinteger
Returns
boolean
nil set_column_resizable ( integer  index,
boolean  resizable)

Sets whether the width of a column can be changed with the mouse.

Parameters
indexinteger
resizableboolean
boolean is_column_resizable ( integer  index)

Returns true if the width of a column can be changed with the mouse.

Parameters
indexinteger
Returns
boolean
integer add_row ( )

Appends a row of the default height 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
nil insert_row ( integer  index)

Inserts a row of the default height, 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 remove_row ( integer  index)

Removes a row 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 set_row_height ( integer  index,
number  height)

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

Parameters
indexinteger
heightnumber
number get_row_height ( integer  index)

Returns the height requested for a row.

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

Returns the cell at a position of the table, or nil.

Parameters
rowinteger
columninteger
Returns
GridCell|nil
nil sort ( integer  column,
SortOrder  order)

Changes the sorted column and the sort direction, then fires OnSortColumn without reordering the rows.

Parameters
columninteger
orderSortOrder
nil set_resources ( string  res_header,
string  res_grid,
string  res_arrow)

Reloads the visual style: res_header = headers, res_grid = grid, res_arrow = sort indicators.

Parameters
res_headerstring
res_gridstring
res_arrowstring

Property Documentation

integer NO_COLUMN

Sentinel value used when no column is sorted or found.

integer column_count

The number of columns. (read-only)

integer row_count

The number of rows. (read-only)

integer sorted_column

The index of the sorted column, or NO_COLUMN. (read-only)

integer sort_order

The direction of the sort of the sorted column (see lysa.ui.SortOrder). (read-only)

number header_height

The height of the row of headers, zero to compute it from the height of the titles.

number grip_width

The width of the area used to drag the border between two columns.

number default_row_height

The height given to the rows added without an explicit height.

Grid grid

The grid displaying the content of the table. (read-only)

Widget header

The widget holding the headers of the columns. (read-only)