Button

Inherits: BaseButton < Control < CanvasItem < Node < Object

Inherited By: OptionButton, ColorPickerButton, CheckButton, MenuButton, ToolButton, CheckBox

Category: Core

Brief Description

Standard themed Button.

Member Functions

Texture get_button_icon ( ) const
bool get_clip_text ( ) const
String get_text ( ) const
int get_text_align ( ) const
bool is_flat ( ) const
void set_button_icon ( Texture texture )
void set_clip_text ( bool enabled )
void set_flat ( bool enabled )
void set_text ( String text )
void set_text_align ( int align )

Numeric Constants

  • ALIGN_LEFT = 0 — Align the text to the left.
  • ALIGN_CENTER = 1 — Center the text.
  • ALIGN_RIGHT = 2 — Align the text to the right.

Description

Button is the standard themed button. It can contain text and an icon, and will display them according to the current Theme.

Member Function Description

  • Texture get_button_icon ( ) const

Return the button icon.

  • bool get_clip_text ( ) const

Return the state of the clip_text property (see set_clip_text)

Return the button text.

  • int get_text_align ( ) const

Return the text alignment policy.

  • bool is_flat ( ) const

Return the state of the flat property (see set_flat).

  • void set_button_icon ( Texture texture )

Set the icon that will be displayed next to the text inside the button area.

  • void set_clip_text ( bool enabled )

Set the clip_text property of a Button. When this property is enabled, text that is too large to fit the button is clipped, when disabled (default) the Button will always be wide enough to hold the text.

  • void set_flat ( bool enabled )

Set the flat property of a Button. Flat buttons don’t display decoration unless hovered or pressed.

  • void set_text ( String text )

Set the button text, which will be displayed inside the button area.

  • void set_text_align ( int align )

Set the text alignment policy, using one of the ALIGN_* constants.