This commit is contained in:
NoryiE
2025-02-24 22:54:38 +00:00
parent c3f9dfa735
commit 47fef51a0c
21 changed files with 188 additions and 1114 deletions

View File

@@ -14,40 +14,23 @@ The base class for all UI elements in Basalt. This class provides basic properti
|Method|Returns|Description|
|---|---|---|
|[BaseElement.defineEvent](#BaseElement.defineEvent)|-|
|[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:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|Handles all events
|[BaseElement:fireEvent](#BaseElement:fireEvent)|table|Triggers an event and calls all registered callbacks
|[BaseElement:getBaseFrame](#BaseElement:getBaseFrame)|table|Returns the base frame of the element
|[BaseElement:handleEvent](#BaseElement:handleEvent)|boolean?|The default event handler for all events
|[BaseElement:init](#BaseElement:init)|table|Initializes the BaseElement instance
|[BaseElement:isType](#BaseElement:isType)|boolean|Checks if the element is a specific type
|[BaseElement:listenEvent](#BaseElement:listenEvent)|table|Enables or disables event listening for a specific event
|[BaseElement:postInit](#BaseElement:postInit)|table|Post initialization
|[BaseElement:registerCallback](#BaseElement:registerCallback)|table|Registers a callback function
|[BaseElement:updateRender](#BaseElement:updateRender)|-|Requests a render update for this element
## BaseElement.defineEvent()
## Protected Functions
## BaseElement.new(props, basalt)
Creates a new BaseElement instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `table` `The` newly created BaseElement instance
### Usage
```lua
local element = BaseElement.new()
```
## BaseElement.registerEventCallback()
|Method|Returns|Description|
|---|---|---|
|[BaseElement:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|Handles all events
|[BaseElement:handleEvent](#BaseElement:handleEvent)|boolean?|The default event handler for all events
|[BaseElement:init](#BaseElement:init)|table|Initializes the BaseElement instance
|[BaseElement:postInit](#BaseElement:postInit)|table|Post initialization
## BaseElement:destroy()
Destroys the element and cleans up all references
@@ -57,16 +40,6 @@ Destroys the element and cleans up all references
element:destroy()
```
## BaseElement:dispatchEvent(event...)
Handles all events
### Parameters
* `event` `string` The event to handle
* `...` *(vararg)* `any` The arguments for the event
### Returns
* `boolean?` `handled` Whether the event was handled
## BaseElement:fireEvent(event, ...)
Triggers an event and calls all registered callbacks
@@ -88,26 +61,6 @@ Returns the base frame of the element
### Returns
* `table` `BaseFrame` The base frame of the element
## BaseElement:handleEvent(event...)
The default event handler for all events
### Parameters
* `event` `string` The event to handle
* `...` *(vararg)* `any` The arguments for the event
### Returns
* `boolean?` `handled` Whether the event was handled
## BaseElement:init(props, basalt)
Initializes the BaseElement instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `table` `self` The initialized instance
## BaseElement:isType(type)
Checks if the element is a specific type
@@ -132,12 +85,6 @@ Enables or disables event listening for a specific event
element:listenEvent("mouse_click", true)
```
## BaseElement:postInit()
Post initialization
### Returns
* `table` `self` The BaseElement instance
## BaseElement:registerCallback(event, callback)
Registers a callback function for an event