Panel Class
The basic component which makes up most `Window`s.
Full description:
The visual parts of most ingame dialogs are sprites from a sprite sheet. A `Panel` is an instance of a particular sprite, consisting of a sprite index and a position. It is advantageous to construct dialogs out of panels (using `Window:addPanel`) as the common operations on panels (like drawing them and hit-testing against them) are implemented in the `Window` class, thus reducing the amount of work that each individual dialog has to do.
Method Index
- afterLoad(old, new)
- clipLine(line, limit)
- drawLabel(canvas, x, y, limit)
- makeButton(...)
- makeHotkeyBox(...)
- makeRepeatButton(...)
- makeScrollbar(...)
- makeTextbox(...)
- makeToggleButton(...)
- setAutoClip(mode)
- setColour(col, preserve_disable)
- setDynamicTooltip(callback, x, y)
- setLabel(label, font, align)
- setPosition(x, y)
- setSize(width, height)
- setTextWrap(enabled)
- setTooltip(tooltip, x, y)
- setVisible(visibility)
Member Index
- align
- apply_ui_scale
- auto_clip
- colour
- custom_draw
- disabled_colour
- h
- highlight_colour
- label
- label_font
- lowered_colour
- shadow_colour
- tooltip
- visible
- w
- window
- wrap_text
- x
- y
function Panel:Panel()
Declared on: line 174 of Lua/window.lua.
function Panel:afterLoad(old, new)
Parameters:
| Name | Type | Description |
|---|---|---|
| old | ? | ? |
| new | ? | ? |
Declared on: line 2131 of Lua/window.lua.
function Panel:clipLine(line, limit)
Checks if a given line drawn with the panel's label font would be longer than the given limit
and if so, shortens it enough to fit including "..." at the end
Parameters:
| Name | Type | Description |
|---|---|---|
| line | string | the line to modify |
| limit | int | the maximum length in pixels the line should have |
Declared on: line 286 of Lua/window.lua.
function Panel:drawLabel(canvas, x, y, limit)
Draw function for the label on a panel
Parameters:
| Name | Type | Description |
|---|---|---|
| canvas | ? | The canvas to draw on (can be nil for test) |
| x | ? | x position to start drawing on |
| y | ? | y position to start drawing on |
| limit | nil or or or int or int | limit after which line and with character on that line to stop drawing |
Declared on: line 304 of Lua/window.lua.
function Panel:makeButton(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 189 of Lua/window.lua.
function Panel:makeHotkeyBox(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 209 of Lua/window.lua.
function Panel:makeRepeatButton(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 197 of Lua/window.lua.
function Panel:makeScrollbar(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 201 of Lua/window.lua.
function Panel:makeTextbox(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 205 of Lua/window.lua.
function Panel:makeToggleButton(...)
Parameters:
| Name | Type | Description |
|---|---|---|
| ... | ? | ? |
Declared on: line 193 of Lua/window.lua.
function Panel:setAutoClip(mode)
Specifies whether auto clip (clipping text at the end so it fits) is enabled for this panel
Parameters:
| Name | Type | Description |
|---|---|---|
| mode | boolean | true to activate, false to deactivate. |
Declared on: line 279 of Lua/window.lua.
function Panel:setColour(col, preserve_disable)
Set the colour of a panel
Note: This works only with ColourPanel and BevelPanel, not normal (sprite) panels.
Parameters:
| Name | Type | Description |
|---|---|---|
| col | table | Colour given as a table with three fields red, green and blue, each an integer value in [0, 255]. |
| preserve_disable | boolean | If true, do not adjust the panel's disabled colour. |
Declared on: line 222 of Lua/window.lua.
function Panel:setDynamicTooltip(callback, x, y)
Parameters:
| Name | Type | Description |
|---|---|---|
| callback | ? | ? |
| x | ? | ? |
| y | ? | ? |
Declared on: line 257 of Lua/window.lua.
function Panel:setLabel(label, font, align)
Specify a label to be drawn on top of the panel.
Note: This works only with ColourPanel and BevelPanel, not normal (sprite) panels.
can be either of "left", "center", "right"
Parameters:
| Name | Type | Description |
|---|---|---|
| label | string | The text to be drawn on top of the label. |
| font | font | [optional] The font to use. Default is Font01V in QData. |
| align | string | [optional] Alignment for non-multiline labels (multiline is always left) |
Declared on: line 266 of Lua/window.lua.
function Panel:setPosition(x, y)
Set the position of a panel.
Parameters:
| Name | Type | Description |
|---|---|---|
| x | int | New horizontal position of the panel. |
| y | int | New vertical position of the panel. |
Declared on: line 350 of Lua/window.lua.
function Panel:setSize(width, height)
Set the size of a panel.
Parameters:
| Name | Type | Description |
|---|---|---|
| width | int | New width of the panel. |
| height | int | New height of the panel. |
Declared on: line 358 of Lua/window.lua.
function Panel:setTextWrap(enabled)
Set whether text wrapping is enabled for this panel.
Parameters:
| Name | Type | Description |
|---|---|---|
| enabled | bool | Whether to text wrapping enabled. |
Declared on: line 373 of Lua/window.lua.
function Panel:setTooltip(tooltip, x, y)
Specify a tooltip to be displayed when hovering this panel.
x and y are optional position of bottom left of the tooltip.
If not specified, will default to mouse position.
Parameters:
| Name | Type | Description |
|---|---|---|
| tooltip | ? | ? |
| x | ? | ? |
| y | ? | ? |
Declared on: line 245 of Lua/window.lua.
function Panel:setVisible(visibility)
Set the visibility of the panel.
Parameters:
| Name | Type | Description |
|---|---|---|
| visibility | bool | New visibility of the panel. |
Declared on: line 366 of Lua/window.lua.