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

Init()client
Creates the notice's comment icon and text label on a blue background.
Returns whether the notice acts as a button.
Returns whether the notice is held down.
Returns 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.
Plays the click sound and calls DoClick when a held button is released over the notice.
Draws the notice's background, shrunk while pressed and lightened while a hovered button.
Centres the text, or aligns it to the left when SetTextToLeft is set, and moves the icon next to it.
Sets whether the notice acts as a button that calls DoClick when clicked.
Sets whether the notice is held down.
Sets whether the notice is hovered.
Sets and shows the notice's icon.
Sets the notice's background color and icon from a preset, or a custom color without an icon.
Shows or hides the notice's icon.
Sets the notice's text and resizes the label to fit it.
Sets the color of the notice's text.
Sets whether the text is aligned to the left instead of centred.
Moves the icon next to the text, or to the left edge when the text is aligned left.

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.

PANEL:OnMousePressed(mouseCode)

client gamemodes/catwork/gamemode/core/derma/cl_infotext.lua:126

Marks the notice as held down and captures the mouse when it is a button.

Parameters

  • mouseCode

PANEL:OnMouseReleased(mouseCode)

client gamemodes/catwork/gamemode/core/derma/cl_infotext.lua:134

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 true to make the notice clickable

PANEL:SetDepressed(isDepressed)

client gamemodes/catwork/gamemode/core/derma/cl_infotext.lua:97

Sets whether the notice is held down.

Parameters

  • isDepressed Boolean true while the mouse button is held on it

Sets whether the notice is hovered.

Parameters

  • isHovered Boolean true while 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 nil Width and height of the icon; defaults to the info_text_icon_size option

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 Color for a custom background

Shows or hides the notice's icon.

Parameters

  • showIcon Boolean true to 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 true to align the text to the left

Moves the icon next to the text, or to the left edge when the text is aligned left.

Defined in