CorsixTH Lua Documentation

Panel Class

The basic component which makes up most `Window`s.

Declared on: line 127 of Lua/window.lua.
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

Member Index

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:

NameTypeDescription
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:

NameTypeDescription
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:

NameTypeDescription
... ? ?

Declared on: line 150 of Lua/window.lua.

function Panel:makeRepeatButton(...)

Parameters:

NameTypeDescription
... ? ?

Declared on: line 158 of Lua/window.lua.

function Panel:makeScrollbar(...)

Parameters:

NameTypeDescription
... ? ?

Declared on: line 162 of Lua/window.lua.

function Panel:makeTextbox(...)

Parameters:

NameTypeDescription
... ? ?

Declared on: line 166 of Lua/window.lua.

function Panel:makeToggleButton(...)

Parameters:

NameTypeDescription
... ? ?

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:

NameTypeDescription
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:

NameTypeDescription
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:

NameTypeDescription
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:

NameTypeDescription
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:

NameTypeDescription
x ? ?
y ? ?

Declared on: line 304 of Lua/window.lua.

function Panel:setSize(width, height)

Parameters:

NameTypeDescription
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:

NameTypeDescription
tooltip ? ?
x ? ?
y ? ?

Declared on: line 200 of Lua/window.lua.

Page generated on Sat Feb 07, 2015 at 18:38:28 by LDocGen.