Control

package
v0.0.0-...-357ca8a Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Base class for all UI-related nodes. Control features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, and offsets relative to the anchor. The offsets update automatically when the node, any of its parents, or the screen size change.

For more information on Godot's UI system, anchors, offsets, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from Control and Container nodes.

Note: Since both Node2D and Control inherit from CanvasItem, they share several concepts from the class such as the CanvasItem.ZIndex and CanvasItem.Visible properties.

User Interface nodes and input

Godot propagates input events via viewports. Each Viewport is responsible for propagating InputEvents to their child nodes. As the SceneTree.Root is a Window, this already happens automatically for all UI elements in your game.

Input events are propagated through the SceneTree from the root node to all child nodes by calling Node.Input. For UI elements specifically, it makes more sense to override the virtual method GuiInput, which filters out unrelated input events, such as by checking z-order, MouseFilter, focus, or if the event was inside of the control's bounding box.

Call AcceptEvent so no other node receives the event. Once you accept an input, it becomes handled so Node.UnhandledInput will not process it.

Only one Control node can be in focus. Only the node in focus will receive events. To get the focus, call GrabFocus. Control nodes lose focus when another node grabs it, or if you hide the node in focus.

Sets MouseFilter to MouseFilterIgnore to tell a Control node to ignore mouse or touch events. You'll need it if you place an icon on top of a button.

Theme resources change the control's appearance. The Theme of a Control node affects all of its direct and indirect children (as long as a chain of controls is uninterrupted). To override some of the theme items, call one of the add_theme_*_override methods, like AddThemeFontOverride. You can also override theme items in the Inspector.

Note: Theme items are not Object properties. This means you can't access their values using Object.Get and Object.Set. Instead, use the get_theme_* and add_theme_*_override methods provided by this class.

Index

Constants

View Source
const NotificationFocusEnter Object.Notification = 43 //gd:Control.NOTIFICATION_FOCUS_ENTER
View Source
const NotificationFocusExit Object.Notification = 44 //gd:Control.NOTIFICATION_FOCUS_EXIT
View Source
const NotificationLayoutDirectionChanged Object.Notification = 49 //gd:Control.NOTIFICATION_LAYOUT_DIRECTION_CHANGED
View Source
const NotificationMouseEnter Object.Notification = 41 //gd:Control.NOTIFICATION_MOUSE_ENTER
View Source
const NotificationMouseEnterSelf Object.Notification = 60 //gd:Control.NOTIFICATION_MOUSE_ENTER_SELF
View Source
const NotificationMouseExit Object.Notification = 42 //gd:Control.NOTIFICATION_MOUSE_EXIT
View Source
const NotificationMouseExitSelf Object.Notification = 61 //gd:Control.NOTIFICATION_MOUSE_EXIT_SELF
View Source
const NotificationResized Object.Notification = 40 //gd:Control.NOTIFICATION_RESIZED
View Source
const NotificationScrollBegin Object.Notification = 47 //gd:Control.NOTIFICATION_SCROLL_BEGIN
View Source
const NotificationScrollEnd Object.Notification = 48 //gd:Control.NOTIFICATION_SCROLL_END
View Source
const NotificationThemeChanged Object.Notification = 45 //gd:Control.NOTIFICATION_THEME_CHANGED

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 Anchor

type Anchor int //gd:Control.Anchor
const (
	// Snaps one of the 4 anchor's sides to the origin of the node's Rect, in the top left. Use it with one of the anchor_* member variables, like [AnchorLeft]. To change all 4 anchors at once, use [SetAnchorsPreset].
	//
	// [AnchorLeft]: https://pkg.go.dev/graphics.gd/classdb/#Instance.AnchorLeft
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	AnchorBegin Anchor = 0
	// Snaps one of the 4 anchor's sides to the end of the node's Rect, in the bottom right. Use it with one of the anchor_* member variables, like [AnchorLeft]. To change all 4 anchors at once, use [SetAnchorsPreset].
	//
	// [AnchorLeft]: https://pkg.go.dev/graphics.gd/classdb/#Instance.AnchorLeft
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	AnchorEnd Anchor = 1
)

type Any

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

type CursorShape

type CursorShape int //gd:Control.CursorShape
const (
	// Show the system's arrow mouse cursor when the user hovers the node. Use with [MouseDefaultCursorShape].
	//
	// [MouseDefaultCursorShape]: https://pkg.go.dev/graphics.gd/classdb/#Instance.MouseDefaultCursorShape
	CursorArrow CursorShape = 0
	// Show the system's I-beam mouse cursor when the user hovers the node. The I-beam pointer has a shape similar to "I". It tells the user they can highlight or insert text.
	CursorIbeam CursorShape = 1
	// Show the system's pointing hand mouse cursor when the user hovers the node.
	CursorPointingHand CursorShape = 2
	// Show the system's cross mouse cursor when the user hovers the node.
	CursorCross CursorShape = 3
	// Show the system's wait mouse cursor when the user hovers the node. Often an hourglass.
	CursorWait CursorShape = 4
	// Show the system's busy mouse cursor when the user hovers the node. Often an arrow with a small hourglass.
	CursorBusy CursorShape = 5
	// Show the system's drag mouse cursor, often a closed fist or a cross symbol, when the user hovers the node. It tells the user they're currently dragging an item, like a node in the Scene dock.
	CursorDrag CursorShape = 6
	// Show the system's drop mouse cursor when the user hovers the node. It can be an open hand. It tells the user they can drop an item they're currently grabbing, like a node in the Scene dock.
	CursorCanDrop CursorShape = 7
	// Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle.
	CursorForbidden CursorShape = 8
	// Show the system's vertical resize mouse cursor when the user hovers the node. A double-headed vertical arrow. It tells the user they can resize the window or the panel vertically.
	CursorVsize CursorShape = 9
	// Show the system's horizontal resize mouse cursor when the user hovers the node. A double-headed horizontal arrow. It tells the user they can resize the window or the panel horizontally.
	CursorHsize CursorShape = 10
	// Show the system's window resize mouse cursor when the user hovers the node. The cursor is a double-headed arrow that goes from the bottom left to the top right. It tells the user they can resize the window or the panel both horizontally and vertically.
	CursorBdiagsize CursorShape = 11
	// Show the system's window resize mouse cursor when the user hovers the node. The cursor is a double-headed arrow that goes from the top left to the bottom right, the opposite of [CursorBdiagsize]. It tells the user they can resize the window or the panel both horizontally and vertically.
	CursorFdiagsize CursorShape = 12
	// Show the system's move mouse cursor when the user hovers the node. It shows 2 double-headed arrows at a 90 degree angle. It tells the user they can move a UI element freely.
	CursorMove CursorShape = 13
	// Show the system's vertical split mouse cursor when the user hovers the node. On Windows, it's the same as [CursorVsize].
	CursorVsplit CursorShape = 14
	// Show the system's horizontal split mouse cursor when the user hovers the node. On Windows, it's the same as [CursorHsize].
	CursorHsplit CursorShape = 15
	// Show the system's help mouse cursor when the user hovers the node, a question mark.
	CursorHelp CursorShape = 16
)

type Expanded

type Expanded = MoreArgs

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsControl

func (self *Extension[T]) AsControl() Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

type FocusBehaviorRecursive

type FocusBehaviorRecursive int //gd:Control.FocusBehaviorRecursive
const (
	// Inherits the [FocusBehaviorRecursive] from the parent control. If there is no parent control, this is the same as [FocusBehaviorEnabled].
	//
	// [FocusBehaviorRecursive]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FocusBehaviorRecursive
	FocusBehaviorInherited FocusBehaviorRecursive = 0
	// Prevents the control from getting focused. [GetFocusModeWithOverride] will return [FocusNone].
	//
	// [GetFocusModeWithOverride]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GetFocusModeWithOverride
	FocusBehaviorDisabled FocusBehaviorRecursive = 1
	// Allows the control to be focused, depending on the [FocusMode]. This can be used to ignore the parent's [FocusBehaviorRecursive]. [GetFocusModeWithOverride] will return the [FocusMode].
	//
	// [FocusBehaviorRecursive]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FocusBehaviorRecursive
	// [FocusMode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FocusMode
	// [GetFocusModeWithOverride]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GetFocusModeWithOverride
	FocusBehaviorEnabled FocusBehaviorRecursive = 2
)

type FocusMode

type FocusMode int //gd:Control.FocusMode
const (
	// The node cannot grab focus. Use with [FocusMode].
	//
	// [FocusMode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FocusMode
	FocusNone FocusMode = 0
	// The node can only grab focus on mouse clicks. Use with [FocusMode].
	//
	// [FocusMode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FocusMode
	FocusClick FocusMode = 1
	// The node can grab focus on mouse click, using the arrows and the Tab keys on the keyboard, or using the D-pad buttons on a gamepad. Use with [FocusMode].
	//
	// [FocusMode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FocusMode
	FocusAll FocusMode = 2
	// The node can grab focus only when screen reader is active. Use with [FocusMode].
	//
	// [FocusMode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FocusMode
	FocusAccessibility FocusMode = 3
)

type GrowDirection

type GrowDirection int //gd:Control.GrowDirection
const (
	// The control will grow to the left or top to make up if its minimum size is changed to be greater than its current size on the respective axis.
	GrowDirectionBegin GrowDirection = 0
	// The control will grow to the right or bottom to make up if its minimum size is changed to be greater than its current size on the respective axis.
	GrowDirectionEnd GrowDirection = 1
	// The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.
	GrowDirectionBoth GrowDirection = 2
)

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.Control

Instance of the class with convieniently typed arguments and results.

var Nil Instance

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

func New

func New() Instance

func (Instance) AcceptEvent

func (self Instance) AcceptEvent()

Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to Node.UnhandledInput or Node.UnhandledKeyInput.

Note: This does not affect the methods in Input, only the way events are propagated.

func (Instance) AccessibilityControlsNodes

func (self Instance) AccessibilityControlsNodes() []string

The paths to the nodes which are controlled by this node.

func (Instance) AccessibilityDescribedByNodes

func (self Instance) AccessibilityDescribedByNodes() []string

The paths to the nodes which are describing this node.

func (Instance) AccessibilityDescription

func (self Instance) AccessibilityDescription() string

The human-readable node description that is reported to assistive apps.

func (Instance) AccessibilityDrag

func (self Instance) AccessibilityDrag()

Starts drag-and-drop operation without using a mouse.

func (Instance) AccessibilityDrop

func (self Instance) AccessibilityDrop()

Ends drag-and-drop operation without using a mouse.

func (Instance) AccessibilityFlowToNodes

func (self Instance) AccessibilityFlowToNodes() []string

The paths to the nodes which this node flows into.

func (Instance) AccessibilityLabeledByNodes

func (self Instance) AccessibilityLabeledByNodes() []string

The paths to the nodes which label this node.

func (Instance) AccessibilityLive

func (self Instance) AccessibilityLive() DisplayServer.AccessibilityLiveMode

The mode with which a live region updates. A live region is a Node that is updated as a result of an external event when the user's focus may be elsewhere.

func (Instance) AccessibilityName

func (self Instance) AccessibilityName() string

The human-readable node name that is reported to assistive apps.

func (Instance) AddThemeColorOverride

func (self Instance) AddThemeColorOverride(name string, color Color.RGBA)

Creates a local override for a theme Color.RGBA with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with RemoveThemeColorOverride.

See also GetThemeColor.

Example: Override a Label's color and reset it later:

// Given the child Label node "MyLabel", override its font color with a custom value.
MyLabel.AsControl().AddThemeColorOverride("font_color", Color.RGBA{1, 0.5, 0, 1})
// Reset the font color of the child label.
MyLabel.AsControl().RemoveThemeColorOverride("font_color")
// Alternatively it can be overridden with the default value from the Label type.
MyLabel.AsControl().AddThemeColorOverride("font_color", MyLabel.AsControl().MoreArgs().GetThemeColor("font_color", "Label"))

func (Instance) AddThemeConstantOverride

func (self Instance) AddThemeConstantOverride(name string, constant int)

Creates a local override for a theme constant with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with RemoveThemeConstantOverride.

See also GetThemeConstant.

func (Instance) AddThemeFontOverride

func (self Instance) AddThemeFontOverride(name string, font Font.Instance)

Creates a local override for a theme Font with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with RemoveThemeFontOverride.

See also GetThemeFont.

func (Instance) AddThemeFontSizeOverride

func (self Instance) AddThemeFontSizeOverride(name string, font_size int)

Creates a local override for a theme font size with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with RemoveThemeFontSizeOverride.

See also GetThemeFontSize.

func (Instance) AddThemeIconOverride

func (self Instance) AddThemeIconOverride(name string, texture Texture2D.Instance)

Creates a local override for a theme icon with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with RemoveThemeIconOverride.

See also GetThemeIcon.

func (Instance) AddThemeStyleboxOverride

func (self Instance) AddThemeStyleboxOverride(name string, stylebox StyleBox.Instance)

Creates a local override for a theme StyleBox with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with RemoveThemeStyleboxOverride.

See also GetThemeStylebox.

Example: Modify a property in a StyleBox by duplicating it:

// The snippet below assumes the child node "MyButton" has a StyleBoxFlat assigned.
// Resources are shared across instances, so we need to duplicate it
// to avoid modifying the appearance of all other buttons.
var newStyleboxNormal = Resource.Duplicate(MyButton.AsControl().GetThemeStylebox("normal"))
Object.Set(newStyleboxNormal, "border_width_top", 3)
Object.Set(newStyleboxNormal, "border_color", Color.RGBA{0, 1, 0.5, 1})
MyButton.AsControl().AddThemeStyleboxOverride("normal", newStyleboxNormal)
// Remove the stylebox override.
MyButton.AsControl().RemoveThemeStyleboxOverride("normal")

func (Instance) AnchorBottom

func (self Instance) AnchorBottom() Float.X

Anchors the bottom edge of the node to the origin, the center, or the end of its parent control. It changes how the bottom offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience.

func (Instance) AnchorLeft

func (self Instance) AnchorLeft() Float.X

Anchors the left edge of the node to the origin, the center or the end of its parent control. It changes how the left offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience.

func (Instance) AnchorRight

func (self Instance) AnchorRight() Float.X

Anchors the right edge of the node to the origin, the center or the end of its parent control. It changes how the right offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience.

func (Instance) AnchorTop

func (self Instance) AnchorTop() Float.X

Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience.

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsControl

func (self Instance) AsControl() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

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

func (Instance) AutoTranslate

func (self Instance) AutoTranslate() bool

Toggles if any text should automatically change to its translated version depending on the current locale.

func (Instance) BeginBulkThemeOverride

func (self Instance) BeginBulkThemeOverride()

Prevents *_theme_*_override methods from emitting NotificationThemeChanged until EndBulkThemeOverride is called.

func (Instance) ClipContents

func (self Instance) ClipContents() bool

Enables whether rendering of CanvasItem based children should be clipped to this control's rectangle. If true, parts of a child which would be visibly outside of this control's rectangle will not be rendered and won't receive input.

func (Instance) CustomMinimumSize

func (self Instance) CustomMinimumSize() Vector2.XY

The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size. Note that Control nodes have their internal minimum size returned by GetMinimumSize. It depends on the control's contents, like text, textures, or style boxes. The actual minimum size is the maximum value of this property and the internal minimum size (see GetCombinedMinimumSize).

func (Instance) EndBulkThemeOverride

func (self Instance) EndBulkThemeOverride()

Ends a bulk theme override update. See BeginBulkThemeOverride.

func (Instance) FindNextValidFocus

func (self Instance) FindNextValidFocus() Instance

Finds the next (below in the tree) Control that can receive the focus.

func (Instance) FindPrevValidFocus

func (self Instance) FindPrevValidFocus() Instance

Finds the previous (above in the tree) Control that can receive the focus.

func (Instance) FindValidFocusNeighbor

func (self Instance) FindValidFocusNeighbor(side Rect2.Side) Instance

Finds the next Control that can receive the focus on the specified [Side].

Note: This is different from GetFocusNeighbor, which returns the path of a specified focus neighbor.

func (Instance) FocusBehaviorRecursive

func (self Instance) FocusBehaviorRecursive() FocusBehaviorRecursive

Determines which controls can be focused together with FocusMode. See GetFocusModeWithOverride. Since the default behavior is FocusBehaviorInherited, this can be used to prevent all children controls from getting focused.

func (Instance) FocusMode

func (self Instance) FocusMode() FocusMode

Determines which controls can be focused. Only one control can be focused at a time, and the focused control will receive keyboard, gamepad, and mouse events in GuiInput. Use GetFocusModeWithOverride to determine if a control can grab focus, since FocusBehaviorRecursive also affects it. See also GrabFocus.

func (Instance) FocusNeighborBottom

func (self Instance) FocusNeighborBottom() string

Tells Godot which node it should give focus to if the user presses the down arrow on the keyboard or down on a gamepad by default. You can change the key by editing the ProjectSettings "input/ui_down" input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the bottom of this one.

func (Instance) FocusNeighborLeft

func (self Instance) FocusNeighborLeft() string

Tells Godot which node it should give focus to if the user presses the left arrow on the keyboard or left on a gamepad by default. You can change the key by editing the ProjectSettings "input/ui_left" input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the left of this one.

func (Instance) FocusNeighborRight

func (self Instance) FocusNeighborRight() string

Tells Godot which node it should give focus to if the user presses the right arrow on the keyboard or right on a gamepad by default. You can change the key by editing the ProjectSettings "input/ui_right" input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the right of this one.

func (Instance) FocusNeighborTop

func (self Instance) FocusNeighborTop() string

Tells Godot which node it should give focus to if the user presses the top arrow on the keyboard or top on a gamepad by default. You can change the key by editing the ProjectSettings "input/ui_up" input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the top of this one.

func (Instance) FocusNext

func (self Instance) FocusNext() string

Tells Godot which node it should give focus to if the user presses Tab on a keyboard by default. You can change the key by editing the ProjectSettings "input/ui_focus_next" input action.

If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.

func (Instance) FocusPrevious

func (self Instance) FocusPrevious() string

Tells Godot which node it should give focus to if the user presses Shift + Tab on a keyboard by default. You can change the key by editing the ProjectSettings "input/ui_focus_prev" input action.

If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.

func (Instance) ForceDrag

func (self Instance) ForceDrag(data any, preview Instance)

Forces drag and bypasses GetDragData and SetDragPreview by passing 'data' and 'preview'. Drag will start even if the mouse is neither over nor pressed on this control.

The methods CanDropData and DropData must be implemented on controls that want to receive drop data.

func (Instance) GetBegin

func (self Instance) GetBegin() Vector2.XY

Returns OffsetLeft and OffsetTop. See also Position.

func (Instance) GetCombinedMinimumSize

func (self Instance) GetCombinedMinimumSize() Vector2.XY

Returns combined minimum size from CustomMinimumSize and GetMinimumSize.

func (Instance) GetCursorShape

func (self Instance) GetCursorShape() CursorShape

Returns the mouse cursor shape for this control when hovered over 'position' in local coordinates. For most controls, this is the same as MouseDefaultCursorShape, but some built-in controls implement more complex logic.

func (Instance) GetEnd

func (self Instance) GetEnd() Vector2.XY

Returns OffsetRight and OffsetBottom.

func (Instance) GetFocusModeWithOverride

func (self Instance) GetFocusModeWithOverride() FocusMode

Returns the FocusMode, but takes the FocusBehaviorRecursive into account. If FocusBehaviorRecursive is set to FocusBehaviorDisabled, or it is set to FocusBehaviorInherited and its ancestor is set to FocusBehaviorDisabled, then this returns FocusNone.

func (Instance) GetGlobalRect

func (self Instance) GetGlobalRect() Rect2.PositionSize

Returns the position and size of the control relative to the containing canvas. See GlobalPosition and Size.

Note: If the node itself or any parent CanvasItem between the node and the canvas have a non default rotation or skew, the resulting size is likely not meaningful.

Note: Setting Viewport.GuiSnapControlsToPixels to true can lead to rounding inaccuracies between the displayed control and the returned Rect2.PositionSize.

func (Instance) GetMinimumSize

func (self Instance) GetMinimumSize() Vector2.XY

Returns the minimum size for this control. See CustomMinimumSize.

func (Instance) GetMouseFilterWithOverride

func (self Instance) GetMouseFilterWithOverride() MouseFilter

Returns the MouseFilter, but takes the MouseBehaviorRecursive into account. If MouseBehaviorRecursive is set to MouseBehaviorDisabled, or it is set to MouseBehaviorInherited and its ancestor is set to MouseBehaviorDisabled, then this returns MouseFilterIgnore.

func (Instance) GetParentAreaSize

func (self Instance) GetParentAreaSize() Vector2.XY

Returns the width/height occupied in the parent control.

func (Instance) GetParentControl

func (self Instance) GetParentControl() Instance

Returns the parent control node.

func (Instance) GetRect

func (self Instance) GetRect() Rect2.PositionSize

Returns the position and size of the control in the coordinate system of the containing node. See Position, Scale and Size.

Note: If Rotation is not the default rotation, the resulting size is not meaningful.

Note: Setting Viewport.GuiSnapControlsToPixels to true can lead to rounding inaccuracies between the displayed control and the returned Rect2.PositionSize.

func (Instance) GetScreenPosition

func (self Instance) GetScreenPosition() Vector2.XY

Returns the position of this Control in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.

Equals to GlobalPosition if the window is embedded (see Viewport.GuiEmbedSubwindows).

Example: Show a popup at the mouse position:

popup_menu.AsWindow().SetPosition(Vector2i.From(Vector2.Add(control.GetScreenPosition(), control.AsCanvasItem().GetLocalMousePosition())))
popup_menu.AsWindow().ResetSize()
popup_menu.AsWindow().Popup()

func (Instance) GetThemeColor

func (self Instance) GetThemeColor(name string) Color.RGBA

Returns a Color.RGBA from the first matching Theme in the tree if that Theme has a color item with the specified 'name' and 'theme_type'. If 'theme_type' is omitted the class name of the current control is used as the type, or ThemeTypeVariation if it is defined. If the type is a class name its parent classes are also checked, in order of inheritance. If the type is a variation its base types are checked, in order of dependency, then the control's class name and its parent classes are checked.

For the current control its local overrides are considered first (see AddThemeColorOverride), then its assigned Theme. After the current control, each parent control and its assigned Theme are considered; controls without a Theme assigned are skipped. If no matching Theme is found in the tree, the custom project Theme (see ProjectSettings "gui/theme/custom") and the default Theme are used (see ThemeDB).

// Get the font color defined for the current Control's class, if it exists.
control.AsCanvasItem().SetModulate(control.GetThemeColor("font_color"))
// Get the font color defined for the Button class.
control.MoreArgs().GetThemeColor("font_color", "Button")

func (Instance) GetThemeConstant

func (self Instance) GetThemeConstant(name string) int

Returns a constant from the first matching Theme in the tree if that Theme has a constant item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) GetThemeDefaultBaseScale

func (self Instance) GetThemeDefaultBaseScale() Float.X

Returns the default base scale value from the first matching Theme in the tree if that Theme has a valid Theme.DefaultBaseScale value.

See GetThemeColor for details.

func (Instance) GetThemeDefaultFont

func (self Instance) GetThemeDefaultFont() Font.Instance

Returns the default font from the first matching Theme in the tree if that Theme has a valid Theme.DefaultFont value.

See GetThemeColor for details.

func (Instance) GetThemeDefaultFontSize

func (self Instance) GetThemeDefaultFontSize() int

Returns the default font size value from the first matching Theme in the tree if that Theme has a valid Theme.DefaultFontSize value.

See GetThemeColor for details.

func (Instance) GetThemeFont

func (self Instance) GetThemeFont(name string) Font.Instance

Returns a Font from the first matching Theme in the tree if that Theme has a font item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) GetThemeFontSize

func (self Instance) GetThemeFontSize(name string) int

Returns a font size from the first matching Theme in the tree if that Theme has a font size item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) GetThemeIcon

func (self Instance) GetThemeIcon(name string) Texture2D.Instance

Returns an icon from the first matching Theme in the tree if that Theme has an icon item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) GetThemeStylebox

func (self Instance) GetThemeStylebox(name string) StyleBox.Instance

Returns a StyleBox from the first matching Theme in the tree if that Theme has a stylebox item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) GetTooltip

func (self Instance) GetTooltip() string

Returns the tooltip text for the position 'at_position' in control's local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns TooltipText.

This method can be overridden to customize its behavior. See GetTooltip.

Note: If this method returns an empty string and MakeCustomTooltip is not overridden, no tooltip is displayed.

func (Instance) GlobalPosition

func (self Instance) GlobalPosition() Vector2.XY

The node's global position, relative to the world (usually to the CanvasLayer).

func (Instance) GrabClickFocus

func (self Instance) GrabClickFocus()

Creates an InputEventMouseButton that attempts to click the control. If the event is received, the control gains focus.

control.GrabClickFocus() // When clicking another Control node, this node will be clicked instead.

func (Instance) GrabFocus

func (self Instance) GrabFocus()

Steal the focus from another control and become the focused control (see FocusMode).

Note: Using this method together with Callable.CallDeferred makes it more reliable, especially when called inside Node.Ready.

func (Instance) GrowHorizontal

func (self Instance) GrowHorizontal() GrowDirection

Controls the direction on the horizontal axis in which the control should grow if its horizontal minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size.

func (Instance) GrowVertical

func (self Instance) GrowVertical() GrowDirection

Controls the direction on the vertical axis in which the control should grow if its vertical minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size.

func (Instance) HasFocus

func (self Instance) HasFocus() bool

Returns true if this is the current focused control. See FocusMode.

func (Instance) HasThemeColor

func (self Instance) HasThemeColor(name string) bool

Returns true if there is a matching Theme in the tree that has a color item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) HasThemeColorOverride

func (self Instance) HasThemeColorOverride(name string) bool

Returns true if there is a local override for a theme Color.RGBA with the specified 'name' in this Control node.

See AddThemeColorOverride.

func (Instance) HasThemeConstant

func (self Instance) HasThemeConstant(name string) bool

Returns true if there is a matching Theme in the tree that has a constant item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) HasThemeConstantOverride

func (self Instance) HasThemeConstantOverride(name string) bool

Returns true if there is a local override for a theme constant with the specified 'name' in this Control node.

See AddThemeConstantOverride.

func (Instance) HasThemeFont

func (self Instance) HasThemeFont(name string) bool

Returns true if there is a matching Theme in the tree that has a font item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) HasThemeFontOverride

func (self Instance) HasThemeFontOverride(name string) bool

Returns true if there is a local override for a theme Font with the specified 'name' in this Control node.

See AddThemeFontOverride.

func (Instance) HasThemeFontSize

func (self Instance) HasThemeFontSize(name string) bool

Returns true if there is a matching Theme in the tree that has a font size item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) HasThemeFontSizeOverride

func (self Instance) HasThemeFontSizeOverride(name string) bool

Returns true if there is a local override for a theme font size with the specified 'name' in this Control node.

See AddThemeFontSizeOverride.

func (Instance) HasThemeIcon

func (self Instance) HasThemeIcon(name string) bool

Returns true if there is a matching Theme in the tree that has an icon item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) HasThemeIconOverride

func (self Instance) HasThemeIconOverride(name string) bool

Returns true if there is a local override for a theme icon with the specified 'name' in this Control node.

See AddThemeIconOverride.

func (Instance) HasThemeStylebox

func (self Instance) HasThemeStylebox(name string) bool

Returns true if there is a matching Theme in the tree that has a stylebox item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (Instance) HasThemeStyleboxOverride

func (self Instance) HasThemeStyleboxOverride(name string) bool

Returns true if there is a local override for a theme StyleBox with the specified 'name' in this Control node.

See AddThemeStyleboxOverride.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsDragSuccessful

func (self Instance) IsDragSuccessful() bool

Returns true if a drag operation is successful. Alternative to Viewport.GuiIsDragSuccessful.

Best used with [Node.NotificationDragEnd].

func (Instance) IsLayoutRtl

func (self Instance) IsLayoutRtl() bool

Returns true if the layout is right-to-left. See also LayoutDirection.

func (Instance) LayoutDirection

func (self Instance) LayoutDirection() LayoutDirection

Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew). See also IsLayoutRtl.

func (Instance) LocalizeNumeralSystem

func (self Instance) LocalizeNumeralSystem() bool

If true, automatically converts code line numbers, list indices, SpinBox and ProgressBar values from the Western Arabic (0..9) to the numeral systems used in current locale.

Note: Numbers within the text are not automatically converted, it can be done manually, using TextServer.FormatNumber.

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) MouseBehaviorRecursive

func (self Instance) MouseBehaviorRecursive() MouseBehaviorRecursive

Determines which controls can receive mouse input together with MouseFilter. See GetMouseFilterWithOverride. Since the default behavior is MouseBehaviorInherited, this can be used to prevent all children controls from receiving mouse input.

func (Instance) MouseDefaultCursorShape

func (self Instance) MouseDefaultCursorShape() CursorShape

The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors.

Note: On Linux, shapes may vary depending on the cursor theme of the system.

func (Instance) MouseFilter

func (self Instance) MouseFilter() MouseFilter

Determines which controls will be able to receive mouse button input events through GuiInput and the OnMouseEntered, and OnMouseExited signals. Also determines how these events should be propagated. See the constants to learn what each does. Use GetMouseFilterWithOverride to determine if a control can receive mouse input, since MouseBehaviorRecursive also affects it.

func (Instance) MouseForcePassScrollEvents

func (self Instance) MouseForcePassScrollEvents() bool

When enabled, scroll wheel events processed by GuiInput will be passed to the parent control even if MouseFilter is set to MouseFilterStop.

You should disable it on the root of your UI if you do not want scroll events to go to the Node.UnhandledInput processing.

Note: Because this property defaults to true, this allows nested scrollable containers to work out of the box.

func (Instance) OffsetBottom

func (self Instance) OffsetBottom() Float.X

Distance between the node's bottom edge and its parent control, based on AnchorBottom.

Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node.

func (Instance) OffsetLeft

func (self Instance) OffsetLeft() Float.X

Distance between the node's left edge and its parent control, based on AnchorLeft.

Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node.

func (Instance) OffsetRight

func (self Instance) OffsetRight() Float.X

Distance between the node's right edge and its parent control, based on AnchorRight.

Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node.

func (Instance) OffsetTop

func (self Instance) OffsetTop() Float.X

Distance between the node's top edge and its parent control, based on AnchorTop.

Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node.

func (Instance) OnFocusEntered

func (self Instance) OnFocusEntered(cb func(), flags ...Signal.Flags)

Emitted when the node gains focus.

func (Instance) OnFocusExited

func (self Instance) OnFocusExited(cb func(), flags ...Signal.Flags)

Emitted when the node loses focus.

func (Instance) OnGuiInput

func (self Instance) OnGuiInput(cb func(event InputEvent.Instance), flags ...Signal.Flags)

Emitted when the node receives an InputEvent.

func (Instance) OnMinimumSizeChanged

func (self Instance) OnMinimumSizeChanged(cb func(), flags ...Signal.Flags)

Emitted when the node's minimum size changes.

func (Instance) OnMouseEntered

func (self Instance) OnMouseEntered(cb func(), flags ...Signal.Flags)

Emitted when the mouse cursor enters the control's (or any child control's) visible area, that is not occluded behind other Controls or Windows, provided its MouseFilter lets the event reach it and regardless if it's currently focused or not.

Note: CanvasItem.ZIndex doesn't affect, which Control receives the signal.

func (Instance) OnMouseExited

func (self Instance) OnMouseExited(cb func(), flags ...Signal.Flags)

Emitted when the mouse cursor leaves the control's (and all child control's) visible area, that is not occluded behind other Controls or Windows, provided its MouseFilter lets the event reach it and regardless if it's currently focused or not.

Note: CanvasItem.ZIndex doesn't affect, which Control receives the signal.

Note: If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this:

func (Instance) OnResized

func (self Instance) OnResized(cb func(), flags ...Signal.Flags)

Emitted when the control changes size.

func (Instance) OnSizeFlagsChanged

func (self Instance) OnSizeFlagsChanged(cb func(), flags ...Signal.Flags)

Emitted when one of the size flags changes. See SizeFlagsHorizontal and SizeFlagsVertical.

func (Instance) OnThemeChanged

func (self Instance) OnThemeChanged(cb func(), flags ...Signal.Flags)

Emitted when the NotificationThemeChanged notification is sent.

func (Instance) PivotOffset

func (self Instance) PivotOffset() Vector2.XY

By default, the node's pivot is its top-left corner. When you change its Rotation or Scale, it will rotate or scale around this pivot. Set this property to Size / 2 to pivot around the Control's center.

func (Instance) Position

func (self Instance) Position() Vector2.XY

The node's position, relative to its containing node. It corresponds to the rectangle's top-left corner. The property is not affected by PivotOffset.

func (Instance) ReleaseFocus

func (self Instance) ReleaseFocus()

Give up the focus. No other control will be able to receive input.

func (Instance) RemoveThemeColorOverride

func (self Instance) RemoveThemeColorOverride(name string)

Removes a local override for a theme Color.RGBA with the specified 'name' previously added by AddThemeColorOverride or via the Inspector dock.

func (Instance) RemoveThemeConstantOverride

func (self Instance) RemoveThemeConstantOverride(name string)

Removes a local override for a theme constant with the specified 'name' previously added by AddThemeConstantOverride or via the Inspector dock.

func (Instance) RemoveThemeFontOverride

func (self Instance) RemoveThemeFontOverride(name string)

Removes a local override for a theme Font with the specified 'name' previously added by AddThemeFontOverride or via the Inspector dock.

func (Instance) RemoveThemeFontSizeOverride

func (self Instance) RemoveThemeFontSizeOverride(name string)

Removes a local override for a theme font size with the specified 'name' previously added by AddThemeFontSizeOverride or via the Inspector dock.

func (Instance) RemoveThemeIconOverride

func (self Instance) RemoveThemeIconOverride(name string)

Removes a local override for a theme icon with the specified 'name' previously added by AddThemeIconOverride or via the Inspector dock.

func (Instance) RemoveThemeStyleboxOverride

func (self Instance) RemoveThemeStyleboxOverride(name string)

Removes a local override for a theme StyleBox with the specified 'name' previously added by AddThemeStyleboxOverride or via the Inspector dock.

func (Instance) ResetSize

func (self Instance) ResetSize()

Resets the size to GetCombinedMinimumSize. This is equivalent to calling set_size(Vector2()) (or any size below the minimum).

func (Instance) Rotation

func (self Instance) Rotation() Float.X

The node's rotation around its pivot, in radians. See PivotOffset to change the pivot's position.

Note: This property is edited in the inspector in degrees. If you want to use degrees in a script, use RotationDegrees.

func (Instance) RotationDegrees

func (self Instance) RotationDegrees() Float.X

Helper property to access Rotation in degrees instead of radians.

func (Instance) Scale

func (self Instance) Scale() Vector2.XY

The node's scale, relative to its Size. Change this property to scale the node around its PivotOffset. The Control's tooltip will also scale according to this value.

Note: This property is mainly intended to be used for animation purposes. To support multiple resolutions in your project, use an appropriate viewport stretch mode as described in the documentation instead of scaling Controls individually.

Note: FontFile.Oversampling does not take Control Scale into account. This means that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font rendering by enabling ProjectSettings "gui/theme/default_font_multichannel_signed_distance_field" (applies to the default project font only), or enabling Multichannel Signed Distance Field in the import options of a DynamicFont for custom fonts. On system fonts, SystemFont.MultichannelSignedDistanceField can be enabled in the inspector.

Note: If the Control node is a child of a Container node, the scale will be reset to Vector2(1, 1) when the scene is instantiated. To set the Control's scale when it's instantiated, wait for one frame using await get_tree().process_frame then set its Scale property.

func (Instance) SetAccessibilityControlsNodes

func (self Instance) SetAccessibilityControlsNodes(value []string)

SetAccessibilityControlsNodes sets the property returned by [GetAccessibilityControlsNodes].

func (Instance) SetAccessibilityDescribedByNodes

func (self Instance) SetAccessibilityDescribedByNodes(value []string)

SetAccessibilityDescribedByNodes sets the property returned by [GetAccessibilityDescribedByNodes].

func (Instance) SetAccessibilityDescription

func (self Instance) SetAccessibilityDescription(value string)

SetAccessibilityDescription sets the property returned by [GetAccessibilityDescription].

func (Instance) SetAccessibilityFlowToNodes

func (self Instance) SetAccessibilityFlowToNodes(value []string)

SetAccessibilityFlowToNodes sets the property returned by [GetAccessibilityFlowToNodes].

func (Instance) SetAccessibilityLabeledByNodes

func (self Instance) SetAccessibilityLabeledByNodes(value []string)

SetAccessibilityLabeledByNodes sets the property returned by [GetAccessibilityLabeledByNodes].

func (Instance) SetAccessibilityLive

func (self Instance) SetAccessibilityLive(value DisplayServer.AccessibilityLiveMode)

SetAccessibilityLive sets the property returned by [GetAccessibilityLive].

func (Instance) SetAccessibilityName

func (self Instance) SetAccessibilityName(value string)

SetAccessibilityName sets the property returned by [GetAccessibilityName].

func (Instance) SetAnchor

func (self Instance) SetAnchor(side Rect2.Side, anchor Float.X)

Sets the anchor for the specified [Side] to 'anchor'. A setter method for AnchorBottom, AnchorLeft, AnchorRight and AnchorTop.

If 'keep_offset' is true, offsets aren't updated after this operation.

If 'push_opposite_anchor' is true and the opposite anchor overlaps this anchor, the opposite one will have its value overridden. For example, when setting left anchor to 1 and the right anchor has value of 0.5, the right anchor will also get value of 1. If 'push_opposite_anchor' was false, the left anchor would get value 0.5.

func (Instance) SetAnchorAndOffset

func (self Instance) SetAnchorAndOffset(side Rect2.Side, anchor Float.X, offset Float.X)

Works the same as SetAnchor, but instead of keep_offset argument and automatic update of offset, it allows to set the offset yourself (see SetOffset).

func (Instance) SetAnchorsAndOffsetsPreset

func (self Instance) SetAnchorsAndOffsetsPreset(preset LayoutPreset)

Sets both anchor preset and offset preset. See SetAnchorsPreset and SetOffsetsPreset.

func (Instance) SetAnchorsPreset

func (self Instance) SetAnchorsPreset(preset LayoutPreset)

Sets the anchors to a 'preset' from [Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.

If 'keep_offsets' is true, control's position will also be updated.

func (Instance) SetAutoTranslate

func (self Instance) SetAutoTranslate(value bool)

SetAutoTranslate sets the property returned by [IsAutoTranslating].

func (Instance) SetBegin

func (self Instance) SetBegin(position Vector2.XY)

Sets OffsetLeft and OffsetTop at the same time. Equivalent of changing Position.

func (Instance) SetClipContents

func (self Instance) SetClipContents(value bool)

SetClipContents sets the property returned by [IsClippingContents].

func (Instance) SetCustomMinimumSize

func (self Instance) SetCustomMinimumSize(value Vector2.XY)

SetCustomMinimumSize sets the property returned by [GetCustomMinimumSize].

func (Instance) SetDragForwarding

func (self Instance) SetDragForwarding(drag_func func(at_position Vector2.XY) any, can_drop_func func(at_position Vector2.XY, data any) bool, drop_func func(at_position Vector2.XY, data any))

Sets the given callables to be used instead of the control's own drag-and-drop virtual methods. If a callable is empty, its respective virtual method is used as normal.

The arguments for each callable should be exactly the same as their respective virtual methods, which would be:

- 'drag_func' corresponds to GetDragData and requires a Vector2.XY;

- 'can_drop_func' corresponds to CanDropData and requires both a Vector2.XY and a any;

- 'drop_func' corresponds to DropData and requires both a Vector2.XY and a any.

func (Instance) SetDragPreview

func (self Instance) SetDragPreview(control Instance)

Shows the given control at the mouse pointer. A good time to call this method is in GetDragData. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended.

GetDragData := func(position Vector2.XY) any {
	// Use a control that is not in the tree
	var cpb = ColorPickerButton.New()
	cpb.SetColor(Color.RGBA{1, 0, 0, 1})
	cpb.AsControl().SetSize(Vector2.XY{50, 50})
	control.SetDragPreview(cpb.AsControl())
	return cpb.Color()
}

func (Instance) SetEnd

func (self Instance) SetEnd(position Vector2.XY)

Sets OffsetRight and OffsetBottom at the same time.

func (Instance) SetFocusBehaviorRecursive

func (self Instance) SetFocusBehaviorRecursive(value FocusBehaviorRecursive)

SetFocusBehaviorRecursive sets the property returned by [GetFocusBehaviorRecursive].

func (Instance) SetFocusMode

func (self Instance) SetFocusMode(value FocusMode)

SetFocusMode sets the property returned by [GetFocusMode].

func (Instance) SetFocusNeighborBottom

func (self Instance) SetFocusNeighborBottom(value string)

SetFocusNeighborBottom sets the property returned by [GetFocusNeighbor].

func (Instance) SetFocusNeighborLeft

func (self Instance) SetFocusNeighborLeft(value string)

SetFocusNeighborLeft sets the property returned by [GetFocusNeighbor].

func (Instance) SetFocusNeighborRight

func (self Instance) SetFocusNeighborRight(value string)

SetFocusNeighborRight sets the property returned by [GetFocusNeighbor].

func (Instance) SetFocusNeighborTop

func (self Instance) SetFocusNeighborTop(value string)

SetFocusNeighborTop sets the property returned by [GetFocusNeighbor].

func (Instance) SetFocusNext

func (self Instance) SetFocusNext(value string)

SetFocusNext sets the property returned by [GetFocusNext].

func (Instance) SetFocusPrevious

func (self Instance) SetFocusPrevious(value string)

SetFocusPrevious sets the property returned by [GetFocusPrevious].

func (Instance) SetGlobalPosition

func (self Instance) SetGlobalPosition(position Vector2.XY)

Sets the GlobalPosition to given 'position'.

If 'keep_offsets' is true, control's anchors will be updated instead of offsets.

func (Instance) SetGrowHorizontal

func (self Instance) SetGrowHorizontal(value GrowDirection)

SetGrowHorizontal sets the property returned by [GetHGrowDirection].

func (Instance) SetGrowVertical

func (self Instance) SetGrowVertical(value GrowDirection)

SetGrowVertical sets the property returned by [GetVGrowDirection].

func (Instance) SetLayoutDirection

func (self Instance) SetLayoutDirection(value LayoutDirection)

SetLayoutDirection sets the property returned by [GetLayoutDirection].

func (Instance) SetLocalizeNumeralSystem

func (self Instance) SetLocalizeNumeralSystem(value bool)

SetLocalizeNumeralSystem sets the property returned by [IsLocalizingNumeralSystem].

func (Instance) SetMouseBehaviorRecursive

func (self Instance) SetMouseBehaviorRecursive(value MouseBehaviorRecursive)

SetMouseBehaviorRecursive sets the property returned by [GetMouseBehaviorRecursive].

func (Instance) SetMouseDefaultCursorShape

func (self Instance) SetMouseDefaultCursorShape(value CursorShape)

SetMouseDefaultCursorShape sets the property returned by [GetDefaultCursorShape].

func (Instance) SetMouseFilter

func (self Instance) SetMouseFilter(value MouseFilter)

SetMouseFilter sets the property returned by [GetMouseFilter].

func (Instance) SetMouseForcePassScrollEvents

func (self Instance) SetMouseForcePassScrollEvents(value bool)

SetMouseForcePassScrollEvents sets the property returned by [IsForcePassScrollEvents].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetOffsetBottom

func (self Instance) SetOffsetBottom(value Float.X)

SetOffsetBottom sets the property returned by [GetOffset].

func (Instance) SetOffsetLeft

func (self Instance) SetOffsetLeft(value Float.X)

SetOffsetLeft sets the property returned by [GetOffset].

func (Instance) SetOffsetRight

func (self Instance) SetOffsetRight(value Float.X)

SetOffsetRight sets the property returned by [GetOffset].

func (Instance) SetOffsetTop

func (self Instance) SetOffsetTop(value Float.X)

SetOffsetTop sets the property returned by [GetOffset].

func (Instance) SetOffsetsPreset

func (self Instance) SetOffsetsPreset(preset LayoutPreset)

Sets the offsets to a 'preset' from [Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.

Use parameter 'resize_mode' with constants from [Control.LayoutPresetMode] to better determine the resulting size of the Control. Constant size will be ignored if used with presets that change size, e.g. PresetLeftWide.

Use parameter 'margin' to determine the gap between the Control and the edges.

func (Instance) SetPivotOffset

func (self Instance) SetPivotOffset(value Vector2.XY)

SetPivotOffset sets the property returned by [GetPivotOffset].

func (Instance) SetPosition

func (self Instance) SetPosition(position Vector2.XY)

Sets the Position to given 'position'.

If 'keep_offsets' is true, control's anchors will be updated instead of offsets.

func (Instance) SetRotation

func (self Instance) SetRotation(value Float.X)

SetRotation sets the property returned by [GetRotation].

func (Instance) SetRotationDegrees

func (self Instance) SetRotationDegrees(value Float.X)

SetRotationDegrees sets the property returned by [GetRotationDegrees].

func (Instance) SetScale

func (self Instance) SetScale(value Vector2.XY)

SetScale sets the property returned by [GetScale].

func (Instance) SetShortcutContext

func (self Instance) SetShortcutContext(value Node.Instance)

SetShortcutContext sets the property returned by [GetShortcutContext].

func (Instance) SetSize

func (self Instance) SetSize(size Vector2.XY)

Sets the size (see Size).

If 'keep_offsets' is true, control's anchors will be updated instead of offsets.

func (Instance) SetSizeFlagsHorizontal

func (self Instance) SetSizeFlagsHorizontal(value SizeFlags)

SetSizeFlagsHorizontal sets the property returned by [GetHSizeFlags].

func (Instance) SetSizeFlagsStretchRatio

func (self Instance) SetSizeFlagsStretchRatio(value Float.X)

SetSizeFlagsStretchRatio sets the property returned by [GetStretchRatio].

func (Instance) SetSizeFlagsVertical

func (self Instance) SetSizeFlagsVertical(value SizeFlags)

SetSizeFlagsVertical sets the property returned by [GetVSizeFlags].

func (Instance) SetTheme

func (self Instance) SetTheme(value Theme.Instance)

SetTheme sets the property returned by [GetTheme].

func (Instance) SetThemeTypeVariation

func (self Instance) SetThemeTypeVariation(value string)

SetThemeTypeVariation sets the property returned by [GetThemeTypeVariation].

func (Instance) SetTooltipAutoTranslateMode

func (self Instance) SetTooltipAutoTranslateMode(value Node.AutoTranslateMode)

SetTooltipAutoTranslateMode sets the property returned by [GetTooltipAutoTranslateMode].

func (Instance) SetTooltipText

func (self Instance) SetTooltipText(value string)

SetTooltipText sets the property returned by [GetTooltipText].

func (Instance) ShortcutContext

func (self Instance) ShortcutContext() Node.Instance

The Node which must be a parent of the focused Control for the shortcut to be activated. If null, the shortcut can be activated when any control is focused (a global shortcut). This allows shortcuts to be accepted only when the user has a certain area of the GUI focused.

func (Instance) Size

func (self Instance) Size() Vector2.XY

The size of the node's bounding rectangle, in the node's coordinate system. Container nodes update this property automatically.

func (Instance) SizeFlagsHorizontal

func (self Instance) SizeFlagsHorizontal() SizeFlags

Tells the parent Container nodes how they should resize and place the node on the X axis. Use a combination of the SizeFlags constants to change the flags. See the constants to learn what each does.

func (Instance) SizeFlagsStretchRatio

func (self Instance) SizeFlagsStretchRatio() Float.X

If the node and at least one of its neighbors uses the SizeExpand size flag, the parent Container will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbor a ratio of 1, this node will take two thirds of the available space.

func (Instance) SizeFlagsVertical

func (self Instance) SizeFlagsVertical() SizeFlags

Tells the parent Container nodes how they should resize and place the node on the Y axis. Use a combination of the SizeFlags constants to change the flags. See the constants to learn what each does.

func (Instance) Theme

func (self Instance) Theme() Theme.Instance

The Theme resource this node and all its Control and Window children use. If a child node has its own Theme resource set, theme items are merged with child's definitions having higher priority.

Note: Window styles will have no effect unless the window is embedded.

func (Instance) ThemeTypeVariation

func (self Instance) ThemeTypeVariation() string

The name of a theme type variation used by this Control to look up its own theme items. When empty, the class name of the node is used (e.g. Button for the Button control), as well as the class names of all parent classes (in order of inheritance).

When set, this property gives the highest priority to the type of the specified name. This type can in turn extend another type, forming a dependency chain. See Theme.SetTypeVariation. If the theme item cannot be found using this type or its base types, lookup falls back on the class names.

Note: To look up Control's own items use various get_theme_* methods without specifying theme_type.

Note: Theme items are looked for in the tree order, from branch to root, where each Control node is checked for its Theme property. The earliest match against any type/class name is returned. The project-level Theme and the default Theme are checked last.

func (Instance) TooltipAutoTranslateMode

func (self Instance) TooltipAutoTranslateMode() Node.AutoTranslateMode

Defines if tooltip text should automatically change to its translated version depending on the current locale. Uses the same auto translate mode as this control when set to [Node.AutoTranslateModeInherit].

Note: Tooltips customized using MakeCustomTooltip do not use this auto translate mode automatically.

func (Instance) TooltipText

func (self Instance) TooltipText() string

The default tooltip text. The tooltip appears when the user's mouse cursor stays idle over this control for a few moments, provided that the MouseFilter property is not MouseFilterIgnore. The time required for the tooltip to appear can be changed with the ProjectSettings "gui/timers/tooltip_delay_sec" setting.

This string is the default return value of GetTooltip. Override GetTooltip to generate tooltip text dynamically. Override MakeCustomTooltip to customize the tooltip interface and behavior.

The tooltip popup will use either a default implementation, or a custom one that you can provide by overriding MakeCustomTooltip. The default tooltip includes a PopupPanel and Label whose theme properties can be customized using Theme methods with the "TooltipPanel" and "TooltipLabel" respectively. For example:

func (Instance) UpdateMinimumSize

func (self Instance) UpdateMinimumSize()

Invalidates the size cache in this node and in parent nodes up to top level. Intended to be used with GetMinimumSize when the return value is changed. Setting CustomMinimumSize directly calls this method automatically.

func (Instance) Virtual

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

func (Instance) WarpMouse

func (self Instance) WarpMouse(position Vector2.XY)

Moves the mouse cursor to 'position', relative to Position of this Control.

Note: WarpMouse is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.

type Interface

type Interface interface {
	// Virtual method to be implemented by the user. Returns whether the given 'point' is inside this control.
	//
	// If not overridden, default behavior is checking if the point is within control's Rect.
	//
	// Note: If you want to check if a point is inside the control, you can use Rect2(Vector2.ZERO, size).has_point(point).
	HasPoint(point Vector2.XY) bool
	// User defined BiDi algorithm override function.
	//
	// Returns an slice of [Vector3i.XYZ] text ranges and text base directions, in the left-to-right order. Ranges should cover full source 'text' without overlaps. BiDi algorithm will be used on each range separately.
	//
	// [Vector3i.XYZ]: https://pkg.go.dev/graphics.gd/variant/Vector3i#XYZ
	StructuredTextParser(args []any, text string) []Vector3i.XYZ
	// Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to [CustomMinimumSize] for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately).
	//
	// If not overridden, defaults to [Vector2.Zero].
	//
	// Note: This method will not be called when the script is attached to a [Control] node that already overrides its minimum size (e.g. [Label], [Button], [PanelContainer] etc.). It can only be used with most basic GUI nodes, like [Control], [Container], [Panel] etc.
	//
	// [Button]: https://pkg.go.dev/graphics.gd/classdb/Button
	// [Container]: https://pkg.go.dev/graphics.gd/classdb/Container
	// [Control]: https://pkg.go.dev/graphics.gd/classdb/Control
	// [CustomMinimumSize]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.CustomMinimumSize
	// [Label]: https://pkg.go.dev/graphics.gd/classdb/Label
	// [Panel]: https://pkg.go.dev/graphics.gd/classdb/Panel
	// [PanelContainer]: https://pkg.go.dev/graphics.gd/classdb/PanelContainer
	GetMinimumSize() Vector2.XY
	// Virtual method to be implemented by the user. Returns the tooltip text for the position 'at_position' in control's local coordinates, which will typically appear when the cursor is resting over this control. See [GetTooltip].
	//
	// Note: If this method returns an empty string and [MakeCustomTooltip] is not overridden, no tooltip is displayed.
	//
	// [GetTooltip]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.GetTooltip
	// [MakeCustomTooltip]: https://pkg.go.dev/graphics.gd/classdb/Control#Interface
	GetTooltip(at_position Vector2.XY) string
	// Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns null if there is no data to drag. Controls that want to receive drop data should implement [CanDropData] and [DropData]. 'at_position' is local to this control. Drag may be forced with [ForceDrag].
	//
	// A preview that will follow the mouse that should represent the data can be set with [SetDragPreview]. A good time to set the preview is in this method.
	//
	// Note: If the drag was initiated by a keyboard shortcut or [AccessibilityDrag], 'at_position' is set to [Vector2.Inf], and the currently selected item/text position should be used as the drag position.
	//
	//
	//
	// [gdscript]
	//
	// func _get_drag_data(position):
	//
	// 	var mydata = make_data() # This is your custom method generating the drag data.
	//
	// 	set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data.
	//
	// 	return mydata
	//
	// [/gdscript]
	//
	// [csharp]
	//
	// public override Variant _GetDragData(Vector2 atPosition)
	//
	// {
	//
	// 	var myData = MakeData(); // This is your custom method generating the drag data.
	//
	// 	SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data.
	//
	// 	return myData;
	//
	// }
	//
	// [/csharp]
	//
	//
	//
	// [AccessibilityDrag]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.AccessibilityDrag
	// [CanDropData]: https://pkg.go.dev/graphics.gd/classdb/Control#Interface
	// [DropData]: https://pkg.go.dev/graphics.gd/classdb/Control#Interface
	// [ForceDrag]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.ForceDrag
	// [SetDragPreview]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.SetDragPreview
	GetDragData(at_position Vector2.XY) any
	// Godot calls this method to test if 'data' from a control's [GetDragData] can be dropped at 'at_position'. 'at_position' is local to this control.
	//
	// This method should only be used to test the data. Process the data in [DropData].
	//
	// Note: If the drag was initiated by a keyboard shortcut or [AccessibilityDrag], 'at_position' is set to [Vector2.Inf], and the currently selected item/text position should be used as the drop position.
	//
	//
	//
	// [gdscript]
	//
	// func _can_drop_data(position, data):
	//
	// 	# Check position if it is relevant to you
	//
	// 	# Otherwise, just check data
	//
	// 	return typeof(data) == TYPE_DICTIONARY and data.has("expected")
	//
	// [/gdscript]
	//
	// [csharp]
	//
	// public override bool _CanDropData(Vector2 atPosition, Variant data)
	//
	// {
	//
	// 	// Check position if it is relevant to you
	//
	// 	// Otherwise, just check data
	//
	// 	return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("expected");
	//
	// }
	//
	// [/csharp]
	//
	//
	//
	// [AccessibilityDrag]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.AccessibilityDrag
	// [DropData]: https://pkg.go.dev/graphics.gd/classdb/Control#Interface
	// [GetDragData]: https://pkg.go.dev/graphics.gd/classdb/Control#Interface
	CanDropData(at_position Vector2.XY, data any) bool
	// Godot calls this method to pass you the 'data' from a control's [GetDragData] result. Godot first calls [CanDropData] to test if 'data' is allowed to drop at 'at_position' where 'at_position' is local to this control.
	//
	// Note: If the drag was initiated by a keyboard shortcut or [AccessibilityDrag], 'at_position' is set to [Vector2.Inf], and the currently selected item/text position should be used as the drop position.
	//
	//
	//
	// [gdscript]
	//
	// func _can_drop_data(position, data):
	//
	// 	return typeof(data) == TYPE_DICTIONARY and data.has("color")
	//
	//
	//
	// func _drop_data(position, data):
	//
	// 	var color = data["color"]
	//
	// [/gdscript]
	//
	// [csharp]
	//
	// public override bool _CanDropData(Vector2 atPosition, Variant data)
	//
	// {
	//
	// 	return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("color");
	//
	// }
	//
	//
	//
	// public override void _DropData(Vector2 atPosition, Variant data)
	//
	// {
	//
	// 	Color color = data.AsGodotDictionary()["color"].AsColor();
	//
	// }
	//
	// [/csharp]
	//
	//
	//
	// [AccessibilityDrag]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.AccessibilityDrag
	// [CanDropData]: https://pkg.go.dev/graphics.gd/classdb/Control#Interface
	// [GetDragData]: https://pkg.go.dev/graphics.gd/classdb/Control#Interface
	DropData(at_position Vector2.XY, data any)
	// Virtual method to be implemented by the user. Returns a [Control] node that should be used as a tooltip instead of the default one. 'for_text' is the return value of [GetTooltip].
	//
	// The returned node must be of type [Control] or Control-derived. It can have child nodes of any type. It is freed when the tooltip disappears, so make sure you always provide a new instance (if you want to use a pre-existing node from your scene tree, you can duplicate it and pass the duplicated instance). When null or a non-Control node is returned, the default tooltip will be used instead.
	//
	// The returned node will be added as child to a [PopupPanel], so you should only provide the contents of that panel. That [PopupPanel] can be themed using [Theme.SetStylebox] for the type "TooltipPanel" (see [TooltipText] for an example).
	//
	// Note: The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its [CustomMinimumSize] to some non-zero value.
	//
	// Note: The node (and any relevant children) should have their [CanvasItem.Visible] set to true when returned, otherwise, the viewport that instantiates it will not be able to calculate its minimum size reliably.
	//
	// Note: If overridden, this method is called even if [GetTooltip] returns an empty string. When this happens with the default tooltip, it is not displayed. To copy this behavior, return null in this method when 'for_text' is empty.
	//
	// Example: Use a constructed node as a tooltip:
	//
	//
	//
	// [gdscript]
	//
	// func _make_custom_tooltip(for_text):
	//
	// 	var label = Label.new()
	//
	// 	label.text = for_text
	//
	// 	return label
	//
	// [/gdscript]
	//
	// [csharp]
	//
	// public override Control _MakeCustomTooltip(string forText)
	//
	// {
	//
	// 	var label = new Label();
	//
	// 	label.Text = forText;
	//
	// 	return label;
	//
	// }
	//
	// [/csharp]
	//
	//
	//
	// Example: Usa a scene instance as a tooltip:
	//
	//
	//
	// [gdscript]
	//
	// func _make_custom_tooltip(for_text):
	//
	// 	var tooltip = preload("res://some_tooltip_scene.tscn").instantiate()
	//
	// 	tooltip.get_node("Label").text = for_text
	//
	// 	return tooltip
	//
	// [/gdscript]
	//
	// [csharp]
	//
	// public override Control _MakeCustomTooltip(string forText)
	//
	// {
	//
	// 	Node tooltip = ResourceLoader.Load<PackedScene>("res://some_tooltip_scene.tscn").Instantiate();
	//
	// 	tooltip.GetNode<Label>("Label").Text = forText;
	//
	// 	return tooltip;
	//
	// }
	//
	// [/csharp]
	//
	//
	//
	// [CanvasItem.Visible]: https://pkg.go.dev/graphics.gd/classdb/CanvasItem#Instance.Visible
	// [Control]: https://pkg.go.dev/graphics.gd/classdb/Control
	// [CustomMinimumSize]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.CustomMinimumSize
	// [GetTooltip]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.GetTooltip
	// [PopupPanel]: https://pkg.go.dev/graphics.gd/classdb/PopupPanel
	// [Theme.SetStylebox]: https://pkg.go.dev/graphics.gd/classdb/Theme#Instance.SetStylebox
	// [TooltipText]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.TooltipText
	MakeCustomTooltip(for_text string) Object.Instance
	// Return the description of the keyboard shortcuts and other contextual help for this control.
	AccessibilityGetContextualInfo() string
	// Override this method to return a human-readable description of the position of the child 'node' in the custom container, added to the [AccessibilityName].
	//
	// [AccessibilityName]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.AccessibilityName
	GetAccessibilityContainerName(node Node.Instance) string
	// Virtual method to be implemented by the user. Override this method to handle and accept inputs on UI elements. See also [AcceptEvent].
	//
	// Example: Click on the control to print a message:
	//
	//
	//
	// [gdscript]
	//
	// func _gui_input(event):
	//
	// 	if event is InputEventMouseButton:
	//
	// 		if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
	//
	// 			print("I've been clicked D:")
	//
	// [/gdscript]
	//
	// [csharp]
	//
	// public override void _GuiInput(InputEvent @event)
	//
	// {
	//
	// 	if (@event is InputEventMouseButton mb)
	//
	// 	{
	//
	// 		if (mb.ButtonIndex == MouseButton.Left && mb.Pressed)
	//
	// 		{
	//
	// 			GD.Print("I've been clicked D:");
	//
	// 		}
	//
	// 	}
	//
	// }
	//
	// [/csharp]
	//
	//
	//
	// If the 'event' inherits [InputEventMouse], this method will not be called when:
	//
	// - the control's [MouseFilter] is set to [MouseFilterIgnore];
	//
	// - the control is obstructed by another control on top, that doesn't have [MouseFilter] set to [MouseFilterIgnore];
	//
	// - the control's parent has [MouseFilter] set to [MouseFilterStop] or has accepted the event;
	//
	// - the control's parent has [ClipContents] enabled and the 'event”s position is outside the parent's rectangle;
	//
	// - the 'event”s position is outside the control (see [HasPoint]).
	//
	// Note: The 'event”s position is relative to this control's origin.
	//
	// [AcceptEvent]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.AcceptEvent
	// [ClipContents]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.ClipContents
	// [HasPoint]: https://pkg.go.dev/graphics.gd/classdb/Control#Interface
	// [InputEventMouse]: https://pkg.go.dev/graphics.gd/classdb/InputEventMouse
	// [MouseFilter]: https://pkg.go.dev/graphics.gd/classdb/Control#Instance.MouseFilter
	GuiInput(event InputEvent.Instance)
}

type LayoutDirection

type LayoutDirection int //gd:Control.LayoutDirection
const (
	// Automatic layout direction, determined from the parent control layout direction.
	LayoutDirectionInherited LayoutDirection = 0
	// Automatic layout direction, determined from the current locale. Right-to-left layout direction is automatically used for languages that require it such as Arabic and Hebrew, but only if a valid translation file is loaded for the given language (unless said language is configured as a fallback in [ProjectSettings] "internationalization/locale/fallback"). For all other languages (or if no valid translation file is found by Godot), left-to-right layout direction is used. If using [TextServerFallback] ([ProjectSettings] "internationalization/rendering/text_driver"), left-to-right layout direction is always used regardless of the language. Right-to-left layout direction can also be forced using [ProjectSettings] "internationalization/rendering/force_right_to_left_layout_direction".
	//
	// [ProjectSettings]: https://pkg.go.dev/graphics.gd/classdb/ProjectSettings
	// [TextServerFallback]: https://pkg.go.dev/graphics.gd/classdb/TextServerFallback
	LayoutDirectionApplicationLocale LayoutDirection = 1
	// Left-to-right layout direction.
	LayoutDirectionLtr LayoutDirection = 2
	// Right-to-left layout direction.
	LayoutDirectionRtl LayoutDirection = 3
	// Automatic layout direction, determined from the system locale. Right-to-left layout direction is automatically used for languages that require it such as Arabic and Hebrew, but only if a valid translation file is loaded for the given language. For all other languages (or if no valid translation file is found by Godot), left-to-right layout direction is used. If using [TextServerFallback] ([ProjectSettings] "internationalization/rendering/text_driver"), left-to-right layout direction is always used regardless of the language.
	//
	// [ProjectSettings]: https://pkg.go.dev/graphics.gd/classdb/ProjectSettings
	// [TextServerFallback]: https://pkg.go.dev/graphics.gd/classdb/TextServerFallback
	LayoutDirectionSystemLocale LayoutDirection = 4
	// Represents the size of the [LayoutDirection] enum.
	LayoutDirectionMax    LayoutDirection = 5
	LayoutDirectionLocale LayoutDirection = 1
)

type LayoutPreset

type LayoutPreset int //gd:Control.LayoutPreset
const (
	// Snap all 4 anchors to the top-left of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetTopLeft LayoutPreset = 0
	// Snap all 4 anchors to the top-right of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetTopRight LayoutPreset = 1
	// Snap all 4 anchors to the bottom-left of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetBottomLeft LayoutPreset = 2
	// Snap all 4 anchors to the bottom-right of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetBottomRight LayoutPreset = 3
	// Snap all 4 anchors to the center of the left edge of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetCenterLeft LayoutPreset = 4
	// Snap all 4 anchors to the center of the top edge of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetCenterTop LayoutPreset = 5
	// Snap all 4 anchors to the center of the right edge of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetCenterRight LayoutPreset = 6
	// Snap all 4 anchors to the center of the bottom edge of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetCenterBottom LayoutPreset = 7
	// Snap all 4 anchors to the center of the parent control's bounds. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetCenter LayoutPreset = 8
	// Snap all 4 anchors to the left edge of the parent control. The left offset becomes relative to the left edge and the top offset relative to the top left corner of the node's parent. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetLeftWide LayoutPreset = 9
	// Snap all 4 anchors to the top edge of the parent control. The left offset becomes relative to the top left corner, the top offset relative to the top edge, and the right offset relative to the top right corner of the node's parent. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetTopWide LayoutPreset = 10
	// Snap all 4 anchors to the right edge of the parent control. The right offset becomes relative to the right edge and the top offset relative to the top right corner of the node's parent. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetRightWide LayoutPreset = 11
	// Snap all 4 anchors to the bottom edge of the parent control. The left offset becomes relative to the bottom left corner, the bottom offset relative to the bottom edge, and the right offset relative to the bottom right corner of the node's parent. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetBottomWide LayoutPreset = 12
	// Snap all 4 anchors to a vertical line that cuts the parent control in half. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetVcenterWide LayoutPreset = 13
	// Snap all 4 anchors to a horizontal line that cuts the parent control in half. Use with [SetAnchorsPreset].
	//
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetHcenterWide LayoutPreset = 14
	// Snap all 4 anchors to the respective corners of the parent control. Set all 4 offsets to 0 after you applied this preset and the [Control] will fit its parent control. Use with [SetAnchorsPreset].
	//
	// [Control]: https://pkg.go.dev/graphics.gd/classdb/Control
	// [SetAnchorsPreset]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SetAnchorsPreset
	PresetFullRect LayoutPreset = 15
)

type LayoutPresetMode

type LayoutPresetMode int //gd:Control.LayoutPresetMode
const (
	// The control will be resized to its minimum size.
	PresetModeMinsize LayoutPresetMode = 0
	// The control's width will not change.
	PresetModeKeepWidth LayoutPresetMode = 1
	// The control's height will not change.
	PresetModeKeepHeight LayoutPresetMode = 2
	// The control's size will not change.
	PresetModeKeepSize LayoutPresetMode = 3
)

type MoreArgs

type MoreArgs [1]gdclass.Control

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) GetCursorShape

func (self MoreArgs) GetCursorShape(position Vector2.XY) CursorShape

Returns the mouse cursor shape for this control when hovered over 'position' in local coordinates. For most controls, this is the same as MouseDefaultCursorShape, but some built-in controls implement more complex logic.

func (MoreArgs) GetThemeColor

func (self MoreArgs) GetThemeColor(name string, theme_type string) Color.RGBA

Returns a Color.RGBA from the first matching Theme in the tree if that Theme has a color item with the specified 'name' and 'theme_type'. If 'theme_type' is omitted the class name of the current control is used as the type, or ThemeTypeVariation if it is defined. If the type is a class name its parent classes are also checked, in order of inheritance. If the type is a variation its base types are checked, in order of dependency, then the control's class name and its parent classes are checked.

For the current control its local overrides are considered first (see AddThemeColorOverride), then its assigned Theme. After the current control, each parent control and its assigned Theme are considered; controls without a Theme assigned are skipped. If no matching Theme is found in the tree, the custom project Theme (see ProjectSettings "gui/theme/custom") and the default Theme are used (see ThemeDB).

// Get the font color defined for the current Control's class, if it exists.
control.AsCanvasItem().SetModulate(control.GetThemeColor("font_color"))
// Get the font color defined for the Button class.
control.MoreArgs().GetThemeColor("font_color", "Button")

func (MoreArgs) GetThemeConstant

func (self MoreArgs) GetThemeConstant(name string, theme_type string) int

Returns a constant from the first matching Theme in the tree if that Theme has a constant item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) GetThemeFont

func (self MoreArgs) GetThemeFont(name string, theme_type string) Font.Instance

Returns a Font from the first matching Theme in the tree if that Theme has a font item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) GetThemeFontSize

func (self MoreArgs) GetThemeFontSize(name string, theme_type string) int

Returns a font size from the first matching Theme in the tree if that Theme has a font size item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) GetThemeIcon

func (self MoreArgs) GetThemeIcon(name string, theme_type string) Texture2D.Instance

Returns an icon from the first matching Theme in the tree if that Theme has an icon item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) GetThemeStylebox

func (self MoreArgs) GetThemeStylebox(name string, theme_type string) StyleBox.Instance

Returns a StyleBox from the first matching Theme in the tree if that Theme has a stylebox item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) GetTooltip

func (self MoreArgs) GetTooltip(at_position Vector2.XY) string

Returns the tooltip text for the position 'at_position' in control's local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns TooltipText.

This method can be overridden to customize its behavior. See GetTooltip.

Note: If this method returns an empty string and MakeCustomTooltip is not overridden, no tooltip is displayed.

func (MoreArgs) HasThemeColor

func (self MoreArgs) HasThemeColor(name string, theme_type string) bool

Returns true if there is a matching Theme in the tree that has a color item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) HasThemeConstant

func (self MoreArgs) HasThemeConstant(name string, theme_type string) bool

Returns true if there is a matching Theme in the tree that has a constant item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) HasThemeFont

func (self MoreArgs) HasThemeFont(name string, theme_type string) bool

Returns true if there is a matching Theme in the tree that has a font item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) HasThemeFontSize

func (self MoreArgs) HasThemeFontSize(name string, theme_type string) bool

Returns true if there is a matching Theme in the tree that has a font size item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) HasThemeIcon

func (self MoreArgs) HasThemeIcon(name string, theme_type string) bool

Returns true if there is a matching Theme in the tree that has an icon item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) HasThemeStylebox

func (self MoreArgs) HasThemeStylebox(name string, theme_type string) bool

Returns true if there is a matching Theme in the tree that has a stylebox item with the specified 'name' and 'theme_type'.

See GetThemeColor for details.

func (MoreArgs) SetAnchor

func (self MoreArgs) SetAnchor(side Rect2.Side, anchor Float.X, keep_offset bool, push_opposite_anchor bool)

Sets the anchor for the specified [Side] to 'anchor'. A setter method for AnchorBottom, AnchorLeft, AnchorRight and AnchorTop.

If 'keep_offset' is true, offsets aren't updated after this operation.

If 'push_opposite_anchor' is true and the opposite anchor overlaps this anchor, the opposite one will have its value overridden. For example, when setting left anchor to 1 and the right anchor has value of 0.5, the right anchor will also get value of 1. If 'push_opposite_anchor' was false, the left anchor would get value 0.5.

func (MoreArgs) SetAnchorAndOffset

func (self MoreArgs) SetAnchorAndOffset(side Rect2.Side, anchor Float.X, offset Float.X, push_opposite_anchor bool)

Works the same as SetAnchor, but instead of keep_offset argument and automatic update of offset, it allows to set the offset yourself (see SetOffset).

func (MoreArgs) SetAnchorsAndOffsetsPreset

func (self MoreArgs) SetAnchorsAndOffsetsPreset(preset LayoutPreset, resize_mode LayoutPresetMode, margin int)

Sets both anchor preset and offset preset. See SetAnchorsPreset and SetOffsetsPreset.

func (MoreArgs) SetAnchorsPreset

func (self MoreArgs) SetAnchorsPreset(preset LayoutPreset, keep_offsets bool)

Sets the anchors to a 'preset' from [Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.

If 'keep_offsets' is true, control's position will also be updated.

func (MoreArgs) SetGlobalPosition

func (self MoreArgs) SetGlobalPosition(position Vector2.XY, keep_offsets bool)

Sets the GlobalPosition to given 'position'.

If 'keep_offsets' is true, control's anchors will be updated instead of offsets.

func (MoreArgs) SetOffsetsPreset

func (self MoreArgs) SetOffsetsPreset(preset LayoutPreset, resize_mode LayoutPresetMode, margin int)

Sets the offsets to a 'preset' from [Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.

Use parameter 'resize_mode' with constants from [Control.LayoutPresetMode] to better determine the resulting size of the Control. Constant size will be ignored if used with presets that change size, e.g. PresetLeftWide.

Use parameter 'margin' to determine the gap between the Control and the edges.

func (MoreArgs) SetPosition

func (self MoreArgs) SetPosition(position Vector2.XY, keep_offsets bool)

Sets the Position to given 'position'.

If 'keep_offsets' is true, control's anchors will be updated instead of offsets.

func (MoreArgs) SetSize

func (self MoreArgs) SetSize(size Vector2.XY, keep_offsets bool)

Sets the size (see Size).

If 'keep_offsets' is true, control's anchors will be updated instead of offsets.

type MouseBehaviorRecursive

type MouseBehaviorRecursive int //gd:Control.MouseBehaviorRecursive
const (
	// Inherits the [MouseBehaviorRecursive] from the parent control. If there is no parent control, this is the same as [MouseBehaviorEnabled].
	//
	// [MouseBehaviorRecursive]: https://pkg.go.dev/graphics.gd/classdb/#Instance.MouseBehaviorRecursive
	MouseBehaviorInherited MouseBehaviorRecursive = 0
	// Prevents the control from receiving mouse input. [GetMouseFilterWithOverride] will return [MouseFilterIgnore].
	//
	// [GetMouseFilterWithOverride]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GetMouseFilterWithOverride
	MouseBehaviorDisabled MouseBehaviorRecursive = 1
	// Allows the control to be receive mouse input, depending on the [MouseFilter]. This can be used to ignore the parent's [MouseBehaviorRecursive]. [GetMouseFilterWithOverride] will return the [MouseFilter].
	//
	// [GetMouseFilterWithOverride]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GetMouseFilterWithOverride
	// [MouseBehaviorRecursive]: https://pkg.go.dev/graphics.gd/classdb/#Instance.MouseBehaviorRecursive
	// [MouseFilter]: https://pkg.go.dev/graphics.gd/classdb/#Instance.MouseFilter
	MouseBehaviorEnabled MouseBehaviorRecursive = 2
)

type MouseFilter

type MouseFilter int //gd:Control.MouseFilter
const (
	// The control will receive mouse movement input events and mouse button input events if clicked on through [GuiInput]. The control will also receive the [OnMouseEntered] and [OnMouseExited] signals. These events are automatically marked as handled, and they will not propagate further to other controls. This also results in blocking signals in other controls.
	//
	// [GuiInput]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GuiInput
	// [OnMouseEntered]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnMouseEntered
	// [OnMouseExited]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnMouseExited
	MouseFilterStop MouseFilter = 0
	// The control will receive mouse movement input events and mouse button input events if clicked on through [GuiInput]. The control will also receive the [OnMouseEntered] and [OnMouseExited] signals.
	//
	// If this control does not handle the event, the event will propagate up to its parent control if it has one. The event is bubbled up the node hierarchy until it reaches a non-[CanvasItem], a control with [MouseFilterStop], or a [CanvasItem] with [CanvasItem.TopLevel] enabled. This will allow signals to fire in all controls it reaches. If no control handled it, the event will be passed to [Node.ShortcutInput] for further processing.
	//
	// [CanvasItem]: https://pkg.go.dev/graphics.gd/classdb/CanvasItem
	// [CanvasItem.TopLevel]: https://pkg.go.dev/graphics.gd/classdb/CanvasItem#Instance.TopLevel
	// [GuiInput]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GuiInput
	// [Node.ShortcutInput]: https://pkg.go.dev/graphics.gd/classdb/Node#Instance.ShortcutInput
	// [OnMouseEntered]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnMouseEntered
	// [OnMouseExited]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnMouseExited
	MouseFilterPass MouseFilter = 1
	// The control will not receive any mouse movement input events nor mouse button input events through [GuiInput]. The control will also not receive the [OnMouseEntered] nor [OnMouseExited] signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically. If a child has [MouseFilterPass] and an event was passed to this control, the event will further propagate up to the control's parent.
	//
	// Note: If the control has received [OnMouseEntered] but not [OnMouseExited], changing the [MouseFilter] to [MouseFilterIgnore] will cause [OnMouseExited] to be emitted.
	//
	// [GuiInput]: https://pkg.go.dev/graphics.gd/classdb/#Instance.GuiInput
	// [MouseFilter]: https://pkg.go.dev/graphics.gd/classdb/#Instance.MouseFilter
	// [OnMouseEntered]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnMouseEntered
	// [OnMouseExited]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnMouseExited
	MouseFilterIgnore MouseFilter = 2
)

type SizeFlags

type SizeFlags int //gd:Control.SizeFlags
const (
	// Tells the parent [Container] to align the node with its start, either the top or the left edge. It is mutually exclusive with [SizeFill] and other shrink size flags, but can be used with [SizeExpand] in some containers. Use with [SizeFlagsHorizontal] and [SizeFlagsVertical].
	//
	// Note: Setting this flag is equal to not having any size flags.
	//
	// [Container]: https://pkg.go.dev/graphics.gd/classdb/Container
	// [SizeFlagsHorizontal]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsHorizontal
	// [SizeFlagsVertical]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsVertical
	SizeShrinkBegin SizeFlags = 0
	// Tells the parent [Container] to expand the bounds of this node to fill all the available space without pushing any other node. It is mutually exclusive with shrink size flags. Use with [SizeFlagsHorizontal] and [SizeFlagsVertical].
	//
	// [Container]: https://pkg.go.dev/graphics.gd/classdb/Container
	// [SizeFlagsHorizontal]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsHorizontal
	// [SizeFlagsVertical]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsVertical
	SizeFill SizeFlags = 1
	// Tells the parent [Container] to let this node take all the available space on the axis you flag. If multiple neighboring nodes are set to expand, they'll share the space based on their stretch ratio. See [SizeFlagsStretchRatio]. Use with [SizeFlagsHorizontal] and [SizeFlagsVertical].
	//
	// [Container]: https://pkg.go.dev/graphics.gd/classdb/Container
	// [SizeFlagsHorizontal]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsHorizontal
	// [SizeFlagsStretchRatio]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsStretchRatio
	// [SizeFlagsVertical]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsVertical
	SizeExpand SizeFlags = 2
	// Sets the node's size flags to both fill and expand. See [SizeFill] and [SizeExpand] for more information.
	SizeExpandFill SizeFlags = 3
	// Tells the parent [Container] to center the node in the available space. It is mutually exclusive with [SizeFill] and other shrink size flags, but can be used with [SizeExpand] in some containers. Use with [SizeFlagsHorizontal] and [SizeFlagsVertical].
	//
	// [Container]: https://pkg.go.dev/graphics.gd/classdb/Container
	// [SizeFlagsHorizontal]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsHorizontal
	// [SizeFlagsVertical]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsVertical
	SizeShrinkCenter SizeFlags = 4
	// Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It is mutually exclusive with [SizeFill] and other shrink size flags, but can be used with [SizeExpand] in some containers. Use with [SizeFlagsHorizontal] and [SizeFlagsVertical].
	//
	// [Container]: https://pkg.go.dev/graphics.gd/classdb/Container
	// [SizeFlagsHorizontal]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsHorizontal
	// [SizeFlagsVertical]: https://pkg.go.dev/graphics.gd/classdb/#Instance.SizeFlagsVertical
	SizeShrinkEnd SizeFlags = 8
)

type TextDirection

type TextDirection int //gd:Control.TextDirection
const (
	// Text writing direction is the same as layout direction.
	TextDirectionInherited TextDirection = 3
	// Automatic text writing direction, determined from the current locale and text content.
	TextDirectionAuto TextDirection = 0
	// Left-to-right text writing direction.
	TextDirectionLtr TextDirection = 1
	// Right-to-left text writing direction.
	TextDirectionRtl TextDirection = 2
)

Jump to

Keyboard shortcuts

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