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:
@@ -1,17 +1,24 @@
|
||||
## addItem
|
||||
Adds a item into the list
|
||||
|
||||
#### Parameters:
|
||||
### Description
|
||||
|
||||
Adds a item into the list.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `string` The entry name
|
||||
2. `number|color` unique default background color - optional
|
||||
3. `number|color` unique default text color - optional
|
||||
4. `any` any value - you could access this later in a :onChange() event (you need to use :getValue()) - optional
|
||||
4. `any` any value - can be accessed later in an :onChange() event (needs to use :getValue()) - optional
|
||||
|
||||
#### Returns
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
@@ -19,10 +26,11 @@ aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
```
|
||||
|
||||
```xml
|
||||
<list>
|
||||
<item><text>1. Entry</text></item>
|
||||
<item><text>2. Entry</text><bg>yellow</bg></item>
|
||||
<item><text>3. Entry</text><bg>yellow</bg><fg>green</fg></item>
|
||||
</list>
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
## clear
|
||||
Removes all items.
|
||||
|
||||
#### Returns:
|
||||
### Description
|
||||
|
||||
Removes all items from the list.
|
||||
|
||||
#### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and removes them immediatley. Which makes no sense.
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries and removes them immediately.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("2. Entry", colors.yellow)
|
||||
aList:addItem("3. Entry", colors.yellow, colors.green)
|
||||
aList:clear()
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
## editItem
|
||||
Edits a item from the list
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should be edited
|
||||
### Description
|
||||
|
||||
Edits an item in the list.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `number` The index of the item to be edited
|
||||
2. `string` The new item name
|
||||
3. `number` the new item background color - optional
|
||||
4. `number` The new item text color - optional
|
||||
3. `number|color` The new item background color - optional
|
||||
4. `number|color` The new item text color - optional
|
||||
5. `any` New additional information - optional
|
||||
|
||||
#### Returns:
|
||||
#### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries and edits the second one.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("2. Entry", colors.yellow)
|
||||
aList:addItem("3. Entry", colors.yellow, colors.green)
|
||||
aList:editItem(2, "Still 2. Entry", colors.red)
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
## getAll
|
||||
Returns all items as table
|
||||
|
||||
#### Returns:
|
||||
### Description
|
||||
|
||||
Returns all items as a table.
|
||||
|
||||
#### Returns
|
||||
|
||||
1. `table` All items
|
||||
|
||||
#### Usage:
|
||||
* Creates a default menubar with 3 entries and prints a table.
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries and prints a table.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("2. Entry", colors.yellow)
|
||||
aList:addItem("3. Entry", colors.yellow, colors.green)
|
||||
basalt.debug(aList:getAll())
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
## getItem
|
||||
Returns a item by index
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should be returned
|
||||
### Description
|
||||
|
||||
#### Returns:
|
||||
1. `table` The item table example: {text="1. Entry", bgCol=colors.black, fgCol=colors.white}
|
||||
Returns an item by index.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `number` The index of the item to be returned
|
||||
|
||||
#### Returns
|
||||
|
||||
1. `table` The item table, for example: {text="1. Entry", bgCol=colors.black, fgCol=colors.white, args={}}
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries and retrieves the second one.
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and edits the second one.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("2. Entry", colors.yellow)
|
||||
aList:addItem("3. Entry", colors.yellow, colors.green)
|
||||
basalt.debug(aList:getItem(2).text)
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
## getItemCount
|
||||
Returns the current item count
|
||||
|
||||
#### Returns:
|
||||
### Description
|
||||
|
||||
Returns the current item count.
|
||||
|
||||
#### Returns
|
||||
|
||||
1. `number` The item list count
|
||||
|
||||
#### Usage:
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries and prints the current item count.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("2. Entry", colors.yellow)
|
||||
aList:addItem("3. Entry", colors.yellow, colors.green)
|
||||
basalt.debug(aList:getItemCount())
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
## getItemIndex
|
||||
returns the item index of the currently selected item
|
||||
|
||||
#### Returns:
|
||||
### Description
|
||||
|
||||
Returns the item index of the currently selected item.
|
||||
|
||||
#### Returns
|
||||
|
||||
1. `number` The current index
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries selects the second entry and prints the currently selected index.
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries and removes the second one.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("2. Entry", colors.yellow)
|
||||
aList:addItem("3. Entry", colors.yellow, colors.green)
|
||||
aList:selectItem(2)
|
||||
basalt.debug(aList:getItemIndex())
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
## getOffset
|
||||
Returns the current index offset
|
||||
|
||||
#### Returns:
|
||||
### Description
|
||||
|
||||
Returns the current index offset.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `number` offset value
|
||||
|
||||
#### Usage:
|
||||
### Usage
|
||||
|
||||
* Creates a default dropdown with 6 entries and sets the offset to 3, also prints the current offset.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
@@ -19,4 +25,4 @@ local aList = mainFrame:addList()
|
||||
:addItem("8. Entry")
|
||||
:setOffset(3)
|
||||
basalt.debug(aList:getOffset())
|
||||
```
|
||||
```
|
||||
|
||||
27
docs/objects/List/getSelectionColor.md
Normal file
27
docs/objects/List/getSelectionColor.md
Normal file
@@ -0,0 +1,27 @@
|
||||
## getSelectionColor
|
||||
|
||||
### Description
|
||||
|
||||
Returns the background and text colors of the currently selected item.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `number|color` The background color which should be used
|
||||
2. `number|color` The text color which should be used
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 4 entries, sets the selection colors, and then retrieves and prints the selection colors.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("4. Entry")
|
||||
aList:setSelectionColor(colors.green, colors.red)
|
||||
|
||||
local selectionBG, selectionFG = aList:getSelectionColor()
|
||||
basalt.debug(selectionBG, selectionFG)
|
||||
```
|
||||
26
docs/objects/List/isSelectionColorActive.md
Normal file
26
docs/objects/List/isSelectionColorActive.md
Normal file
@@ -0,0 +1,26 @@
|
||||
## isSelectionColorActive
|
||||
|
||||
### Description
|
||||
|
||||
Checks if the selection color is active or not.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `boolean` true if selection color is active, false otherwise.
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 4 entries, sets the selection colors, and then checks if the selection color is active.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("4. Entry")
|
||||
aList:setSelectionColor(colors.green, colors.red)
|
||||
|
||||
local isActive = aList:isSelectionColorActive()
|
||||
basalt.debug(isActive)
|
||||
```
|
||||
@@ -1,19 +1,26 @@
|
||||
## removeItem
|
||||
Removes a item from the list
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should get removed
|
||||
### Description
|
||||
|
||||
Removes an item from the list.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `number` The index of the item to be removed
|
||||
|
||||
#### Returns
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries and removes the second one.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("2. Entry", colors.yellow)
|
||||
aList:addItem("3. Entry", colors.yellow, colors.green)
|
||||
aList:removeItem(2)
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
## selectItem
|
||||
selects a item in the list (same as a player would click on a item)
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should get selected
|
||||
### Description
|
||||
|
||||
Selects an item in the list (same as a user would click on an item).
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `number` The index of the item that should be selected
|
||||
|
||||
#### Returns
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and selects the second entry.
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 3 entries and selects the second entry
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("2. Entry", colors.yellow)
|
||||
aList:addItem("3. Entry", colors.yellow, colors.green)
|
||||
aList:selectItem(2)
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
## setOffset
|
||||
Sets the offset of the list (the same as you would scroll) - default is 0
|
||||
|
||||
#### Parameters:
|
||||
### Description
|
||||
|
||||
Sets the offset of the list (the same as you would scroll) - default is 0.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `number` The offset value
|
||||
|
||||
#### Returns:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 6 entries and sets the offset to 3.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
@@ -20,6 +27,7 @@ local aList = mainFrame:addList()
|
||||
:addItem("6. Entry")
|
||||
:setOffset(3)
|
||||
```
|
||||
|
||||
```xml
|
||||
<list offset="3">
|
||||
<item><text>1. Entry</text></item>
|
||||
@@ -29,4 +37,4 @@ local aList = mainFrame:addList()
|
||||
<item><text>5. Entry</text></item>
|
||||
<item><text>6. Entry</text></item>
|
||||
</list>
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
## setScrollable
|
||||
Makes it possible to scroll while the mouse is over the list
|
||||
|
||||
#### Parameters:
|
||||
### Description
|
||||
|
||||
Makes it possible to scroll while the mouse is over the list.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `boolean` If the list should be scrollable or not
|
||||
|
||||
#### Returns:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a new list and makes it scrollable
|
||||
### Usage
|
||||
|
||||
* Creates a new list and makes it scrollable.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList():setScrollable(true)
|
||||
@@ -23,6 +30,7 @@ local aList = mainFrame:addList():setScrollable(true)
|
||||
:addItem("9. Entry")
|
||||
|
||||
```
|
||||
|
||||
```xml
|
||||
<dropdown scrollable="true">
|
||||
<item><text>1. Entry</text></item>
|
||||
@@ -35,4 +43,4 @@ local aList = mainFrame:addList():setScrollable(true)
|
||||
<item><text>8. Entry</text></item>
|
||||
<item><text>9. Entry</text></item>
|
||||
</dropdown>
|
||||
```
|
||||
```
|
||||
|
||||
36
docs/objects/List/setSelectionColor.md
Normal file
36
docs/objects/List/setSelectionColor.md
Normal file
@@ -0,0 +1,36 @@
|
||||
## setSelectionColor
|
||||
|
||||
### Description
|
||||
|
||||
Sets the background and the foreground of the item which is currently selected.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `number|color` The background color which should be used
|
||||
2. `number|color` The text color which should be used
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default list with 4 entries and sets the selection background color to green and text color to red.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:addItem("4. Entry")
|
||||
aList:setSelectedItem(colors.green, colors.red)
|
||||
```
|
||||
|
||||
```xml
|
||||
<list selectionBG="green" selectionFG="red">
|
||||
<item><text>1. Entry</text></item>
|
||||
<item><text>2. Entry</text><bg>yellow</bg></item>
|
||||
<item><text>2. Entry</text><bg>yellow</bg><fg>green</fg></item>
|
||||
</list>
|
||||
```
|
||||
Reference in New Issue
Block a user