cwInfoText panelclient
Panel defined in core/derma/cl_infotext.lua
Defines cwInfoText, a colored notice bar with an icon and a line of text that can also act as a button.
SetInfoColor picks a preset background color and icon or a custom color, SetButton makes the notice call
DoClick when clicked. It is used across the menus for messages such as an empty list.
Summary
Methods
DoClick when a held button is released over the notice.SetTextToLeft is set, and moves the icon next to it.DoClick when clicked.Methods
Creates the notice's comment icon and text label on a blue background.
Returns whether the notice acts as a button.
Returns
- Boolean Whether the notice is clickable
Returns whether the notice is held down.
Returns
- Boolean Whether the notice is held down
Returns whether the notice is hovered.
Returns
- Boolean Whether the notice is hovered
Marks the notice as hovered.
Clears the notice's hovered state.
Marks the notice as held down and captures the mouse when it is a button.
Parameters
- mouseCode
Plays the click sound and calls DoClick when a held button is released over the notice.
Parameters
- mouseCode
Draws the notice's background, shrunk while pressed and lightened while a hovered button.
Parameters
- w
- h
Centres the text, or aligns it to the left when SetTextToLeft is set, and moves the icon next to it.
Parameters
- w
- h
Sets whether the notice acts as a button that calls DoClick when clicked.
Parameters
- isButton Boolean
trueto make the notice clickable
Sets whether the notice is held down.
Parameters
- isDepressed Boolean
truewhile the mouse button is held on it
Sets whether the notice is hovered.
Parameters
- isHovered Boolean
truewhile the cursor is over it
Sets and shows the notice's icon.
Parameters
- icon String Image path of the icon
- size Number optional, defaults to
nilWidth and height of the icon; defaults to theinfo_text_icon_sizeoption
Sets the notice's background color and icon from a preset, or a custom color without an icon.
The presets are 'red', 'orange', 'green' and 'blue', each with the icon from the matching
info_text_*_icon option.
Parameters
- color String Preset name, or a
Colorfor a custom background
Shows or hides the notice's icon.
Parameters
- showIcon Boolean
trueto show the icon
Sets the notice's text and resizes the label to fit it.
Parameters
- text String Text to show; may be a language phrase
Sets the color of the notice's text.
Parameters
- color Color Text color
Sets whether the text is aligned to the left instead of centred.
Parameters
- bValue Boolean
trueto align the text to the left
Moves the icon next to the text, or to the left edge when the text is aligned left.