This commit is contained in:
NoryiE
2025-10-29 16:56:08 +00:00
parent 9a5b46138e
commit 00a9ce5632
26 changed files with 812 additions and 77 deletions

View File

@@ -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