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:
Robert Jelic
2023-04-30 17:05:34 +02:00
parent e086c1abb2
commit bb1b1beb79
341 changed files with 15541 additions and 3862 deletions

View File

@@ -1,24 +1,12 @@
Dropdowns are objects where the user can click on a button, this will open a list where the user can choose from.
Dropdowns are objects where the user can click on a button, which opens a list from which the user can choose an item.
[Object](objects/Object.md) methods also apply for dropdowns.
List Object methods also apply for dropdowns.
In addition to the Object, VisualObject and List methods, Dropdowns also have the following methods:
| | |
|---|---|
|[addItem](objects/Dropdown/addItem.md)|Adds a new item into the list
|[removeItem](objects/Dropdown/removeItem.md)|Removes a item from the list
|[editItem](objects/Dropdown/editItem.md)|Changes a already existing item in the list
|[getItem](objects/Dropdown/getItem.md)|Returns a item by its index
|[getItemCount](objects/Dropdown/getItemCount.md)|Returns the item count
|[getAll](objects/Dropdown/getAll.md)|Returns the entire list as a table
|[selectItem](objects/Dropdown/selectItem.md)|Selects a item
|[clear](objects/Dropdown/clear.md)|Makes the entire list empty
|[getItemIndex](objects/Dropdown/getItemIndex.md)|Returns the currently active item index
|[setSelectedItem](objects/Dropdown/setSelectedItem.md)|Changes the default bg and fg, when the user selects a item
|[setOffset](objects/Dropdown/setOffset.md)|Changes the list offset
|[getOffset](objects/Dropdown/getOffset.md)|Returns the current offset
|[setDropdownSize](objects/Dropdown/setDropdownSize.md)|Changes the dropdown size
A item-table in dropdowns looks like the following example:
```lua
@@ -28,4 +16,33 @@ item = {
fgCol=colors.white -- the foreground color
args = {} -- custom args you want to pass, which you will be able to access in for example onChange events
}
```
```
Here's an example of how to create a fully functional dropdown using the Dropdown object:
Lua:
```lua
local main = basalt.createFrame()
local aDropdown = main:addDropdown()
aDropdown:addItem("Item 1")
aDropdown:addItem("Item 2", colors.yellow)
aDropdown:addItem("Item 3", colors.yellow, colors.green)
aDropdown:onChange(function(self, item)
basalt.debug("Selected item: ", item.text)
end)
```
XML:
```xml
<dropdown>
<item><text>Item 1</text></item>
<item><text>Item 2</text><bg>yellow</bg></item>
<item><text>Item 3</text><bg>yellow</bg><fg>green</fg></item>
<onChange>
basalt.debug("Selected item: ", item.text)
</onChange>
</dropdown>
```