The text panel of Lumen (lumen_text), behind the text element. It draws its text with the font and the color of its style, wraps it to its width unless wrap_text is false, aligns it with text_align and vertical_align, and measures itself for the layout engine. set_text changes the text. Derives from EditablePanel.

Summary

Methods

Draws the lines of text with the alignment of the style.
Returns the font of the style, or the default Derma font.
Returns the text.
Returns the color of the text: the one of the style, or the text color of the theme, or white.
Measures the size the text needs, wrapped to the width available.
Measures lines of text.
Fires the press handlers of the element.
Draws the background of the style and the text.
Wraps the text to the width of the panel.
Sets the text and lays the panel out again if it has changed.
Splits the text into the lines that fit a width.

Methods

PANEL:draw_text(w, h, color, offset_x)

client packages/lumen/views/cl_text.lua:131

Draws the lines of text with the alignment of the style.

Parameters

  • w Number panel width
  • h Number panel height
  • color Color optional, defaults to nil color to draw with instead of the one of the style
  • offset_x Number optional, defaults to 0 space taken up at the left, by an icon

PANEL:get_font()

client packages/lumen/views/cl_text.lua:43

Returns the font of the style, or the default Derma font.

Returns

  • String

PANEL:get_text()

client packages/lumen/views/cl_text.lua:37

Returns the text.

Returns

  • String

PANEL:get_text_color()

client packages/lumen/views/cl_text.lua:52

Returns the color of the text: the one of the style, or the text color of the theme, or white.

Returns

  • Color

PANEL:lumen_measure(max_w, _max_h)

client packages/lumen/views/cl_text.lua:106

Measures the size the text needs, wrapped to the width available.

Parameters

  • max_w Number width available, nil if unconstrained
  • _max_h Number height available, nil if unconstrained

Returns

  • Number width
  • Number height

PANEL:measure_lines(lines)

client packages/lumen/views/cl_text.lua:88

Measures lines of text.

Parameters

  • lines List<String>

Returns

  • Number width of the widest line
  • Number height of all lines

PANEL:OnMousePressed(code)

client packages/lumen/views/cl_text.lua:179

Fires the press handlers of the element.

Parameters

  • code Number mouse button

PANEL:Paint(w, h)

client packages/lumen/views/cl_text.lua:171

Draws the background of the style and the text.

Parameters

  • w Number panel width
  • h Number panel height

PANEL:PerformLayout(w, _h)

client packages/lumen/views/cl_text.lua:119

Wraps the text to the width of the panel.

Parameters

  • w Number panel width
  • _h Number panel height

PANEL:set_text(text)

client packages/lumen/views/cl_text.lua:23

Sets the text and lays the panel out again if it has changed.

Parameters

  • text String

PANEL:wrap(width)

client packages/lumen/views/cl_text.lua:65

Splits the text into the lines that fit a width.

Parameters

  • width Number width available to the text, nil to keep the lines as they are

Returns

  • List<String>

Defined in