Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview) - Pluginsystem to add/remove functionality - Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject - Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox - Removed the Animation Object, and added a animation plugin instead - Removed the Graphic Object and merged it's functionality with the image object - Updated currently existing objects
This commit is contained in:
13
docs/objects/Container/addObject.md
Normal file
13
docs/objects/Container/addObject.md
Normal file
@@ -0,0 +1,13 @@
|
||||
## addObject
|
||||
|
||||
### Description
|
||||
|
||||
Adds a object to the container
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `object` any object
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object which got added
|
||||
30
docs/objects/Container/getDeepObject.md
Normal file
30
docs/objects/Container/getDeepObject.md
Normal file
@@ -0,0 +1,30 @@
|
||||
## getDeepObject
|
||||
|
||||
### Description
|
||||
|
||||
Retrieves an object from the container or its descendants by its ID. This method searches recursively through all child containers to find the object.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `string` id - The ID of the object you want to retrieve.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object with the specified ID, or nil if no object with that ID is found.
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
local container = main:addFrame("container")
|
||||
local button = container:addButton("myButton")
|
||||
:setPosition(2, 2)
|
||||
:setText("My Button")
|
||||
-- Get the button object by its ID, searching through all containers
|
||||
local retrievedButton = main:getDeepObject("myButton")
|
||||
if retrievedButton then
|
||||
basalt.debug("Button found!")
|
||||
end
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
30
docs/objects/Container/getObject.md
Normal file
30
docs/objects/Container/getObject.md
Normal file
@@ -0,0 +1,30 @@
|
||||
## getObject
|
||||
|
||||
### Description
|
||||
|
||||
Retrieves an object from the container by its ID.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `string` id - The ID of the object you want to retrieve.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object with the specified ID, or nil if no object with that ID is found.
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
local button = main:addButton("myButton")
|
||||
:setPosition(2, 2)
|
||||
:setText("My Button")
|
||||
|
||||
-- Get the button object by its ID
|
||||
local retrievedButton = main:getObject("myButton")
|
||||
if retrievedButton then
|
||||
basalt.debug("Button found!")
|
||||
end
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
32
docs/objects/Container/removeFocusedObject.md
Normal file
32
docs/objects/Container/removeFocusedObject.md
Normal file
@@ -0,0 +1,32 @@
|
||||
## removeFocusedObject
|
||||
|
||||
### Description
|
||||
|
||||
Removes the focus from the currently focused object within the container. If no object is focused, this method has no effect.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
local container = main:addFrame()
|
||||
local inputField1 = container:addInputField()
|
||||
:setPosition(2, 2)
|
||||
local inputField2 = container:addInputField()
|
||||
:setPosition(2, 4)
|
||||
|
||||
container:setFocusedObject(inputField1)
|
||||
|
||||
main:addButton()
|
||||
:setPosition(2, 6)
|
||||
:setText("Remove focus from input fields")
|
||||
:onClick(function()
|
||||
container:removeFocusedObject()
|
||||
basalt.debug("Focus removed from input fields!")
|
||||
end)
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
37
docs/objects/Container/removeObject.md
Normal file
37
docs/objects/Container/removeObject.md
Normal file
@@ -0,0 +1,37 @@
|
||||
## removeObject
|
||||
|
||||
### Description
|
||||
|
||||
Removes an object from the container by its ID. If the object is not a direct child of the container, this method will not remove it.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `string` id - The ID of the object you want to retrieve.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `boolean` true if the object was removed
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
local container = main:addFrame("container")
|
||||
local button = container:addButton("removableButton")
|
||||
:setPosition(2, 2)
|
||||
:setText("Remove me")
|
||||
|
||||
main:addButton()
|
||||
:setPosition(2, 4)
|
||||
:setText("Remove the button above")
|
||||
:onClick(function()
|
||||
local removed = container:removeObject("removableButton")
|
||||
if removed then
|
||||
basalt.debug("Button removed!")
|
||||
else
|
||||
basalt.debug("Button not found!")
|
||||
end
|
||||
end)
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
38
docs/objects/Container/setFocusedObject.md
Normal file
38
docs/objects/Container/setFocusedObject.md
Normal file
@@ -0,0 +1,38 @@
|
||||
## setFocusedObject
|
||||
|
||||
### Description
|
||||
|
||||
Sets the focused object within the container. When an object is focused, it will receive keyboard events. Only one object can be focused at a time within a container.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `object` object - The object to set as the focused object.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
local container = main:addFrame()
|
||||
local inputField1 = container:addInput("inputField1")
|
||||
:setPosition(2, 2)
|
||||
local inputField2 = container:addInput("inputField2")
|
||||
:setPosition(2, 4)
|
||||
|
||||
main:addButton()
|
||||
:setPosition(2, 6)
|
||||
:setText("Focus on inputField1")
|
||||
:onClick(function()
|
||||
local focused = container:setFocusedObject(inputField1)
|
||||
if focused then
|
||||
basalt.debug("InputField1 is now focused!")
|
||||
else
|
||||
basalt.debug("Failed to set focus on InputField1!")
|
||||
end
|
||||
end)
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
36
docs/objects/Container/setImportant.md
Normal file
36
docs/objects/Container/setImportant.md
Normal file
@@ -0,0 +1,36 @@
|
||||
## setImportant
|
||||
|
||||
### Description
|
||||
|
||||
Sets the specified object as "important" within the container. This means the object will be reordered on the same z-index level, making it more important than other objects on the same level. This can be useful when you want to prioritize event handling or drawing order for specific objects.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `string` The object to set as important
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` the object in use
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
local container = main:addFrame()
|
||||
local inputField1 = container:addInput()
|
||||
:setPosition(2, 2)
|
||||
local inputField2 = container:addInput()
|
||||
:setPosition(2, 4)
|
||||
|
||||
inputField1:onKey(function(event, key)
|
||||
basalt.debug("InputField1 received key press: ", key)
|
||||
end)
|
||||
|
||||
inputField2:onKey(function(event, key)
|
||||
basalt.debug("InputField2 received key press: ", key)
|
||||
end)
|
||||
|
||||
container:setImportant(inputField1)
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
11
docs/objects/Container/sortElementOrder.md
Normal file
11
docs/objects/Container/sortElementOrder.md
Normal file
@@ -0,0 +1,11 @@
|
||||
## sortElementOrder
|
||||
|
||||
### Description
|
||||
|
||||
This function is called internally and automatically after objects are added or removed from the container. It sorts all objects by their z-index and the time they were added, ensuring the correct order is maintained. This is essential for proper event handling and drawing order of objects within the container.
|
||||
|
||||
As a user, you don't need to call this function directly, as it's automatically taken care of by the library.
|
||||
|
||||
### Usage
|
||||
|
||||
No direct usage example is provided since this function is called automatically by the library when needed.
|
||||
25
docs/objects/Container/updateZIndex.md
Normal file
25
docs/objects/Container/updateZIndex.md
Normal file
@@ -0,0 +1,25 @@
|
||||
## setFocusedObject
|
||||
|
||||
### Description
|
||||
|
||||
Updates the z-index of a specified object within the container. This is useful when you need to change the z-index of an object after it has been added to the container.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `object` The object whose z-index you want to update.
|
||||
2. `number` The new z-index value for the object.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local frame = basalt.createFrame()
|
||||
local button1 = frame:addButton():setZIndex(1)
|
||||
local button2 = frame:addButton():setZIndex(2)
|
||||
|
||||
-- Update button1's z-index to be above button2
|
||||
frame:updateZIndex(button1, 3)
|
||||
```
|
||||
Reference in New Issue
Block a user