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,19 +1,35 @@
## addKeywords
Adds keywords for special coloring
#### Parameteres:
1. `number|color` color of your choice
2. `table` a list of keywords which should be colored example: {"if", "else", "then", "while", "do"}
### Description
Adds keywords for special coloring in a Textfield object. This allows you to highlight specific words with a chosen color.
### Parameteres
1. `number|color` color - The color you want to apply to the keywords
2. `table` keywords - A list of keywords that should be colored, for example: {"if", "else", "then", "while", "do", "hello"}
### Returns
#### Returns:
1. `object` The object in use
#### Usage:
* Changes the color of some words to purple
### Usage
* Changes the color of specific words to purple in a Textfield object:
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield():addKeywords(colors.purple, {"if", "else", "then", "while", "do", "hello"})
local aTextfield = mainFrame:addTextfield()
aTextfield:addKeywords(colors.purple, {"if", "else", "then", "while", "do", "hello"})
basalt.autoUpdate()
```
In this example, a Textfield object is created and added to the mainFrame. The addKeywords method is called to add a list of keywords to be highlighted in purple color. The specified keywords are "if", "else", "then", "while", "do", and "hello".
```xml
<textfield>
<keywords>
@@ -27,4 +43,4 @@ local aTextfield = mainFrame:addTextfield():addKeywords(colors.purple, {"if", "e
</purple>
</keywords>
</textfield>
```
```

View File

@@ -1,24 +1,39 @@
## addLine
Adds a line on index position
#### Parameteres:
1. `string` text
2. `number` index
### Description
Adds a line to a Textfield object at a specified index position.
### Parameteres
1. `string` text - The text you want to add as a new line
2. `number` Optional - The position at which the new line should be added
### Returns
#### Returns:
1. `object` The object in use
#### Usage:
### Usage
* Adds a line
```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:addLine("Hello!", 1))
local basalt = require("basalt")
local mainFrame = basalt.createFrame("myFirstFrame")
local aTextfield = mainFrame:addTextfield("myFirstTextfield")
aTextfield:addLine("Hello, world!", 1)
basalt.autoUpdate()
```
In this example, a Textfield object is created and added to the mainFrame. The addLine method is then called to add a new line containing the text "Hello, world!" at the specified index position (1 in this case).
```xml
<textfield>
<lines>
<line>Hello!</line>
</lines>
</textfield>
```
```

View File

@@ -1,20 +1,36 @@
## addRule
Adds a new rule for special coloring
#### Parameteres:
1. `string` a pattern - check out this page: (https://riptutorial.com/lua/example/20315/lua-pattern-matching)
2. `number|color` text color
3. `number|color` background color - optional
### Description
Adds a new rule for special coloring in a Textfield object. This allows you to apply a specific color and/or background color to text matching a provided pattern.
### Parameteres
1. `string` pattern - A Lua pattern for matching the text you want to color. You can find more information about Lua patterns [here](https://riptutorial.com/lua/example/20315/lua-pattern-matching).
2. `number|color` textColor - The color you want to apply to the text matching the pattern
3. `number|color` backgroundColor - (optional) The background color you want to apply to the text matching the pattern
### Returns
#### Returns:
1. `object` The object in use
#### Usage:
* Changes the color of all numbers
### Usage
* Changes the color of all numbers in a Textfield object
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield():addRule("%d", colors.lightBlue)
local aTextfield = mainFrame:addTextfield()
aTextfield:addRule("%d", colors.lightBlue)
basalt.autoUpdate()
```
In this example, a Textfield object is created and added to the mainFrame. The `addRule` method is called to add a rule that highlights all numbers with a light blue color. The pattern used for matching numbers is `%d`.
```xml
<textfield>
<rules>
@@ -24,4 +40,4 @@ local aTextfield = mainFrame:addTextfield():addRule("%d", colors.lightBlue)
</rule>
</rules>
</textfield>
```
```

View File

@@ -1,17 +1,32 @@
## editLine
Edits the line on index position
#### Parameteres:
1. `number` index
2. `string` text
### Description
Edits the content of a line at the specified index position in a Textfield object.
### Parameteres
1. `number` index - The position of the line you want to edit
2. `string` text - The new content you want to set for the line
### Returns
#### Returns:
1. `object` The object in use
#### Usage:
* Edits the line
### Usage
* Edits the content of a line at a specific index:
```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:editLine(1, "Hello!"))
```
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:addLine("Original text", 1)
aTextfield:editLine(1, "Hello!")
basalt.autoUpdate()
```
In this example, a Textfield object is created and added to the mainFrame. A line with the content "Original text" is added at index position 1. The `editLine` method is then called to update the content of the line at index 1 to "Hello!".

View File

@@ -1,16 +1,33 @@
## getLine
Returns the line on index position
#### Parameteres:
1. `number` index
### Description
#### Returns:
1. `string` line
Returns the content of a line at the specified index position in a Textfield object.
### Parameteres
1. `number` index - The position of the line you want to retrieve
### Returns
1. `string` line - The content of the line at the specified index
### Usage
* Retrieves and prints the content of a line at a specific index:
#### Usage:
* Prints one line
```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getLine(1))
```
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:addLine("Hello, world!", 1)
local lineContent = aTextfield:getLine(1)
basalt.debug(lineContent)
basalt.autoUpdate()
```
In this example, a Textfield object is created and added to the mainFrame. A line with the content "Hello, world!" is added at index position 1. The `getLine` method is then called to retrieve the content of the line at index 1, which is then printed using `basalt.debug`.

View File

@@ -1,13 +1,30 @@
## getLines
Returns all lines
#### Returns:
1. `table` lines
### Description
Returns all lines in a Textfield object as a table.
### Returns
1. `table` lines - A table containing all the lines in the Textfield
### Usage
* Retrieves and prints all lines in a Textfield:
#### Usage:
* Prints all lines
```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getLines())
```
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:addLine("Hello, world!", 1)
aTextfield:addLine("This is a test.", 2)
local allLines = aTextfield:getLines()
basalt.debug(allLines)
basalt.autoUpdate()
```
In this example, a Textfield object is created and added to the mainFrame. Two lines with content "Hello, world!" and "This is a test." are added at index positions 1 and 2, respectively. The `getLines` method is then called to retrieve all lines in the Textfield as a table, which is then printed using `basalt.debug`.

View File

@@ -1,6 +1,28 @@
## getTextCursor
Gets text cursor position
#### Returns:
1. `number` x position
2. `number` y position
### Description
Gets the current text cursor position within the Textfield object.
### Returns
1. `number` x position - The X (horizontal) position of the text cursor
2. `number` y position - The Y (vertical) position of the text cursor
### Usage
* Retrieves and prints the text cursor position in a Textfield:
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame():show()
local aTextfield = mainFrame:addTextfield():show()
local x, y = aTextfield:getTextCursor()
basalt.debug("Text cursor position: X:", x, "Y:", y)
basalt.autoUpdate()
```
In this example, a Textfield object is created and added to the mainFrame. The `getTextCursor` method is then called to retrieve the current text cursor position as X and Y coordinates, which are then printed using `basalt.debug`.

View File

@@ -1,17 +1,44 @@
## removeLine
Removes the line on index position
#### Parameteres:
1. `number` index
2. `string` text
### Description
Removes the line at the specified index position within the Textfield object.
### Parameteres
1. `number` index - The index of the line you want to remove
### Returns
#### Returns:
1. `object` The object in use
#### Usage:
### Usage
* Removes a line
```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:removeLine())
```
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:addLine("Line to be removed", 1)
aTextfield:addLine("Line that stays", 2)
basalt.debug("Before removing the line:")
basalt.debug(aTextfield:getLines())
for k,v in pairs(aTextfield:getLines())do
basalt.debug(v)
end
aTextfield:removeLine(1)
basalt.debug("After removing the line:")
for k,v in pairs(aTextfield:getLines())do
basalt.debug(v)
end
basalt.autoUpdate()
```
In this example, a Textfield object is created and added to the mainFrame. Two lines are added to the Textfield, then the `removeLine` method is called to remove the first line by specifying its index. The `getLines` method is used to print the lines before and after the removal.