cwLabelButton panelclient
Panel defined in core/derma/cl_labelbutton.lua
Defines cwLabelButton, a DLabel that works as a button with hovered, depressed and disabled states and an
optional background box.
Has FadeIn and FadeOut animations that play the theme's click and rollover sounds, OverrideTextColor, and
SetCallback to set the click handler. The character menu and the quiz use it for their buttons.
Summary
Methods
DoClick when the left button is released over an enabled label.Methods
Shows the label 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 label is fully visible
Starts fading the label 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 label is hidden
Returns whether the label is held down.
Returns
- Boolean Whether the label is held down
Returns whether the label is disabled.
Returns
- Boolean Whether the label is disabled
Returns whether the label is hovered.
Returns
- Boolean Whether the label is hovered
Marks the label as hovered unless it is disabled.
Clears the label's hovered state.
Captures the mouse and marks the label as held down.
Parameters
- code
Releases the mouse and calls DoClick when the left button is released over an enabled label.
Parameters
- code
Sets a text color that replaces the default white, with a darker variant used when hovered or disabled.
Parameters
- color Color Text color, or
nil/falseto use the default colors
Draws the background box, when enabled, lighter while hovered.
Parameters
- w
- h
Sets the size of the background box, or makes it follow the text size.
Parameters
- w Number optional, defaults to
nilWidth of the box; leave out withhto fit the text - h Number optional, defaults to
nilHeight of the box; leave out withwto fit the text
Sets the function called when the label is clicked, playing the click sound first.
Parameters
- Callback Function Called with the label
Sets whether the label is held down.
Parameters
- depressed Boolean
truewhile the mouse button is held on it
Sets whether the label ignores hovering and clicks and is drawn greyed out.
Parameters
- disabled Boolean
trueto disable the label
Sets whether a translucent box is drawn behind the label.
Parameters
- bDraw Boolean optional, defaults to
falsetrueto draw the box
Sets whether the label is hovered.
Parameters
- hovered Boolean
truewhile the cursor is over it
Runs the fade animation, sizes the label to its background box and colors the text for its disabled, hovered or normal state.