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
Methods
Returns the background color of the button.
Returns
- Color the background color, or nil if none is set
Checks whether the outline of the button is drawn.
Returns
- Boolean
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
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
Sets the active (selected) state of the button, which themes use when painting it.
Parameters
- active Boolean
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
Sets whether the title is centered horizontally instead of placed at the text offset.
Parameters
- centered Boolean
Sets whether a border in the theme's outline color is drawn around the button.
Parameters
- should_draw Boolean
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
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
falseplace the icon to the right of the title instead of the left
Sets a fixed icon size and stops the icon from being resized to fit the button height.
Parameters
- size Number icon size in pixels
Sets the title displayed on the button.
Parameters
- new_text String
Sets the text autoposition flag. The flag is only stored; nothing in the framework reads it.
Parameters
- autopos Boolean
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
Sets the horizontal offset of the title from the left edge of the button.
Parameters
- pos Number optional, defaults to
0offset in pixels
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.
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.