deploy: e10d3c1ae8
This commit is contained in:
@@ -2,28 +2,3 @@
|
||||
_The Bar Chart element is designed for visualizing data series as vertical bars. It displays multiple values as side-by-side bars where each bar's height represents its value._
|
||||
|
||||
Extends: `Graph`
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[BarChart.new](#barchart-new)|BarChart|Creates a new BarChart instance|
|
||||
|[BarChart:init](#barchart-init-props-basalt)|BarChart|Initializes the BarChart instance|
|
||||
|[BarChart:render](#barchart-render)|-|Renders the BarChart|
|
||||
|
||||
## BarChart.new()
|
||||
|
||||
Creates a new BarChart instance
|
||||
|
||||
### Returns
|
||||
* `BarChart` `self` The newly created BarChart instance
|
||||
|
||||
## BarChart:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `BarChart` `self` The initialized instance
|
||||
|
||||
## BarChart:render()
|
||||
@@ -19,15 +19,10 @@ Extends: `PropertySystem`
|
||||
|---|---|---|
|
||||
|[BaseElement.defineEvent](#baseelement-defineevent-class-eventname-requiredevent)|-|Registers a new event listener for the element (on class level)|
|
||||
|[BaseElement.registerEventCallback](#baseelement-registereventcallback-class-callbackname-string)|-|Registers a new event callback for the element (on class level)|
|
||||
|[BaseElement.new](#baseelement-new)|table|Creates a new BaseElement instance|
|
||||
|[BaseElement:init](#baseelement-init-props-basalt)|table|Initializes the BaseElement instance|
|
||||
|[BaseElement:postInit](#baseelement-postinit)|table|Post initialization|
|
||||
|[BaseElement:isType](#baseelement-istype-type)|boolean|Checks if the element is a specific type|
|
||||
|[BaseElement:listenEvent](#baseelement-listenevent-eventname-enable)|table|Enables or disables event listening for a specific event|
|
||||
|[BaseElement:registerCallback](#baseelement-registercallback-event-callback)|table|Registers a callback function|
|
||||
|[BaseElement:fireEvent](#baseelement-fireevent-event-any)|table|Triggers an event and calls all registered callbacks|
|
||||
|[BaseElement:dispatchEvent](#baseelement-dispatchevent-event)|handled|Handles all events|
|
||||
|[BaseElement:handleEvent](#baseelement-handleevent-event)|handled|The default event handler for all events|
|
||||
|[BaseElement:onChange](#baseelement-onchange-property-callback)|table|Observes a property and calls a callback when it changes|
|
||||
|[BaseElement:getBaseFrame](#baseelement-getbaseframe)|BaseFrame|Returns the base frame of the element|
|
||||
|[BaseElement:destroy](#baseelement-destroy)|-|Destroys the element and cleans up all references|
|
||||
@@ -51,22 +46,6 @@ Registers a new event callback for the element (on class level)
|
||||
* `callbackName` `string` The name of the callback to register
|
||||
* `string` `The` names of the events to register the callback for
|
||||
|
||||
## BaseElement.new()
|
||||
### Returns
|
||||
* `table` `The` newly created BaseElement instance
|
||||
|
||||
## BaseElement:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `table` `self` The initialized instance
|
||||
|
||||
## BaseElement:postInit()
|
||||
### Returns
|
||||
* `table` `self` The BaseElement instance
|
||||
|
||||
## BaseElement:isType(type)
|
||||
|
||||
Checks if the element is a specific type
|
||||
@@ -110,20 +89,6 @@ Triggers an event and calls all registered callbacks
|
||||
### Returns
|
||||
* `table` `self` The BaseElement instance
|
||||
|
||||
## BaseElement:dispatchEvent(event)
|
||||
### Parameters
|
||||
* `event` `string` The event to handle
|
||||
|
||||
### Returns
|
||||
* `handled` `Whether` the event was handled
|
||||
|
||||
## BaseElement:handleEvent(event)
|
||||
### Parameters
|
||||
* `event` `string` The event to handle
|
||||
|
||||
### Returns
|
||||
* `handled` `Whether` the event was handled
|
||||
|
||||
## BaseElement:onChange(property, callback)
|
||||
|
||||
Observes a property and calls a callback when it changes
|
||||
|
||||
@@ -13,81 +13,7 @@ Extends: `Container`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[BaseFrame.new](#baseframe-new)|BaseFrame|Creates a new Frame instance|
|
||||
|[BaseFrame:init](#baseframe-init-props-basalt)|table|Initializes the Frame instance|
|
||||
|[BaseFrame:multiBlit](#baseframe-multiblit-x-y-width-height-text-fg-bg)|-|Renders a multiBlit to the render Object|
|
||||
|[BaseFrame:textFg](#baseframe-textfg-x-y-text-fg)|-|Renders a text with a foreground color to the render Object|
|
||||
|[BaseFrame:textBg](#baseframe-textbg-x-y-text-bg)|-|Renders a text with a background color to the render Object|
|
||||
|[BaseFrame:drawText](#baseframe-drawtext-x-y-text-bg)|-|Renders a text with a background color to the render Object|
|
||||
|[BaseFrame:blit](#baseframe-blit-x-y-text-fg-bg)|-|Renders a text with a foreground and background color to the render Object|
|
||||
|[BaseFrame:setCursor](#baseframe-setcursor-x-y-blink)|-|Sets the cursor position|
|
||||
|[BaseFrame:monitor_touch](#baseframe-monitor-touch-name-x-y)|-|Handles monitor touch events|
|
||||
|[BaseFrame:mouse_click](#baseframe-mouse-click-button-x-y)|-|Handles mouse click events|
|
||||
|[BaseFrame:mouse_up](#baseframe-mouse-up-button-x-y)|-|Handles mouse up events|
|
||||
|[BaseFrame:term_resize](#baseframe-term-resize)|-|Resizes the Frame|
|
||||
|[BaseFrame:key](#baseframe-key-key)|-|Handles key events|
|
||||
|[BaseFrame:key_up](#baseframe-key-up-key)|-|Handles key up events|
|
||||
|[BaseFrame:char](#baseframe-char-char)|-|Handles character events|
|
||||
|[BaseFrame:render](#baseframe-render)|-|Renders the Frame|
|
||||
|
||||
## BaseFrame.new()
|
||||
|
||||
Creates a new Frame instance
|
||||
|
||||
### Returns
|
||||
* `BaseFrame` `object` The newly created Frame instance
|
||||
|
||||
### Usage
|
||||
```lua
|
||||
local element = BaseFrame.new()
|
||||
```
|
||||
|
||||
## BaseFrame:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `table` `self` The initialized instance
|
||||
|
||||
## BaseFrame:multiBlit(x, y, width, height, text, fg, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to render to
|
||||
* `y` `number` The y position to render to
|
||||
* `width` `number` The width of the text
|
||||
* `height` `number` The height of the text
|
||||
* `text` `string` The text to render
|
||||
* `fg` `string` The foreground color
|
||||
* `bg` `string` The background color
|
||||
|
||||
## BaseFrame:textFg(x, y, text, fg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to render to
|
||||
* `y` `number` The y position to render to
|
||||
* `text` `string` The text to render
|
||||
* `fg` `colors` The foreground color
|
||||
|
||||
## BaseFrame:textBg(x, y, text, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to render to
|
||||
* `y` `number` The y position to render to
|
||||
* `text` `string` The text to render
|
||||
* `bg` `colors` The background color
|
||||
|
||||
## BaseFrame:drawText(x, y, text, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to render to
|
||||
* `y` `number` The y position to render to
|
||||
* `text` `string` The text to render
|
||||
* `bg` `colors` The background color
|
||||
|
||||
## BaseFrame:blit(x, y, text, fg, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to render to
|
||||
* `y` `number` The y position to render to
|
||||
* `text` `string` The text to render
|
||||
* `fg` `string` The foreground color
|
||||
* `bg` `string` The background color
|
||||
|
||||
## BaseFrame:setCursor(x, y, blink)
|
||||
|
||||
@@ -97,36 +23,3 @@ Sets the cursor position
|
||||
* `x` `number` The x position to set the cursor to
|
||||
* `y` `number` The y position to set the cursor to
|
||||
* `blink` `boolean` Whether the cursor should blink
|
||||
|
||||
## BaseFrame:monitor_touch(name, x, y)
|
||||
### Parameters
|
||||
* `name` `string` The name of the monitor that was touched
|
||||
* `x` `number` The x position of the mouse
|
||||
* `y` `number` The y position of the mouse
|
||||
|
||||
## BaseFrame:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the mouse
|
||||
* `y` `number` The y position of the mouse
|
||||
|
||||
## BaseFrame:mouse_up(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was released
|
||||
* `x` `number` The x position of the mouse
|
||||
* `y` `number` The y position of the mouse
|
||||
|
||||
## BaseFrame:term_resize()
|
||||
## BaseFrame:key(key)
|
||||
### Parameters
|
||||
* `key` `number` The key that was pressed
|
||||
|
||||
## BaseFrame:key_up(key)
|
||||
### Parameters
|
||||
* `key` `number` The key that was released
|
||||
|
||||
## BaseFrame:char(char)
|
||||
### Parameters
|
||||
* `char` `string` The character that was pressed
|
||||
|
||||
## BaseFrame:render()
|
||||
@@ -9,22 +9,3 @@ Extends: `VisualElement`
|
||||
|---|---|---|---|
|
||||
|text|string|BigFont|BigFont text|
|
||||
|fontSize|number|1|The font size of the BigFont|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[BigFont.new](#bigfont-new)|table|Creates a new BigFont instance|
|
||||
|[BigFont:init](#bigfont-init-props-basalt)|-|Initializes the BigFont instance|
|
||||
|[BigFont:render](#bigfont-render)|-|Renders the BigFont|
|
||||
|
||||
## BigFont.new()
|
||||
### Returns
|
||||
* `table` `self` The created instance
|
||||
|
||||
## BigFont:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## BigFont:render()
|
||||
@@ -8,22 +8,3 @@ Extends: `VisualElement`
|
||||
|Property|Type|Default|Description|
|
||||
|---|---|---|---|
|
||||
|text|string|Button|Button text|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Button.new](#button-new)|table|Creates a new Button instance|
|
||||
|[Button:init](#button-init-props-basalt)|-|Initializes the Button instance|
|
||||
|[Button:render](#button-render)|-|Renders the Button|
|
||||
|
||||
## Button.new()
|
||||
### Returns
|
||||
* `table` `self` The created instance
|
||||
|
||||
## Button:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## Button:render()
|
||||
@@ -11,32 +11,3 @@ Extends: `VisualElement`
|
||||
|text|string|empty|Text to display|
|
||||
|checkedText|string|Text|when checked|
|
||||
|autoSize|boolean|true|Whether to automatically size the checkbox|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Checkbox.new](#checkbox-new)|Checkbox|Creates a new Checkbox instance|
|
||||
|[Checkbox:init](#checkbox-init-props-basalt)|-|Initializes the Checkbox instance|
|
||||
|[Checkbox:mouse_click](#checkbox-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[Checkbox:render](#checkbox-render)|-|Renders the Checkbox|
|
||||
|
||||
## Checkbox.new()
|
||||
### Returns
|
||||
* `Checkbox` `self` The created instance
|
||||
|
||||
## Checkbox:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## Checkbox:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `Clicked` Whether the event was handled
|
||||
|
||||
## Checkbox:render()
|
||||
@@ -24,16 +24,11 @@ Extends: `Dropdown`
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[ComboBox.new](#combobox-new)|ComboBox|Creates a new ComboBox instance|
|
||||
|[ComboBox:init](#combobox-init-props-basalt)|ComboBox|Initializes the ComboBox instance|
|
||||
|[ComboBox:setText](#combobox-settext-text)|ComboBox|Sets the text content|
|
||||
|[ComboBox:getText](#combobox-gettext)|string|Gets the text content|
|
||||
|[ComboBox:setEditable](#combobox-seteditable-editable)|ComboBox|Sets editable state|
|
||||
|[ComboBox:getFilteredItems](#combobox-getfiltereditems)|-|Filters items for auto-complete|
|
||||
|[ComboBox:updateFilteredDropdown](#combobox-updatefiltereddropdown)|-|Updates dropdown with filtered items|
|
||||
|[ComboBox:updateViewport](#combobox-updateviewport)|-|Updates the viewport|
|
||||
|[ComboBox:char](#combobox-char-char)|-|Handles character input|
|
||||
|[ComboBox:key](#combobox-key-key-held)|-|Handles key input|
|
||||
|[ComboBox:mouse_click](#combobox-mouse-click-button-x-y)|boolean|Handles mouse clicks|
|
||||
|[ComboBox:render](#combobox-render)|-|Renders the ComboBox|
|
||||
|[ComboBox:focus](#combobox-focus)|-|Called when gaining focus|
|
||||
|[ComboBox:blur](#combobox-blur)|-|Called when losing focus|
|
||||
@@ -45,14 +40,6 @@ Creates a new ComboBox instance
|
||||
### Returns
|
||||
* `ComboBox` `self` The newly created ComboBox instance
|
||||
|
||||
## ComboBox:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `ComboBox` `self` The initialized instance
|
||||
|
||||
## ComboBox:setText(text)
|
||||
|
||||
Sets the text content of the ComboBox
|
||||
@@ -80,15 +67,6 @@ Sets whether the ComboBox is editable
|
||||
### Returns
|
||||
* `ComboBox` self
|
||||
|
||||
## ComboBox:getFilteredItems()
|
||||
|
||||
Filters items based on current text for auto-complete
|
||||
|
||||
## ComboBox:updateFilteredDropdown()
|
||||
|
||||
Updates the dropdown with filtered items
|
||||
|
||||
## ComboBox:updateViewport()
|
||||
## ComboBox:char(char)
|
||||
|
||||
Handles character input when editable
|
||||
@@ -104,18 +82,6 @@ Handles key input when editable
|
||||
* `key` `number` The key code that was pressed
|
||||
* `held` `boolean` Whether the key is being held
|
||||
|
||||
## ComboBox:mouse_click(button, x, y)
|
||||
|
||||
Handles mouse clicks
|
||||
|
||||
### Parameters
|
||||
* `button` `number` The mouse button (1 = left, 2 = right, 3 = middle)
|
||||
* `x` `number` The x coordinate of the click
|
||||
* `y` `number` The y coordinate of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## ComboBox:render()
|
||||
|
||||
Renders the ComboBox
|
||||
|
||||
@@ -22,8 +22,6 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Container.new](#container-new)|Container|Creates a new Container instance|
|
||||
|[Container:init](#container-init-props-basalt)|-|Initializes the Container instance|
|
||||
|[Container:isChildVisible](#container-ischildvisible-child)|boolean|Returns whether a child is visible|
|
||||
|[Container:addChild](#container-addchild-child)|Container|Adds a child to the container|
|
||||
|[Container:clear](#container-clear)|Container|Clears the container|
|
||||
@@ -36,34 +34,6 @@ Extends: `VisualElement`
|
||||
|[Container:removeChild](#container-removechild-child)|Container|Removes a child from the container|
|
||||
|[Container:getChild](#container-getchild-path)|self|Removes a child from the container|
|
||||
|[Container:callChildrenEvent](#container-callchildrenevent-visibleonly-event)|boolean, child|Calls a event on all children|
|
||||
|[Container:handleEvent](#container-handleevent-event)|boolean|Default handler for events|
|
||||
|[Container:mouse_click](#container-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[Container:mouse_up](#container-mouse-up-button-x-y)|boolean|Handles mouse up events|
|
||||
|[Container:mouse_release](#container-mouse-release-button-x-y)|-|Handles mouse release events|
|
||||
|[Container:mouse_move](#container-mouse-move---x-y)|boolean|Handles mouse move events|
|
||||
|[Container:mouse_drag](#container-mouse-drag-button-x-y)|boolean|Handles mouse drag events|
|
||||
|[Container:mouse_scroll](#container-mouse-scroll-direction-x-y)|boolean|Handles mouse scroll events|
|
||||
|[Container:key](#container-key-key)|boolean|Handles key events|
|
||||
|[Container:char](#container-char-char)|boolean|Handles char events|
|
||||
|[Container:key_up](#container-key-up-key)|boolean|Handles key up events|
|
||||
|[Container:multiBlit](#container-multiblit-x-y-width-height-text-fg-bg)|Container|Draws multiple lines of text, fg and bg strings|
|
||||
|[Container:textFg](#container-textfg-x-y-text-fg)|Container|Draws a line of text and fg as color|
|
||||
|[Container:textBg](#container-textbg-x-y-text-bg)|Container|Draws a line of text and bg as color|
|
||||
|[Container:blit](#container-blit-x-y-text-fg-bg)|Container|Draws a line of text and fg and bg as colors|
|
||||
|[Container:render](#container-render)|-|Renders the container|
|
||||
|[Container:destroy](#container-destroy)|-||
|
||||
|
||||
## Container.new()
|
||||
|
||||
Creates a new Container instance
|
||||
|
||||
### Returns
|
||||
* `Container` `self` The new container instance
|
||||
|
||||
## Container:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## Container:isChildVisible(child)
|
||||
|
||||
@@ -182,129 +152,3 @@ Calls a event on all children
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
* `child` `The` child that handled the event
|
||||
|
||||
## Container:handleEvent(event)
|
||||
### Parameters
|
||||
* `event` `string` The event to handle
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:mouse_up(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:mouse_release(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
## Container:mouse_move(_, x, y)
|
||||
### Parameters
|
||||
* `_` `number` unknown
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:mouse_drag(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The direction of the scroll
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:key(key)
|
||||
### Parameters
|
||||
* `key` `number` The key that was pressed
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:char(char)
|
||||
### Parameters
|
||||
* `char` `string` The character that was pressed
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:key_up(key)
|
||||
### Parameters
|
||||
* `key` `number` The key that was released
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Container:multiBlit(x, y, width, height, text, fg, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to draw the text
|
||||
* `y` `number` The y position to draw the text
|
||||
* `width` `number` The width of the text
|
||||
* `height` `number` The height of the text
|
||||
* `text` `string` The text to draw
|
||||
* `fg` `string` The foreground color of the text
|
||||
* `bg` `string` The background color of the text
|
||||
|
||||
### Returns
|
||||
* `Container` `self` The container instance
|
||||
|
||||
## Container:textFg(x, y, text, fg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to draw the text
|
||||
* `y` `number` The y position to draw the text
|
||||
* `text` `string` The text to draw
|
||||
* `fg` `color` The foreground color of the text
|
||||
|
||||
### Returns
|
||||
* `Container` `self` The container instance
|
||||
|
||||
## Container:textBg(x, y, text, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to draw the text
|
||||
* `y` `number` The y position to draw the text
|
||||
* `text` `string` The text to draw
|
||||
* `bg` `color` The background color of the text
|
||||
|
||||
### Returns
|
||||
* `Container` `self` The container instance
|
||||
|
||||
## Container:blit(x, y, text, fg, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to draw the text
|
||||
* `y` `number` The y position to draw the text
|
||||
* `text` `string` The text to draw
|
||||
* `fg` `string` The foreground color of the text
|
||||
* `bg` `string` The background color of the text
|
||||
|
||||
### Returns
|
||||
* `Container` `self` The container instance
|
||||
|
||||
## Container:render()
|
||||
## Container:destroy()
|
||||
@@ -7,20 +7,8 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Display.new](#display-new)|table|Creates a new Display instance|
|
||||
|[Display:init](#display-init-props-basalt)|-|Initializes the Display instance|
|
||||
|[Display:getWindow](#display-getwindow)|table|Returns the current window object|
|
||||
|[Display:write](#display-write-x-y-text-fg-bg)|Display|Writes text to the display|
|
||||
|[Display:render](#display-render)|-|Renders the Display|
|
||||
|
||||
## Display.new()
|
||||
### Returns
|
||||
* `table` `self` The created instance
|
||||
|
||||
## Display:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## Display:getWindow()
|
||||
|
||||
@@ -42,5 +30,3 @@ Writes text to the display at the given position with the given foreground and b
|
||||
|
||||
### Returns
|
||||
* `Display` `self` The display instance
|
||||
|
||||
## Display:render()
|
||||
@@ -11,38 +11,3 @@ Extends: `List`
|
||||
|dropdownHeight|number|5|Maximum height of the dropdown menu when open|
|
||||
|selectedText|string|""|The text to show when no item is selected|
|
||||
|dropSymbol|string|"\31"|The symbol to show for dropdown indication|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Dropdown.new](#dropdown-new)|Dropdown|Creates a new Dropdown instance|
|
||||
|[Dropdown:init](#dropdown-init-props-basalt)|Dropdown|Initializes the Dropdown instance|
|
||||
|[Dropdown:mouse_click](#dropdown-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[Dropdown:render](#dropdown-render)|-|Renders the Dropdown|
|
||||
|
||||
## Dropdown.new()
|
||||
|
||||
Creates a new Dropdown instance
|
||||
|
||||
### Returns
|
||||
* `Dropdown` `self` The newly created Dropdown instance
|
||||
|
||||
## Dropdown:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Dropdown` `self` The initialized instance
|
||||
|
||||
## Dropdown:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Dropdown:render()
|
||||
@@ -19,24 +19,8 @@ Extends: `Container`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Flexbox.new](#flexbox-new)|Flexbox|Creates a new Flexbox instance|
|
||||
|[Flexbox:init](#flexbox-init-props-basalt)|Flexbox|Initializes the Flexbox instance|
|
||||
|[Flexbox:addChild](#flexbox-addchild-element)|Flexbox|Adds a child element to the flexbox|
|
||||
|[Flexbox:removeChild](#flexbox-removechild-element)|Flexbox|Removes a child element from the flexbox|
|
||||
|[Flexbox:addLineBreak](#flexbox-addlinebreak-self)|Flexbox|Adds a new line break to the flexbox.|
|
||||
|[Flexbox:render](#flexbox-render)|-|Renders the flexbox and its children|
|
||||
|
||||
## Flexbox.new()
|
||||
### Returns
|
||||
* `Flexbox` `object` The newly created Flexbox instance
|
||||
|
||||
## Flexbox:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Flexbox` `self` The initialized instance
|
||||
|
||||
## Flexbox:addChild(element)
|
||||
|
||||
@@ -48,13 +32,6 @@ Adds a child element to the flexbox
|
||||
### Returns
|
||||
* `Flexbox` `self` The flexbox instance
|
||||
|
||||
## Flexbox:removeChild(element)
|
||||
### Parameters
|
||||
* `element` `Element` The child element to remove
|
||||
|
||||
### Returns
|
||||
* `Flexbox` `self` The flexbox instance
|
||||
|
||||
## Flexbox:addLineBreak(self)
|
||||
|
||||
Adds a new line break to the flexbox
|
||||
@@ -64,5 +41,3 @@ Adds a new line break to the flexbox
|
||||
|
||||
### Returns
|
||||
* `Flexbox`
|
||||
|
||||
## Flexbox:render()
|
||||
@@ -10,70 +10,3 @@ Extends: `Container`
|
||||
|draggable|boolean|false|Whether the frame is draggable|
|
||||
|draggingMap|table|{}|The map of dragging positions|
|
||||
|scrollable|boolean|false|Whether the frame is scrollable|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Frame.new](#frame-new)|Frame|Creates a new Frame instance|
|
||||
|[Frame:init](#frame-init-props-basalt)|Frame|Initializes the Frame instance|
|
||||
|[Frame:mouse_click](#frame-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[Frame:mouse_up](#frame-mouse-up-button-x-y)|boolean|Handles mouse release events|
|
||||
|[Frame:mouse_drag](#frame-mouse-drag-button-x-y)|boolean|Handles mouse drag events|
|
||||
|[Frame:getChildrenHeight](#frame-getchildrenheight)|number|Calculates the total height of all children elements|
|
||||
|[Frame:mouse_scroll](#frame-mouse-scroll-direction-x-y)|boolean|Handles mouse scroll events|
|
||||
|
||||
## Frame.new()
|
||||
|
||||
Creates a new Frame instance
|
||||
|
||||
### Returns
|
||||
* `Frame` `self` The newly created Frame instance
|
||||
|
||||
## Frame:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Frame` `self` The initialized instance
|
||||
|
||||
## Frame:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Frame:mouse_up(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was released
|
||||
* `x` `number` The x position of the release
|
||||
* `y` `number` The y position of the release
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Frame:mouse_drag(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the drag position
|
||||
* `y` `number` The y position of the drag position
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Frame:getChildrenHeight()
|
||||
### Returns
|
||||
* `number` `height` The total height needed for all children
|
||||
|
||||
## Frame:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The scroll direction
|
||||
* `x` `number` The x position of the scroll
|
||||
* `y` `number` The y position of the scroll
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
@@ -15,8 +15,6 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Graph.new](#graph-new)|Graph|Creates a new Graph instance|
|
||||
|[Graph:init](#graph-init-props-basalt)|Graph|Initializes the Graph instance|
|
||||
|[Graph:addSeries](#graph-addseries-name-symbol-bgcol-fgcol-pointcount)|Graph|Adds a series to the graph|
|
||||
|[Graph:removeSeries](#graph-removeseries-name)|Graph|Removes a series from the graph|
|
||||
|[Graph:getSeries](#graph-getseries-name)|series|Gets a series from the graph|
|
||||
@@ -25,22 +23,6 @@ Extends: `VisualElement`
|
||||
|[Graph:focusSeries](#graph-focusseries-name)|Graph|Focuses a series|
|
||||
|[Graph:setSeriesPointCount](#graph-setseriespointcount-name-count)|Graph|Sets the point count of a series|
|
||||
|[Graph:clear](#graph-clear-name)|Graph|Clears all points from a series|
|
||||
|[Graph:render](#graph-render)|-|Renders the graph|
|
||||
|
||||
## Graph.new()
|
||||
|
||||
Creates a new Graph instance
|
||||
|
||||
### Returns
|
||||
* `Graph` `self` The newly created Graph instance
|
||||
|
||||
## Graph:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Graph` `self` The initialized instance
|
||||
|
||||
## Graph:addSeries(name, symbol, bgCol, fgCol, pointCount)
|
||||
### Parameters
|
||||
@@ -107,5 +89,3 @@ Clears all points from a series
|
||||
|
||||
### Returns
|
||||
* `Graph` `self` The graph instance
|
||||
|
||||
## Graph:render()
|
||||
@@ -19,8 +19,6 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Image.new](#image-new)|Image|Creates a new Image instance|
|
||||
|[Image:init](#image-init-props-basalt)|Image|Initializes the Image instance|
|
||||
|[Image:resizeImage](#image-resizeimage-width-height)|Image|Resizes the image to the specified width and height|
|
||||
|[Image:getImageSize](#image-getimagesize)|number, number|Gets the size of the image|
|
||||
|[Image:getPixelData](#image-getpixeldata-x-y)|fg, bg, char|Gets pixel information at position|
|
||||
@@ -37,22 +35,6 @@ Extends: `VisualElement`
|
||||
|[Image:getFrame](#image-getframe-frameindex)|table|Gets the specified frame|
|
||||
|[Image:getMetadata](#image-getmetadata)|table|Gets the metadata of the image|
|
||||
|[Image:setMetadata](#image-setmetadata-key-value)|Image|Sets the metadata of the image|
|
||||
|[Image:render](#image-render)|-|Renders the Image|
|
||||
|
||||
## Image.new()
|
||||
|
||||
Creates a new Image instance
|
||||
|
||||
### Returns
|
||||
* `Image` `self` The newly created Image instance
|
||||
|
||||
## Image:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Image` `self` The initialized instance
|
||||
|
||||
## Image:resizeImage(width, height)
|
||||
|
||||
@@ -224,5 +206,3 @@ Sets the metadata of the image
|
||||
|
||||
### Returns
|
||||
* `Image` `self` The Image instance
|
||||
|
||||
## Image:render()
|
||||
@@ -22,29 +22,8 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Input.new](#input-new)|Input|Creates a new Input instance|
|
||||
|[Input:init](#input-init-props-basalt)|Input|Initializes the Input instance|
|
||||
|[Input:setCursor](#input-setcursor-x-y-blink-color)|-|Sets the cursor position and color|
|
||||
|[Input:char](#input-char-char)|boolean|Handles char events|
|
||||
|[Input:key](#input-key-key)|boolean|Handles key events|
|
||||
|[Input:mouse_click](#input-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[Input:updateViewport](#input-updateviewport)|Input|Updates the input's viewport|
|
||||
|[Input:focus](#input-focus)|-|Handles a focus event|
|
||||
|[Input:blur](#input-blur)|-|Handles a blur event|
|
||||
|[Input:paste](#input-paste)|-|Handles paste events|
|
||||
|[Input:render](#input-render)|-|Renders the input element|
|
||||
|
||||
## Input.new()
|
||||
### Returns
|
||||
* `Input` `object` The newly created Input instance
|
||||
|
||||
## Input:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Input` `self` The initialized instance
|
||||
|
||||
## Input:setCursor(x, y, blink, color)
|
||||
|
||||
@@ -56,37 +35,9 @@ Sets the cursor position and color
|
||||
* `blink` `boolean` Whether the cursor should blink
|
||||
* `color` `number` The color of the cursor
|
||||
|
||||
## Input:char(char)
|
||||
### Parameters
|
||||
* `char` `string` The character that was typed
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Input:key(key)
|
||||
### Parameters
|
||||
* `key` `number` The key that was pressed
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Input:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Input:updateViewport()
|
||||
|
||||
Updates the input's viewport
|
||||
|
||||
### Returns
|
||||
* `Input` `self` The updated instance
|
||||
|
||||
## Input:focus()
|
||||
## Input:blur()
|
||||
## Input:paste()
|
||||
## Input:render()
|
||||
@@ -15,25 +15,7 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Label.new](#label-new)|Label|Creates a new Label instance|
|
||||
|[Label:init](#label-init-props-basalt)|Label|Initializes the Label instance|
|
||||
|[Label:getWrappedText](#label-getwrappedtext)|table|Gets the wrapped lines of the Label|
|
||||
|[Label:render](#label-render)|-|Renders the Label by drawing its text content|
|
||||
|
||||
## Label.new()
|
||||
|
||||
Creates a new Label instance
|
||||
|
||||
### Returns
|
||||
* `Label` `self` The newly created Label instance
|
||||
|
||||
## Label:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Label` `self` The initialized instance
|
||||
|
||||
## Label:getWrappedText()
|
||||
|
||||
@@ -41,5 +23,3 @@ Gets the wrapped lines of the Label
|
||||
|
||||
### Returns
|
||||
* `table` `wrappedText` The wrapped lines of the Label
|
||||
|
||||
## Label:render()
|
||||
@@ -2,28 +2,3 @@
|
||||
_The Line Chart element visualizes data series as connected line graphs. It plots points on a coordinate system and connects them with lines._
|
||||
|
||||
Extends: `Graph`
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[LineChart.new](#linechart-new)|LineChart|Creates a new LineChart instance|
|
||||
|[LineChart:init](#linechart-init-props-basalt)|LineChart|Initializes the LineChart instance|
|
||||
|[LineChart:render](#linechart-render)|-|Renders the LineChart|
|
||||
|
||||
## LineChart.new()
|
||||
|
||||
Creates a new LineChart instance
|
||||
|
||||
### Returns
|
||||
* `LineChart` `self` The newly created LineChart instance
|
||||
|
||||
## LineChart:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `LineChart` `self` The initialized instance
|
||||
|
||||
## LineChart:render()
|
||||
@@ -25,34 +25,14 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[List.new](#list-new)|List|Creates a new List instance|
|
||||
|[List:init](#list-init-props-basalt)|List|Initializes the List instance|
|
||||
|[List:addItem](#list-additem-text)|List|Adds an item to the list|
|
||||
|[List:removeItem](#list-removeitem-index)|List|Removes an item from the list|
|
||||
|[List:clear](#list-clear)|List|Clears all items from the list|
|
||||
|[List:getSelectedItems](#list-getselecteditems)|table|Gets the currently selected items|
|
||||
|[List:getSelectedItem](#list-getselecteditem)|selected|Gets first selected item|
|
||||
|[List:mouse_click](#list-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[List:mouse_scroll](#list-mouse-scroll-direction-x-y)|boolean|Handles mouse scroll events|
|
||||
|[List:onSelect](#list-onselect-callback)|List|Registers a callback for the select event|
|
||||
|[List:scrollToBottom](#list-scrolltobottom)|List|Scrolls the list to the bottom|
|
||||
|[List:scrollToTop](#list-scrolltotop)|List|Scrolls the list to the top|
|
||||
|[List:render](#list-render)|-|Renders the list|
|
||||
|
||||
## List.new()
|
||||
|
||||
Creates a new List instance
|
||||
|
||||
### Returns
|
||||
* `List` `self` The newly created List instance
|
||||
|
||||
## List:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `List` `self` The initialized instance
|
||||
|
||||
## List:addItem(text)
|
||||
|
||||
@@ -116,24 +96,6 @@ Gets first selected item
|
||||
### Returns
|
||||
* `selected` `The` first item
|
||||
|
||||
## List:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The mouse button that was clicked
|
||||
* `x` `number` The x-coordinate of the click
|
||||
* `y` `number` The y-coordinate of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## List:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The direction of the scroll (1 for down, -1 for up)
|
||||
* `x` `number` The x-coordinate of the scroll
|
||||
* `y` `number` The y-coordinate of the scroll
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## List:onSelect(callback)
|
||||
|
||||
Registers a callback for the select event
|
||||
@@ -162,5 +124,3 @@ Scrolls the list to the top
|
||||
|
||||
### Returns
|
||||
* `List` `self` The List instance
|
||||
|
||||
## List:render()
|
||||
@@ -14,26 +14,7 @@ Extends: `List`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Menu.new](#menu-new)|Menu|Creates a new Menu instance|
|
||||
|[Menu:init](#menu-init-props-basalt)|Menu|Initializes the Menu instance|
|
||||
|[Menu:setItems](#menu-setitems-items)|Menu|Sets the menu items and calculates total width|
|
||||
|[Menu:render](#menu-render)|-|Renders the menu horizontally with proper spacing and colors|
|
||||
|[Menu:mouse_click](#menu-mouse-click-button-x-y)|boolean|Handles mouse click events and item selection|
|
||||
|
||||
## Menu.new()
|
||||
|
||||
Creates a new Menu instance
|
||||
|
||||
### Returns
|
||||
* `Menu` `self` The newly created Menu instance
|
||||
|
||||
## Menu:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Menu` `self` The initialized instance
|
||||
|
||||
## Menu:setItems(items)
|
||||
|
||||
@@ -49,13 +30,3 @@ Sets the menu items
|
||||
```lua
|
||||
menu:setItems({{text="File"}, {separator=true}, {text="Edit"}})
|
||||
```
|
||||
|
||||
## Menu:render()
|
||||
## Menu:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
@@ -17,38 +17,11 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Program.new](#program-new)|-||
|
||||
|[Program:run](#program-run)|-||
|
||||
|[Program:resize](#program-resize)|-||
|
||||
|[Program:resume](#program-resume)|-||
|
||||
|[Program:stop](#program-stop)|-||
|
||||
|[Program.new](#program-new)|Program|Creates a new Program instance|
|
||||
|[Program:init](#program-init-props-basalt)|Program|Initializes the Program instance|
|
||||
|[Program:execute](#program-execute-path-env-addenvironment)|Program|Executes a program|
|
||||
|[Program:stop](#program-stop)|Program|Stops the program|
|
||||
|[Program:sendEvent](#program-sendevent-event-any)|Program|Sends an event to the program|
|
||||
|[Program:onError](#program-onerror-fn)|Program|Registers a callback for the program's error event|
|
||||
|[Program:onDone](#program-ondone-fn)|Program|Registers a callback for the program's done event|
|
||||
|[Program:dispatchEvent](#program-dispatchevent-event-any)|any|Handles all incomming events|
|
||||
|[Program:focus](#program-focus)|-|Gets called when the element gets focused|
|
||||
|[Program:render](#program-render)|-|Renders the program|
|
||||
|
||||
## Program.new()
|
||||
## Program:run()
|
||||
## Program:resize()
|
||||
## Program:resume()
|
||||
## Program:stop()
|
||||
## Program.new()
|
||||
### Returns
|
||||
* `Program` `object` The newly created Program instance
|
||||
|
||||
## Program:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Program` `self` The initialized instance
|
||||
|
||||
## Program:execute(path, env?, addEnvironment?)
|
||||
|
||||
@@ -99,14 +72,3 @@ Registers a callback for the program's done event
|
||||
|
||||
### Returns
|
||||
* `Program` `self` The Program instance
|
||||
|
||||
## Program:dispatchEvent(event, any)
|
||||
### Parameters
|
||||
* `event` `string` The event to handle
|
||||
* `any` `The` event arguments
|
||||
|
||||
### Returns
|
||||
* `any` `result` The event result
|
||||
|
||||
## Program:focus()
|
||||
## Program:render()
|
||||
@@ -12,28 +12,3 @@ Extends: `VisualElement`
|
||||
|showPercentage|boolean|false|Whether to show the percentage text in the center|
|
||||
|progressColor|color|lime|The color used for the filled portion of the progress bar|
|
||||
|direction|string|right|The direction of the progress bar ("up", "down", "left", "right")|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[ProgressBar.new](#progressbar-new)|ProgressBar|Creates a new ProgressBar instance|
|
||||
|[ProgressBar:init](#progressbar-init-props-basalt)|ProgressBar|Initializes the ProgressBar instance|
|
||||
|[ProgressBar:render](#progressbar-render)|-|Renders the progress bar with filled portion and optional percentage text|
|
||||
|
||||
## ProgressBar.new()
|
||||
|
||||
Creates a new ProgressBar instance
|
||||
|
||||
### Returns
|
||||
* `ProgressBar` `self` The newly created ProgressBar instance
|
||||
|
||||
## ProgressBar:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `ProgressBar` `self` The initialized instance
|
||||
|
||||
## ProgressBar:render()
|
||||
@@ -25,29 +25,8 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[ScrollBar.new](#scrollbar-new)|ScrollBar|Creates a new ScrollBar instance|
|
||||
|[ScrollBar:init](#scrollbar-init-props-basalt)|ScrollBar|Initializes the ScrollBar instance|
|
||||
|[ScrollBar:attach](#scrollbar-attach-element-config)|ScrollBar|Attaches the ScrollBar to an element's property|
|
||||
|[ScrollBar:updateAttachedElement](#scrollbar-updateattachedelement)|ScrollBar|Updates the attached element's property based on the ScrollBar value|
|
||||
|[ScrollBar:mouse_click](#scrollbar-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[ScrollBar:mouse_drag](#scrollbar-mouse-drag-button-x-y)|boolean|Handles mouse drag events|
|
||||
|[ScrollBar:mouse_scroll](#scrollbar-mouse-scroll-direction-x-y)|boolean|Handles mouse scroll events|
|
||||
|[ScrollBar:render](#scrollbar-render)|-|Renders the ScrollBar|
|
||||
|
||||
## ScrollBar.new()
|
||||
|
||||
Creates a new ScrollBar instance
|
||||
|
||||
### Returns
|
||||
* `ScrollBar` `self` The newly created ScrollBar instance
|
||||
|
||||
## ScrollBar:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `ScrollBar` `self` The initialized instance
|
||||
|
||||
## ScrollBar:attach(element, config)
|
||||
|
||||
@@ -66,32 +45,3 @@ Updates the attached element's property based on the ScrollBar value
|
||||
|
||||
### Returns
|
||||
* `ScrollBar` `self` The ScrollBar instance
|
||||
|
||||
## ScrollBar:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The mouse button clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## ScrollBar:mouse_drag(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The mouse button being dragged
|
||||
* `x` `number` The x position of the drag
|
||||
* `y` `number` The y position of the drag
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## ScrollBar:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The scroll direction (1 for up, -1 for down)
|
||||
* `x` `number` The x position of the scroll
|
||||
* `y` `number` The y position of the scroll
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## ScrollBar:render()
|
||||
@@ -24,27 +24,7 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Slider.new](#slider-new)|Slider|Creates a new Slider instance|
|
||||
|[Slider:init](#slider-init-props-basalt)|Slider|Initializes the Slider instance|
|
||||
|[Slider:getValue](#slider-getvalue)|number|Gets the current value mapped to the max range|
|
||||
|[Slider:mouse_click](#slider-mouse-click-button-x-y)|boolean|Updates slider position on mouse click|
|
||||
|[Slider:mouse_scroll](#slider-mouse-scroll-button-x-y)|boolean|Handles mouse release events|
|
||||
|[Slider:render](#slider-render)|-|Renders the slider with track and handle|
|
||||
|
||||
## Slider.new()
|
||||
|
||||
Creates a new Slider instance
|
||||
|
||||
### Returns
|
||||
* `Slider` `self` The newly created Slider instance
|
||||
|
||||
## Slider:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Slider` `self` The initialized instance
|
||||
|
||||
## Slider:getValue()
|
||||
|
||||
@@ -57,23 +37,3 @@ Gets the current value of the slider
|
||||
```lua
|
||||
local value = slider:getValue()
|
||||
```
|
||||
|
||||
## Slider:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The mouse button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Slider:mouse_scroll(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The mouse button that was released
|
||||
* `x` `number` The x position of the release
|
||||
* `y` `number` The y position of the release
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Slider:render()
|
||||
@@ -12,32 +12,3 @@ Extends: `VisualElement`
|
||||
|autoSize|boolean|Whether|to automatically size the element to fit switch and text|
|
||||
|onBackground|number|Background|color when ON|
|
||||
|offBackground|number|Background|color when OFF|
|
||||
|
||||
## Functions
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Switch.new](#switch-new)|table|Creates a new Switch instance|
|
||||
|[Switch:init](#switch-init-props-basalt)|-|Initializes the Switch instance|
|
||||
|[Switch:mouse_click](#switch-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[Switch:render](#switch-render)|-|Renders the Switch|
|
||||
|
||||
## Switch.new()
|
||||
### Returns
|
||||
* `table` `self` The created instance
|
||||
|
||||
## Switch:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## Switch:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## Switch:render()
|
||||
@@ -18,29 +18,11 @@ Extends: `Container`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[TabControl.new](#tabcontrol-new)|TabControl|Creates a new TabControl instance|
|
||||
|[TabControl:init](#tabcontrol-init-props-basalt)|-|Initializes the TabControl instance|
|
||||
|[TabControl:newTab](#tabcontrol-newtab-title)|table|Creates a new tab handler proxy|
|
||||
|[TabControl:setTab](#tabcontrol-settab-element-tabid)|TabControl|Sets an element to belong to a specific tab|
|
||||
|[TabControl:addElement](#tabcontrol-addelement-elementtype-tabid)|table|Adds an element to the TabControl and assigns it to the active tab|
|
||||
|[TabControl:addChild](#tabcontrol-addchild-child)|Container|Overrides Container's addChild to assign new elements to tab 1 by default|
|
||||
|[TabControl:updateTabVisibility](#tabcontrol-updatetabvisibility)|-|Updates visibility of tab containers|
|
||||
|[TabControl:setActiveTab](#tabcontrol-setactivetab-tabid)|-|Sets the active tab|
|
||||
|[TabControl:isChildVisible](#tabcontrol-ischildvisible-child)|boolean|Checks if a child should be visible (overrides Container)|
|
||||
|[TabControl:getContentYOffset](#tabcontrol-getcontentyoffset)|number|Gets the content area Y offset (below tab headers)|
|
||||
|[TabControl:mouse_click](#tabcontrol-mouse-click-button-x-y)|boolean|Handles mouse click events for tab switching|
|
||||
|[TabControl:setCursor](#tabcontrol-setcursor)|-|Sets the cursor position; accounts for tab header offset when delegating to parent|
|
||||
|[TabControl:render](#tabcontrol-render)|-|Renders the TabControl (header + children)|
|
||||
|[TabControl:sortChildrenEvents](#tabcontrol-sortchildrenevents)|-||
|
||||
|
||||
## TabControl.new()
|
||||
### Returns
|
||||
* `TabControl` `self` The created instance
|
||||
|
||||
## TabControl:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## TabControl:newTab(title)
|
||||
|
||||
@@ -68,38 +50,8 @@ returns a proxy for adding elements to the tab
|
||||
### Returns
|
||||
* `table` `element` The created element
|
||||
|
||||
## TabControl:addChild(child)
|
||||
### Parameters
|
||||
* `child` `table` The child element to add
|
||||
|
||||
### Returns
|
||||
* `Container` `self` For method chaining
|
||||
|
||||
## TabControl:updateTabVisibility()
|
||||
## TabControl:setActiveTab(tabId)
|
||||
### Parameters
|
||||
* `tabId` `number` The ID of the tab to activate
|
||||
|
||||
## TabControl:isChildVisible(child)
|
||||
### Parameters
|
||||
* `child` `table` The child element to check
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the child should be visible
|
||||
|
||||
## TabControl:getContentYOffset()
|
||||
### Returns
|
||||
* `number` `yOffset` The Y offset for content
|
||||
|
||||
## TabControl:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click (global)
|
||||
* `y` `number` The y position of the click (global)
|
||||
|
||||
### Returns
|
||||
* `boolean` `Whether` the event was handled
|
||||
|
||||
## TabControl:setCursor()
|
||||
## TabControl:render()
|
||||
## TabControl:sortChildrenEvents()
|
||||
## TabControl:setCursor()
|
||||
@@ -21,33 +21,12 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Table.new](#table-new)|Table|Creates a new Table instance|
|
||||
|[Table:init](#table-init-props-basalt)|Table|Initializes the Table instance|
|
||||
|[Table:addColumn](#table-addcolumn-name-width)|Table|Adds a new column to the table|
|
||||
|[Table:addData](#table-adddata-any)|Table|Adds a new row of data to the table|
|
||||
|[Table:setColumnSortFunction](#table-setcolumnsortfunction-columnindex-sortfn)|Table|Sets a custom sort function for a column|
|
||||
|[Table:setFormattedData](#table-setformatteddata-displaydata-sortdata)|Table|Adds formatted data with raw sort values|
|
||||
|[Table:setData](#table-setdata-rawdata-formatters)|Table|Sets table data with optional column formatters|
|
||||
|[Table:calculateColumnWidths](#table-calculatecolumnwidths-columns-totalwidth)|table|Calculates column widths for rendering|
|
||||
|[Table:sortData](#table-sortdata-columnindex-fn)|Table|Sorts the table data by the specified column|
|
||||
|[Table:mouse_click](#table-mouse-click-button-x-y)|boolean|Handles header clicks for sorting and row selection|
|
||||
|[Table:mouse_scroll](#table-mouse-scroll-direction-x-y)|boolean|Handles scrolling through the table data|
|
||||
|[Table:render](#table-render)|-|Renders the table with headers, data and scrollbar|
|
||||
|
||||
## Table.new()
|
||||
|
||||
Creates a new Table instance
|
||||
|
||||
### Returns
|
||||
* `Table` `self` The newly created Table instance
|
||||
|
||||
## Table:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Table` `self` The initialized instance
|
||||
|
||||
## Table:addColumn(name, width)
|
||||
|
||||
@@ -103,14 +82,6 @@ Set data with automatic formatting
|
||||
### Returns
|
||||
* `Table` `self` The Table instance
|
||||
|
||||
## Table:calculateColumnWidths(columns, totalWidth)
|
||||
### Parameters
|
||||
* `columns` `table` The column definitions
|
||||
* `totalWidth` `number` The total available width
|
||||
|
||||
### Returns
|
||||
* `table` `The` columns with calculated visibleWidth
|
||||
|
||||
## Table:sortData(columnIndex, fn)
|
||||
|
||||
Sorts the table data by column
|
||||
@@ -121,23 +92,3 @@ Sorts the table data by column
|
||||
|
||||
### Returns
|
||||
* `Table` `self` The Table instance
|
||||
|
||||
## Table:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Table:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The scroll direction (-1 up, 1 down)
|
||||
* `x` `number` The x position of the scroll
|
||||
* `y` `number` The y position of the scroll
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Table:render()
|
||||
@@ -20,35 +20,12 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[TextBox.new](#textbox-new)|TextBox|Creates a new TextBox instance|
|
||||
|[TextBox:init](#textbox-init-props-basalt)|TextBox|Initializes the TextBox instance|
|
||||
|[TextBox:addSyntaxPattern](#textbox-addsyntaxpattern-pattern-color)|TextBox|Adds a new syntax highlighting pattern|
|
||||
|[TextBox:removeSyntaxPattern](#textbox-removesyntaxpattern-index)|TextBox|Removes a syntax pattern by index (1-based)|
|
||||
|[TextBox:clearSyntaxPatterns](#textbox-clearsyntaxpatterns)|TextBox|Clears all syntax highlighting patterns|
|
||||
|[TextBox:updateViewport](#textbox-updateviewport)|TextBox|Updates the viewport to keep the cursor in view|
|
||||
|[TextBox:char](#textbox-char-char)|boolean|Handles character input|
|
||||
|[TextBox:key](#textbox-key-key)|boolean|Handles key events|
|
||||
|[TextBox:mouse_scroll](#textbox-mouse-scroll-direction-x-y)|boolean|Handles mouse scroll events|
|
||||
|[TextBox:mouse_click](#textbox-mouse-click-button-x-y)|boolean|Handles mouse click events|
|
||||
|[TextBox:paste](#textbox-paste)|-|Handles paste events|
|
||||
|[TextBox:setText](#textbox-settext-text)|TextBox|Sets the text of the TextBox|
|
||||
|[TextBox:getText](#textbox-gettext)|string|Gets the text of the TextBox|
|
||||
|[TextBox:render](#textbox-render)|-|Renders the TextBox with syntax highlighting|
|
||||
|
||||
## TextBox.new()
|
||||
|
||||
Creates a new TextBox instance
|
||||
|
||||
### Returns
|
||||
* `TextBox` `self` The newly created TextBox instance
|
||||
|
||||
## TextBox:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `TextBox` `self` The initialized instance
|
||||
|
||||
## TextBox:addSyntaxPattern(pattern, color)
|
||||
|
||||
@@ -85,39 +62,6 @@ Updates the viewport to keep the cursor in view
|
||||
### Returns
|
||||
* `TextBox` `self` The TextBox instance
|
||||
|
||||
## TextBox:char(char)
|
||||
### Parameters
|
||||
* `char` `string` The character that was typed
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## TextBox:key(key)
|
||||
### Parameters
|
||||
* `key` `number` The key that was pressed
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## TextBox:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The scroll direction
|
||||
* `x` `number` The x position of the scroll
|
||||
* `y` `number` The y position of the scroll
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## TextBox:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## TextBox:paste()
|
||||
## TextBox:setText(text)
|
||||
|
||||
Sets the text of the TextBox
|
||||
@@ -134,5 +78,3 @@ Gets the text of the TextBox
|
||||
|
||||
### Returns
|
||||
* `string` `text` The text of the TextBox
|
||||
|
||||
## TextBox:render()
|
||||
@@ -16,20 +16,8 @@ Extends: `BaseElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Timer.new](#timer-new)|table|Creates a new Timer instance|
|
||||
|[Timer:init](#timer-init-props-basalt)|-|Initializes the Timer instance|
|
||||
|[Timer:start](#timer-start-self)|Timer|Starts the timer|
|
||||
|[Timer:stop](#timer-stop-self)|Timer|Stops the timer|
|
||||
|[Timer:dispatchEvent](#timer-dispatchevent)|-|Dispatches events to the Timer instance|
|
||||
|
||||
## Timer.new()
|
||||
### Returns
|
||||
* `table` `self` The created instance
|
||||
|
||||
## Timer:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## Timer:start(self)
|
||||
|
||||
@@ -50,5 +38,3 @@ Stops the timer if it is currently running.
|
||||
|
||||
### Returns
|
||||
* `Timer` `self` The Timer instance
|
||||
|
||||
## Timer:dispatchEvent()
|
||||
@@ -19,34 +19,11 @@ Extends: `VisualElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[Tree.new](#tree-new)|Tree|Creates a new Tree instance|
|
||||
|[Tree:init](#tree-init-props-basalt)|Tree|Initializes the Tree instance|
|
||||
|[Tree:expandNode](#tree-expandnode-node)|Tree|Expands a node to show its children|
|
||||
|[Tree:collapseNode](#tree-collapsenode-node)|Tree|Collapses a node to hide its children|
|
||||
|[Tree:toggleNode](#tree-togglenode-node)|Tree|Toggles between expanded and collapsed state|
|
||||
|[Tree:mouse_click](#tree-mouse-click-button-x-y)|boolean|Handles mouse click events for node selection and expansion|
|
||||
|[Tree:onSelect](#tree-onselect-callback)|Tree|Registers a callback for when a node is selected|
|
||||
|[Tree:mouse_scroll](#tree-mouse-scroll-direction-x-y)|boolean|Handles mouse scroll events for vertical scrolling|
|
||||
|[Tree:getNodeSize](#tree-getnodesize)|number, number|Gets the size of the tree|
|
||||
|[Tree:render](#tree-render)|-|Renders the tree with nodes, selection and scrolling|
|
||||
|
||||
## Tree.new()
|
||||
|
||||
Creates a new Tree instance
|
||||
|
||||
### Returns
|
||||
* `Tree` `self` The newly created Tree instance
|
||||
|
||||
## Tree:init(props, basalt)
|
||||
|
||||
Initializes the Tree instance
|
||||
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
### Returns
|
||||
* `Tree` `self` The initialized instance
|
||||
|
||||
## Tree:expandNode(node)
|
||||
|
||||
@@ -78,18 +55,6 @@ Toggles a node's expanded state
|
||||
### Returns
|
||||
* `Tree` `self` The Tree instance
|
||||
|
||||
## Tree:mouse_click(button, x, y)
|
||||
|
||||
Handles mouse click events
|
||||
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Tree:onSelect(callback)
|
||||
|
||||
Registers a callback for when a node is selected
|
||||
@@ -100,15 +65,6 @@ Registers a callback for when a node is selected
|
||||
### Returns
|
||||
* `Tree` `self` The Tree instance
|
||||
|
||||
## Tree:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The scroll direction (1 for up, -1 for down)
|
||||
* `x` `number` The x position of the scroll
|
||||
* `y` `number` The y position of the scroll
|
||||
|
||||
### Returns
|
||||
* `boolean` `handled` Whether the event was handled
|
||||
|
||||
## Tree:getNodeSize()
|
||||
|
||||
Gets the size of the tree
|
||||
@@ -116,5 +72,3 @@ Gets the size of the tree
|
||||
### Returns
|
||||
* `number` `width` The width of the tree
|
||||
* `number` `height` The height of the tree
|
||||
|
||||
## Tree:render()
|
||||
@@ -32,75 +32,11 @@ Extends: `BaseElement`
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[VisualElement.new](#visualelement-new)|VisualElement|Creates a new visual element|
|
||||
|[VisualElement:init](#visualelement-init-props-basalt)|-|Initializes a new visual element with properties|
|
||||
|[VisualElement:multiBlit](#visualelement-multiblit-x-y-width-height-text-fg-bg)|-|Multi-character drawing with colors|
|
||||
|[VisualElement:textFg](#visualelement-textfg-x-y-text-fg)|-|Draws text with foreground color|
|
||||
|[VisualElement:textBg](#visualelement-textbg-x-y-text-bg)|-|Draws text with background color|
|
||||
|[VisualElement:blit](#visualelement-blit-x-y-text-fg-bg)|-|Draws text with both colors|
|
||||
|[VisualElement:isInBounds](#visualelement-isinbounds-x-y)|boolean|Checks if point is within bounds|
|
||||
|[VisualElement:mouse_click](#visualelement-mouse-click-button-x-y)|boolean|Handles a mouse click event|
|
||||
|[VisualElement:mouse_up](#visualelement-mouse-up-button-x-y)|boolean|Handles a mouse up event|
|
||||
|[VisualElement:mouse_release](#visualelement-mouse-release-button-x-y)|-|Handles a mouse release event|
|
||||
|[VisualElement:mouse_move](#visualelement-mouse-move---x-y)|boolean|Handles a mouse move event|
|
||||
|[VisualElement:mouse_scroll](#visualelement-mouse-scroll-direction-x-y)|boolean|Handles a mouse scroll event|
|
||||
|[VisualElement:mouse_drag](#visualelement-mouse-drag-button-x-y)|boolean|Handles a mouse drag event|
|
||||
|[VisualElement:focus](#visualelement-focus)|-|Handles a focus event|
|
||||
|[VisualElement:blur](#visualelement-blur)|-|Handles a blur event|
|
||||
|[VisualElement:key](#visualelement-key-key)|-|Handles a key event|
|
||||
|[VisualElement:key_up](#visualelement-key-up-key)|-|Handles a key up event|
|
||||
|[VisualElement:char](#visualelement-char-char)|-|Handles a character event|
|
||||
|[VisualElement:calculatePosition](#visualelement-calculateposition)|number, number|Calculates the position of the element|
|
||||
|[VisualElement:getAbsolutePosition](#visualelement-getabsoluteposition-x-y)|number, number|Returns the absolute position of the element|
|
||||
|[VisualElement:getRelativePosition](#visualelement-getrelativeposition-x-y)|number, number|Returns the relative position of the element|
|
||||
|[VisualElement:setCursor](#visualelement-setcursor-x-y-blink-color)|VisualElement|Sets the cursor position|
|
||||
|[VisualElement:prioritize](#visualelement-prioritize)|VisualElement|Prioritizes the element by moving it to the top of its parent's children|
|
||||
|[VisualElement:render](#visualelement-render)|-|Renders the element|
|
||||
|[VisualElement:postRender](#visualelement-postrender)|-|Post-rendering function for the element|
|
||||
|
||||
## VisualElement.new()
|
||||
|
||||
Creates a new VisualElement instance
|
||||
|
||||
### Returns
|
||||
* `VisualElement` `object` The newly created VisualElement instance
|
||||
|
||||
## VisualElement:init(props, basalt)
|
||||
### Parameters
|
||||
* `props` `table` The properties to initialize the element with
|
||||
* `basalt` `table` The basalt instance
|
||||
|
||||
## VisualElement:multiBlit(x, y, width, height, text, fg, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to draw
|
||||
* `y` `number` The y position to draw
|
||||
* `width` `number` The width of the area to draw
|
||||
* `height` `number` The height of the area to draw
|
||||
* `text` `string` The text to draw
|
||||
* `fg` `string` The foreground color
|
||||
* `bg` `string` The background color
|
||||
|
||||
## VisualElement:textFg(x, y, text, fg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to draw
|
||||
* `y` `number` The y position to draw
|
||||
* `text` `string` The text char to draw
|
||||
* `fg` `color` The foreground color
|
||||
|
||||
## VisualElement:textBg(x, y, text, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to draw
|
||||
* `y` `number` The y position to draw
|
||||
* `text` `string` The text char to draw
|
||||
* `bg` `color` The background color
|
||||
|
||||
## VisualElement:blit(x, y, text, fg, bg)
|
||||
### Parameters
|
||||
* `x` `number` The x position to draw
|
||||
* `y` `number` The y position to draw
|
||||
* `text` `string` The text char to draw
|
||||
* `fg` `string` The foreground color
|
||||
* `bg` `string` The background color
|
||||
|
||||
## VisualElement:isInBounds(x, y)
|
||||
|
||||
@@ -113,71 +49,6 @@ Checks if the specified coordinates are within the bounds of the element
|
||||
### Returns
|
||||
* `boolean` `isInBounds` Whether the coordinates are within the bounds of the element
|
||||
|
||||
## VisualElement:mouse_click(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked
|
||||
* `x` `number` The x position of the click
|
||||
* `y` `number` The y position of the click
|
||||
|
||||
### Returns
|
||||
* `boolean` `clicked` Whether the element was clicked
|
||||
|
||||
## VisualElement:mouse_up(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was released
|
||||
* `x` `number` The x position of the release
|
||||
* `y` `number` The y position of the release
|
||||
|
||||
### Returns
|
||||
* `boolean` `release` Whether the element was released on the element
|
||||
|
||||
## VisualElement:mouse_release(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was released
|
||||
* `x` `number` The x position of the release
|
||||
* `y` `number` The y position of the release
|
||||
|
||||
## VisualElement:mouse_move(_, x, y)
|
||||
### Parameters
|
||||
* `_` `number` unknown
|
||||
* `x` `number` The x position of the mouse
|
||||
* `y` `number` The y position of the mouse
|
||||
|
||||
### Returns
|
||||
* `boolean` `hover` Whether the mouse has moved over the element
|
||||
|
||||
## VisualElement:mouse_scroll(direction, x, y)
|
||||
### Parameters
|
||||
* `direction` `number` The scroll direction
|
||||
* `x` `number` The x position of the scroll
|
||||
* `y` `number` The y position of the scroll
|
||||
|
||||
### Returns
|
||||
* `boolean` `scroll` Whether the element was scrolled
|
||||
|
||||
## VisualElement:mouse_drag(button, x, y)
|
||||
### Parameters
|
||||
* `button` `number` The button that was clicked while dragging
|
||||
* `x` `number` The x position of the drag
|
||||
* `y` `number` The y position of the drag
|
||||
|
||||
### Returns
|
||||
* `boolean` `drag` Whether the element was dragged
|
||||
|
||||
## VisualElement:focus()
|
||||
## VisualElement:blur()
|
||||
## VisualElement:key(key)
|
||||
### Parameters
|
||||
* `key` `number` The key that was pressed
|
||||
|
||||
## VisualElement:key_up(key)
|
||||
### Parameters
|
||||
* `key` `number` The key that was released
|
||||
|
||||
## VisualElement:char(char)
|
||||
### Parameters
|
||||
* `char` `string` The character that was pressed
|
||||
|
||||
## VisualElement:calculatePosition()
|
||||
|
||||
Calculates the position of the element relative to its parent
|
||||
@@ -210,22 +81,9 @@ Returns the relative position of the element or the given coordinates.
|
||||
* `number` `x` The relative x position
|
||||
* `number` `y` The relative y position
|
||||
|
||||
## VisualElement:setCursor(x, y, blink, color)
|
||||
### Parameters
|
||||
* `x` `number` The x position of the cursor
|
||||
* `y` `number` The y position of the cursor
|
||||
* `blink` `boolean` Whether the cursor should blink
|
||||
* `color` `number` The color of the cursor
|
||||
|
||||
### Returns
|
||||
* `VisualElement` `self` The VisualElement instance
|
||||
|
||||
## VisualElement:prioritize()
|
||||
|
||||
This function is used to prioritize the element by moving it to the top of its parent's children. It removes the element from its parent and adds it back, effectively changing its order.
|
||||
|
||||
### Returns
|
||||
* `VisualElement` `self` The VisualElement instance
|
||||
|
||||
## VisualElement:render()
|
||||
## VisualElement:postRender()
|
||||
@@ -166,13 +166,9 @@ _Adds additional methods for VisualElement when adding animation plugin_
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[VisualElement.hooks](#visualelement-hooks)|-||
|
||||
|[VisualElement.setup](#visualelement-setup)|-||
|
||||
|[VisualElement.stopAnimation](#visualelement-stopanimation)|-|Convenience to stop animations from the element|
|
||||
|[VisualElement:animate](#visualelement-animate)|Animation|Creates a new animation|
|
||||
|
||||
## VisualElement.hooks()
|
||||
## VisualElement.setup()
|
||||
## VisualElement.stopAnimation()
|
||||
|
||||
Convenience to stop animations from the element
|
||||
|
||||
@@ -6,11 +6,9 @@ _with support for inheritance, named styles, and dynamic theme switching._
|
||||
|
||||
|Method|Returns|Description|
|
||||
|---|---|---|
|
||||
|[BaseElement.____getElementPath](#baseelement-----getelementpath)|-||
|
||||
|[BaseElement:applyTheme](#baseelement-applytheme-self-applytochildren)|BaseElement|Applies theme styles to the element|
|
||||
|[BaseElement:getTheme](#baseelement-gettheme-self)|table|Gets theme properties for the element|
|
||||
|
||||
## BaseElement.____getElementPath()
|
||||
## BaseElement:applyTheme(self, applyToChildren)
|
||||
|
||||
Applies the current theme to this element
|
||||
|
||||
Reference in New Issue
Block a user