cwFAButton panelclient
Panel defined in core/derma/cl_fabutton.lua
Defines the cwFAButton panel, a button that draws a Font Awesome icon with an optional text label next to it.
The icon is drawn with cw.FontIcons:Draw and set up with SetIcon, SetIconSize and SetText; SetCallback
sets what a click does. A collapsible button toggles between showing and hiding its text when clicked, and FadeIn
and FadeOut animate its alpha. It is the base of the main menu's buttons, such as cw.menuButton.
Summary
Methods
Methods
Shows the button and starts fading it in, playing the click sound.
Parameters
- speed Number Length of the fade in seconds
- Callback Function optional, defaults to
nilCalled once the button is fully visible
Starts fading the button out and hiding it, playing the rollover sound.
Parameters
- speed Number Length of the fade in seconds
- Callback Function optional, defaults to
nilCalled once the button is hidden
Toggles the button when it is collapsible and runs its callback, reporting any error it throws.
Sets a color that replaces the text and icon color, including the hover color.
Parameters
- color Color Color to use, or
nilto use the default colors
Draws the background, when enabled, then the icon and text, highlighted when hovered.
Parameters
- w
- h
Sets the function called when the button is clicked.
Parameters
- cb Function Called with the button; errors are caught and printed
Sets whether clicking the button toggles it open and closed.
Parameters
- coll Boolean
trueto toggle on click
PANEL:SetDrawBackground(bDrawBackground)
client gamemodes/catwork/gamemode/core/derma/cl_fabutton.lua:30Sets whether the button draws its dark background box.
Parameters
- bDrawBackground Boolean
trueto draw the background
Sets the font of the button's text.
Parameters
- font String Font name;
Derma16is used when unset
Aliases
PANEL.SetTextFont
Sets the Font Awesome icon drawn on the button.
Parameters
- id String Icon name, as accepted by
cw.FontIcons:Draw
Sets the icon's size and offset.
Parameters
- w Number optional, defaults to
16Icon width - h Number optional, defaults to
16Icon height, also used as the icon's draw size - x Number optional, defaults to
0Horizontal offset of the icon - y Number optional, defaults to
0Vertical offset of the icon
Sets whether the button is open, which shows its text next to the icon.
Parameters
- bIsOpen Boolean
trueto show the text
Sets the button's text and makes it visible.
Parameters
- text String Text to draw
Sets the position of the text inside the button, replacing the default placement after the icon.
Parameters
- x Number Horizontal offset
- y Number Vertical offset
Sets whether the button highlights itself when hovered.
Parameters
- hover Boolean
trueto highlight on hover
Resizes the button to fit its icon and text.
Aliases
PANEL.SizeToContents
Shows the text only while the button is open.
Toggles whether the button is open.