Button

package
v0.0.0-...-ae8aae0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package Button provides methods for working with Button object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsButton() Instance
}

type HorizontalAlignment

type HorizontalAlignment int
const (
	/*Horizontal left alignment, usually for text-derived classes.*/
	HorizontalAlignmentLeft HorizontalAlignment = 0
	/*Horizontal center alignment, usually for text-derived classes.*/
	HorizontalAlignmentCenter HorizontalAlignment = 1
	/*Horizontal right alignment, usually for text-derived classes.*/
	HorizontalAlignmentRight HorizontalAlignment = 2
	/*Expand row to fit width, usually for text-derived classes.*/
	HorizontalAlignmentFill HorizontalAlignment = 3
)

type Instance

type Instance [1]gdclass.Button

[Button] is the standard themed button. It can contain text and an icon, and it will display them according to the current [Theme]. [b]Example of creating a button and assigning an action when pressed by code:[/b] [codeblocks] [gdscript] func _ready():

var button = Button.new()
button.text = "Click me"
button.pressed.connect(self._button_pressed)
add_child(button)

func _button_pressed():

print("Hello world!")

[/gdscript] [csharp] public override void _Ready()

{
    var button = new Button();
    button.Text = "Click me";
    button.Pressed += ButtonPressed;
    AddChild(button);
}

private void ButtonPressed()

{
    GD.Print("Hello world!");
}

[/csharp] [/codeblocks] See also [BaseButton] which contains common properties and methods associated with this node. [b]Note:[/b] Buttons do not interpret touch input and therefore don't support multitouch, since mouse emulation can only press one button at a given time. Use [TouchScreenButton] for buttons that trigger gameplay movement or actions.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) Alignment

func (self Instance) Alignment() HorizontalAlignment

func (Instance) AsBaseButton

func (self Instance) AsBaseButton() BaseButton.Instance

func (Instance) AsButton

func (self Instance) AsButton() Instance

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsControl

func (self Instance) AsControl() Control.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AutowrapMode

func (self Instance) AutowrapMode() gdclass.TextServerAutowrapMode

func (Instance) ClipText

func (self Instance) ClipText() bool

func (Instance) ExpandIcon

func (self Instance) ExpandIcon() bool

func (Instance) Flat

func (self Instance) Flat() bool

func (Instance) Icon

func (self Instance) Icon() [1]gdclass.Texture2D

func (Instance) IconAlignment

func (self Instance) IconAlignment() HorizontalAlignment

func (Instance) Language

func (self Instance) Language() string

func (Instance) SetAlignment

func (self Instance) SetAlignment(value HorizontalAlignment)

func (Instance) SetAutowrapMode

func (self Instance) SetAutowrapMode(value gdclass.TextServerAutowrapMode)

func (Instance) SetClipText

func (self Instance) SetClipText(value bool)

func (Instance) SetExpandIcon

func (self Instance) SetExpandIcon(value bool)

func (Instance) SetFlat

func (self Instance) SetFlat(value bool)

func (Instance) SetIcon

func (self Instance) SetIcon(value [1]gdclass.Texture2D)

func (Instance) SetIconAlignment

func (self Instance) SetIconAlignment(value HorizontalAlignment)

func (Instance) SetLanguage

func (self Instance) SetLanguage(value string)

func (Instance) SetText

func (self Instance) SetText(value string)

func (Instance) SetTextDirection

func (self Instance) SetTextDirection(value gdclass.ControlTextDirection)

func (Instance) SetTextOverrunBehavior

func (self Instance) SetTextOverrunBehavior(value gdclass.TextServerOverrunBehavior)

func (Instance) SetVerticalIconAlignment

func (self Instance) SetVerticalIconAlignment(value VerticalAlignment)

func (Instance) Text

func (self Instance) Text() string

func (Instance) TextDirection

func (self Instance) TextDirection() gdclass.ControlTextDirection

func (Instance) TextOverrunBehavior

func (self Instance) TextOverrunBehavior() gdclass.TextServerOverrunBehavior

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) VerticalIconAlignment

func (self Instance) VerticalIconAlignment() VerticalAlignment

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type VerticalAlignment

type VerticalAlignment int
const (
	/*Vertical top alignment, usually for text-derived classes.*/
	VerticalAlignmentTop VerticalAlignment = 0
	/*Vertical center alignment, usually for text-derived classes.*/
	VerticalAlignmentCenter VerticalAlignment = 1
	/*Vertical bottom alignment, usually for text-derived classes.*/
	VerticalAlignmentBottom VerticalAlignment = 2
	/*Expand rows to fit height, usually for text-derived classes.*/
	VerticalAlignmentFill VerticalAlignment = 3
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL