Class BaseButton

Namespace
Forma
Assembly
Forma.dll

Provides pointer, keyboard, shortcut, toggle, and button-group activation behavior for button controls.

public class BaseButton : ContentControl, IAddChild<Control>, IAddChild, INotifyPropertyChanged, IDisposable
Inheritance
BaseButton
Implements
Derived
Inherited Members

Constructors

BaseButton()

public BaseButton()

Properties

AccessibilityActions

public override AccessibilityActions AccessibilityActions { get; }

Property Value

AccessibilityActions

AccessibilityName

public override string AccessibilityName { get; }

Property Value

string

AccessibilityRole

public override AccessibilityRole AccessibilityRole { get; }

Property Value

AccessibilityRole

AccessibilityStates

public override AccessibilityStates AccessibilityStates { get; }

Property Value

AccessibilityStates

ActionMode

public ButtonActionMode ActionMode { get; set; }

Property Value

ButtonActionMode

ButtonGroup

Gets or sets the mutual-exclusion group used by this button.

public ButtonGroup ButtonGroup { get; set; }

Property Value

ButtonGroup

ButtonMask

Physical pointer buttons that can activate this button, matching Godot's button_mask flags.

public ButtonMouseMask ButtonMask { get; set; }

Property Value

ButtonMouseMask

ButtonPressed

Gets or sets the toggled state, emitting Toggled when it changes.

public bool ButtonPressed { get; set; }

Property Value

bool

ExpandIcon

public bool ExpandIcon { get; set; }

Property Value

bool

Flat

Suppresses the default button panel while retaining focus feedback.

public bool Flat { get; set; }

Property Value

bool

Font

public SpriteFont Font { get; set; }

Property Value

SpriteFont

Icon

Optional Godot-style icon displayed alongside the button text.

public Texture2D Icon { get; set; }

Property Value

Texture2D

IconAlignment

public HorizontalAlignment IconAlignment { get; set; }

Property Value

HorizontalAlignment

IconModulate

public Color IconModulate { get; set; }

Property Value

Color

IconSeparation

public float IconSeparation { get; set; }

Property Value

float

IsHovering

public bool IsHovering { get; }

Property Value

bool

IsPressing

public bool IsPressing { get; }

Property Value

bool

IsShortcutFeedbackActive

public bool IsShortcutFeedbackActive { get; }

Property Value

bool

IsVisuallyPressed

Whether the button should currently render as pressed, matching Godot's BaseButton::get_draw_mode() DRAW_PRESSED case. Unlike IsPressing/release activation, this combines with KeepPressedOutside while dragging outside the button's bounds. A keyboard-driven press is always visually pressed, matching Godot's status.pressing_inside being forced true for the accept-action path.

public bool IsVisuallyPressed { get; }

Property Value

bool

KeepPressedOutside

Whether a release outside the button still completes an active pointer press.

public bool KeepPressedOutside { get; set; }

Property Value

bool

Padding

public Thickness Padding { get; set; }

Property Value

Thickness

Shortcut

Optional retained shortcut that activates this button without requiring focus.

public PopupMenuShortcut Shortcut { get; }

Property Value

PopupMenuShortcut

ShortcutFeedback

Whether shortcut activation should temporarily use pressed drawing feedback.

public bool ShortcutFeedback { get; set; }

Property Value

bool

ShortcutFeedbackDuration

Seconds of retained visual feedback after shortcut activation.

public float ShortcutFeedbackDuration { get; set; }

Property Value

float

ShortcutInTooltip

Whether shortcut text should be appended to this button's tooltip, matching Godot's shortcut_in_tooltip.

public bool ShortcutInTooltip { get; set; }

Property Value

bool

Text

public string Text { get; set; }

Property Value

string

TextAlignment

Horizontal text placement for text-bearing buttons.

public HorizontalAlignment TextAlignment { get; set; }

Property Value

HorizontalAlignment

ToggleMode

public bool ToggleMode { get; set; }

Property Value

bool

UIFont

public UIFont UIFont { get; set; }

Property Value

UIFont

VerticalIconAlignment

public VerticalAlignment VerticalIconAlignment { get; set; }

Property Value

VerticalAlignment

WasActivatedByPointer

protected bool WasActivatedByPointer { get; }

Property Value

bool

Methods

GetActionMode()

public ButtonActionMode GetActionMode()

Returns

ButtonActionMode

GetButtonMask()

public ButtonMouseMask GetButtonMask()

Returns

ButtonMouseMask

GetIconRectangle(Vector2)

Calculates the local icon rectangle for the configured icon alignment and expansion mode.

public Rectangle GetIconRectangle(Vector2 iconSize)

Parameters

iconSize Vector2

Returns

Rectangle

GetMinimumSize()

public override Vector2 GetMinimumSize()

Returns

Vector2

GetShortcut()

public PopupMenuShortcut GetShortcut()

Returns

PopupMenuShortcut

GetTextPosition(Vector2)

Calculates local text placement independent of a font renderer.

public Vector2 GetTextPosition(Vector2 textSize)

Parameters

textSize Vector2

Returns

Vector2

GetTooltip(Point)

Returns the tooltip at a global pointer position. Override to provide dynamic help text.

public override string GetTooltip(Point position)

Parameters

position Point

Returns

string

IsDisabled()

public bool IsDisabled()

Returns

bool

IsHovered()

public bool IsHovered()

Returns

bool

IsKeepPressedOutside()

public bool IsKeepPressedOutside()

Returns

bool

IsPressed()

Matches Godot's BaseButton::is_pressed: the toggled state for a toggle button, or whether the pointer/key is currently held down otherwise.

public bool IsPressed()

Returns

bool

IsPseudoStateActive(string)

public override bool IsPseudoStateActive(string state)

Parameters

state string

Returns

bool

IsShortcutFeedback()

public bool IsShortcutFeedback()

Returns

bool

IsShortcutInTooltipEnabled()

public bool IsShortcutInTooltipEnabled()

Returns

bool

IsToggleMode()

public bool IsToggleMode()

Returns

bool

SetActionMode(ButtonActionMode)

public void SetActionMode(ButtonActionMode mode)

Parameters

mode ButtonActionMode

SetButtonMask(ButtonMouseMask)

public void SetButtonMask(ButtonMouseMask mask)

Parameters

mask ButtonMouseMask

SetDisabled(bool)

public void SetDisabled(bool disabled)

Parameters

disabled bool

SetKeepPressedOutside(bool)

public void SetKeepPressedOutside(bool enabled)

Parameters

enabled bool

SetPressed(bool)

public void SetPressed(bool pressed)

Parameters

pressed bool

SetPressedNoSignal(bool)

Sets the pressed state without emitting Toggled.

public void SetPressedNoSignal(bool pressed)

Parameters

pressed bool

SetShortcut(PopupMenuShortcut)

public void SetShortcut(PopupMenuShortcut shortcut)

Parameters

shortcut PopupMenuShortcut

SetShortcutFeedback(bool)

public void SetShortcutFeedback(bool enabled)

Parameters

enabled bool

SetShortcutInTooltip(bool)

public void SetShortcutInTooltip(bool enabled)

Parameters

enabled bool

SetToggleMode(bool)

public void SetToggleMode(bool enabled)

Parameters

enabled bool

Events

ButtonDown

public event EventHandler ButtonDown

Event Type

EventHandler

ButtonUp

public event EventHandler ButtonUp

Event Type

EventHandler

Pressed

public event EventHandler Pressed

Event Type

EventHandler

Toggled

public event Action<BaseButton, bool> Toggled

Event Type

Action<BaseButton, bool>