Base node for all User Interface components.
The base class Node for all User Interface components. Every UI node inherits from it. Any scene or portion of a scene tree composed of Control nodes is a User Interface.
Controls use anchors and margins to place themselves relative to their parent. They adapt automatically when their parent or the screen size changes. To build flexible UIs, use built-in [Container] nodes or create your own.
Anchors work by defining which margin do they follow, and a value relative to it. Allowed anchoring modes are ANCHOR_BEGIN, where the margin is relative to the top or left margins of the parent (in pixels), ANCHOR_END for the right and bottom margins of the parent and ANCHOR_RATIO, which is a ratio from 0 to 1 in the parent range.
Godot sends Input events to the root node first, via [method Node._input]. The method distributes it through the node tree and delivers the input events to the node under the mouse cursor or on focus with the keyboard. To do so, it calls [method MainLoop._input_event]. No need to enable [method Node.set_process_input] on Controls to receive input events. Call [method accept_event] to ensure no other node receives the event, not even [method Node._unhandled_input].
Only the one Control node in focus receives keyboard events. To do so, the Control must get the focus mode with [method set_focus_mode]. It loses focus when another Control gets it, or if the current Control in focus is hidden.
You'll sometimes want Controls to ignore mouse or touch events. For example, if you place an icon on top of a button. Call [method set_ignore_mouse] for that.
[Theme] resources change the Control's appearance. If you change the [Theme] on a parent Control node, it will propagate to all of its children. You can override parts of the theme on each Control with the add_*_override methods, like [method add_font_override]. You can also override the theme from the editor.
Returns the minimum size this Control can shrink to. A control will never be displayed or resized smaller than its minimum size.
Marks the input event as handled. No other Control will receive it, and the input event will not propagate. Not even to nodes listening to [method Node._unhandled_input] or [method Node._unhandled_key_input].
Override a single constant (integer) in the theme of this Control. If constant equals Theme.INVALID_CONSTANT, override is cleared.
Override a single font (font) in the theme of this Control. If font is empty, override is cleared.
Override a single icon ([Texture]) in the theme of this Control. If texture is empty, override is cleared.
Override a single stylebox ([Stylebox]) in the theme of this Control. If stylebox is empty, override is cleared.
Return the anchor type (ANCHOR_BEGIN, ANCHOR_END, ANCHOR_RATIO) for a given margin (MARGIN_LEFT, MARGIN_TOP, MARGIN_RIGHT, MARGIN_BOTTOM).
Return the cursor shape at a certain position in the control.
Return the default cursor shape for this control. See enum CURSOR_* for the list of shapes.
Returns MARGIN_LEFT and MARGIN_TOP at the same time. This is a helper (see [method set_margin]).
Returns the focus access mode for the control (FOCUS_NONE, FOCUS_CLICK, FOCUS_ALL) (see [method set_focus_mode]).
Return the forced neighbour for moving the input focus to. When pressing TAB or directional/joypad directions focus is moved to the next control in that direction. However, the neighbour to move to can be forced with this function.
Return which control is owning the keyboard focus, or null if no one.
Returns the Control position, relative to the top-left corner of the parent Control and independent of the anchor mode.
Return position and size of the Control, relative to the top-left corner of the [i]window[/i] Control. This is a helper (see [method get_global_position], [method get_size]).
Hint for containers, return horizontal positioning flags.
Return a margin offset. Margin can be one of (MARGIN_LEFT, MARGIN_TOP, MARGIN_RIGHT, MARGIN_BOTTOM). Offset value being returned depends on the anchor mode.
Return the minimum size this Control can shrink to. A control will never be displayed or resized smaller than its minimum size.
Return when the control is ignoring mouse events (even touchpad events send mouse events).
Returns the Control position, relative to the top-left corner of the parent Control and independent of the anchor mode.
Return position and size of the Control, relative to the top-left corner of the parent Control. This is a helper (see [method get_position], [method get_size]).
Return the rotation (in radians)
Return the rotation (in degrees)
Returns the size of the Control, computed from all margins, however the size returned will [b]never be smaller than the minimum size reported by[/b] [method get_minimum_size]. This means that even if end position of the Control rectangle is smaller than the begin position, the Control will still display and interact correctly. (see description, [method get_minimum_size], [method set_margin], [method set_anchor]).
Hint for containers, return the stretch ratio. This value is relative to other stretch ratio, so if this control has 2 and another has 1, this one will be twice as big.
Return a [Theme] override, if one exists (see [method set_theme]).
Return the tooltip, which will appear when the cursor is resting over this control.
Hint for containers, return vertical positioning flags.
Steal the focus from another control and become the focused control (see [method set_focus_mode]).
Return whether the Control is the current focused control (see [method set_focus_mode]).
Give up the focus, no other control will be able to receive keyboard input.
Change all margins and anchors, so this Control always takes up the same area as the parent Control. This is a helper (see [method set_anchor], [method set_margin]).
Sets MARGIN_LEFT and MARGIN_TOP at the same time. This is a helper (see [method set_margin]).
Set the default cursor shape for this control. See enum CURSOR_* for the list of shapes.
Sets MARGIN_RIGHT and MARGIN_BOTTOM at the same time. This is a helper (see [method set_margin]).
Set the focus access mode for the control (FOCUS_NONE, FOCUS_CLICK, FOCUS_ALL). Only one Control can be focused at the same time, and it will receive keyboard signals.
Force a neighbour for moving the input focus to. When pressing TAB or directional/joypad directions focus is moved to the next control in that direction. However, the neighbour to move to can be forced with this function.
Move the Control to a new position, relative to the top-left corner of the [i]window[/i] Control, and without changing current anchor mode. (see [method set_margin]).
Hint for containers, set horizontal positioning flags.
Set a margin offset. Margin can be one of (MARGIN_LEFT, MARGIN_TOP, MARGIN_RIGHT, MARGIN_BOTTOM). Offset value being set depends on the anchor mode.
Set when the control is ignoring mouse events (even touchpad events send mouse events). (see the MOUSE_FILTER_* constants)
Move the Control to a new position, relative to the top-left corner of the parent Control, changing all margins if needed and without changing current anchor mode. This is a helper (see [method set_margin]).
Set the rotation (in radians).
Set the rotation (in degrees).
Changes MARGIN_RIGHT and MARGIN_BOTTOM to fit a given size. This is a helper (see [method set_margin]).
Hint for containers, set the stretch ratio. This value is relative to other stretch ratio, so if this control has 2 and another has 1, this one will be twice as big.
Override whole the [Theme] for this Control and all its children controls.
Set a tooltip, which will appear when the cursor is resting over this control.
Hint for containers, set vertical positioning flags.
Display a Control as modal. Control must be a subwindow. Modal controls capture the input signals until closed or the area outside them is accessed. When a modal control loses focus, or the ESC key is pressed, they automatically hide. Modal controls are used extensively for popup dialogs and menus.
Emitted when the node gains keyboard focus.
Emitted when the node loses keyboard focus.
Emitted when the node's minimum size changes.
Emitted when the mouse enters the control's area.
Emitted when the mouse leaves the control's area.
Emitted when the control changes size.
Emitted when the size flags change.
Control can't acquire focus.
Control can acquire focus only if clicked.
Control can acquire focus if clicked, or by pressing TAB/Directionals in the keyboard from another Control.
Control changed size (get_size() reports the new size).
Mouse pointer entered the area of the Control.
Mouse pointer exited the area of the Control.
Control gained focus.
Control lost focus.
Theme changed. Redrawing is desired.
Modal control was closed.
X is relative to MARGIN_LEFT, Y is relative to MARGIN_TOP.
X is relative to -MARGIN_RIGHT, Y is relative to -MARGIN_BOTTOM.