This commit is contained in:
Robert Jelic
2025-09-13 12:50:01 +02:00
parent 179949c8b7
commit 3504d8a3aa
43 changed files with 2553 additions and 1719 deletions

View File

@@ -1,33 +1,48 @@
# Dropdown : List
This is the dropdown class. It is a visual element that can show a list of selectable items in a dropdown menu.
### Usage
```lua
local dropdown = main:addDropdown()
dropdown:setItems({
{text = "Item 1", callback = function() basalt.LOGGER.debug("Item 1 selected") end},
{text = "Item 2", callback = function() basalt.LOGGER.debug("Item 2 selected") end},
{text = "Item 3", callback = function() basalt.LOGGER.debug("Item 3 selected") end},
})
```
# Dropdown
_This is the dropdown class. It is a visual element that can show a list of selectable items in a dropdown menu._
Extends: `List`
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|isOpen|boolean|false|Whether the dropdown menu is currently open
|dropdownHeight|number|5|Maximum height of the dropdown menu when open
|selectedText|string|""|The text to show when no item is selected
|dropSymbol|string|"\31"|The symbol to show for dropdown indication
|isOpen|boolean|false|Whether the dropdown menu is currently open|
|dropdownHeight|number|5|Maximum height of the dropdown menu when open|
|selectedText|string|""|The text to show when no item is selected|
|dropSymbol|string|"\31"|The symbol to show for dropdown indication|
## Protected Functions
## Functions
|Method|Returns|Description|
|---|---|---|
|Dropdown:init|Dropdown|Initializes the Dropdown instance
|Dropdown:mouse_click|boolean|Handles mouse click events
|Dropdown:render|-|Renders the Dropdown
|[Dropdown.new](#dropdown-new)|Dropdown|Creates a new Dropdown instance|
|[Dropdown:Dropdown](#dropdown-dropdown-props-basalt)|Dropdown|Initializes the Dropdown instance|
|[Dropdown:Dropdown](#dropdown-dropdown-button-x-y)|boolean|Handles mouse click events|
|[Dropdown:Dropdown](#dropdown-dropdown)|-|Renders the Dropdown|
## Dropdown.new()
Creates a new Dropdown instance
### Returns
* `Dropdown` `self` The newly created Dropdown instance
## Dropdown:Dropdown(props, basalt)
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Dropdown` `self` The initialized instance
## Dropdown:Dropdown(button, x, y)
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Dropdown:Dropdown()