The standard Flux button (fl_button): a title with an optional FontAwesome icon, drawn by the active theme's PaintButton hook. Set it up with set_text, set_icon, set_icon_size, set_centered and set_text_offset, and assign DoClick or DoRightClick to handle clicks. set_active marks the button as selected, set_enabled(false) darkens its text and blocks mouse input, and set_background_color and set_draw_outline control what is drawn behind the title. Derives from fl_base_panel.

Summary

Methods

Returns the background color of the button.
Checks whether the outline of the button is drawn.
Returns the horizontal offset of the title, which is always 0 for centered buttons.
Checks whether the button is in the active (selected) state.
Calls DoClick on a left click and DoRightClick on a right click, if they are defined.
Delegates drawing of the button to the active theme's PaintButton hook.
Sets the active (selected) state of the button, which themes use when painting it.
Sets the background color of the button.
Sets whether the title is centered horizontally instead of placed at the text offset.
Sets whether a border in the theme's outline color is drawn around the button.
Enables or disables the button.
Sets the FontAwesome icon displayed next to the title.
Sets a fixed icon size and stops the icon from being resized to fit the button height.
Sets the title displayed on the button.
Sets the text autoposition flag.
Overrides the color of the title and the icon.
Sets the horizontal offset of the title from the left edge of the button.
Resizes the button to fit its title and icon in both dimensions.
Sets the width of the button to fit its title, icon and text offset.
Sets the height of the button to the height of its title text.
Think()client
Updates the hover fade amount and, unless an icon size was set explicitly, fits the icon size to the height of the button.
toggle()client
Flips the active state of the button.

Methods

PANEL:get_background_color()

client packages/active_ui/views/base/cl_button.lua:183

Returns the background color of the button.

Returns

  • Color the background color, or nil if none is set

PANEL:get_draw_outline()

client packages/active_ui/views/base/cl_button.lua:195

Checks whether the outline of the button is drawn.

Returns

  • Boolean

PANEL:get_text_offset()

client packages/active_ui/views/base/cl_button.lua:145

Returns the horizontal offset of the title, which is always 0 for centered buttons.

Returns

  • Number offset in pixels

Checks whether the button is in the active (selected) state.

Returns

  • Boolean

PANEL:OnMousePressed(key)

client packages/active_ui/views/base/cl_button.lua:52

Calls DoClick on a left click and DoRightClick on a right click, if they are defined.

Parameters

  • key Number mouse button code, one of the MOUSE_ enums

Delegates drawing of the button to the active theme's PaintButton hook.

Parameters

  • w Number panel width
  • h Number panel height

PANEL:set_active(active)

client packages/active_ui/views/base/cl_button.lua:99

Sets the active (selected) state of the button, which themes use when painting it.

Parameters

  • active Boolean

PANEL:set_background_color(color)

client packages/active_ui/views/base/cl_button.lua:177

Sets the background color of the button. It is only drawn while the panel's draw_background field is enabled.

Parameters

  • color Color the color to use, or nil for no background fill

PANEL:set_centered(centered)

client packages/active_ui/views/base/cl_button.lua:93

Sets whether the title is centered horizontally instead of placed at the text offset.

Parameters

  • centered Boolean

PANEL:set_draw_outline(should_draw)

client packages/active_ui/views/base/cl_button.lua:189

Sets whether a border in the theme's outline color is drawn around the button.

Parameters

  • should_draw Boolean

PANEL:set_enabled(enabled)

client packages/active_ui/views/base/cl_button.lua:118

Enables or disables the button. A disabled button ignores mouse input and is drawn with the dimmed text color of the theme; changing the state clears any text color set with set_text_color.

Parameters

  • enabled Boolean

PANEL:set_icon(icon, right)

client packages/active_ui/views/base/cl_button.lua:152

Sets the FontAwesome icon displayed next to the title.

Parameters

  • icon String FontAwesome icon ID, e.g. 'fa-times', or nil/false for no icon
  • right Boolean optional, defaults to false place the icon to the right of the title instead of the left

PANEL:set_icon_size(size)

client packages/active_ui/views/base/cl_button.lua:162

Sets a fixed icon size and stops the icon from being resized to fit the button height.

Parameters

  • size Number icon size in pixels

PANEL:set_text(new_text)

client packages/active_ui/views/base/cl_button.lua:133

Sets the title displayed on the button.

Parameters

  • new_text String

PANEL:set_text_autoposition(autopos)

client packages/active_ui/views/base/cl_button.lua:170

Sets the text autoposition flag. The flag is only stored; nothing in the framework reads it.

Parameters

  • autopos Boolean

PANEL:set_text_color(color)

client packages/active_ui/views/base/cl_button.lua:127

Overrides the color of the title and the icon.

Parameters

  • color Color the color to use, or nil to go back to the theme's text color

PANEL:set_text_offset(pos)

client packages/active_ui/views/base/cl_button.lua:139

Sets the horizontal offset of the title from the left edge of the button.

Parameters

  • pos Number optional, defaults to 0 offset in pixels

PANEL:SizeToContents()

client packages/active_ui/views/base/cl_button.lua:86

Resizes the button to fit its title and icon in both dimensions.

PANEL:SizeToContentsX()

client packages/active_ui/views/base/cl_button.lua:65

Sets the width of the button to fit its title, icon and text offset.

PANEL:SizeToContentsY()

client packages/active_ui/views/base/cl_button.lua:79

Sets the height of the button to the height of its title text.

Updates the hover fade amount and, unless an icon size was set explicitly, fits the icon size to the height of the button.

Flips the active state of the button.

Defined in