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
AccessibilityName
public override string AccessibilityName { get; }
Property Value
AccessibilityRole
public override AccessibilityRole AccessibilityRole { get; }
Property Value
AccessibilityStates
public override AccessibilityStates AccessibilityStates { get; }
Property Value
ActionMode
public ButtonActionMode ActionMode { get; set; }
Property Value
ButtonGroup
Gets or sets the mutual-exclusion group used by this button.
public ButtonGroup ButtonGroup { get; set; }
Property Value
ButtonMask
Physical pointer buttons that can activate this button, matching Godot's button_mask flags.
public ButtonMouseMask ButtonMask { get; set; }
Property Value
ButtonPressed
Gets or sets the toggled state, emitting Toggled when it changes.
public bool ButtonPressed { get; set; }
Property Value
ExpandIcon
public bool ExpandIcon { get; set; }
Property Value
Flat
Suppresses the default button panel while retaining focus feedback.
public bool Flat { get; set; }
Property Value
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
IconModulate
public Color IconModulate { get; set; }
Property Value
- Color
IconSeparation
public float IconSeparation { get; set; }
Property Value
IsHovering
public bool IsHovering { get; }
Property Value
IsPressing
public bool IsPressing { get; }
Property Value
IsShortcutFeedbackActive
public bool IsShortcutFeedbackActive { get; }
Property Value
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
KeepPressedOutside
Whether a release outside the button still completes an active pointer press.
public bool KeepPressedOutside { get; set; }
Property Value
Padding
public Thickness Padding { get; set; }
Property Value
Shortcut
Optional retained shortcut that activates this button without requiring focus.
public PopupMenuShortcut Shortcut { get; }
Property Value
ShortcutFeedback
Whether shortcut activation should temporarily use pressed drawing feedback.
public bool ShortcutFeedback { get; set; }
Property Value
ShortcutFeedbackDuration
Seconds of retained visual feedback after shortcut activation.
public float ShortcutFeedbackDuration { get; set; }
Property Value
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
Text
public string Text { get; set; }
Property Value
TextAlignment
Horizontal text placement for text-bearing buttons.
public HorizontalAlignment TextAlignment { get; set; }
Property Value
ToggleMode
public bool ToggleMode { get; set; }
Property Value
UIFont
public UIFont UIFont { get; set; }
Property Value
VerticalIconAlignment
public VerticalAlignment VerticalIconAlignment { get; set; }
Property Value
WasActivatedByPointer
protected bool WasActivatedByPointer { get; }
Property Value
Methods
GetActionMode()
public ButtonActionMode GetActionMode()
Returns
GetButtonMask()
public ButtonMouseMask GetButtonMask()
Returns
GetIconRectangle(Vector2)
Calculates the local icon rectangle for the configured icon alignment and expansion mode.
public Rectangle GetIconRectangle(Vector2 iconSize)
Parameters
iconSizeVector2
Returns
- Rectangle
GetMinimumSize()
public override Vector2 GetMinimumSize()
Returns
- Vector2
GetShortcut()
public PopupMenuShortcut GetShortcut()
Returns
GetTextPosition(Vector2)
Calculates local text placement independent of a font renderer.
public Vector2 GetTextPosition(Vector2 textSize)
Parameters
textSizeVector2
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
positionPoint
Returns
IsDisabled()
public bool IsDisabled()
Returns
IsHovered()
public bool IsHovered()
Returns
IsKeepPressedOutside()
public bool IsKeepPressedOutside()
Returns
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
IsPseudoStateActive(string)
public override bool IsPseudoStateActive(string state)
Parameters
statestring
Returns
IsShortcutFeedback()
public bool IsShortcutFeedback()
Returns
IsShortcutInTooltipEnabled()
public bool IsShortcutInTooltipEnabled()
Returns
IsToggleMode()
public bool IsToggleMode()
Returns
SetActionMode(ButtonActionMode)
public void SetActionMode(ButtonActionMode mode)
Parameters
modeButtonActionMode
SetButtonMask(ButtonMouseMask)
public void SetButtonMask(ButtonMouseMask mask)
Parameters
maskButtonMouseMask
SetDisabled(bool)
public void SetDisabled(bool disabled)
Parameters
disabledbool
SetKeepPressedOutside(bool)
public void SetKeepPressedOutside(bool enabled)
Parameters
enabledbool
SetPressed(bool)
public void SetPressed(bool pressed)
Parameters
pressedbool
SetPressedNoSignal(bool)
Sets the pressed state without emitting Toggled.
public void SetPressedNoSignal(bool pressed)
Parameters
pressedbool
SetShortcut(PopupMenuShortcut)
public void SetShortcut(PopupMenuShortcut shortcut)
Parameters
shortcutPopupMenuShortcut
SetShortcutFeedback(bool)
public void SetShortcutFeedback(bool enabled)
Parameters
enabledbool
SetShortcutInTooltip(bool)
public void SetShortcutInTooltip(bool enabled)
Parameters
enabledbool
SetToggleMode(bool)
public void SetToggleMode(bool enabled)
Parameters
enabledbool
Events
ButtonDown
public event EventHandler ButtonDown
Event Type
ButtonUp
public event EventHandler ButtonUp
Event Type
Pressed
public event EventHandler Pressed
Event Type
Toggled
public event Action<BaseButton, bool> Toggled