The button of Lumen (lumen_button), behind the button element. A text panel that takes the mouse, lightens when hovered, is drawn with the active_background of its style when set_active is on, is dimmed and ignores clicks when set_enabled is off, and can show a FontAwesome icon in front of its text with set_icon. Fires the on_press and on_right_press props when a button is released over it. Derives from lumen_text.

Summary

Methods

Returns the background to draw right now: the active, hovered or plain one of the style.
Returns the color of the text right now.
Returns the size of the icon, which is the height of a line of the font.
Returns the width the icon and the space after it take up.
Init()client
Takes the mouse and shows the hand cursor.
Checks whether the button is marked as selected.
Checks whether the button is enabled.
Forgets a press when the cursor leaves the panel.
Remembers that a button went down on the panel.
Fires the press handler of the button that went down on the panel.
Draws the background, the icon and the text.
Marks the button as selected, which draws it with the active_background of its style.
Enables or disables the button.
Sets the FontAwesome icon drawn in front of the text.
Think()client
Fades the hover highlight in and out.

Methods

PANEL:get_background()

client packages/lumen/views/cl_button.lua:93

Returns the background to draw right now: the active, hovered or plain one of the style.

Returns

  • Color, or nil for none

PANEL:get_current_text_color()

client packages/lumen/views/cl_button.lua:135

Returns the color of the text right now.

Returns

  • Color

PANEL:get_icon_font_size()

client packages/lumen/views/cl_button.lua:61

Returns the size of the icon, which is the height of a line of the font.

Returns

  • Number

PANEL:get_icon_size()

client packages/lumen/views/cl_button.lua:67

Returns the width the icon and the space after it take up.

Returns

  • Number 0 without an icon or without the FontAwesome package

Takes the mouse and shows the hand cursor.

PANEL:is_active()

client packages/lumen/views/cl_button.lua:44

Checks whether the button is marked as selected.

Returns

  • Boolean

PANEL:is_enabled()

client packages/lumen/views/cl_button.lua:32

Checks whether the button is enabled.

Returns

  • Boolean

PANEL:OnCursorExited()

client packages/lumen/views/cl_button.lua:200

Forgets a press when the cursor leaves the panel.

PANEL:OnMousePressed(code)

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

Remembers that a button went down on the panel.

Parameters

  • code Number mouse button

PANEL:OnMouseReleased(code)

client packages/lumen/views/cl_button.lua:187

Fires the press handler of the button that went down on the panel.

Parameters

  • code Number mouse button

PANEL:Paint(w, h)

client packages/lumen/views/cl_button.lua:150

Draws the background, the icon and the text.

Parameters

  • w Number panel width
  • h Number panel height

PANEL:set_active(active)

client packages/lumen/views/cl_button.lua:38

Marks the button as selected, which draws it with the active_background of its style.

Parameters

  • active Boolean

PANEL:set_enabled(enabled)

client packages/lumen/views/cl_button.lua:26

Enables or disables the button. A disabled button ignores clicks and draws its text in the disabled_color of its style, or darkened.

Parameters

  • enabled Boolean

PANEL:set_icon(icon)

client packages/lumen/views/cl_button.lua:50

Sets the FontAwesome icon drawn in front of the text.

Parameters

  • icon String icon ID such as 'fa-times', or nil for none

Fades the hover highlight in and out.

Defined in