Base class for different kinds of buttons.
    public abstract class BaseButton : Control

BaseButton is the abstract base class for buttons, so it shouldn’t be used directly (it doesn’t display anything). Other types of buttons inherit from it.

Inheritance Chain

Derived Classes

Signals

    "button_down" ()

Emitted when the button starts being held down.

    "button_up" ()

Emitted when the button stops being held down.

    "pressed" ()

Emitted when the button is toggled or pressed. This is on button_down if ActionMode is [constant ACTION_MODE_BUTTON_PRESS] and on button_up otherwise.

    "toggled" (bool button_pressed)

Emitted when the button was just toggled between pressed and normal states (only if ToggleMode is active). The new state is contained in the button_pressed argument.

Properties

    public ActionModeEnum ActionMode { get; set; }

Determines when the button is considered clicked, one of the ACTION_MODE_* constants.

    public int ButtonMask { get; set; }

Binary mask to choose which mouse buttons this button will respond to.

To allow both left-click and right-click, use BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT.

    public bool Disabled { get; set; }

If true, the button is in disabled state and can’t be clicked or toggled.

    public Control.FocusModeEnum EnabledFocusMode { get; set; }

Focus access mode to use when switching between enabled/disabled (see Control.FocusMode and Disabled).

    public ButtonGroup Group { get; set; }

ButtonGroup associated to the button.

    public bool KeepPressedOutside { get; set; }

If true, the button stays pressed when moving the cursor outside the button while pressing it.

    public bool Pressed { get; set; }

If true, the button’s state is pressed. Means the button is pressed down or toggled (if toggle_mode is active).

    public ShortCut Shortcut { get; set; }

ShortCut associated to the button.

    public bool ShortcutInTooltip { get; set; }

If true, the button will add information about its shortcut in the tooltip.

    public bool ToggleMode { get; set; }

If true, the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.

Methods

    public virtual void _Pressed()

Called when the button is pressed.

    public virtual void _Toggled(bool buttonPressed)

Called when the button is toggled (only if toggle_mode is active).

    [Obsolete("GetActionMode is deprecated. Use the ActionMode property instead.")]
    public ActionModeEnum GetActionMode()

Getter for ActionMode

    [Obsolete("GetButtonGroup is deprecated. Use the Group property instead.")]
    public ButtonGroup GetButtonGroup()

Getter for Group

    [Obsolete("GetButtonMask is deprecated. Use the ButtonMask property instead.")]
    public int GetButtonMask()

Getter for ButtonMask

    public DrawMode GetDrawMode()

Returns the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overriding _draw() or connecting to “draw” signal. The visual state of the button is defined by the DRAW_* enum.

    [Obsolete("GetEnabledFocusMode is deprecated. Use the EnabledFocusMode property instead.")]
    public FocusModeEnum GetEnabledFocusMode()

Getter for EnabledFocusMode

    [Obsolete("GetShortcut is deprecated. Use the Shortcut property instead.")]
    public ShortCut GetShortcut()

Getter for Shortcut

    [Obsolete("IsDisabled is deprecated. Use the Disabled property instead.")]
    public bool IsDisabled()

Getter for Disabled

    public bool IsHovered()

Returns true if the mouse has entered the button and has not left it yet.

    [Obsolete("IsKeepPressedOutside is deprecated. Use the KeepPressedOutside property instead.")]
    public bool IsKeepPressedOutside()

Getter for KeepPressedOutside

    [Obsolete("IsPressed is deprecated. Use the Pressed property instead.")]
    public bool IsPressed()

Getter for _Pressed()

    [Obsolete("IsShortcutInTooltipEnabled is deprecated. Use the ShortcutInTooltip property instead.")]
    public bool IsShortcutInTooltipEnabled()

Getter for ShortcutInTooltip

    [Obsolete("IsToggleMode is deprecated. Use the ToggleMode property instead.")]
    public bool IsToggleMode()

Getter for ToggleMode

    [Obsolete("SetActionMode is deprecated. Use the ActionMode property instead.")]
    public void SetActionMode(ActionModeEnum mode)

Setter for ActionMode

    [Obsolete("SetButtonGroup is deprecated. Use the Group property instead.")]
    public void SetButtonGroup(ButtonGroup buttonGroup)

Setter for Group

    [Obsolete("SetButtonMask is deprecated. Use the ButtonMask property instead.")]
    public void SetButtonMask(int mask)

Setter for ButtonMask

    [Obsolete("SetDisabled is deprecated. Use the Disabled property instead.")]
    public void SetDisabled(bool disabled)

Setter for Disabled

    [Obsolete("SetEnabledFocusMode is deprecated. Use the EnabledFocusMode property instead.")]
    public void SetEnabledFocusMode(FocusModeEnum mode)

Setter for EnabledFocusMode

    [Obsolete("SetKeepPressedOutside is deprecated. Use the KeepPressedOutside property instead.")]
    public void SetKeepPressedOutside(bool enabled)

Setter for KeepPressedOutside

    [Obsolete("SetPressed is deprecated. Use the Pressed property instead.")]
    public void SetPressed(bool pressed)

Setter for _Pressed()

    [Obsolete("SetShortcut is deprecated. Use the Shortcut property instead.")]
    public void SetShortcut(ShortCut shortcut)

Setter for Shortcut

    [Obsolete("SetShortcutInTooltip is deprecated. Use the ShortcutInTooltip property instead.")]
    public void SetShortcutInTooltip(bool enabled)

Setter for ShortcutInTooltip

    [Obsolete("SetToggleMode is deprecated. Use the ToggleMode property instead.")]
    public void SetToggleMode(bool enabled)

Setter for ToggleMode

Inner Types

ActionModeEnum

Name Value Description
Press 0 Require just a press to consider the button clicked.
Release 1 Require a press and a subsequent release before considering the button clicked.

DrawMode

Name Value Description
Normal 0 The normal state (i.e. not pressed, not hovered, not toggled and enabled) of buttons.
Pressed 1 The state of buttons are pressed.
Hover 2 The state of buttons are hovered.
Disabled 3 The state of buttons are disabled.
HoverPressed 4  
Tags: