summaryrefslogtreecommitdiff
path: root/doc/classes/Control.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Control.xml')
-rw-r--r--doc/classes/Control.xml46
1 files changed, 37 insertions, 9 deletions
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 6a99d119fc..fea706987c 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -4,7 +4,7 @@
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. [Control] 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.
+ Base class for all User Interface or [i]UI[/i] related nodes. [Control] features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, 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 [Control] 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.
@@ -16,8 +16,6 @@
<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>
<method name="_clips_input" qualifiers="virtual">
<return type="bool">
@@ -223,7 +221,7 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
- 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].
+ 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 [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
@@ -514,7 +512,7 @@
</return>
<argument index="0" name="preset" type="int" enum="Control.LayoutPreset">
</argument>
- <argument index="1" name="keep_margin" type="bool" default="false">
+ <argument index="1" name="keep_margins" type="bool" default="false">
</argument>
<description>
</description>
@@ -576,6 +574,16 @@
Sets [member margin_right] and [member margin_bottom] at the same time.
</description>
</method>
+ <method name="set_global_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="Vector2">
+ </argument>
+ <argument index="1" name="keep_margins" type="bool" default="false">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_margins_preset">
<return type="void">
</return>
@@ -588,6 +596,16 @@
<description>
</description>
</method>
+ <method name="set_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="Vector2">
+ </argument>
+ <argument index="1" name="keep_margins" type="bool" default="false">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_rotation">
<return type="void">
</return>
@@ -597,6 +615,16 @@
Sets the rotation (in radians).
</description>
</method>
+ <method name="set_size">
+ <return type="void">
+ </return>
+ <argument index="0" name="size" type="Vector2">
+ </argument>
+ <argument index="1" name="keep_margins" type="bool" default="false">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="show_modal">
<return type="void">
</return>
@@ -684,9 +712,9 @@
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">
- 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.
+ Enables whether rendering of children should be clipped to this control's rectangle. If [code]true[/code], parts of a child which would be visibly outside of this control's rectangle will not be rendered.
</member>
- <member name="rect_global_position" type="Vector2" setter="set_global_position" getter="get_global_position">
+ <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">
@@ -695,7 +723,7 @@
<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">
+ <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>
<member name="rect_rotation" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees">
@@ -704,7 +732,7 @@
<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">
+ <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">