This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
Quentin 89f57a9a4c
Lua: can make new tabs from lua scripts, doc generation for available tabs to use (#1593)
* lua api: add globals.get_uint and globals.set_uint

* lua doc: remove duplicate function check as we can overload so it doesn't make sense

* lua doc gen: add support for parsing the tabs enum

* gui: custom lua tabs don't have a `func` rendering function but can still have elements to draw

* lua doc: update generated doc

* chore: code style

* chore: minor spelling mistake

* chore: code style

* gui_service: add runtime removal of tabs

* refactor: make it so that it's less likely defining tabs and their translation key in a wrong way.

* lua api: ability to add custom tabs to the gui from lua
2023-07-05 00:30:57 +02:00

138 lines
2.2 KiB
Markdown

# Class: tab
Class for representing a tab within the GUI.
## Functions (10)
### `clear()`
Clear the tab of all its custom lua content that you own.
**Example Usage:**
```lua
tab:clear()
```
### `add_tab()`
Add a sub tab to this tab.
**Example Usage:**
```lua
tab:add_tab()
```
### `add_button(name, callback)`
Add a button to the gui tab.
- **Parameters:**
- `name` (string): Text written inside the button.
- `callback` (function): function that will be called when the button is clicked.
**Example Usage:**
```lua
tab:add_button(name, callback)
```
### `add_text(name)`
Add text to the gui tab.
- **Parameters:**
- `name` (string): Text that will be written.
- **Returns:**
- `text`: The text object instance.
**Example Usage:**
```lua
text = tab:add_text(name)
```
### `add_checkbox(name)`
Add a checkbox widget to the gui tab.
- **Parameters:**
- `name` (string): Text that will be written next to the checkbox.
- **Returns:**
- `checkbox`: The checkbox object instance.
**Example Usage:**
```lua
checkbox = tab:add_checkbox(name)
```
### `add_sameline()`
Add a ImGui::SameLine.
- **Returns:**
- `sameline`: The sameline object instance.
**Example Usage:**
```lua
sameline = tab:add_sameline()
```
### `add_separator()`
Add a ImGui::Separator.
- **Returns:**
- `separator`: The separator object instance.
**Example Usage:**
```lua
separator = tab:add_separator()
```
### `add_input_int(name)`
Add a ImGui::InputInt.
- **Parameters:**
- `name` (string): Text that will be written next to the input field.
- **Returns:**
- `input_int`: The input_int object instance.
**Example Usage:**
```lua
input_int = tab:add_input_int(name)
```
### `add_input_float(name)`
Add a ImGui::InputFloat.
- **Parameters:**
- `name` (string): Text that will be written next to the input field.
- **Returns:**
- `input_float`: The input_float object instance.
**Example Usage:**
```lua
input_float = tab:add_input_float(name)
```
### `add_input_string(name)`
Add a ImGui::InputText.
- **Parameters:**
- `name` (string): Text that will be written next to the input field.
- **Returns:**
- `input_string`: The input_string object instance.
**Example Usage:**
```lua
input_string = tab:add_input_string(name)
```