Documentation ¶
Overview ¶
Package Button provides methods for working with Button object instances.
Index ¶
- type Advanced
- type Any
- type HorizontalAlignment
- type Instance
- func (self Instance) Alignment() HorizontalAlignment
- func (self Instance) AsBaseButton() BaseButton.Instance
- func (self Instance) AsButton() Instance
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsControl() Control.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AutowrapMode() gdclass.TextServerAutowrapMode
- func (self Instance) ClipText() bool
- func (self Instance) ExpandIcon() bool
- func (self Instance) Flat() bool
- func (self Instance) Icon() [1]gdclass.Texture2D
- func (self Instance) IconAlignment() HorizontalAlignment
- func (self Instance) Language() string
- func (self Instance) SetAlignment(value HorizontalAlignment)
- func (self Instance) SetAutowrapMode(value gdclass.TextServerAutowrapMode)
- func (self Instance) SetClipText(value bool)
- func (self Instance) SetExpandIcon(value bool)
- func (self Instance) SetFlat(value bool)
- func (self Instance) SetIcon(value [1]gdclass.Texture2D)
- func (self Instance) SetIconAlignment(value HorizontalAlignment)
- func (self Instance) SetLanguage(value string)
- func (self Instance) SetText(value string)
- func (self Instance) SetTextDirection(value gdclass.ControlTextDirection)
- func (self Instance) SetTextOverrunBehavior(value gdclass.TextServerOverrunBehavior)
- func (self Instance) SetVerticalIconAlignment(value VerticalAlignment)
- func (self Instance) Text() string
- func (self Instance) TextDirection() gdclass.ControlTextDirection
- func (self Instance) TextOverrunBehavior() gdclass.TextServerOverrunBehavior
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) VerticalIconAlignment() VerticalAlignment
- func (self Instance) Virtual(name string) reflect.Value
- type VerticalAlignment
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 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 ¶
[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 (Instance) Alignment ¶
func (self Instance) Alignment() HorizontalAlignment
func (Instance) AsBaseButton ¶
func (self Instance) AsBaseButton() BaseButton.Instance
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AutowrapMode ¶
func (self Instance) AutowrapMode() gdclass.TextServerAutowrapMode
func (Instance) ExpandIcon ¶
func (Instance) IconAlignment ¶
func (self Instance) IconAlignment() HorizontalAlignment
func (Instance) SetAlignment ¶
func (self Instance) SetAlignment(value HorizontalAlignment)
func (Instance) SetAutowrapMode ¶
func (self Instance) SetAutowrapMode(value gdclass.TextServerAutowrapMode)
func (Instance) SetClipText ¶
func (Instance) SetExpandIcon ¶
func (Instance) SetIconAlignment ¶
func (self Instance) SetIconAlignment(value HorizontalAlignment)
func (Instance) SetLanguage ¶
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) TextDirection ¶
func (self Instance) TextDirection() gdclass.ControlTextDirection
func (Instance) TextOverrunBehavior ¶
func (self Instance) TextOverrunBehavior() gdclass.TextServerOverrunBehavior
func (*Instance) UnsafePointer ¶
func (Instance) VerticalIconAlignment ¶
func (self Instance) VerticalIconAlignment() VerticalAlignment
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 )