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
- clipLine(line, limit)
 - drawLabel(canvas, x, y, limit)
 - makeButton(...)
 - makeRepeatButton(...)
 - makeScrollbar(...)
 - makeTextbox(...)
 - makeToggleButton(...)
 - setAutoClip(mode)
 - setColour(col)
 - setDynamicTooltip(callback, x, y)
 - setLabel(label, font, align)
 - setPosition(x, y)
 - setSize(width, height)
 - setTooltip(tooltip, x, y)
 
Member Index
- align
 - auto_clip
 - colour
 - custom_draw
 - disabled_colour
 - h
 - highlight_colour
 - label
 - label_font
 - shadow_colour
 - tooltip
 - visible
 - w
 - window
 - x
 - y
 
function Panel:Panel()
Declared on: line 136 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 241 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 259 of Lua/window.lua.
function Panel:makeButton(...)
Parameters:
| Name | Type | Description | 
|---|---|---|
| ... | ? | ? | 
Declared on: line 150 of Lua/window.lua.
function Panel:makeRepeatButton(...)
Parameters:
| Name | Type | Description | 
|---|---|---|
| ... | ? | ? | 
Declared on: line 158 of Lua/window.lua.
function Panel:makeScrollbar(...)
Parameters:
| Name | Type | Description | 
|---|---|---|
| ... | ? | ? | 
Declared on: line 162 of Lua/window.lua.
function Panel:makeTextbox(...)
Parameters:
| Name | Type | Description | 
|---|---|---|
| ... | ? | ? | 
Declared on: line 166 of Lua/window.lua.
function Panel:makeToggleButton(...)
Parameters:
| Name | Type | Description | 
|---|---|---|
| ... | ? | ? | 
Declared on: line 154 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 234 of Lua/window.lua.
function Panel:setColour(col)
 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]. | 
Declared on: line 179 of Lua/window.lua.
function Panel:setDynamicTooltip(callback, x, y)
Parameters:
| Name | Type | Description | 
|---|---|---|
| callback | ? | ? | 
| x | ? | ? | 
| y | ? | ? | 
Declared on: line 212 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"/"centre"/"middle", "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 221 of Lua/window.lua.
function Panel:setPosition(x, y)
Parameters:
| Name | Type | Description | 
|---|---|---|
| x | ? | ? | 
| y | ? | ? | 
Declared on: line 304 of Lua/window.lua.
function Panel:setSize(width, height)
Parameters:
| Name | Type | Description | 
|---|---|---|
| width | ? | ? | 
| height | ? | ? | 
Declared on: line 309 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 200 of Lua/window.lua.