deploy: 792832c61d
This commit is contained in:
@@ -8,14 +8,15 @@ The base class for all UI elements in Basalt
|
|||||||
|type|string|BaseElement|The type identifier of the element
|
|type|string|BaseElement|The type identifier of the element
|
||||||
|id|string|BaseElement|The unique identifier for the element
|
|id|string|BaseElement|The unique identifier for the element
|
||||||
|name|string|BaseElement|The name of the element
|
|name|string|BaseElement|The name of the element
|
||||||
|eventCallbacks|table|{}|Table containing all registered event callbacks
|
|eventCallbacks|table|BaseElement|The event callbacks for the element
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|Method|Returns|Description|
|
|Method|Returns|Description|
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|[BaseElement.listenTo](#BaseElement.listenTo)|-|Registers an event that this class can listen to
|
|[BaseElement.defineEvent](#BaseElement.defineEvent)|-|
|
||||||
|[BaseElement.new](#BaseElement.new)|table|Creates a new BaseElement instance
|
|[BaseElement.new](#BaseElement.new)|table|Creates a new BaseElement instance
|
||||||
|
|[BaseElement.registerEventCallback](#BaseElement.registerEventCallback)|-|
|
||||||
|[BaseElement:destroy](#BaseElement:destroy)|-|Destroys the element and cleans up all references
|
|[BaseElement:destroy](#BaseElement:destroy)|-|Destroys the element and cleans up all references
|
||||||
|[BaseElement:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|Handles all events
|
|[BaseElement:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|Handles all events
|
||||||
|[BaseElement:fireEvent](#BaseElement:fireEvent)|table|Triggers an event and calls all registered callbacks
|
|[BaseElement:fireEvent](#BaseElement:fireEvent)|table|Triggers an event and calls all registered callbacks
|
||||||
@@ -28,18 +29,7 @@ The base class for all UI elements in Basalt
|
|||||||
|[BaseElement:registerCallback](#BaseElement:registerCallback)|table|Registers a callback function
|
|[BaseElement:registerCallback](#BaseElement:registerCallback)|table|Registers a callback function
|
||||||
|[BaseElement:updateRender](#BaseElement:updateRender)|-|Requests a render update for this element
|
|[BaseElement:updateRender](#BaseElement:updateRender)|-|Requests a render update for this element
|
||||||
|
|
||||||
## BaseElement.listenTo(class, eventName, event?)
|
## BaseElement.defineEvent()
|
||||||
Registers an event that this class can listen to
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
* `class` `table` The class to add the event to
|
|
||||||
* `eventName` `string` The name of the event to register
|
|
||||||
* `event` *(optional)* `string` The event to handle
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
```lua
|
|
||||||
BaseElement.listenTo(MyClass, "mouse_click")
|
|
||||||
```
|
|
||||||
|
|
||||||
## BaseElement.new(props, basalt)
|
## BaseElement.new(props, basalt)
|
||||||
Creates a new BaseElement instance
|
Creates a new BaseElement instance
|
||||||
@@ -56,6 +46,8 @@ Creates a new BaseElement instance
|
|||||||
local element = BaseElement.new()
|
local element = BaseElement.new()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## BaseElement.registerEventCallback()
|
||||||
|
|
||||||
## BaseElement:destroy()
|
## BaseElement:destroy()
|
||||||
Destroys the element and cleans up all references
|
Destroys the element and cleans up all references
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# Button : VisualElement
|
# Button : VisualElement
|
||||||
|
This is the button class. It is a visual element that can be clicked.
|
||||||
|
@configDescription Standard button element with click handling and state management
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
@@ -15,14 +17,24 @@
|
|||||||
|
|
||||||
|Method|Returns|Description|
|
|Method|Returns|Description|
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|[Button.new](#Button.new)|-|
|
|[Button.new](#Button.new)|table|Creates a new Button instance
|
||||||
|[Button:init](#Button:init)|-|
|
|[Button:init](#Button:init)|-|Initializes the Button instance
|
||||||
|[Button:render](#Button:render)|-|
|
|[Button:render](#Button:render)|-|Renders the Button
|
||||||
|
|
||||||
## Button.new()
|
## Button.new()
|
||||||
|
Creates a new Button instance
|
||||||
|
|
||||||
## Button:init()
|
### Returns
|
||||||
|
* `table` `self` The created instance
|
||||||
|
|
||||||
|
## Button:init(props, basalt)
|
||||||
|
Initializes the Button instance
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
* `props` `table` The properties to initialize the element with
|
||||||
|
* `basalt` `table` The basalt instance
|
||||||
|
|
||||||
## Button:render()
|
## Button:render()
|
||||||
|
Renders the Button
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ like Frames, BaseFrames, and more.
|
|||||||
|[Container:render](#Container:render)|-|Renders the container
|
|[Container:render](#Container:render)|-|Renders the container
|
||||||
|[Container:sortChildren](#Container:sortChildren)|Container|Sorts the children of the container
|
|[Container:sortChildren](#Container:sortChildren)|Container|Sorts the children of the container
|
||||||
|[Container:sortChildrenEvents](#Container:sortChildrenEvents)|Container|Sorts the children events of the container
|
|[Container:sortChildrenEvents](#Container:sortChildrenEvents)|Container|Sorts the children events of the container
|
||||||
|
|[Container:textBg](#Container:textBg)|Container|Draws a line of text and bg as color
|
||||||
|[Container:textFg](#Container:textFg)|Container|Draws a line of text and fg as color
|
|[Container:textFg](#Container:textFg)|Container|Draws a line of text and fg as color
|
||||||
|[Container:unregisterChildEvent](#Container:unregisterChildEvent)|Container|Unregisters the children events of the container
|
|[Container:unregisterChildEvent](#Container:unregisterChildEvent)|Container|Unregisters the children events of the container
|
||||||
|
|
||||||
@@ -255,6 +256,18 @@ Sorts the children events of the container
|
|||||||
### Returns
|
### Returns
|
||||||
* `Container` `self` The container instance
|
* `Container` `self` The container instance
|
||||||
|
|
||||||
|
## Container:textBg(x, y, text, bg)
|
||||||
|
Draws a line of text and bg as color, it is usually used in the render loop
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
* `x` `number` The x position to draw the text
|
||||||
|
* `y` `number` The y position to draw the text
|
||||||
|
* `text` `string` The text to draw
|
||||||
|
* `bg` `color` The background color of the text
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
* `Container` `self` The container instance
|
||||||
|
|
||||||
## Container:textFg(x, y, text, fg)
|
## Container:textFg(x, y, text, fg)
|
||||||
Draws a line of text and fg as color, it is usually used in the render loop
|
Draws a line of text and fg as color, it is usually used in the render loop
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
# Frame : Container
|
# Frame : Container
|
||||||
This is the frame class. It serves as a grouping container for other elements.
|
This is the frame class. It serves as a grouping container for other elements.
|
||||||
|
|
||||||
## Events
|
|
||||||
|
|
||||||
|Event|Parameters|Description|
|
|
||||||
|---|---|---|
|
|
||||||
|onResize|`width number, height number`|Fired when the frame is resized|
|
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|Method|Returns|Description|
|
|Method|Returns|Description|
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ custom item rendering, separators, and selection handling.
|
|||||||
|
|
||||||
|Property|Type|Default|Description|
|
|Property|Type|Default|Description|
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
|items|table|{}|List of items to display. Items can be strings or tables with properties
|
|items|table|{}|List of items to display. Items can be tables with properties including selected state
|
||||||
|selectedIndex|number|0|Index of the currently selected item (0 means no selection)
|
|
||||||
|selectable|boolean|true|Whether items in the list can be selected
|
|selectable|boolean|true|Whether items in the list can be selected
|
||||||
|
|multiSelection|boolean|false|Whether multiple items can be selected at once
|
||||||
|offset|number|0|Current scroll offset for viewing long lists
|
|offset|number|0|Current scroll offset for viewing long lists
|
||||||
|selectedColor|color|blue|Background color for the selected item
|
|selectedBackground|color|blue|Background color for selected items
|
||||||
|
|selectedForeground|color|white|Text color for selected items
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ custom item rendering, separators, and selection handling.
|
|||||||
|[List.new](#List.new)|List|Creates a new List instance
|
|[List.new](#List.new)|List|Creates a new List instance
|
||||||
|[List:addItem](#List:addItem)|List|Adds an item to the list
|
|[List:addItem](#List:addItem)|List|Adds an item to the list
|
||||||
|[List:clear](#List:clear)|List|Clears all items from the list
|
|[List:clear](#List:clear)|List|Clears all items from the list
|
||||||
|
|[List:getSelectedItems](#List:getSelectedItems)|table|Gets the currently selected items
|
||||||
|[List:init](#List:init)|List|Initializes the List instance
|
|[List:init](#List:init)|List|Initializes the List instance
|
||||||
|[List:mouse_click](#List:mouse_click)|boolean|Handles mouse click events
|
|[List:mouse_click](#List:mouse_click)|boolean|Handles mouse click events
|
||||||
|[List:mouse_scroll](#List:mouse_scroll)|boolean|Handles mouse scroll events
|
|[List:mouse_scroll](#List:mouse_scroll)|boolean|Handles mouse scroll events
|
||||||
@@ -69,6 +71,17 @@ Clears all items from the list
|
|||||||
list:clear()
|
list:clear()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## List:getSelectedItems()
|
||||||
|
Gets the currently selected items
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
* `table` `selected` List of selected items
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
```lua
|
||||||
|
local selected = list:getSelectedItems()
|
||||||
|
```
|
||||||
|
|
||||||
## List:init(props, basalt)
|
## List:init(props, basalt)
|
||||||
Initializes the List instance
|
Initializes the List instance
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Menu : List
|
# Menu : List
|
||||||
This is the menu class. It provides a horizontal menu bar with selectable items and separators.
|
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.
|
Menu items are displayed in a single row and can have custom colors and callbacks.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ and provides core functionality for positioning, sizing, colors, and rendering.
|
|||||||
|[VisualElement:mouse_release](#VisualElement:mouse_release)|-|Handles a mouse release event
|
|[VisualElement:mouse_release](#VisualElement:mouse_release)|-|Handles a mouse release event
|
||||||
|[VisualElement:mouse_scroll](#VisualElement:mouse_scroll)|-|
|
|[VisualElement:mouse_scroll](#VisualElement:mouse_scroll)|-|
|
||||||
|[VisualElement:mouse_up](#VisualElement:mouse_up)|boolean|Handles a mouse up event
|
|[VisualElement:mouse_up](#VisualElement:mouse_up)|boolean|Handles a mouse up event
|
||||||
|
|[VisualElement:multiBlit](#VisualElement:multiBlit)|-|Multi-character drawing with colors
|
||||||
|[VisualElement:render](#VisualElement:render)|-|Renders the element
|
|[VisualElement:render](#VisualElement:render)|-|Renders the element
|
||||||
|[VisualElement:setCursor](#VisualElement:setCursor)|-|Sets the cursor position
|
|[VisualElement:setCursor](#VisualElement:setCursor)|-|Sets the cursor position
|
||||||
|[VisualElement:textBg](#VisualElement:textBg)|-|Draws text with background color
|
|[VisualElement:textBg](#VisualElement:textBg)|-|Draws text with background color
|
||||||
@@ -169,6 +170,18 @@ Handles a mouse up event
|
|||||||
### Returns
|
### Returns
|
||||||
* `boolean` `release` Whether the element was released on the element
|
* `boolean` `release` Whether the element was released on the element
|
||||||
|
|
||||||
|
## VisualElement:multiBlit(x, y, width, height, text, fg, bg)
|
||||||
|
Draws multiple characters at once with colors
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
* `x` `number` The x position to draw
|
||||||
|
* `y` `number` The y position to draw
|
||||||
|
* `width` `number` The width of the area to draw
|
||||||
|
* `height` `number` The height of the area to draw
|
||||||
|
* `text` `string` The text to draw
|
||||||
|
* `fg` `string` The foreground color
|
||||||
|
* `bg` `string` The background color
|
||||||
|
|
||||||
## VisualElement:render()
|
## VisualElement:render()
|
||||||
Renders the element
|
Renders the element
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user