Defines cwImageButton, a DImage that works as a button with hovered, depressed and disabled states.

Has FadeIn and FadeOut animations that play the theme's click and rollover sounds, and SetCallback to set the click handler.

Summary

Methods

Shows the button and fades it in, playing the click sound.
Fades the button out and hides it, playing the rollover sound.
Returns whether the button is held down.
Returns whether the button is disabled.
Returns whether the button is hovered.
Marks the button as hovered unless it is disabled.
Clears the button's hovered state.
Captures the mouse and marks the button as held down.
Releases the mouse and calls DoClick when the left button is released over an enabled button.
Sets the function called when the button is clicked, playing the click sound first.
Sets whether the button is held down.
Sets whether the button ignores hovering and clicks.
Sets whether the button is hovered.
Think()client
Runs the fade animation.

Methods

Shows the button and fades it in, playing the click sound.

Parameters

  • speed Number Length of the fade in seconds
  • Callback Function optional, defaults to nil Called once the button is fully visible

PANEL:FadeOut(speed, Callback)

client gamemodes/catwork/gamemode/core/derma/cl_imagebutton.lua:88

Fades the button out and hides it, playing the rollover sound.

Parameters

  • speed Number Length of the fade in seconds
  • Callback Function optional, defaults to nil Called once the button is hidden

Returns whether the button is held down.

Returns

  • Boolean Whether the button is held down

Returns whether the button is disabled.

Returns

  • Boolean Whether the button is disabled

Returns whether the button is hovered.

Returns

  • Boolean Whether the button is hovered

Marks the button as hovered unless it is disabled.

Clears the button's hovered state.

Captures the mouse and marks the button as held down.

Parameters

  • code

Releases the mouse and calls DoClick when the left button is released over an enabled button.

Parameters

  • code

Sets the function called when the button is clicked, playing the click sound first.

Parameters

  • Callback Function Called with the button

Sets whether the button is held down.

Parameters

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

Sets whether the button ignores hovering and clicks.

Parameters

  • disabled Boolean true to disable the button

Sets whether the button is hovered.

Parameters

  • hovered Boolean true while the cursor is over it

Runs the fade animation.

Defined in