deploy: 5a1ec672a7
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
# Menu
|
||||
_This is the menu class. It provides a horizontal menu bar with selectable items._
|
||||
_Menu items are displayed in a single row and can have custom colors and callbacks._
|
||||
_This is the menu class. It provides a horizontal menu bar with selectable items. Menu items are displayed in a single row and can have custom colors and callbacks._
|
||||
|
||||
Extends: `List`
|
||||
|
||||
@@ -9,24 +8,19 @@ Extends: `List`
|
||||
|Property|Type|Default|Description|
|
||||
|---|---|---|---|
|
||||
|separatorColor|color|gray|The color used for separator items in the menu|
|
||||
|spacing|number|0|The number of spaces between menu items|
|
||||
|horizontalOffset|number|0|Current horizontal scroll offset|
|
||||
|maxWidth|number|nil|Maximum width before scrolling is enabled (nil = auto-size to items)|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Menu:setItems](#menu-setitems-items)|Menu|Sets the menu items and calculates total width|
|
||||
|[Menu:getTotalWidth](#menu-gettotalwidth)|number|Calculates total width of menu items|
|
||||
|
||||
## Menu:setItems(items)
|
||||
## Menu:getTotalWidth()
|
||||
|
||||
Sets the menu items
|
||||
|
||||
### Parameters
|
||||
* `items` `table` [] List of items with {text, separator, callback, foreground, background} properties
|
||||
Calculates the total width of all menu items with spacing
|
||||
|
||||
### Returns
|
||||
* `Menu` `self` The Menu instance
|
||||
|
||||
### Usage
|
||||
```lua
|
||||
menu:setItems({{text="File"}, {separator=true}, {text="Edit"}})
|
||||
```
|
||||
* `number` `totalWidth` The total width of all items
|
||||
|
||||
Reference in New Issue
Block a user