Lysa.ui  0.0
Lysa 3D Engine
TabBar Class Referenceabstract

Detailed Description

A horizontal bar of tabs. Draws and selects the tabs, without managing the widgets they display. Fires OnSelectItem when a tab is selected.

Inherits from: Widget

Lua full name: lysa.ui.TabBar

Public Member Functions

integer add_tab (label: string)
 Adds a tab at the right of the last tab and returns its 0-based index. More...
 
integer add_tab (label: string, resource: string)
 Adds a tab, loading the style of its text from a resource string. More...
 
integer add_tab (label: string, resource: string, leading: Widget)
 Adds a tab displaying the given widget (icon, mark, ...) at the left of the text. More...
 
nil remove_tab (index: integer)
 Removes the tab at the given 0-based index; removing the selected tab selects another one. More...
 
nil remove_all_tabs ()
 Removes all the tabs. More...
 
Text|nil get_tab (index: integer)
 Returns the text widget of a tab, or nil for an invalid index. More...
 
integer get_tab_at (x: number, y: number)
 Returns the index of the tab at the given position, or NO_TAB. More...
 
nil select (index: integer)
 Selects a tab, NO_TAB removes the selection. Emits OnSelectItem if the selection changed. More...
 

Properties

integer NO_TAB
 Sentinel value used when no tab is selected, pointed or found.
 
integer count
 The number of tabs. (read-only)
 
integer selected
 The index of the selected tab, or NO_TAB. (read-only)
 
integer pointed
 The index of the tab below the mouse cursor, or NO_TAB. (read-only)
 
integer placement
 The position of the bar relatively to the content displayed by the tabs (see lysa.ui.TabPlacement).
 
number tab_padding
 The space between the borders of a tab and its content, applied to the next added tabs.
 
number content_height
 The height needed to display the highest tab. (read-only)
 
number content_width
 The width needed to display all the tabs. (read-only)
 

Member Function Documentation

integer add_tab ( string  label)

Adds a tab at the right of the last tab and returns its 0-based index.

Parameters
labelstring
Returns
integer
integer add_tab ( string  label,
string  resource)

Adds a tab, loading the style of its text from a resource string.

Parameters
labelstring
resourcestring
Returns
integer
integer add_tab ( string  label,
string  resource,
Widget  leading)

Adds a tab displaying the given widget (icon, mark, ...) at the left of the text.

Parameters
labelstring
resourcestring
leadingWidget
Returns
integer
nil remove_tab ( integer  index)

Removes the tab at the given 0-based index; removing the selected tab selects another one.

Parameters
indexinteger
nil remove_all_tabs ( )

Removes all the tabs.

Text|nil get_tab ( integer  index)

Returns the text widget of a tab, or nil for an invalid index.

Parameters
indexinteger
Returns
Text|nil
integer get_tab_at ( number  x,
number  y)

Returns the index of the tab at the given position, or NO_TAB.

Parameters
xnumber
ynumber
Returns
integer
nil select ( integer  index)

Selects a tab, NO_TAB removes the selection. Emits OnSelectItem if the selection changed.

Parameters
indexinteger

Property Documentation

integer NO_TAB

Sentinel value used when no tab is selected, pointed or found.

integer count

The number of tabs. (read-only)

integer selected

The index of the selected tab, or NO_TAB. (read-only)

integer pointed

The index of the tab below the mouse cursor, or NO_TAB. (read-only)

integer placement

The position of the bar relatively to the content displayed by the tabs (see lysa.ui.TabPlacement).

number tab_padding

The space between the borders of a tab and its content, applied to the next added tabs.

number content_height

The height needed to display the highest tab. (read-only)

number content_width

The width needed to display all the tabs. (read-only)