godot/doc/classes/Control.xml

957 lines
48 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
<class name="Control" inherits="CanvasItem" category="Core" version="3.1">
<brief_description>
All User Interface nodes inherit from Control. A control's anchors and margins adapt its position and size relative to its parent.
</brief_description>
<description>
Base class for all User Interface or [i]UI[/i] related nodes. [code]Control[/code] features a bounding rectangle that defines its extents, an anchor position relative to its parent and margins that represent an offset to the anchor. The margins update automatically when the node, any of its parents, or the screen size change.
For more information on Godot's UI system, anchors, margins, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from [code]Control[/code] and [Container] nodes.
[b]User Interface nodes and input[/b]
Godot sends input events to the scene's root node first, by calling [method Node._input]. [method Node._input] forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls [method MainLoop._input_event]. Call [method accept_event] so no other node receives the event. Once you accepted an input, it becomes handled so [method Node._unhandled_input] will not process it.
Only one [code]Control[/code] node can be in keyboard focus. Only the node in focus will receive keyboard events. To get the focus, call [method grab_focus]. [code]Control[/code] nodes lose focus when another node grabs it, or if you hide the node in focus.
Set [member mouse_filter] to [constant MOUSE_FILTER_IGNORE] to tell a [code]Control[/code] 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. If you change the [Theme] on a [code]Control[/code] node, it affects all of its children. To override some of the theme's parameters, call one of the [code]add_*_override[/code] methods, like [method add_font_override]. You can override the theme with the inspector.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/gui/index.html</link>
<link>https://docs.godotengine.org/en/latest/tutorials/2d/custom_drawing_in_2d.html</link>
</tutorials>
<demos>
</demos>
<methods>
2018-08-20 22:35:30 +00:00
<method name="_clips_input" qualifiers="virtual">
<return type="bool">
</return>
<description>
</description>
</method>
<method name="_get_minimum_size" qualifiers="virtual">
<return type="Vector2">
</return>
<description>
Returns the minimum size for this control. See [member rect_min_size].
</description>
</method>
<method name="_gui_input" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="event" type="InputEvent">
</argument>
<description>
Use this method to process and accept inputs on UI elements. See [method accept_event].
Replaces Godot 2's [code]_input_event[/code].
</description>
</method>
<method name="_make_custom_tooltip" qualifiers="virtual">
<return type="Object">
</return>
<argument index="0" name="for_text" type="String">
</argument>
<description>
</description>
</method>
<method name="accept_event">
<return type="void">
</return>
<description>
Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to [method Node._unhandled_input] or [method Node._unhandled_key_input].
</description>
</method>
<method name="add_color_override">
<return type="void">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="color" type="Color">
</argument>
<description>
2018-05-16 16:15:30 +00:00
Overrides the color in the [member theme] resource the node uses.
</description>
</method>
<method name="add_constant_override">
<return type="void">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="constant" type="int">
</argument>
<description>
2018-10-05 20:20:16 +00:00
Overrides an integer constant in the [member theme] resource the node uses. If the [code]constant[/code] is invalid, Godot clears the override.
</description>
</method>
<method name="add_font_override">
<return type="void">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="font" type="Font">
</argument>
<description>
2018-05-16 16:15:30 +00:00
Overrides the [code]name[/code] font in the [member theme] resource the node uses. If [code]font[/code] is empty, Godot clears the override.
</description>
</method>
<method name="add_icon_override">
<return type="void">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="texture" type="Texture">
</argument>
<description>
2018-05-16 16:15:30 +00:00
Overrides the [code]name[/code] icon in the [member theme] resource the node uses. If [code]icon[/code] is empty, Godot clears the override.
</description>
</method>
<method name="add_shader_override">
<return type="void">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="shader" type="Shader">
</argument>
<description>
2018-05-16 16:15:30 +00:00
Overrides the [code]name[/code] shader in the [member theme] resource the node uses. If [code]shader[/code] is empty, Godot clears the override.
</description>
</method>
2018-01-13 07:58:45 +00:00
<method name="add_stylebox_override">
<return type="void">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="stylebox" type="StyleBox">
</argument>
<description>
Overrides the [code]name[/code] [StyleBox] in the [member theme] resource the node uses. If [code]stylebox[/code] is empty, Godot clears the override.
</description>
</method>
<method name="can_drop_data" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="data" type="Variant">
</argument>
<description>
Godot calls this method to test if [code]data[/code] from a control's [method get_drag_data] can be dropped at [code]position[/code]. [code]position[/code] is local to this control.
This method should only be used to test the data. Process the data in [method drop_data].
[codeblock]
extends Control
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')
[/codeblock]
</description>
</method>
<method name="drop_data" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="position" type="Vector2">
</argument>
<argument index="1" name="data" type="Variant">
</argument>
<description>
Godot calls this method to pass you the [code]data[/code] from a control's [method get_drag_data] result. Godot first calls [method can_drop_data] to test if [code]data[/code] is allowed to drop at [code]position[/code] where [code]position[/code] is local to this control.
[codeblock]
extends ColorRect
func can_drop_data(position, data):
return typeof(data) == TYPE_DICTIONARY and data.has('color')
func drop_data(position, data):
color = data['color']
[/codeblock]
</description>
</method>
<method name="force_drag">
<return type="void">
</return>
<argument index="0" name="data" type="Variant">
</argument>
<argument index="1" name="preview" type="Control">
</argument>
<description>
Forces drag and bypasses [method get_drag_data] and [method set_drag_preview] by passing [code]data[/code] and [code]preview[/code]. Drag will start even if the mouse is neither over nor pressed on this control.
2018-03-29 05:46:21 +00:00
The methods [method can_drop_data] and [method drop_data] must be implemented on controls that want to receive drop data.
</description>
</method>
<method name="get_begin" qualifiers="const">
<return type="Vector2">
</return>
<description>
Returns [member margin_left] and [member margin_top]. See also [member rect_position].
</description>
</method>
<method name="get_color" qualifiers="const">
<return type="Color">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="get_combined_minimum_size" qualifiers="const">
<return type="Vector2">
</return>
<description>
</description>
</method>
<method name="get_constant" qualifiers="const">
<return type="int">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="get_cursor_shape" qualifiers="const">
<return type="int" enum="Control.CursorShape">
</return>
<argument index="0" name="position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
Returns the mouse cursor shape the control displays on mouse hover. See [enum CursorShape].
</description>
</method>
<method name="get_drag_data" qualifiers="virtual">
<return type="Object">
</return>
<argument index="0" name="position" type="Vector2">
</argument>
<description>
2018-03-29 05:46:21 +00:00
Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Return null if there is no data to drag. Controls that want to receive drop data should implement [method can_drop_data] and [method drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag].
A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method.
[codeblock]
extends Control
func get_drag_data(position):
var mydata = make_data()
set_drag_preview(make_preview(mydata))
return mydata
[/codeblock]
</description>
</method>
<method name="get_end" qualifiers="const">
<return type="Vector2">
</return>
<description>
Returns [member margin_right] and [member margin_bottom].
</description>
</method>
<method name="get_focus_owner" qualifiers="const">
<return type="Control">
</return>
<description>
Returns the control that has the keyboard focus or [code]null[/code] if none.
</description>
</method>
<method name="get_font" qualifiers="const">
<return type="Font">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="get_global_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
Returns the position and size of the control relative to the top-left corner of the screen. See [member rect_position] and [member rect_size].
</description>
</method>
<method name="get_icon" qualifiers="const">
<return type="Texture">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="get_minimum_size" qualifiers="const">
<return type="Vector2">
</return>
<description>
Returns the minimum size for this control. See [member rect_min_size].
</description>
</method>
<method name="get_parent_area_size" qualifiers="const">
<return type="Vector2">
</return>
<description>
Returns the width/height occupied in the parent control.
</description>
</method>
<method name="get_parent_control" qualifiers="const">
<return type="Control">
</return>
<description>
Returns the parent control node.
</description>
</method>
<method name="get_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
Returns the position and size of the control relative to the top-left corner of the parent Control. See [member rect_position] and [member rect_size].
</description>
</method>
<method name="get_rotation" qualifiers="const">
<return type="float">
</return>
<description>
Returns the rotation (in radians).
</description>
</method>
<method name="get_stylebox" qualifiers="const">
<return type="StyleBox">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="get_tooltip" qualifiers="const">
<return type="String">
</return>
<argument index="0" name="at_position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
Returns the tooltip, which will appear when the cursor is resting over this control.
</description>
</method>
<method name="grab_click_focus">
<return type="void">
</return>
<description>
</description>
</method>
<method name="grab_focus">
<return type="void">
</return>
<description>
Steal the focus from another control and become the focused control (see [member focus_mode]).
</description>
</method>
<method name="has_color" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="has_color_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
<method name="has_constant" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="has_constant_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
<method name="has_focus" qualifiers="const">
<return type="bool">
</return>
<description>
Returns [code]true[/code] if this is the current focused control. See [member focus_mode].
</description>
</method>
<method name="has_font" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="has_font_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
<method name="has_icon" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="has_icon_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
<method name="has_point" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="point" type="Vector2">
</argument>
<description>
</description>
</method>
2018-01-13 07:58:45 +00:00
<method name="has_shader_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
<method name="has_stylebox" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<argument index="1" name="type" type="String" default="&quot;&quot;">
</argument>
<description>
</description>
</method>
<method name="has_stylebox_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
<method name="minimum_size_changed">
<return type="void">
</return>
<description>
</description>
</method>
<method name="release_focus">
<return type="void">
</return>
<description>
Give up the focus. No other control will be able to receive keyboard input.
</description>
</method>
<method name="set_anchor">
<return type="void">
</return>
<argument index="0" name="margin" type="int" enum="Margin">
</argument>
<argument index="1" name="anchor" type="float">
</argument>
<argument index="2" name="keep_margin" type="bool" default="false">
</argument>
<argument index="3" name="push_opposite_anchor" type="bool" default="true">
</argument>
<description>
</description>
</method>
<method name="set_anchor_and_margin">
<return type="void">
</return>
<argument index="0" name="margin" type="int" enum="Margin">
</argument>
<argument index="1" name="anchor" type="float">
</argument>
<argument index="2" name="offset" type="float">
</argument>
<argument index="3" name="push_opposite_anchor" type="bool" default="false">
</argument>
<description>
</description>
</method>
<method name="set_anchors_and_margins_preset">
<return type="void">
</return>
<argument index="0" name="preset" type="int" enum="Control.LayoutPreset">
</argument>
<argument index="1" name="resize_mode" type="int" enum="Control.LayoutPresetMode" default="0">
</argument>
<argument index="2" name="margin" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="set_anchors_preset">
<return type="void">
</return>
<argument index="0" name="preset" type="int" enum="Control.LayoutPreset">
</argument>
<argument index="1" name="keep_margin" type="bool" default="false">
</argument>
<description>
</description>
</method>
<method name="set_begin">
<return type="void">
</return>
<argument index="0" name="position" type="Vector2">
</argument>
<description>
Sets [member margin_left] and [member margin_top] at the same time.
</description>
</method>
<method name="set_drag_forwarding">
<return type="void">
</return>
<argument index="0" name="target" type="Control">
</argument>
<description>
Forwards the handling of this control's drag and drop to [code]target[/code] control.
Forwarding can be implemented in the target control similar to the methods [method get_drag_data], [method can_drop_data], and [method drop_data] but with two differences:
1. The function name must be suffixed with [b]_fw[/b]
2. The function must take an extra argument that is the control doing the forwarding
[codeblock]
# ThisControl.gd
extends Control
func _ready():
set_drag_forwarding(target_control)
# TargetControl.gd
extends Control
func can_drop_data_fw(position, data, from_control):
return true
func drop_data_fw(position, data, from_control):
my_handle_data(data)
func get_drag_data_fw(position, from_control):
set_drag_preview(my_preview)
return my_data()
[/codeblock]
</description>
</method>
<method name="set_drag_preview">
<return type="void">
</return>
<argument index="0" name="control" type="Control">
</argument>
<description>
Shows the given control at the mouse pointer. A good time to call this method is in [method get_drag_data].
</description>
</method>
<method name="set_end">
<return type="void">
</return>
<argument index="0" name="position" type="Vector2">
</argument>
<description>
Sets [member margin_right] and [member margin_bottom] at the same time.
</description>
</method>
<method name="set_margins_preset">
<return type="void">
</return>
<argument index="0" name="preset" type="int" enum="Control.LayoutPreset">
</argument>
<argument index="1" name="resize_mode" type="int" enum="Control.LayoutPresetMode" default="0">
</argument>
<argument index="2" name="margin" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="set_rotation">
<return type="void">
</return>
<argument index="0" name="radians" type="float">
</argument>
<description>
Sets the rotation (in radians).
</description>
</method>
<method name="show_modal">
<return type="void">
</return>
<argument index="0" name="exclusive" type="bool" default="false">
</argument>
<description>
Displays 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.
</description>
</method>
<method name="warp_mouse">
<return type="void">
</return>
<argument index="0" name="to_position" type="Vector2">
</argument>
<description>
</description>
</method>
</methods>
<members>
<member name="anchor_bottom" type="float" setter="_set_anchor" getter="get_anchor">
2018-12-26 15:20:31 +00:00
Anchors the bottom edge of the node to the origin, the center, or the end of its parent control. It changes how the bottom margin updates when the node moves or changes size. You can use one of the [code]ANCHOR_*[/code] constants for convenience. Default value: [code]ANCHOR_BEGIN[/code].
</member>
<member name="anchor_left" type="float" setter="_set_anchor" getter="get_anchor">
2018-12-26 15:20:31 +00:00
Anchors the left edge of the node to the origin, the center or the end of its parent control. It changes how the left margin updates when the node moves or changes size. You can use one of the [code]ANCHOR_*[/code] constants for convenience.Default value: [code]ANCHOR_BEGIN[/code].
</member>
<member name="anchor_right" type="float" setter="_set_anchor" getter="get_anchor">
2018-12-26 15:20:31 +00:00
Anchors the right edge of the node to the origin, the center or the end of its parent control. It changes how the right margin updates when the node moves or changes size. You can use one of the [code]ANCHOR_*[/code] constants for convenience. Default value: [code]ANCHOR_BEGIN[/code].
</member>
<member name="anchor_top" type="float" setter="_set_anchor" getter="get_anchor">
2018-12-26 15:20:31 +00:00
Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top margin updates when the node moves or changes size. You can use one of the [code]ANCHOR_*[/code] constants for convenience. Default value: [code]ANCHOR_BEGIN[/code].
</member>
2018-01-11 22:38:35 +00:00
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" enum="Control.FocusMode">
The focus access mode for the control (None, Click or All). Only one Control can be focused at the same time, and it will receive keyboard signals.
</member>
<member name="focus_neighbour_bottom" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour">
2018-12-26 15:20:31 +00:00
Tells Godot which node it should give keyboard 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 [code]ui_down[/code] input action. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the bottom of this one.
</member>
<member name="focus_neighbour_left" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour">
2018-12-26 15:20:31 +00:00
Tells Godot which node it should give keyboard 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 [code]ui_left[/code] input action. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the left of this one.
</member>
<member name="focus_neighbour_right" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour">
2018-12-26 15:20:31 +00:00
Tells Godot which node it should give keyboard 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 [code]ui_right[/code] input action. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the bottom of this one.
</member>
<member name="focus_neighbour_top" type="NodePath" setter="set_focus_neighbour" getter="get_focus_neighbour">
2018-12-26 15:20:31 +00:00
Tells Godot which node it should give keyboard 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 [code]ui_top[/code] input action. The node must be a [code]Control[/code]. If this property is not set, Godot will give focus to the closest [code]Control[/code] to the bottom of this one.
</member>
2017-11-24 08:16:27 +00:00
<member name="focus_next" type="NodePath" setter="set_focus_next" getter="get_focus_next">
2018-12-26 15:20:31 +00:00
Tells Godot which node it should give keyboard focus to if the user presses Tab on a keyboard by default. You can change the key by editing the [code]ui_focus_next[/code] input action.
If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
2017-11-24 08:16:27 +00:00
</member>
<member name="focus_previous" type="NodePath" setter="set_focus_previous" getter="get_focus_previous">
2018-12-26 15:20:31 +00:00
Tells Godot which node it should give keyboard focus to if the user presses Shift+Tab on a keyboard by default. You can change the key by editing the [code]ui_focus_prev[/code] input action.
If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
2017-11-24 08:16:27 +00:00
</member>
<member name="grow_horizontal" type="int" setter="set_h_grow_direction" getter="get_h_grow_direction" enum="Control.GrowDirection">
2018-12-26 15:20:31 +00:00
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.
</member>
<member name="grow_vertical" type="int" setter="set_v_grow_direction" getter="get_v_grow_direction" enum="Control.GrowDirection">
2018-12-26 15:20:31 +00:00
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.
</member>
<member name="hint_tooltip" type="String" setter="set_tooltip" getter="_get_tooltip">
Changes the tooltip text. The tooltip appears when the user's mouse cursor stays idle over this control for a few moments, provided that the [member mouse_filter] property is not [constant MOUSE_FILTER_IGNORE].
</member>
<member name="margin_bottom" type="float" setter="set_margin" getter="get_margin">
2018-12-26 15:20:31 +00:00
Distance between the node's bottom edge and its parent control, based on [member anchor_bottom].
Margins 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]. Margins update automatically when you move or resize the node.
</member>
<member name="margin_left" type="float" setter="set_margin" getter="get_margin">
2018-12-26 15:20:31 +00:00
Distance between the node's left edge and its parent control, based on [member anchor_left].
Margins 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]. Margins update automatically when you move or resize the node.
</member>
<member name="margin_right" type="float" setter="set_margin" getter="get_margin">
2018-12-26 15:20:31 +00:00
Distance between the node's right edge and its parent control, based on [member anchor_right].
Margins 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]. Margins update automatically when you move or resize the node.
</member>
<member name="margin_top" type="float" setter="set_margin" getter="get_margin">
2018-12-26 15:20:31 +00:00
Distance between the node's top edge and its parent control, based on [member anchor_top].
Margins 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]. Margins update automatically when you move or resize the node.
</member>
2018-01-11 22:38:35 +00:00
<member name="mouse_default_cursor_shape" type="int" setter="set_default_cursor_shape" getter="get_default_cursor_shape" enum="Control.CursorShape">
The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors.
[b]Note:[/b] On Linux, shapes may vary depending on the cursor theme of the system.
2018-01-11 22:38:35 +00:00
</member>
<member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" enum="Control.MouseFilter">
Controls whether the control will be able to receive mouse button input events through [method _gui_input] and how these events should be handled. Also controls whether the control can receive the [signal mouse_entered], and [signal mouse_exited] signals. See the constants to learn what each does.
</member>
<member name="rect_clip_content" type="bool" setter="set_clip_contents" getter="is_clipping_contents">
2018-12-26 15:20:31 +00:00
Enables whether rendering of 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.
</member>
2018-01-11 22:38:35 +00:00
<member name="rect_global_position" type="Vector2" setter="set_global_position" getter="get_global_position">
The node's global position, relative to the world (usually to the top-left corner of the window).
</member>
<member name="rect_min_size" type="Vector2" setter="set_custom_minimum_size" getter="get_custom_minimum_size">
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, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes.
</member>
<member name="rect_pivot_offset" type="Vector2" setter="set_pivot_offset" getter="get_pivot_offset">
By default, the node's pivot is its top-left corner. When you change its [member rect_scale], it will scale around this pivot. Set this property to [member rect_size] / 2 to center the pivot in the node's rectangle.
</member>
<member name="rect_position" type="Vector2" setter="set_position" getter="get_position">
The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by [member rect_pivot_offset].
</member>
2017-11-10 10:07:52 +00:00
<member name="rect_rotation" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees">
The node's rotation around its pivot, in degrees. See [member rect_pivot_offset] to change the pivot's position.
</member>
<member name="rect_scale" type="Vector2" setter="set_scale" getter="get_scale">
The node's scale, relative to its [member rect_size]. Change this property to scale the node around its [member rect_pivot_offset].
</member>
<member name="rect_size" type="Vector2" setter="set_size" getter="get_size">
The size of the node's bounding rectangle, in pixels. [Container] nodes update this property automatically.
</member>
<member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags">
Tells the parent [Container] nodes how they should resize and place the node on the X axis. Use one of the [code]SIZE_*[/code] constants to change the flags. See the constants to learn what each does.
</member>
<member name="size_flags_stretch_ratio" type="float" setter="set_stretch_ratio" getter="get_stretch_ratio">
If the node and at least one of its neighbours uses the [code]SIZE_EXPAND[/code] 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 neighbour a ratio of 1, this node will take two thirds of the available space.
</member>
<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags">
Tells the parent [Container] nodes how they should resize and place the node on the Y axis. Use one of the [code]SIZE_*[/code] constants to change the flags. See the constants to learn what each does.
</member>
<member name="theme" type="Theme" setter="set_theme" getter="get_theme">
Changing this property replaces the current [Theme] resource this node and all its [code]Control[/code] children use.
</member>
</members>
<signals>
<signal name="focus_entered">
<description>
Emitted when the node gains keyboard focus.
</description>
</signal>
<signal name="focus_exited">
<description>
Emitted when the node loses keyboard focus.
</description>
</signal>
<signal name="gui_input">
2018-09-10 22:18:05 +00:00
<argument index="0" name="event" type="InputEvent">
</argument>
<description>
Emitted when the node receives an [InputEvent].
</description>
</signal>
<signal name="minimum_size_changed">
<description>
Emitted when the node's minimum size changes.
</description>
</signal>
<signal name="modal_closed">
<description>
Emitted when a modal [code]Control[/code] is closed. See [method show_modal].
</description>
</signal>
<signal name="mouse_entered">
<description>
Emitted when the mouse enters the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it.
</description>
</signal>
<signal name="mouse_exited">
<description>
Emitted when the mouse leaves the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it.
</description>
</signal>
<signal name="resized">
<description>
Emitted when the control changes size.
</description>
</signal>
<signal name="size_flags_changed">
<description>
Emitted when one of the size flags changes. See [member size_flags_horizontal] and [member size_flags_vertical].
</description>
</signal>
</signals>
<constants>
2017-11-24 22:16:30 +00:00
<constant name="FOCUS_NONE" value="0" enum="FocusMode">
The node cannot grab focus. Use with [member focus_mode].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="FOCUS_CLICK" value="1" enum="FocusMode">
The node can only grab focus on mouse clicks. Use with [member focus_mode].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="FOCUS_ALL" value="2" enum="FocusMode">
The node can grab focus on mouse click or using the arrows and the Tab keys on the keyboard. Use with [member focus_mode].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="NOTIFICATION_RESIZED" value="40">
Sent when the node changes size. Use [member rect_size] to get the new size.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="NOTIFICATION_MOUSE_ENTER" value="41">
Sent when the mouse pointer enters the node.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="NOTIFICATION_MOUSE_EXIT" value="42">
Sent when the mouse pointer exits the node.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="NOTIFICATION_FOCUS_ENTER" value="43">
Sent when the node grabs focus.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="NOTIFICATION_FOCUS_EXIT" value="44">
Sent when the node loses focus.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="NOTIFICATION_THEME_CHANGED" value="45">
Sent when the node's [member theme] changes, right before Godot redraws the control. Happens when you call one of the [code]add_*_override[/code] methods.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="NOTIFICATION_MODAL_CLOSE" value="46">
Sent when an open modal dialog closes. See [method show_modal].
</constant>
2018-04-10 08:12:42 +00:00
<constant name="NOTIFICATION_SCROLL_BEGIN" value="47">
2018-12-26 15:20:31 +00:00
Sent when this node is inside a [ScrollContainer] which has begun being scrolled.
2018-04-10 08:12:42 +00:00
</constant>
<constant name="NOTIFICATION_SCROLL_END" value="48">
2018-12-26 15:20:31 +00:00
Sent when this node is inside a [ScrollContainer] which has stopped being scrolled.
2018-04-10 08:12:42 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_ARROW" value="0" enum="CursorShape">
Show the system's arrow mouse cursor when the user hovers the node. Use with [member mouse_default_cursor_shape].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_IBEAM" value="1" enum="CursorShape">
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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_POINTING_HAND" value="2" enum="CursorShape">
Show the system's pointing hand mouse cursor when the user hovers the node.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_CROSS" value="3" enum="CursorShape">
Show the system's cross mouse cursor when the user hovers the node.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_WAIT" value="4" enum="CursorShape">
Show the system's wait mouse cursor, often an hourglass, when the user hovers the node.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_BUSY" value="5" enum="CursorShape">
Show the system's busy mouse cursor when the user hovers the node. Often an hourglass.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_DRAG" value="6" enum="CursorShape">
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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_CAN_DROP" value="7" enum="CursorShape">
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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_FORBIDDEN" value="8" enum="CursorShape">
Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_VSIZE" value="9" enum="CursorShape">
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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_HSIZE" value="10" enum="CursorShape">
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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_BDIAGSIZE" value="11" enum="CursorShape">
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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_FDIAGSIZE" value="12" enum="CursorShape">
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 [code]CURSOR_BDIAGSIZE[/code]. It tells the user they can resize the window or the panel both horizontally and vertically.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_MOVE" value="13" enum="CursorShape">
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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_VSPLIT" value="14" enum="CursorShape">
Show the system's vertical split mouse cursor when the user hovers the node. On Windows, it's the same as [code]CURSOR_VSIZE[/code].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_HSPLIT" value="15" enum="CursorShape">
Show the system's horizontal split mouse cursor when the user hovers the node. On Windows, it's the same as [code]CURSOR_HSIZE[/code].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="CURSOR_HELP" value="16" enum="CursorShape">
Show the system's help mouse cursor when the user hovers the node, a question mark.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_TOP_LEFT" value="0" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the top-left of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_TOP_RIGHT" value="1" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the top-right of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_BOTTOM_LEFT" value="2" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the bottom-left of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_BOTTOM_RIGHT" value="3" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the bottom-right of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_CENTER_LEFT" value="4" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the center of the left edge of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_CENTER_TOP" value="5" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the center of the top edge of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_CENTER_RIGHT" value="6" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the center of the right edge of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_CENTER_BOTTOM" value="7" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the center of the bottom edge of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_CENTER" value="8" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the center of the parent control's bounds. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_LEFT_WIDE" value="9" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the left edge of the parent control. The left margin becomes relative to the left edge and the top margin relative to the top left corner of the node's parent. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_TOP_WIDE" value="10" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the top edge of the parent control. The left margin becomes relative to the top left corner, the top margin relative to the top edge, and the right margin relative to the top right corner of the node's parent. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_RIGHT_WIDE" value="11" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the right edge of the parent control. The right margin becomes relative to the right edge and the top margin relative to the top right corner of the node's parent. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_BOTTOM_WIDE" value="12" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the bottom edge of the parent control. The left margin becomes relative to the bottom left corner, the bottom margin relative to the bottom edge, and the right margin relative to the bottom right corner of the node's parent. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_VCENTER_WIDE" value="13" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to a vertical line that cuts the parent control in half. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_HCENTER_WIDE" value="14" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to a horizontal line that cuts the parent control in half. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_WIDE" value="15" enum="LayoutPreset">
2018-12-26 15:20:31 +00:00
Snap all 4 anchors to the respective corners of the parent control. Set all 4 margins to 0 after you applied this preset and the [code]Control[/code] will fit its parent control. This is equivalent to to the "Full Rect" layout option in the editor. Use with [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_MODE_MINSIZE" value="0" enum="LayoutPresetMode">
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_MODE_KEEP_WIDTH" value="1" enum="LayoutPresetMode">
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_MODE_KEEP_HEIGHT" value="2" enum="LayoutPresetMode">
</constant>
2017-11-24 22:16:30 +00:00
<constant name="PRESET_MODE_KEEP_SIZE" value="3" enum="LayoutPresetMode">
</constant>
2017-11-24 22:16:30 +00:00
<constant name="SIZE_FILL" value="1" enum="SizeFlags">
Tells the parent [Container] to expand the bounds of this node to fill all the available space without pushing any other node. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="SIZE_EXPAND" value="2" enum="SizeFlags">
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 [member size_flags_stretch_ratio]. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="SIZE_EXPAND_FILL" value="3" enum="SizeFlags">
Sets the node's size flags to both fill and expand. See the 2 constants above for more information.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="SIZE_SHRINK_CENTER" value="4" enum="SizeFlags">
Tells the parent [Container] to center the node in itself. It centers the control based on its bounding box, so it doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="SIZE_SHRINK_END" value="8" enum="SizeFlags">
Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="MOUSE_FILTER_STOP" value="0" enum="MouseFilter">
The control will receive mouse button input events through [method _gui_input] if clicked on. And the control will receive the [signal mouse_entered] and [signal mouse_exited] 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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="MOUSE_FILTER_PASS" value="1" enum="MouseFilter">
The control will receive mouse button input events through [method _gui_input] if clicked on. And the control will receive the [signal mouse_entered] and [signal mouse_exited] signals. If this control does not handle the event, the parent control (if any) will be considered, and so on until there is no more parent control to potentially handle it. This also allows signals to fire in other controls. Even if no control handled it at all, the event will still be handled automatically, so unhandled input will not be fired.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="MOUSE_FILTER_IGNORE" value="2" enum="MouseFilter">
The control will not receive mouse button input events through [method _gui_input]. Also the control will not receive the [signal mouse_entered] nor [signal mouse_exited] signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="GROW_DIRECTION_BEGIN" value="0" enum="GrowDirection">
2018-12-26 15:20:31 +00:00
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.
</constant>
2017-11-24 22:16:30 +00:00
<constant name="GROW_DIRECTION_END" value="1" enum="GrowDirection">
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.
</constant>
2018-04-10 08:12:42 +00:00
<constant name="GROW_DIRECTION_BOTH" value="2" enum="GrowDirection">
The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.
2018-04-10 08:12:42 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name="ANCHOR_BEGIN" value="0" enum="Anchor">
Snaps one of the 4 anchor's sides to the origin of the node's [code]Rect[/code], in the top left. Use it with one of the [code]anchor_*[/code] member variables, like [member anchor_left]. To change all 4 anchors at once, use [method set_anchors_preset].
</constant>
2017-11-24 22:16:30 +00:00
<constant name="ANCHOR_END" value="1" enum="Anchor">
Snaps one of the 4 anchor's sides to the end of the node's [code]Rect[/code], in the bottom right. Use it with one of the [code]anchor_*[/code] member variables, like [member anchor_left]. To change all 4 anchors at once, use [method set_anchors_preset].
</constant>
</constants>
</class>