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.
</description>
</method>
<methodname="_gui_input"qualifiers="virtual">
<returntype="void">
</return>
<argumentindex="0"name="event"type="InputEvent">
</argument>
<description>
</description>
</method>
<methodname="accept_event">
<returntype="void">
</return>
<description>
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].
</description>
</method>
<methodname="add_color_override">
<returntype="void">
</return>
<argumentindex="0"name="name"type="String">
</argument>
<argumentindex="1"name="color"type="Color">
</argument>
<description>
</description>
</method>
<methodname="add_constant_override">
<returntype="void">
</return>
<argumentindex="0"name="name"type="String">
</argument>
<argumentindex="1"name="constant"type="int">
</argument>
<description>
Override a single constant (integer) in the theme of this Control. If constant equals Theme.INVALID_CONSTANT, override is cleared.
</description>
</method>
<methodname="add_font_override">
<returntype="void">
</return>
<argumentindex="0"name="name"type="String">
</argument>
<argumentindex="1"name="font"type="Font">
</argument>
<description>
Override a single font (font) in the theme of this Control. If font is empty, override is cleared.
</description>
</method>
<methodname="add_icon_override">
<returntype="void">
</return>
<argumentindex="0"name="name"type="String">
</argument>
<argumentindex="1"name="texture"type="Texture">
</argument>
<description>
Override a single icon ([Texture]) in the theme of this Control. If texture is empty, override is cleared.
</description>
</method>
<methodname="add_shader_override">
<returntype="void">
</return>
<argumentindex="0"name="name"type="String">
</argument>
<argumentindex="1"name="shader"type="Shader">
</argument>
<description>
</description>
</method>
<methodname="add_style_override">
<returntype="void">
</return>
<argumentindex="0"name="name"type="String">
</argument>
<argumentindex="1"name="stylebox"type="StyleBox">
</argument>
<description>
Override a single stylebox ([Stylebox]) in the theme of this Control. If stylebox is empty, override is cleared.
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.
</description>
</method>
<methodname="get_focus_owner"qualifiers="const">
<returntype="Control">
</return>
<description>
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.
</description>
</method>
<methodname="get_global_rect"qualifiers="const">
<returntype="Rect2">
</return>
<description>
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]).
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.
</description>
</method>
<methodname="get_minimum_size"qualifiers="const">
<returntype="Vector2">
</return>
<description>
Return the minimum size this Control can shrink to. A control will never be displayed or resized smaller than its minimum size.
</description>
</method>
<methodname="get_mouse_filter"qualifiers="const">
<returntype="int"enum="Control.MouseFilter">
</return>
<description>
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.
</description>
</method>
<methodname="get_rect"qualifiers="const">
<returntype="Rect2">
</return>
<description>
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]).
</description>
</method>
<methodname="get_rotation"qualifiers="const">
<returntype="float">
</return>
<description>
Return the rotation (in radians)
</description>
</method>
<methodname="get_rotation_deg"qualifiers="const">
<returntype="float">
</return>
<description>
Return the rotation (in degrees)
</description>
</method>
<methodname="get_scale"qualifiers="const">
<returntype="Vector2">
</return>
<description>
</description>
</method>
<methodname="get_size"qualifiers="const">
<returntype="Vector2">
</return>
<description>
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.
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]).
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]).
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]).
</description>
</method>
<methodname="set_rotation">
<returntype="void">
</return>
<argumentindex="0"name="radians"type="float">
</argument>
<description>
Set the rotation (in radians).
</description>
</method>
<methodname="set_rotation_deg">
<returntype="void">
</return>
<argumentindex="0"name="degrees"type="float">
</argument>
<description>
Set the rotation (in degrees).
</description>
</method>
<methodname="set_scale">
<returntype="void">
</return>
<argumentindex="0"name="scale"type="Vector2">
</argument>
<description>
</description>
</method>
<methodname="set_size">
<returntype="void">
</return>
<argumentindex="0"name="size"type="Vector2">
</argument>
<description>
Changes MARGIN_RIGHT and MARGIN_BOTTOM to fit a given size. This is a helper (see [method set_margin]).
</description>
</method>
<methodname="set_stretch_ratio">
<returntype="void">
</return>
<argumentindex="0"name="ratio"type="float">
</argument>
<description>
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.
</description>
</method>
<methodname="set_theme">
<returntype="void">
</return>
<argumentindex="0"name="theme"type="Theme">
</argument>
<description>
Override whole the [Theme] for this Control and all its children controls.
</description>
</method>
<methodname="set_tooltip">
<returntype="void">
</return>
<argumentindex="0"name="tooltip"type="String">
</argument>
<description>
Set a tooltip, which will appear when the cursor is resting over this control.
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.