Instance Propertymigueldeicaza.swiftgodot 0.45.0SwiftGodot
toggleMode
If true
, the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.
final var toggleMode: Bool { get set }
Other members in extension
Types
enum ActionMode
enum DrawMode
class Signal1
Signal support.
Type members
Instance members
var actionMode: BaseButton.ActionMode
Determines when the button is considered clicked, one of the
ActionMode
constants.var disabled: Bool
If
true
, the button is in disabled state and can’t be clicked or toggled.var keepPressedOutside: Bool
If
true
, the button stays pressed when moving the cursor outside the button while pressing it.var pressed: SimpleSignal
Emitted when the button is toggled or pressed. This is on [signal button_down] if
actionMode
is .buttonPress and on [signal button_up] otherwise.var shortcut: Shortcut?
Shortcut
associated to the button.var shortcutFeedback: Bool
If
true
, the button will highlight for a short amount of time when its shortcut is activated. Iffalse
andtoggleMode
isfalse
, the shortcut will activate without any visual feedback.var shortcutInTooltip: Bool
If
true
, the button will add information about its shortcut in the tooltip.var toggled: Signal1
Emitted when the button was just toggled between pressed and normal states (only if
toggleMode
is active). The new state is contained in thetoggledOn
argument.func getDrawMode(
) -> BaseButton.DrawMode 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
DrawMode
enum.func isHovered(
) -> Bool Returns
true
if the mouse has entered the button and has not left it yet.func setPressedNoSignal(pressed: Bool
) Changes the
buttonPressed
state of the button, without emitting [signal toggled]. Use when you just want to change the state of the button without sending the pressed event (e.g. when initializing scene). Only works iftoggleMode
istrue
.
Show implementation details (2)
Hide implementation details
func _pressed(
) Called when the button is pressed. If you need to know the button’s pressed state (and
toggleMode
is active), use_toggled(toggledOn:)
instead.func _toggled(toggledOn: Bool
) Called when the button is toggled (only if
toggleMode
is active).