Debian Codegraph @

doc/classes/Control.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="Control" inherits="CanvasItem" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Base class for all GUI controls. Adapts its position and size based on its parent control.
5 </brief_description>
6 <description>
7 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.
8 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.
9 [b]Note:[/b] Since both [Node2D] and [Control] inherit from [CanvasItem], they share several concepts from the class such as the [member CanvasItem.z_index] and [member CanvasItem.visible] properties.
10 [b]User Interface nodes and input[/b]
11 Godot propagates input events via viewports. Each [Viewport] is responsible for propagating [InputEvent]s to their child nodes. As the [member SceneTree.root] is a [Window], this already happens automatically for all UI elements in your game.
12 Input events are propagated through the [SceneTree] from the root node to all child nodes by calling [method Node._input]. For UI elements specifically, it makes more sense to override the virtual method [method _gui_input], which filters out unrelated input events, such as by checking z-order, [member mouse_filter], focus, or if the event was inside of the control's bounding box.
13 Call [method accept_event] so no other node receives the event. Once you accept an input, it becomes handled so [method Node._unhandled_input] will not process it.
14 Only one [Control] node can be in focus. Only the node in focus will receive events. To get the focus, call [method grab_focus]. [Control] nodes lose focus when another node grabs it, or if you hide the node in focus. Focus will not be represented visually if gained via mouse/touch input, only appearing with keyboard/gamepad input (for accessibility), or via [method grab_focus].
15 Set [member mouse_filter] to [constant MOUSE_FILTER_IGNORE] 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.
16 [Theme] resources change the control's appearance. The [member 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 [code]add_theme_*_override[/code] methods, like [method add_theme_font_override]. You can also override theme items in the Inspector.
17 [b]Note:[/b] Theme items are [i]not[/i] [Object] properties. This means you can't access their values using [method Object.get] and [method Object.set]. Instead, use the [code]get_theme_*[/code] and [code]add_theme_*_override[/code] methods provided by this class.
18 </description>
19 <tutorials>
20 <link title="GUI documentation index">$DOCS_URL/tutorials/ui/index.html</link>
21 <link title="Custom drawing in 2D">$DOCS_URL/tutorials/2d/custom_drawing_in_2d.html</link>
22 <link title="Control node gallery">$DOCS_URL/tutorials/ui/control_node_gallery.html</link>
23 <link title="Multiple resolutions">$DOCS_URL/tutorials/rendering/multiple_resolutions.html</link>
24 <link title="All GUI Demos">https://github.com/godotengine/godot-demo-projects/tree/master/gui</link>
25 </tutorials>
26 <methods>
27 <method name="_accessibility_get_contextual_info" qualifiers="virtual const">
28 <return type="String" />
29 <description>
30 Return the description of the keyboard shortcuts and other contextual help for this control.
31 </description>
32 </method>
33 <method name="_can_drop_data" qualifiers="virtual const">
34 <return type="bool" />
35 <param index="0" name="at_position" type="Vector2" />
36 <param index="1" name="data" type="Variant" />
37 <description>
38 Godot calls this method to test if [param data] from a control's [method _get_drag_data] can be dropped at [param at_position]. [param at_position] is local to this control.
39 This method should only be used to test the data. Process the data in [method _drop_data].
40 [b]Note:[/b] If the drag was initiated by a keyboard shortcut or [method accessibility_drag], [param at_position] is set to [constant Vector2.INF], and the currently selected item/text position should be used as the drop position.
41 [codeblocks]
42 [gdscript]
43 func _can_drop_data(position, data):
44 # Check position if it is relevant to you
45 # Otherwise, just check data
46 return typeof(data) == TYPE_DICTIONARY and data.has("expected")
47 [/gdscript]
48 [csharp]
49 public override bool _CanDropData(Vector2 atPosition, Variant data)
50 {
51 // Check position if it is relevant to you
52 // Otherwise, just check data
53 return data.VariantType == Variant.Type.Dictionary &amp;&amp; data.AsGodotDictionary().ContainsKey("expected");
54 }
55 [/csharp]
56 [/codeblocks]
57 </description>
58 </method>
59 <method name="_drop_data" qualifiers="virtual">
60 <return type="void" />
61 <param index="0" name="at_position" type="Vector2" />
62 <param index="1" name="data" type="Variant" />
63 <description>
64 Godot calls this method to pass you the [param data] from a control's [method _get_drag_data] result. Godot first calls [method _can_drop_data] to test if [param data] is allowed to drop at [param at_position] where [param at_position] is local to this control.
65 [b]Note:[/b] If the drag was initiated by a keyboard shortcut or [method accessibility_drag], [param at_position] is set to [constant Vector2.INF], and the currently selected item/text position should be used as the drop position.
66 [codeblocks]
67 [gdscript]
68 func _can_drop_data(position, data):
69 return typeof(data) == TYPE_DICTIONARY and data.has("color")
70
71 func _drop_data(position, data):
72 var color = data["color"]
73 [/gdscript]
74 [csharp]
75 public override bool _CanDropData(Vector2 atPosition, Variant data)
76 {
77 return data.VariantType == Variant.Type.Dictionary &amp;&amp; data.AsGodotDictionary().ContainsKey("color");
78 }
79
80 public override void _DropData(Vector2 atPosition, Variant data)
81 {
82 Color color = data.AsGodotDictionary()["color"].AsColor();
83 }
84 [/csharp]
85 [/codeblocks]
86 </description>
87 </method>
88 <method name="_get_accessibility_container_name" qualifiers="virtual const">
89 <return type="String" />
90 <param index="0" name="node" type="Node" />
91 <description>
92 Override this method to return a human-readable description of the position of the child [param node] in the custom container, added to the [member accessibility_name].
93 </description>
94 </method>
95 <method name="_get_drag_data" qualifiers="virtual">
96 <return type="Variant" />
97 <param index="0" name="at_position" type="Vector2" />
98 <description>
99 Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns [code]null[/code] if there is no data to drag. Controls that want to receive drop data should implement [method _can_drop_data] and [method _drop_data]. [param at_position] is local to this control. Drag may be forced with [method force_drag].
100 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.
101 [b]Note:[/b] If the drag was initiated by a keyboard shortcut or [method accessibility_drag], [param at_position] is set to [constant Vector2.INF], and the currently selected item/text position should be used as the drag position.
102 [codeblocks]
103 [gdscript]
104 func _get_drag_data(position):
105 var mydata = make_data() # This is your custom method generating the drag data.
106 set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data.
107 return mydata
108 [/gdscript]
109 [csharp]
110 public override Variant _GetDragData(Vector2 atPosition)
111 {
112 var myData = MakeData(); // This is your custom method generating the drag data.
113 SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data.
114 return myData;
115 }
116 [/csharp]
117 [/codeblocks]
118 </description>
119 </method>
120 <method name="_get_minimum_size" qualifiers="virtual const">
121 <return type="Vector2" />
122 <description>
123 Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to [member custom_minimum_size] for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately).
124 If not overridden, defaults to [constant Vector2.ZERO].
125 [b]Note:[/b] 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.
126 </description>
127 </method>
128 <method name="_get_tooltip" qualifiers="virtual const">
129 <return type="String" />
130 <param index="0" name="at_position" type="Vector2" />
131 <description>
132 Virtual method to be implemented by the user. Returns the tooltip text for the position [param at_position] in control's local coordinates, which will typically appear when the cursor is resting over this control. See [method get_tooltip].
133 [b]Note:[/b] If this method returns an empty [String] and [method _make_custom_tooltip] is not overridden, no tooltip is displayed.
134 </description>
135 </method>
136 <method name="_gui_input" qualifiers="virtual">
137 <return type="void" />
138 <param index="0" name="event" type="InputEvent" />
139 <description>
140 Virtual method to be implemented by the user. Override this method to handle and accept inputs on UI elements. See also [method accept_event].
141 [b]Example:[/b] Click on the control to print a message:
142 [codeblocks]
143 [gdscript]
144 func _gui_input(event):
145 if event is InputEventMouseButton:
146 if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
147 print("I've been clicked D:")
148 [/gdscript]
149 [csharp]
150 public override void _GuiInput(InputEvent @event)
151 {
152 if (@event is InputEventMouseButton mb)
153 {
154 if (mb.ButtonIndex == MouseButton.Left &amp;&amp; mb.Pressed)
155 {
156 GD.Print("I've been clicked D:");
157 }
158 }
159 }
160 [/csharp]
161 [/codeblocks]
162 If the [param event] inherits [InputEventMouse], this method will [b]not[/b] be called when:
163 - the control's [member mouse_filter] is set to [constant MOUSE_FILTER_IGNORE];
164 - the control is obstructed by another control on top, that doesn't have [member mouse_filter] set to [constant MOUSE_FILTER_IGNORE];
165 - the control's parent has [member mouse_filter] set to [constant MOUSE_FILTER_STOP] or has accepted the event;
166 - the control's parent has [member clip_contents] enabled and the [param event]'s position is outside the parent's rectangle;
167 - the [param event]'s position is outside the control (see [method _has_point]).
168 [b]Note:[/b] The [param event]'s position is relative to this control's origin.
169 </description>
170 </method>
171 <method name="_has_point" qualifiers="virtual const">
172 <return type="bool" />
173 <param index="0" name="point" type="Vector2" />
174 <description>
175 Virtual method to be implemented by the user. Returns whether the given [param point] is inside this control.
176 If not overridden, default behavior is checking if the point is within control's Rect.
177 [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]Rect2(Vector2.ZERO, size).has_point(point)[/code].
178 </description>
179 </method>
180 <method name="_make_custom_tooltip" qualifiers="virtual const">
181 <return type="Object" />
182 <param index="0" name="for_text" type="String" />
183 <description>
184 Virtual method to be implemented by the user. Returns a [Control] node that should be used as a tooltip instead of the default one. [param for_text] is the return value of [method get_tooltip].
185 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 [code]null[/code] or a non-Control node is returned, the default tooltip will be used instead.
186 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 [method Theme.set_stylebox] for the type [code]"TooltipPanel"[/code] (see [member tooltip_text] for an example).
187 [b]Note:[/b] The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its [member custom_minimum_size] to some non-zero value.
188 [b]Note:[/b] The node (and any relevant children) should have their [member CanvasItem.visible] set to [code]true[/code] when returned, otherwise, the viewport that instantiates it will not be able to calculate its minimum size reliably.
189 [b]Note:[/b] If overridden, this method is called even if [method get_tooltip] returns an empty string. When this happens with the default tooltip, it is not displayed. To copy this behavior, return [code]null[/code] in this method when [param for_text] is empty.
190 [b]Example:[/b] Use a constructed node as a tooltip:
191 [codeblocks]
192 [gdscript]
193 func _make_custom_tooltip(for_text):
194 var label = Label.new()
195 label.text = for_text
196 return label
197 [/gdscript]
198 [csharp]
199 public override Control _MakeCustomTooltip(string forText)
200 {
201 var label = new Label();
202 label.Text = forText;
203 return label;
204 }
205 [/csharp]
206 [/codeblocks]
207 [b]Example:[/b] Use a scene instance as a tooltip:
208 [codeblocks]
209 [gdscript]
210 func _make_custom_tooltip(for_text):
211 var tooltip = preload("res://some_tooltip_scene.tscn").instantiate()
212 tooltip.get_node("Label").text = for_text
213 return tooltip
214 [/gdscript]
215 [csharp]
216 public override Control _MakeCustomTooltip(string forText)
217 {
218 Node tooltip = ResourceLoader.Load&lt;PackedScene&gt;("res://some_tooltip_scene.tscn").Instantiate();
219 tooltip.GetNode&lt;Label&gt;("Label").Text = forText;
220 return tooltip;
221 }
222 [/csharp]
223 [/codeblocks]
224 </description>
225 </method>
226 <method name="_structured_text_parser" qualifiers="virtual const">
227 <return type="Vector3i[]" />
228 <param index="0" name="args" type="Array" />
229 <param index="1" name="text" type="String" />
230 <description>
231 User defined BiDi algorithm override function.
232 Returns an [Array] of [Vector3i] text ranges and text base directions, in the left-to-right order. Ranges should cover full source [param text] without overlaps. BiDi algorithm will be used on each range separately.
233 </description>
234 </method>
235 <method name="accept_event">
236 <return type="void" />
237 <description>
238 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].
239 [b]Note:[/b] This does not affect the methods in [Input], only the way events are propagated.
240 </description>
241 </method>
242 <method name="accessibility_drag">
243 <return type="void" />
244 <description>
245 Starts drag-and-drop operation without using a mouse.
246 </description>
247 </method>
248 <method name="accessibility_drop">
249 <return type="void" />
250 <description>
251 Ends drag-and-drop operation without using a mouse.
252 </description>
253 </method>
254 <method name="add_theme_color_override">
255 <return type="void" />
256 <param index="0" name="name" type="StringName" />
257 <param index="1" name="color" type="Color" />
258 <description>
259 Creates a local override for a theme [Color] with the specified [param name]. Local overrides always take precedence when fetching theme items for the control. An override can be removed with [method remove_theme_color_override].
260 See also [method get_theme_color].
261 [b]Example:[/b] Override a [Label]'s color and reset it later:
262 [codeblocks]
263 [gdscript]
264 # Given the child Label node "MyLabel", override its font color with a custom value.
265 $MyLabel.add_theme_color_override("font_color", Color(1, 0.5, 0))
266 # Reset the font color of the child label.
267 $MyLabel.remove_theme_color_override("font_color")
268 # Alternatively it can be overridden with the default value from the Label type.
269 $MyLabel.add_theme_color_override("font_color", get_theme_color("font_color", "Label"))
270 [/gdscript]
271 [csharp]
272 // Given the child Label node "MyLabel", override its font color with a custom value.
273 GetNode&lt;Label&gt;("MyLabel").AddThemeColorOverride("font_color", new Color(1, 0.5f, 0));
274 // Reset the font color of the child label.
275 GetNode&lt;Label&gt;("MyLabel").RemoveThemeColorOverride("font_color");
276 // Alternatively it can be overridden with the default value from the Label type.
277 GetNode&lt;Label&gt;("MyLabel").AddThemeColorOverride("font_color", GetThemeColor("font_color", "Label"));
278 [/csharp]
279 [/codeblocks]
280 </description>
281 </method>
282 <method name="add_theme_constant_override">
283 <return type="void" />
284 <param index="0" name="name" type="StringName" />
285 <param index="1" name="constant" type="int" />
286 <description>
287 Creates a local override for a theme constant with the specified [param name]. Local overrides always take precedence when fetching theme items for the control. An override can be removed with [method remove_theme_constant_override].
288 See also [method get_theme_constant].
289 </description>
290 </method>
291 <method name="add_theme_font_override">
292 <return type="void" />
293 <param index="0" name="name" type="StringName" />
294 <param index="1" name="font" type="Font" />
295 <description>
296 Creates a local override for a theme [Font] with the specified [param name]. Local overrides always take precedence when fetching theme items for the control. An override can be removed with [method remove_theme_font_override].
297 See also [method get_theme_font].
298 </description>
299 </method>
300 <method name="add_theme_font_size_override">
301 <return type="void" />
302 <param index="0" name="name" type="StringName" />
303 <param index="1" name="font_size" type="int" />
304 <description>
305 Creates a local override for a theme font size with the specified [param name]. Local overrides always take precedence when fetching theme items for the control. An override can be removed with [method remove_theme_font_size_override].
306 See also [method get_theme_font_size].
307 </description>
308 </method>
309 <method name="add_theme_icon_override">
310 <return type="void" />
311 <param index="0" name="name" type="StringName" />
312 <param index="1" name="texture" type="Texture2D" />
313 <description>
314 Creates a local override for a theme icon with the specified [param name]. Local overrides always take precedence when fetching theme items for the control. An override can be removed with [method remove_theme_icon_override].
315 See also [method get_theme_icon].
316 </description>
317 </method>
318 <method name="add_theme_stylebox_override">
319 <return type="void" />
320 <param index="0" name="name" type="StringName" />
321 <param index="1" name="stylebox" type="StyleBox" />
322 <description>
323 Creates a local override for a theme [StyleBox] with the specified [param name]. Local overrides always take precedence when fetching theme items for the control. An override can be removed with [method remove_theme_stylebox_override].
324 See also [method get_theme_stylebox].
325 [b]Example:[/b] Modify a property in a [StyleBox] by duplicating it:
326 [codeblocks]
327 [gdscript]
328 # The snippet below assumes the child node "MyButton" has a StyleBoxFlat assigned.
329 # Resources are shared across instances, so we need to duplicate it
330 # to avoid modifying the appearance of all other buttons.
331 var new_stylebox_normal = $MyButton.get_theme_stylebox("normal").duplicate()
332 new_stylebox_normal.border_width_top = 3
333 new_stylebox_normal.border_color = Color(0, 1, 0.5)
334 $MyButton.add_theme_stylebox_override("normal", new_stylebox_normal)
335 # Remove the stylebox override.
336 $MyButton.remove_theme_stylebox_override("normal")
337 [/gdscript]
338 [csharp]
339 // The snippet below assumes the child node "MyButton" has a StyleBoxFlat assigned.
340 // Resources are shared across instances, so we need to duplicate it
341 // to avoid modifying the appearance of all other buttons.
342 StyleBoxFlat newStyleboxNormal = GetNode&lt;Button&gt;("MyButton").GetThemeStylebox("normal").Duplicate() as StyleBoxFlat;
343 newStyleboxNormal.BorderWidthTop = 3;
344 newStyleboxNormal.BorderColor = new Color(0, 1, 0.5f);
345 GetNode&lt;Button&gt;("MyButton").AddThemeStyleboxOverride("normal", newStyleboxNormal);
346 // Remove the stylebox override.
347 GetNode&lt;Button&gt;("MyButton").RemoveThemeStyleboxOverride("normal");
348 [/csharp]
349 [/codeblocks]
350 </description>
351 </method>
352 <method name="begin_bulk_theme_override">
353 <return type="void" />
354 <description>
355 Prevents [code]*_theme_*_override[/code] methods from emitting [constant NOTIFICATION_THEME_CHANGED] until [method end_bulk_theme_override] is called.
356 </description>
357 </method>
358 <method name="end_bulk_theme_override">
359 <return type="void" />
360 <description>
361 Ends a bulk theme override update. See [method begin_bulk_theme_override].
362 </description>
363 </method>
364 <method name="find_next_valid_focus" qualifiers="const">
365 <return type="Control" />
366 <description>
367 Finds the next (below in the tree) [Control] that can receive the focus.
368 </description>
369 </method>
370 <method name="find_prev_valid_focus" qualifiers="const">
371 <return type="Control" />
372 <description>
373 Finds the previous (above in the tree) [Control] that can receive the focus.
374 </description>
375 </method>
376 <method name="find_valid_focus_neighbor" qualifiers="const">
377 <return type="Control" />
378 <param index="0" name="side" type="int" enum="Side" />
379 <description>
380 Finds the next [Control] that can receive the focus on the specified [enum Side].
381 [b]Note:[/b] This is different from [method get_focus_neighbor], which returns the path of a specified focus neighbor.
382 </description>
383 </method>
384 <method name="force_drag">
385 <return type="void" />
386 <param index="0" name="data" type="Variant" />
387 <param index="1" name="preview" type="Control" />
388 <description>
389 Forces drag and bypasses [method _get_drag_data] and [method set_drag_preview] by passing [param data] and [param preview]. Drag will start even if the mouse is neither over nor pressed on this control.
390 The methods [method _can_drop_data] and [method _drop_data] must be implemented on controls that want to receive drop data.
391 </description>
392 </method>
393 <method name="get_anchor" qualifiers="const">
394 <return type="float" />
395 <param index="0" name="side" type="int" enum="Side" />
396 <description>
397 Returns the anchor for the specified [enum Side]. A getter method for [member anchor_bottom], [member anchor_left], [member anchor_right] and [member anchor_top].
398 </description>
399 </method>
400 <method name="get_begin" qualifiers="const">
401 <return type="Vector2" />
402 <description>
403 Returns [member offset_left] and [member offset_top]. See also [member position].
404 </description>
405 </method>
406 <method name="get_combined_minimum_size" qualifiers="const">
407 <return type="Vector2" />
408 <description>
409 Returns combined minimum size from [member custom_minimum_size] and [method get_minimum_size].
410 </description>
411 </method>
412 <method name="get_combined_pivot_offset" qualifiers="const">
413 <return type="Vector2" />
414 <description>
415 Returns the combined value of [member pivot_offset] and [member pivot_offset_ratio], in pixels. The ratio is multiplied by the control's size.
416 </description>
417 </method>
418 <method name="get_cursor_shape" qualifiers="const">
419 <return type="int" enum="Control.CursorShape" />
420 <param index="0" name="position" type="Vector2" default="Vector2(0, 0)" />
421 <description>
422 Returns the mouse cursor shape for this control when hovered over [param position] in local coordinates. For most controls, this is the same as [member mouse_default_cursor_shape], but some built-in controls implement more complex logic.
423 </description>
424 </method>
425 <method name="get_end" qualifiers="const">
426 <return type="Vector2" />
427 <description>
428 Returns [member offset_right] and [member offset_bottom].
429 </description>
430 </method>
431 <method name="get_focus_mode_with_override" qualifiers="const">
432 <return type="int" enum="Control.FocusMode" />
433 <description>
434 Returns the [member focus_mode], but takes the [member focus_behavior_recursive] into account. If [member focus_behavior_recursive] is set to [constant FOCUS_BEHAVIOR_DISABLED], or it is set to [constant FOCUS_BEHAVIOR_INHERITED] and its ancestor is set to [constant FOCUS_BEHAVIOR_DISABLED], then this returns [constant FOCUS_NONE].
435 </description>
436 </method>
437 <method name="get_focus_neighbor" qualifiers="const">
438 <return type="NodePath" />
439 <param index="0" name="side" type="int" enum="Side" />
440 <description>
441 Returns the focus neighbor for the specified [enum Side]. A getter method for [member focus_neighbor_bottom], [member focus_neighbor_left], [member focus_neighbor_right] and [member focus_neighbor_top].
442 [b]Note:[/b] To find the next [Control] on the specific [enum Side], even if a neighbor is not assigned, use [method find_valid_focus_neighbor].
443 </description>
444 </method>
445 <method name="get_global_rect" qualifiers="const">
446 <return type="Rect2" />
447 <description>
448 Returns the position and size of the control relative to the containing canvas. See [member global_position] and [member size].
449 [b]Note:[/b] 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.
450 [b]Note:[/b] Setting [member Viewport.gui_snap_controls_to_pixels] to [code]true[/code] can lead to rounding inaccuracies between the displayed control and the returned [Rect2].
451 </description>
452 </method>
453 <method name="get_minimum_size" qualifiers="const">
454 <return type="Vector2" />
455 <description>
456 Returns the minimum size for this control. See [member custom_minimum_size].
457 </description>
458 </method>
459 <method name="get_mouse_filter_with_override" qualifiers="const">
460 <return type="int" enum="Control.MouseFilter" />
461 <description>
462 Returns the [member mouse_filter], but takes the [member mouse_behavior_recursive] into account. If [member mouse_behavior_recursive] is set to [constant MOUSE_BEHAVIOR_DISABLED], or it is set to [constant MOUSE_BEHAVIOR_INHERITED] and its ancestor is set to [constant MOUSE_BEHAVIOR_DISABLED], then this returns [constant MOUSE_FILTER_IGNORE].
463 </description>
464 </method>
465 <method name="get_offset" qualifiers="const">
466 <return type="float" />
467 <param index="0" name="offset" type="int" enum="Side" />
468 <description>
469 Returns the offset for the specified [enum Side]. A getter method for [member offset_bottom], [member offset_left], [member offset_right] and [member offset_top].
470 </description>
471 </method>
472 <method name="get_parent_area_size" qualifiers="const">
473 <return type="Vector2" />
474 <description>
475 Returns the width/height occupied in the parent control.
476 </description>
477 </method>
478 <method name="get_parent_control" qualifiers="const">
479 <return type="Control" />
480 <description>
481 Returns the parent control node.
482 </description>
483 </method>
484 <method name="get_rect" qualifiers="const">
485 <return type="Rect2" />
486 <description>
487 Returns the position and size of the control in the coordinate system of the containing node. See [member position], [member scale] and [member size].
488 [b]Note:[/b] If [member rotation] is not the default rotation, the resulting size is not meaningful.
489 [b]Note:[/b] Setting [member Viewport.gui_snap_controls_to_pixels] to [code]true[/code] can lead to rounding inaccuracies between the displayed control and the returned [Rect2].
490 </description>
491 </method>
492 <method name="get_screen_position" qualifiers="const">
493 <return type="Vector2" />
494 <description>
495 Returns the position of this [Control] in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.
496 Equivalent to [code]get_screen_transform().origin[/code] (see [method CanvasItem.get_screen_transform]).
497 [b]Example:[/b] Show a popup at the mouse position:
498 [codeblock]
499 popup_menu.position = get_screen_position() + get_screen_transform().basis_xform(get_local_mouse_position())
500
501 # The above code is equivalent to:
502 popup_menu.position = get_screen_transform() * get_local_mouse_position()
503
504 popup_menu.reset_size()
505 popup_menu.popup()
506 [/codeblock]
507 </description>
508 </method>
509 <method name="get_theme_color" qualifiers="const">
510 <return type="Color" />
511 <param index="0" name="name" type="StringName" />
512 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
513 <description>
514 Returns a [Color] from the first matching [Theme] in the tree if that [Theme] has a color item with the specified [param name] and [param theme_type]. If [param theme_type] is omitted the class name of the current control is used as the type, or [member theme_type_variation] 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.
515 For the current control its local overrides are considered first (see [method add_theme_color_override]), then its assigned [member theme]. After the current control, each parent control and its assigned [member theme] are considered; controls without a [member theme] assigned are skipped. If no matching [Theme] is found in the tree, the custom project [Theme] (see [member ProjectSettings.gui/theme/custom]) and the default [Theme] are used (see [ThemeDB]).
516 [codeblocks]
517 [gdscript]
518 func _ready():
519 # Get the font color defined for the current Control's class, if it exists.
520 modulate = get_theme_color("font_color")
521 # Get the font color defined for the Button class.
522 modulate = get_theme_color("font_color", "Button")
523 [/gdscript]
524 [csharp]
525 public override void _Ready()
526 {
527 // Get the font color defined for the current Control's class, if it exists.
528 Modulate = GetThemeColor("font_color");
529 // Get the font color defined for the Button class.
530 Modulate = GetThemeColor("font_color", "Button");
531 }
532 [/csharp]
533 [/codeblocks]
534 </description>
535 </method>
536 <method name="get_theme_constant" qualifiers="const">
537 <return type="int" />
538 <param index="0" name="name" type="StringName" />
539 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
540 <description>
541 Returns a constant from the first matching [Theme] in the tree if that [Theme] has a constant item with the specified [param name] and [param theme_type].
542 See [method get_theme_color] for details.
543 </description>
544 </method>
545 <method name="get_theme_default_base_scale" qualifiers="const">
546 <return type="float" />
547 <description>
548 Returns the default base scale value from the first matching [Theme] in the tree if that [Theme] has a valid [member Theme.default_base_scale] value.
549 See [method get_theme_color] for details.
550 </description>
551 </method>
552 <method name="get_theme_default_font" qualifiers="const">
553 <return type="Font" />
554 <description>
555 Returns the default font from the first matching [Theme] in the tree if that [Theme] has a valid [member Theme.default_font] value.
556 See [method get_theme_color] for details.
557 </description>
558 </method>
559 <method name="get_theme_default_font_size" qualifiers="const">
560 <return type="int" />
561 <description>
562 Returns the default font size value from the first matching [Theme] in the tree if that [Theme] has a valid [member Theme.default_font_size] value.
563 See [method get_theme_color] for details.
564 </description>
565 </method>
566 <method name="get_theme_font" qualifiers="const">
567 <return type="Font" />
568 <param index="0" name="name" type="StringName" />
569 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
570 <description>
571 Returns a [Font] from the first matching [Theme] in the tree if that [Theme] has a font item with the specified [param name] and [param theme_type].
572 See [method get_theme_color] for details.
573 </description>
574 </method>
575 <method name="get_theme_font_size" qualifiers="const">
576 <return type="int" />
577 <param index="0" name="name" type="StringName" />
578 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
579 <description>
580 Returns a font size from the first matching [Theme] in the tree if that [Theme] has a font size item with the specified [param name] and [param theme_type].
581 See [method get_theme_color] for details.
582 </description>
583 </method>
584 <method name="get_theme_icon" qualifiers="const">
585 <return type="Texture2D" />
586 <param index="0" name="name" type="StringName" />
587 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
588 <description>
589 Returns an icon from the first matching [Theme] in the tree if that [Theme] has an icon item with the specified [param name] and [param theme_type].
590 See [method get_theme_color] for details.
591 </description>
592 </method>
593 <method name="get_theme_stylebox" qualifiers="const">
594 <return type="StyleBox" />
595 <param index="0" name="name" type="StringName" />
596 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
597 <description>
598 Returns a [StyleBox] from the first matching [Theme] in the tree if that [Theme] has a stylebox item with the specified [param name] and [param theme_type].
599 See [method get_theme_color] for details.
600 </description>
601 </method>
602 <method name="get_tooltip" qualifiers="const">
603 <return type="String" />
604 <param index="0" name="at_position" type="Vector2" default="Vector2(0, 0)" />
605 <description>
606 Returns the tooltip text for the position [param at_position] in control's local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns [member tooltip_text].
607 This method can be overridden to customize its behavior. See [method _get_tooltip].
608 [b]Note:[/b] If this method returns an empty [String] and [method _make_custom_tooltip] is not overridden, no tooltip is displayed.
609 </description>
610 </method>
611 <method name="grab_click_focus">
612 <return type="void" />
613 <description>
614 Creates an [InputEventMouseButton] that attempts to click the control. If the event is received, the control gains focus.
615 [codeblocks]
616 [gdscript]
617 func _process(delta):
618 grab_click_focus() # When clicking another Control node, this node will be clicked instead.
619 [/gdscript]
620 [csharp]
621 public override void _Process(double delta)
622 {
623 GrabClickFocus(); // When clicking another Control node, this node will be clicked instead.
624 }
625 [/csharp]
626 [/codeblocks]
627 </description>
628 </method>
629 <method name="grab_focus">
630 <return type="void" />
631 <param index="0" name="hide_focus" type="bool" default="false" />
632 <description>
633 Steal the focus from another control and become the focused control (see [member focus_mode]).
634 If [param hide_focus] is [code]true[/code], the control will not visually show its focused state. Has no effect for [LineEdit] and [TextEdit] when [member ProjectSettings.gui/common/show_focus_state_on_pointer_event] is set to [code]Control Supports Keyboard Input[/code], or for any control when it is set to [code]Always[/code].
635 [b]Note:[/b] Using this method together with [method Callable.call_deferred] makes it more reliable, especially when called inside [method Node._ready].
636 </description>
637 </method>
638 <method name="has_focus" qualifiers="const">
639 <return type="bool" />
640 <param index="0" name="ignore_hidden_focus" type="bool" default="false" />
641 <description>
642 Returns [code]true[/code] if this is the current focused control. See [member focus_mode].
643 If [param ignore_hidden_focus] is [code]true[/code], controls that have their focus hidden will always return [code]false[/code]. Hidden focus happens automatically when controls gain focus via mouse input, or manually using [method grab_focus] with [code]hide_focus[/code] set to [code]true[/code].
644 </description>
645 </method>
646 <method name="has_theme_color" qualifiers="const">
647 <return type="bool" />
648 <param index="0" name="name" type="StringName" />
649 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
650 <description>
651 Returns [code]true[/code] if there is a matching [Theme] in the tree that has a color item with the specified [param name] and [param theme_type].
652 See [method get_theme_color] for details.
653 </description>
654 </method>
655 <method name="has_theme_color_override" qualifiers="const">
656 <return type="bool" />
657 <param index="0" name="name" type="StringName" />
658 <description>
659 Returns [code]true[/code] if there is a local override for a theme [Color] with the specified [param name] in this [Control] node.
660 See [method add_theme_color_override].
661 </description>
662 </method>
663 <method name="has_theme_constant" qualifiers="const">
664 <return type="bool" />
665 <param index="0" name="name" type="StringName" />
666 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
667 <description>
668 Returns [code]true[/code] if there is a matching [Theme] in the tree that has a constant item with the specified [param name] and [param theme_type].
669 See [method get_theme_color] for details.
670 </description>
671 </method>
672 <method name="has_theme_constant_override" qualifiers="const">
673 <return type="bool" />
674 <param index="0" name="name" type="StringName" />
675 <description>
676 Returns [code]true[/code] if there is a local override for a theme constant with the specified [param name] in this [Control] node.
677 See [method add_theme_constant_override].
678 </description>
679 </method>
680 <method name="has_theme_font" qualifiers="const">
681 <return type="bool" />
682 <param index="0" name="name" type="StringName" />
683 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
684 <description>
685 Returns [code]true[/code] if there is a matching [Theme] in the tree that has a font item with the specified [param name] and [param theme_type].
686 See [method get_theme_color] for details.
687 </description>
688 </method>
689 <method name="has_theme_font_override" qualifiers="const">
690 <return type="bool" />
691 <param index="0" name="name" type="StringName" />
692 <description>
693 Returns [code]true[/code] if there is a local override for a theme [Font] with the specified [param name] in this [Control] node.
694 See [method add_theme_font_override].
695 </description>
696 </method>
697 <method name="has_theme_font_size" qualifiers="const">
698 <return type="bool" />
699 <param index="0" name="name" type="StringName" />
700 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
701 <description>
702 Returns [code]true[/code] if there is a matching [Theme] in the tree that has a font size item with the specified [param name] and [param theme_type].
703 See [method get_theme_color] for details.
704 </description>
705 </method>
706 <method name="has_theme_font_size_override" qualifiers="const">
707 <return type="bool" />
708 <param index="0" name="name" type="StringName" />
709 <description>
710 Returns [code]true[/code] if there is a local override for a theme font size with the specified [param name] in this [Control] node.
711 See [method add_theme_font_size_override].
712 </description>
713 </method>
714 <method name="has_theme_icon" qualifiers="const">
715 <return type="bool" />
716 <param index="0" name="name" type="StringName" />
717 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
718 <description>
719 Returns [code]true[/code] if there is a matching [Theme] in the tree that has an icon item with the specified [param name] and [param theme_type].
720 See [method get_theme_color] for details.
721 </description>
722 </method>
723 <method name="has_theme_icon_override" qualifiers="const">
724 <return type="bool" />
725 <param index="0" name="name" type="StringName" />
726 <description>
727 Returns [code]true[/code] if there is a local override for a theme icon with the specified [param name] in this [Control] node.
728 See [method add_theme_icon_override].
729 </description>
730 </method>
731 <method name="has_theme_stylebox" qualifiers="const">
732 <return type="bool" />
733 <param index="0" name="name" type="StringName" />
734 <param index="1" name="theme_type" type="StringName" default="&amp;&quot;&quot;" />
735 <description>
736 Returns [code]true[/code] if there is a matching [Theme] in the tree that has a stylebox item with the specified [param name] and [param theme_type].
737 See [method get_theme_color] for details.
738 </description>
739 </method>
740 <method name="has_theme_stylebox_override" qualifiers="const">
741 <return type="bool" />
742 <param index="0" name="name" type="StringName" />
743 <description>
744 Returns [code]true[/code] if there is a local override for a theme [StyleBox] with the specified [param name] in this [Control] node.
745 See [method add_theme_stylebox_override].
746 </description>
747 </method>
748 <method name="is_drag_successful" qualifiers="const">
749 <return type="bool" />
750 <description>
751 Returns [code]true[/code] if a drag operation is successful. Alternative to [method Viewport.gui_is_drag_successful].
752 Best used with [constant Node.NOTIFICATION_DRAG_END].
753 </description>
754 </method>
755 <method name="is_layout_rtl" qualifiers="const">
756 <return type="bool" />
757 <description>
758 Returns [code]true[/code] if the layout is right-to-left. See also [member layout_direction].
759 </description>
760 </method>
761 <method name="release_focus">
762 <return type="void" />
763 <description>
764 Give up the focus. No other control will be able to receive input.
765 </description>
766 </method>
767 <method name="remove_theme_color_override">
768 <return type="void" />
769 <param index="0" name="name" type="StringName" />
770 <description>
771 Removes a local override for a theme [Color] with the specified [param name] previously added by [method add_theme_color_override] or via the Inspector dock.
772 </description>
773 </method>
774 <method name="remove_theme_constant_override">
775 <return type="void" />
776 <param index="0" name="name" type="StringName" />
777 <description>
778 Removes a local override for a theme constant with the specified [param name] previously added by [method add_theme_constant_override] or via the Inspector dock.
779 </description>
780 </method>
781 <method name="remove_theme_font_override">
782 <return type="void" />
783 <param index="0" name="name" type="StringName" />
784 <description>
785 Removes a local override for a theme [Font] with the specified [param name] previously added by [method add_theme_font_override] or via the Inspector dock.
786 </description>
787 </method>
788 <method name="remove_theme_font_size_override">
789 <return type="void" />
790 <param index="0" name="name" type="StringName" />
791 <description>
792 Removes a local override for a theme font size with the specified [param name] previously added by [method add_theme_font_size_override] or via the Inspector dock.
793 </description>
794 </method>
795 <method name="remove_theme_icon_override">
796 <return type="void" />
797 <param index="0" name="name" type="StringName" />
798 <description>
799 Removes a local override for a theme icon with the specified [param name] previously added by [method add_theme_icon_override] or via the Inspector dock.
800 </description>
801 </method>
802 <method name="remove_theme_stylebox_override">
803 <return type="void" />
804 <param index="0" name="name" type="StringName" />
805 <description>
806 Removes a local override for a theme [StyleBox] with the specified [param name] previously added by [method add_theme_stylebox_override] or via the Inspector dock.
807 </description>
808 </method>
809 <method name="reset_size">
810 <return type="void" />
811 <description>
812 Resets the size to [method get_combined_minimum_size]. This is equivalent to calling [code]set_size(Vector2())[/code] (or any size below the minimum).
813 </description>
814 </method>
815 <method name="set_anchor">
816 <return type="void" />
817 <param index="0" name="side" type="int" enum="Side" />
818 <param index="1" name="anchor" type="float" />
819 <param index="2" name="keep_offset" type="bool" default="false" />
820 <param index="3" name="push_opposite_anchor" type="bool" default="true" />
821 <description>
822 Sets the anchor for the specified [enum Side] to [param anchor]. A setter method for [member anchor_bottom], [member anchor_left], [member anchor_right] and [member anchor_top].
823 If [param keep_offset] is [code]true[/code], offsets aren't updated after this operation.
824 If [param push_opposite_anchor] is [code]true[/code] 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 [param push_opposite_anchor] was [code]false[/code], the left anchor would get value 0.5.
825 </description>
826 </method>
827 <method name="set_anchor_and_offset">
828 <return type="void" />
829 <param index="0" name="side" type="int" enum="Side" />
830 <param index="1" name="anchor" type="float" />
831 <param index="2" name="offset" type="float" />
832 <param index="3" name="push_opposite_anchor" type="bool" default="false" />
833 <description>
834 Works the same as [method set_anchor], but instead of [code]keep_offset[/code] argument and automatic update of offset, it allows to set the offset yourself (see [method set_offset]).
835 </description>
836 </method>
837 <method name="set_anchors_and_offsets_preset">
838 <return type="void" />
839 <param index="0" name="preset" type="int" enum="Control.LayoutPreset" />
840 <param index="1" name="resize_mode" type="int" enum="Control.LayoutPresetMode" default="0" />
841 <param index="2" name="margin" type="int" default="0" />
842 <description>
843 Sets both anchor preset and offset preset. See [method set_anchors_preset] and [method set_offsets_preset].
844 </description>
845 </method>
846 <method name="set_anchors_preset">
847 <return type="void" />
848 <param index="0" name="preset" type="int" enum="Control.LayoutPreset" />
849 <param index="1" name="keep_offsets" type="bool" default="false" />
850 <description>
851 Sets the anchors to a [param preset] from [enum Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.
852 If [param keep_offsets] is [code]true[/code], control's position will also be updated.
853 </description>
854 </method>
855 <method name="set_begin">
856 <return type="void" />
857 <param index="0" name="position" type="Vector2" />
858 <description>
859 Sets [member offset_left] and [member offset_top] at the same time. Equivalent of changing [member position].
860 </description>
861 </method>
862 <method name="set_drag_forwarding">
863 <return type="void" />
864 <param index="0" name="drag_func" type="Callable" />
865 <param index="1" name="can_drop_func" type="Callable" />
866 <param index="2" name="drop_func" type="Callable" />
867 <description>
868 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.
869 The arguments for each callable should be exactly the same as their respective virtual methods, which would be:
870 - [param drag_func] corresponds to [method _get_drag_data] and requires a [Vector2];
871 - [param can_drop_func] corresponds to [method _can_drop_data] and requires both a [Vector2] and a [Variant];
872 - [param drop_func] corresponds to [method _drop_data] and requires both a [Vector2] and a [Variant].
873 </description>
874 </method>
875 <method name="set_drag_preview">
876 <return type="void" />
877 <param index="0" name="control" type="Control" />
878 <description>
879 Shows the given control at the mouse pointer. A good time to call this method is in [method _get_drag_data]. 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.
880 [codeblocks]
881 [gdscript]
882 @export var color = Color(1, 0, 0, 1)
883
884 func _get_drag_data(position):
885 # Use a control that is not in the tree
886 var cpb = ColorPickerButton.new()
887 cpb.color = color
888 cpb.size = Vector2(50, 50)
889 set_drag_preview(cpb)
890 return color
891 [/gdscript]
892 [csharp]
893 [Export]
894 private Color _color = new Color(1, 0, 0, 1);
895
896 public override Variant _GetDragData(Vector2 atPosition)
897 {
898 // Use a control that is not in the tree
899 var cpb = new ColorPickerButton();
900 cpb.Color = _color;
901 cpb.Size = new Vector2(50, 50);
902 SetDragPreview(cpb);
903 return _color;
904 }
905 [/csharp]
906 [/codeblocks]
907 </description>
908 </method>
909 <method name="set_end">
910 <return type="void" />
911 <param index="0" name="position" type="Vector2" />
912 <description>
913 Sets [member offset_right] and [member offset_bottom] at the same time.
914 </description>
915 </method>
916 <method name="set_focus_neighbor">
917 <return type="void" />
918 <param index="0" name="side" type="int" enum="Side" />
919 <param index="1" name="neighbor" type="NodePath" />
920 <description>
921 Sets the focus neighbor for the specified [enum Side] to the [Control] at [param neighbor] node path. A setter method for [member focus_neighbor_bottom], [member focus_neighbor_left], [member focus_neighbor_right] and [member focus_neighbor_top].
922 </description>
923 </method>
924 <method name="set_global_position">
925 <return type="void" />
926 <param index="0" name="position" type="Vector2" />
927 <param index="1" name="keep_offsets" type="bool" default="false" />
928 <description>
929 Sets the [member global_position] to given [param position].
930 If [param keep_offsets] is [code]true[/code], control's anchors will be updated instead of offsets.
931 </description>
932 </method>
933 <method name="set_offset">
934 <return type="void" />
935 <param index="0" name="side" type="int" enum="Side" />
936 <param index="1" name="offset" type="float" />
937 <description>
938 Sets the offset for the specified [enum Side] to [param offset]. A setter method for [member offset_bottom], [member offset_left], [member offset_right] and [member offset_top].
939 </description>
940 </method>
941 <method name="set_offsets_preset">
942 <return type="void" />
943 <param index="0" name="preset" type="int" enum="Control.LayoutPreset" />
944 <param index="1" name="resize_mode" type="int" enum="Control.LayoutPresetMode" default="0" />
945 <param index="2" name="margin" type="int" default="0" />
946 <description>
947 Sets the offsets to a [param preset] from [enum Control.LayoutPreset] enum. This is the code equivalent to using the Layout menu in the 2D editor.
948 Use parameter [param resize_mode] with constants from [enum 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. [constant PRESET_LEFT_WIDE].
949 Use parameter [param margin] to determine the gap between the [Control] and the edges.
950 </description>
951 </method>
952 <method name="set_position">
953 <return type="void" />
954 <param index="0" name="position" type="Vector2" />
955 <param index="1" name="keep_offsets" type="bool" default="false" />
956 <description>
957 Sets the [member position] to given [param position].
958 If [param keep_offsets] is [code]true[/code], control's anchors will be updated instead of offsets.
959 </description>
960 </method>
961 <method name="set_size">
962 <return type="void" />
963 <param index="0" name="size" type="Vector2" />
964 <param index="1" name="keep_offsets" type="bool" default="false" />
965 <description>
966 Sets the size (see [member size]).
967 If [param keep_offsets] is [code]true[/code], control's anchors will be updated instead of offsets.
968 </description>
969 </method>
970 <method name="update_minimum_size">
971 <return type="void" />
972 <description>
973 Invalidates the size cache in this node and in parent nodes up to top level. Intended to be used with [method get_minimum_size] when the return value is changed. Setting [member custom_minimum_size] directly calls this method automatically.
974 </description>
975 </method>
976 <method name="warp_mouse">
977 <return type="void" />
978 <param index="0" name="position" type="Vector2" />
979 <description>
980 Moves the mouse cursor to [param position], relative to [member position] of this [Control].
981 [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.
982 </description>
983 </method>
984 </methods>
985 <members>
986 <member name="accessibility_controls_nodes" type="NodePath[]" setter="set_accessibility_controls_nodes" getter="get_accessibility_controls_nodes" default="[]">
987 The paths to the nodes which are controlled by this node.
988 </member>
989 <member name="accessibility_described_by_nodes" type="NodePath[]" setter="set_accessibility_described_by_nodes" getter="get_accessibility_described_by_nodes" default="[]">
990 The paths to the nodes which are describing this node.
991 </member>
992 <member name="accessibility_description" type="String" setter="set_accessibility_description" getter="get_accessibility_description" default="&quot;&quot;">
993 The human-readable node description that is reported to assistive apps.
994 </member>
995 <member name="accessibility_flow_to_nodes" type="NodePath[]" setter="set_accessibility_flow_to_nodes" getter="get_accessibility_flow_to_nodes" default="[]">
996 The paths to the nodes which this node flows into.
997 </member>
998 <member name="accessibility_labeled_by_nodes" type="NodePath[]" setter="set_accessibility_labeled_by_nodes" getter="get_accessibility_labeled_by_nodes" default="[]">
999 The paths to the nodes which label this node.
1000 </member>
1001 <member name="accessibility_live" type="int" setter="set_accessibility_live" getter="get_accessibility_live" enum="DisplayServer.AccessibilityLiveMode" default="0">
1002 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.
1003 </member>
1004 <member name="accessibility_name" type="String" setter="set_accessibility_name" getter="get_accessibility_name" default="&quot;&quot;">
1005 The human-readable node name that is reported to assistive apps.
1006 </member>
1007 <member name="anchor_bottom" type="float" setter="_set_anchor" getter="get_anchor" default="0.0">
1008 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 [enum Anchor] constants for convenience.
1009 </member>
1010 <member name="anchor_left" type="float" setter="_set_anchor" getter="get_anchor" default="0.0">
1011 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 [enum Anchor] constants for convenience.
1012 </member>
1013 <member name="anchor_right" type="float" setter="_set_anchor" getter="get_anchor" default="0.0">
1014 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 [enum Anchor] constants for convenience.
1015 </member>
1016 <member name="anchor_top" type="float" setter="_set_anchor" getter="get_anchor" default="0.0">
1017 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 [enum Anchor] constants for convenience.
1018 </member>
1019 <member name="auto_translate" type="bool" setter="set_auto_translate" getter="is_auto_translating" deprecated="Use [member Node.auto_translate_mode] and [method Node.can_auto_translate] instead.">
1020 Toggles if any text should automatically change to its translated version depending on the current locale.
1021 </member>
1022 <member name="clip_contents" type="bool" setter="set_clip_contents" getter="is_clipping_contents" default="false">
1023 Enables whether rendering of [CanvasItem] based 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 and won't receive input.
1024 </member>
1025 <member name="custom_minimum_size" type="Vector2" setter="set_custom_minimum_size" getter="get_custom_minimum_size" default="Vector2(0, 0)">
1026 The minimum size of the node's bounding rectangle. If you set it to a value greater than [code](0, 0)[/code], the node's bounding rectangle will always have at least this size. Note that [Control] nodes have their internal minimum size returned by [method get_minimum_size]. 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 [method get_combined_minimum_size]).
1027 </member>
1028 <member name="focus_behavior_recursive" type="int" setter="set_focus_behavior_recursive" getter="get_focus_behavior_recursive" enum="Control.FocusBehaviorRecursive" default="0">
1029 Determines which controls can be focused together with [member focus_mode]. See [method get_focus_mode_with_override]. Since the default behavior is [constant FOCUS_BEHAVIOR_INHERITED], this can be used to prevent all children controls from getting focused.
1030 </member>
1031 <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" enum="Control.FocusMode" default="0">
1032 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 [method _gui_input]. Use [method get_focus_mode_with_override] to determine if a control can grab focus, since [member focus_behavior_recursive] also affects it. See also [method grab_focus].
1033 </member>
1034 <member name="focus_neighbor_bottom" type="NodePath" setter="set_focus_neighbor" getter="get_focus_neighbor" default="NodePath(&quot;&quot;)" keywords="focus_neighbour_bottom">
1035 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 [member 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.
1036 </member>
1037 <member name="focus_neighbor_left" type="NodePath" setter="set_focus_neighbor" getter="get_focus_neighbor" default="NodePath(&quot;&quot;)" keywords="focus_neighbour_left">
1038 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 [member 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.
1039 </member>
1040 <member name="focus_neighbor_right" type="NodePath" setter="set_focus_neighbor" getter="get_focus_neighbor" default="NodePath(&quot;&quot;)" keywords="focus_neighbour_right">
1041 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 [member 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.
1042 </member>
1043 <member name="focus_neighbor_top" type="NodePath" setter="set_focus_neighbor" getter="get_focus_neighbor" default="NodePath(&quot;&quot;)" keywords="focus_neighbour_top">
1044 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 [member 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.
1045 </member>
1046 <member name="focus_next" type="NodePath" setter="set_focus_next" getter="get_focus_next" default="NodePath(&quot;&quot;)">
1047 Tells Godot which node it should give focus to if the user presses [kbd]Tab[/kbd] on a keyboard by default. You can change the key by editing the [member ProjectSettings.input/ui_focus_next] input action.
1048 If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
1049 </member>
1050 <member name="focus_previous" type="NodePath" setter="set_focus_previous" getter="get_focus_previous" default="NodePath(&quot;&quot;)">
1051 Tells Godot which node it should give focus to if the user presses [kbd]Shift + Tab[/kbd] on a keyboard by default. You can change the key by editing the [member ProjectSettings.input/ui_focus_prev] input action.
1052 If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
1053 </member>
1054 <member name="global_position" type="Vector2" setter="_set_global_position" getter="get_global_position">
1055 The node's global position, relative to the world (usually to the [CanvasLayer]).
1056 </member>
1057 <member name="grow_horizontal" type="int" setter="set_h_grow_direction" getter="get_h_grow_direction" enum="Control.GrowDirection" default="1">
1058 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.
1059 </member>
1060 <member name="grow_vertical" type="int" setter="set_v_grow_direction" getter="get_v_grow_direction" enum="Control.GrowDirection" default="1">
1061 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.
1062 </member>
1063 <member name="layout_direction" type="int" setter="set_layout_direction" getter="get_layout_direction" enum="Control.LayoutDirection" default="0">
1064 Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew). See also [method is_layout_rtl].
1065 </member>
1066 <member name="localize_numeral_system" type="bool" setter="set_localize_numeral_system" getter="is_localizing_numeral_system" default="true">
1067 If [code]true[/code], 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.
1068 [b]Note:[/b] Numbers within the text are not automatically converted, it can be done manually, using [method TextServer.format_number].
1069 </member>
1070 <member name="mouse_behavior_recursive" type="int" setter="set_mouse_behavior_recursive" getter="get_mouse_behavior_recursive" enum="Control.MouseBehaviorRecursive" default="0">
1071 Determines which controls can receive mouse input together with [member mouse_filter]. See [method get_mouse_filter_with_override]. Since the default behavior is [constant MOUSE_BEHAVIOR_INHERITED], this can be used to prevent all children controls from receiving mouse input.
1072 </member>
1073 <member name="mouse_default_cursor_shape" type="int" setter="set_default_cursor_shape" getter="get_default_cursor_shape" enum="Control.CursorShape" default="0">
1074 The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors.
1075 [b]Note:[/b] On Linux, shapes may vary depending on the cursor theme of the system.
1076 </member>
1077 <member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" enum="Control.MouseFilter" default="0">
1078 Determines which controls will be able to receive mouse button input events through [method _gui_input] and the [signal mouse_entered], and [signal mouse_exited] signals. Also determines how these events should be propagated. See the constants to learn what each does. Use [method get_mouse_filter_with_override] to determine if a control can receive mouse input, since [member mouse_behavior_recursive] also affects it.
1079 </member>
1080 <member name="mouse_force_pass_scroll_events" type="bool" setter="set_force_pass_scroll_events" getter="is_force_pass_scroll_events" default="true">
1081 When enabled, scroll wheel events processed by [method _gui_input] will be passed to the parent control even if [member mouse_filter] is set to [constant MOUSE_FILTER_STOP].
1082 You should disable it on the root of your UI if you do not want scroll events to go to the [method Node._unhandled_input] processing.
1083 [b]Note:[/b] Because this property defaults to [code]true[/code], this allows nested scrollable containers to work out of the box.
1084 </member>
1085 <member name="offset_bottom" type="float" setter="set_offset" getter="get_offset" default="0.0">
1086 Distance between the node's bottom edge and its parent control, based on [member anchor_bottom].
1087 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.
1088 </member>
1089 <member name="offset_left" type="float" setter="set_offset" getter="get_offset" default="0.0">
1090 Distance between the node's left edge and its parent control, based on [member anchor_left].
1091 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.
1092 </member>
1093 <member name="offset_right" type="float" setter="set_offset" getter="get_offset" default="0.0">
1094 Distance between the node's right edge and its parent control, based on [member anchor_right].
1095 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.
1096 </member>
1097 <member name="offset_top" type="float" setter="set_offset" getter="get_offset" default="0.0">
1098 Distance between the node's top edge and its parent control, based on [member anchor_top].
1099 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.
1100 </member>
1101 <member name="physics_interpolation_mode" type="int" setter="set_physics_interpolation_mode" getter="get_physics_interpolation_mode" overrides="Node" enum="Node.PhysicsInterpolationMode" default="2" />
1102 <member name="pivot_offset" type="Vector2" setter="set_pivot_offset" getter="get_pivot_offset" default="Vector2(0, 0)">
1103 By default, the node's pivot is its top-left corner. When you change its [member rotation] or [member scale], it will rotate or scale around this pivot.
1104 The actual offset is the combined value of this property and [member pivot_offset_ratio].
1105 </member>
1106 <member name="pivot_offset_ratio" type="Vector2" setter="set_pivot_offset_ratio" getter="get_pivot_offset_ratio" default="Vector2(0, 0)">
1107 Same as [member pivot_offset], but expressed as uniform vector, where [code]Vector2(0, 0)[/code] is the top-left corner of this control, and [code]Vector2(1, 1)[/code] is its bottom-right corner. Set this property to [code]Vector2(0.5, 0.5)[/code] to pivot around this control's center.
1108 The actual offset is the combined value of this property and [member pivot_offset].
1109 </member>
1110 <member name="position" type="Vector2" setter="_set_position" getter="get_position" default="Vector2(0, 0)">
1111 The node's position, relative to its containing node. It corresponds to the rectangle's top-left corner. The property is not affected by [member pivot_offset].
1112 </member>
1113 <member name="rotation" type="float" setter="set_rotation" getter="get_rotation" default="0.0">
1114 The node's rotation around its pivot, in radians. See [member pivot_offset] to change the pivot's position.
1115 [b]Note:[/b] This property is edited in the inspector in degrees. If you want to use degrees in a script, use [member rotation_degrees].
1116 </member>
1117 <member name="rotation_degrees" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees">
1118 Helper property to access [member rotation] in degrees instead of radians.
1119 </member>
1120 <member name="scale" type="Vector2" setter="set_scale" getter="get_scale" default="Vector2(1, 1)">
1121 The node's scale, relative to its [member size]. Change this property to scale the node around its [member pivot_offset]. The Control's tooltip will also scale according to this value.
1122 [b]Note:[/b] 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 [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]documentation[/url] instead of scaling Controls individually.
1123 [b]Note:[/b] [member FontFile.oversampling] does [i]not[/i] take [Control] [member 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 [member ProjectSettings.gui/theme/default_font_multichannel_signed_distance_field] (applies to the default project font only), or enabling [b]Multichannel Signed Distance Field[/b] in the import options of a DynamicFont for custom fonts. On system fonts, [member SystemFont.multichannel_signed_distance_field] can be enabled in the inspector.
1124 [b]Note:[/b] If the Control node is a child of a [Container] node, the scale will be reset to [code]Vector2(1, 1)[/code] when the scene is instantiated. To set the Control's scale when it's instantiated, wait for one frame using [code]await get_tree().process_frame[/code] then set its [member scale] property.
1125 </member>
1126 <member name="shortcut_context" type="Node" setter="set_shortcut_context" getter="get_shortcut_context">
1127 The [Node] which must be a parent of the focused [Control] for the shortcut to be activated. If [code]null[/code], 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.
1128 </member>
1129 <member name="size" type="Vector2" setter="_set_size" getter="get_size" default="Vector2(0, 0)">
1130 The size of the node's bounding rectangle, in the node's coordinate system. [Container] nodes update this property automatically.
1131 </member>
1132 <member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" enum="Control.SizeFlags" is_bitfield="true" default="1">
1133 Tells the parent [Container] nodes how they should resize and place the node on the X axis. Use a combination of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
1134 </member>
1135 <member name="size_flags_stretch_ratio" type="float" setter="set_stretch_ratio" getter="get_stretch_ratio" default="1.0">
1136 If the node and at least one of its neighbors uses the [constant SIZE_EXPAND] 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.
1137 </member>
1138 <member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" enum="Control.SizeFlags" is_bitfield="true" default="1">
1139 Tells the parent [Container] nodes how they should resize and place the node on the Y axis. Use a combination of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
1140 </member>
1141 <member name="theme" type="Theme" setter="set_theme" getter="get_theme">
1142 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.
1143 [b]Note:[/b] [Window] styles will have no effect unless the window is embedded.
1144 </member>
1145 <member name="theme_type_variation" type="StringName" setter="set_theme_type_variation" getter="get_theme_type_variation" default="&amp;&quot;&quot;">
1146 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. [code skip-lint]Button[/code] for the [Button] control), as well as the class names of all parent classes (in order of inheritance).
1147 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 [method Theme.set_type_variation]. If the theme item cannot be found using this type or its base types, lookup falls back on the class names.
1148 [b]Note:[/b] To look up [Control]'s own items use various [code]get_theme_*[/code] methods without specifying [code]theme_type[/code].
1149 [b]Note:[/b] Theme items are looked for in the tree order, from branch to root, where each [Control] node is checked for its [member theme] property. The earliest match against any type/class name is returned. The project-level Theme and the default Theme are checked last.
1150 </member>
1151 <member name="tooltip_auto_translate_mode" type="int" setter="set_tooltip_auto_translate_mode" getter="get_tooltip_auto_translate_mode" enum="Node.AutoTranslateMode" default="0">
1152 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 [constant Node.AUTO_TRANSLATE_MODE_INHERIT].
1153 [b]Note:[/b] Tooltips customized using [method _make_custom_tooltip] do not use this auto translate mode automatically.
1154 </member>
1155 <member name="tooltip_text" type="String" setter="set_tooltip_text" getter="get_tooltip_text" default="&quot;&quot;">
1156 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 [member mouse_filter] property is not [constant MOUSE_FILTER_IGNORE]. The time required for the tooltip to appear can be changed with the [member ProjectSettings.gui/timers/tooltip_delay_sec] setting.
1157 This string is the default return value of [method get_tooltip]. Override [method _get_tooltip] to generate tooltip text dynamically. Override [method _make_custom_tooltip] to customize the tooltip interface and behavior.
1158 The tooltip popup will use either a default implementation, or a custom one that you can provide by overriding [method _make_custom_tooltip]. The default tooltip includes a [PopupPanel] and [Label] whose theme properties can be customized using [Theme] methods with the [code]"TooltipPanel"[/code] and [code]"TooltipLabel"[/code] respectively. For example:
1159 [codeblocks]
1160 [gdscript]
1161 var style_box = StyleBoxFlat.new()
1162 style_box.set_bg_color(Color(1, 1, 0))
1163 style_box.set_border_width_all(2)
1164 # We assume here that the `theme` property has been assigned a custom Theme beforehand.
1165 theme.set_stylebox("panel", "TooltipPanel", style_box)
1166 theme.set_color("font_color", "TooltipLabel", Color(0, 1, 1))
1167 [/gdscript]
1168 [csharp]
1169 var styleBox = new StyleBoxFlat();
1170 styleBox.SetBgColor(new Color(1, 1, 0));
1171 styleBox.SetBorderWidthAll(2);
1172 // We assume here that the `Theme` property has been assigned a custom Theme beforehand.
1173 Theme.SetStyleBox("panel", "TooltipPanel", styleBox);
1174 Theme.SetColor("font_color", "TooltipLabel", new Color(0, 1, 1));
1175 [/csharp]
1176 [/codeblocks]
1177 </member>
1178 </members>
1179 <signals>
1180 <signal name="focus_entered">
1181 <description>
1182 Emitted when the node gains focus.
1183 </description>
1184 </signal>
1185 <signal name="focus_exited">
1186 <description>
1187 Emitted when the node loses focus.
1188 </description>
1189 </signal>
1190 <signal name="gui_input">
1191 <param index="0" name="event" type="InputEvent" />
1192 <description>
1193 Emitted when the node receives an [InputEvent].
1194 </description>
1195 </signal>
1196 <signal name="minimum_size_changed">
1197 <description>
1198 Emitted when the node's minimum size changes.
1199 </description>
1200 </signal>
1201 <signal name="mouse_entered">
1202 <description>
1203 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 [member mouse_filter] lets the event reach it and regardless if it's currently focused or not.
1204 [b]Note:[/b] [member CanvasItem.z_index] doesn't affect, which Control receives the signal.
1205 </description>
1206 </signal>
1207 <signal name="mouse_exited">
1208 <description>
1209 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 [member mouse_filter] lets the event reach it and regardless if it's currently focused or not.
1210 [b]Note:[/b] [member CanvasItem.z_index] doesn't affect, which Control receives the signal.
1211 [b]Note:[/b] If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this:
1212 [codeblock]
1213 func _on_mouse_exited():
1214 if not Rect2(Vector2(), size).has_point(get_local_mouse_position()):
1215 # Not hovering over area.
1216 [/codeblock]
1217 </description>
1218 </signal>
1219 <signal name="resized">
1220 <description>
1221 Emitted when the control changes size.
1222 </description>
1223 </signal>
1224 <signal name="size_flags_changed">
1225 <description>
1226 Emitted when one of the size flags changes. See [member size_flags_horizontal] and [member size_flags_vertical].
1227 </description>
1228 </signal>
1229 <signal name="theme_changed">
1230 <description>
1231 Emitted when the [constant NOTIFICATION_THEME_CHANGED] notification is sent.
1232 </description>
1233 </signal>
1234 </signals>
1235 <constants>
1236 <constant name="FOCUS_NONE" value="0" enum="FocusMode">
1237 The node cannot grab focus. Use with [member focus_mode].
1238 </constant>
1239 <constant name="FOCUS_CLICK" value="1" enum="FocusMode">
1240 The node can only grab focus on mouse clicks. Use with [member focus_mode].
1241 </constant>
1242 <constant name="FOCUS_ALL" value="2" enum="FocusMode">
1243 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 [member focus_mode].
1244 </constant>
1245 <constant name="FOCUS_ACCESSIBILITY" value="3" enum="FocusMode">
1246 The node can grab focus only when screen reader is active. Use with [member focus_mode].
1247 </constant>
1248 <constant name="FOCUS_BEHAVIOR_INHERITED" value="0" enum="FocusBehaviorRecursive">
1249 Inherits the [member focus_behavior_recursive] from the parent control. If there is no parent control, this is the same as [constant FOCUS_BEHAVIOR_ENABLED].
1250 </constant>
1251 <constant name="FOCUS_BEHAVIOR_DISABLED" value="1" enum="FocusBehaviorRecursive">
1252 Prevents the control from getting focused. [method get_focus_mode_with_override] will return [constant FOCUS_NONE].
1253 </constant>
1254 <constant name="FOCUS_BEHAVIOR_ENABLED" value="2" enum="FocusBehaviorRecursive">
1255 Allows the control to be focused, depending on the [member focus_mode]. This can be used to ignore the parent's [member focus_behavior_recursive]. [method get_focus_mode_with_override] will return the [member focus_mode].
1256 </constant>
1257 <constant name="MOUSE_BEHAVIOR_INHERITED" value="0" enum="MouseBehaviorRecursive">
1258 Inherits the [member mouse_behavior_recursive] from the parent control. If there is no parent control, this is the same as [constant MOUSE_BEHAVIOR_ENABLED].
1259 </constant>
1260 <constant name="MOUSE_BEHAVIOR_DISABLED" value="1" enum="MouseBehaviorRecursive">
1261 Prevents the control from receiving mouse input. [method get_mouse_filter_with_override] will return [constant MOUSE_FILTER_IGNORE].
1262 </constant>
1263 <constant name="MOUSE_BEHAVIOR_ENABLED" value="2" enum="MouseBehaviorRecursive">
1264 Allows the control to receive mouse input, depending on the [member mouse_filter]. This can be used to ignore the parent's [member mouse_behavior_recursive]. [method get_mouse_filter_with_override] will return the [member mouse_filter].
1265 </constant>
1266 <constant name="NOTIFICATION_RESIZED" value="40">
1267 Sent when the node changes size. Use [member size] to get the new size.
1268 </constant>
1269 <constant name="NOTIFICATION_MOUSE_ENTER" value="41">
1270 Sent 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 [member mouse_filter] lets the event reach it and regardless if it's currently focused or not.
1271 [b]Note:[/b] [member CanvasItem.z_index] doesn't affect which Control receives the notification.
1272 See also [constant NOTIFICATION_MOUSE_ENTER_SELF].
1273 </constant>
1274 <constant name="NOTIFICATION_MOUSE_EXIT" value="42">
1275 Sent 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 [member mouse_filter] lets the event reach it and regardless if it's currently focused or not.
1276 [b]Note:[/b] [member CanvasItem.z_index] doesn't affect which Control receives the notification.
1277 See also [constant NOTIFICATION_MOUSE_EXIT_SELF].
1278 </constant>
1279 <constant name="NOTIFICATION_MOUSE_ENTER_SELF" value="60" experimental="The reason this notification is sent may change in the future.">
1280 Sent when the mouse cursor enters the control's visible area, that is not occluded behind other Controls or Windows, provided its [member mouse_filter] lets the event reach it and regardless if it's currently focused or not.
1281 [b]Note:[/b] [member CanvasItem.z_index] doesn't affect which Control receives the notification.
1282 See also [constant NOTIFICATION_MOUSE_ENTER].
1283 </constant>
1284 <constant name="NOTIFICATION_MOUSE_EXIT_SELF" value="61" experimental="The reason this notification is sent may change in the future.">
1285 Sent when the mouse cursor leaves the control's visible area, that is not occluded behind other Controls or Windows, provided its [member mouse_filter] lets the event reach it and regardless if it's currently focused or not.
1286 [b]Note:[/b] [member CanvasItem.z_index] doesn't affect which Control receives the notification.
1287 See also [constant NOTIFICATION_MOUSE_EXIT].
1288 </constant>
1289 <constant name="NOTIFICATION_FOCUS_ENTER" value="43">
1290 Sent when the node grabs focus.
1291 </constant>
1292 <constant name="NOTIFICATION_FOCUS_EXIT" value="44">
1293 Sent when the node loses focus.
1294 This notification is sent in reversed order.
1295 </constant>
1296 <constant name="NOTIFICATION_THEME_CHANGED" value="45">
1297 Sent when the node needs to refresh its theme items. This happens in one of the following cases:
1298 - The [member theme] property is changed on this node or any of its ancestors.
1299 - The [member theme_type_variation] property is changed on this node.
1300 - One of the node's theme property overrides is changed.
1301 - The node enters the scene tree.
1302 [b]Note:[/b] As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree.
1303 [b]Note:[/b] This notification is received alongside [constant Node.NOTIFICATION_ENTER_TREE], so if you are instantiating a scene, the child nodes will not be initialized yet. You can use it to setup theming for this node, child nodes created from script, or if you want to access child nodes added in the editor, make sure the node is ready using [method Node.is_node_ready].
1304 [codeblock]
1305 func _notification(what):
1306 if what == NOTIFICATION_THEME_CHANGED:
1307 if not is_node_ready():
1308 await ready # Wait until ready signal.
1309 $Label.add_theme_color_override("font_color", Color.YELLOW)
1310 [/codeblock]
1311 </constant>
1312 <constant name="NOTIFICATION_SCROLL_BEGIN" value="47">
1313 Sent when this node is inside a [ScrollContainer] which has begun being scrolled when dragging the scrollable area [i]with a touch event[/i]. This notification is [i]not[/i] sent when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events.
1314 [b]Note:[/b] This signal is only emitted on Android or iOS, or on desktop/web platforms when [member ProjectSettings.input_devices/pointing/emulate_touch_from_mouse] is enabled.
1315 </constant>
1316 <constant name="NOTIFICATION_SCROLL_END" value="48">
1317 Sent when this node is inside a [ScrollContainer] which has stopped being scrolled when dragging the scrollable area [i]with a touch event[/i]. This notification is [i]not[/i] sent when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events.
1318 [b]Note:[/b] This signal is only emitted on Android or iOS, or on desktop/web platforms when [member ProjectSettings.input_devices/pointing/emulate_touch_from_mouse] is enabled.
1319 </constant>
1320 <constant name="NOTIFICATION_LAYOUT_DIRECTION_CHANGED" value="49">
1321 Sent when the control layout direction is changed from LTR or RTL or vice versa. This notification is propagated to child Control nodes as result of a change to [member layout_direction].
1322 </constant>
1323 <constant name="CURSOR_ARROW" value="0" enum="CursorShape">
1324 Show the system's arrow mouse cursor when the user hovers the node. Use with [member mouse_default_cursor_shape].
1325 </constant>
1326 <constant name="CURSOR_IBEAM" value="1" enum="CursorShape">
1327 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.
1328 </constant>
1329 <constant name="CURSOR_POINTING_HAND" value="2" enum="CursorShape">
1330 Show the system's pointing hand mouse cursor when the user hovers the node.
1331 </constant>
1332 <constant name="CURSOR_CROSS" value="3" enum="CursorShape">
1333 Show the system's cross mouse cursor when the user hovers the node.
1334 </constant>
1335 <constant name="CURSOR_WAIT" value="4" enum="CursorShape">
1336 Show the system's wait mouse cursor when the user hovers the node. Often an hourglass.
1337 </constant>
1338 <constant name="CURSOR_BUSY" value="5" enum="CursorShape">
1339 Show the system's busy mouse cursor when the user hovers the node. Often an arrow with a small hourglass.
1340 </constant>
1341 <constant name="CURSOR_DRAG" value="6" enum="CursorShape">
1342 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.
1343 </constant>
1344 <constant name="CURSOR_CAN_DROP" value="7" enum="CursorShape">
1345 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.
1346 </constant>
1347 <constant name="CURSOR_FORBIDDEN" value="8" enum="CursorShape">
1348 Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle.
1349 </constant>
1350 <constant name="CURSOR_VSIZE" value="9" enum="CursorShape">
1351 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.
1352 </constant>
1353 <constant name="CURSOR_HSIZE" value="10" enum="CursorShape">
1354 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.
1355 </constant>
1356 <constant name="CURSOR_BDIAGSIZE" value="11" enum="CursorShape">
1357 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.
1358 </constant>
1359 <constant name="CURSOR_FDIAGSIZE" value="12" enum="CursorShape">
1360 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 [constant CURSOR_BDIAGSIZE]. It tells the user they can resize the window or the panel both horizontally and vertically.
1361 </constant>
1362 <constant name="CURSOR_MOVE" value="13" enum="CursorShape">
1363 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.
1364 </constant>
1365 <constant name="CURSOR_VSPLIT" value="14" enum="CursorShape">
1366 Show the system's vertical split mouse cursor when the user hovers the node. On Windows, it's the same as [constant CURSOR_VSIZE].
1367 </constant>
1368 <constant name="CURSOR_HSPLIT" value="15" enum="CursorShape">
1369 Show the system's horizontal split mouse cursor when the user hovers the node. On Windows, it's the same as [constant CURSOR_HSIZE].
1370 </constant>
1371 <constant name="CURSOR_HELP" value="16" enum="CursorShape">
1372 Show the system's help mouse cursor when the user hovers the node, a question mark.
1373 </constant>
1374 <constant name="PRESET_TOP_LEFT" value="0" enum="LayoutPreset">
1375 Snap all 4 anchors to the top-left of the parent control's bounds. Use with [method set_anchors_preset].
1376 </constant>
1377 <constant name="PRESET_TOP_RIGHT" value="1" enum="LayoutPreset">
1378 Snap all 4 anchors to the top-right of the parent control's bounds. Use with [method set_anchors_preset].
1379 </constant>
1380 <constant name="PRESET_BOTTOM_LEFT" value="2" enum="LayoutPreset">
1381 Snap all 4 anchors to the bottom-left of the parent control's bounds. Use with [method set_anchors_preset].
1382 </constant>
1383 <constant name="PRESET_BOTTOM_RIGHT" value="3" enum="LayoutPreset">
1384 Snap all 4 anchors to the bottom-right of the parent control's bounds. Use with [method set_anchors_preset].
1385 </constant>
1386 <constant name="PRESET_CENTER_LEFT" value="4" enum="LayoutPreset">
1387 Snap all 4 anchors to the center of the left edge of the parent control's bounds. Use with [method set_anchors_preset].
1388 </constant>
1389 <constant name="PRESET_CENTER_TOP" value="5" enum="LayoutPreset">
1390 Snap all 4 anchors to the center of the top edge of the parent control's bounds. Use with [method set_anchors_preset].
1391 </constant>
1392 <constant name="PRESET_CENTER_RIGHT" value="6" enum="LayoutPreset">
1393 Snap all 4 anchors to the center of the right edge of the parent control's bounds. Use with [method set_anchors_preset].
1394 </constant>
1395 <constant name="PRESET_CENTER_BOTTOM" value="7" enum="LayoutPreset">
1396 Snap all 4 anchors to the center of the bottom edge of the parent control's bounds. Use with [method set_anchors_preset].
1397 </constant>
1398 <constant name="PRESET_CENTER" value="8" enum="LayoutPreset">
1399 Snap all 4 anchors to the center of the parent control's bounds. Use with [method set_anchors_preset].
1400 </constant>
1401 <constant name="PRESET_LEFT_WIDE" value="9" enum="LayoutPreset">
1402 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 [method set_anchors_preset].
1403 </constant>
1404 <constant name="PRESET_TOP_WIDE" value="10" enum="LayoutPreset">
1405 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 [method set_anchors_preset].
1406 </constant>
1407 <constant name="PRESET_RIGHT_WIDE" value="11" enum="LayoutPreset">
1408 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 [method set_anchors_preset].
1409 </constant>
1410 <constant name="PRESET_BOTTOM_WIDE" value="12" enum="LayoutPreset">
1411 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 [method set_anchors_preset].
1412 </constant>
1413 <constant name="PRESET_VCENTER_WIDE" value="13" enum="LayoutPreset">
1414 Snap all 4 anchors to a vertical line that cuts the parent control in half. Use with [method set_anchors_preset].
1415 </constant>
1416 <constant name="PRESET_HCENTER_WIDE" value="14" enum="LayoutPreset">
1417 Snap all 4 anchors to a horizontal line that cuts the parent control in half. Use with [method set_anchors_preset].
1418 </constant>
1419 <constant name="PRESET_FULL_RECT" value="15" enum="LayoutPreset">
1420 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 [method set_anchors_preset].
1421 </constant>
1422 <constant name="PRESET_MODE_MINSIZE" value="0" enum="LayoutPresetMode">
1423 The control will be resized to its minimum size.
1424 </constant>
1425 <constant name="PRESET_MODE_KEEP_WIDTH" value="1" enum="LayoutPresetMode">
1426 The control's width will not change.
1427 </constant>
1428 <constant name="PRESET_MODE_KEEP_HEIGHT" value="2" enum="LayoutPresetMode">
1429 The control's height will not change.
1430 </constant>
1431 <constant name="PRESET_MODE_KEEP_SIZE" value="3" enum="LayoutPresetMode">
1432 The control's size will not change.
1433 </constant>
1434 <constant name="SIZE_SHRINK_BEGIN" value="0" enum="SizeFlags" is_bitfield="true">
1435 Tells the parent [Container] to align the node with its start, either the top or the left edge. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
1436 [b]Note:[/b] Setting this flag is equal to not having any size flags.
1437 </constant>
1438 <constant name="SIZE_FILL" value="1" enum="SizeFlags" is_bitfield="true">
1439 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 [member size_flags_horizontal] and [member size_flags_vertical].
1440 </constant>
1441 <constant name="SIZE_EXPAND" value="2" enum="SizeFlags" is_bitfield="true">
1442 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].
1443 </constant>
1444 <constant name="SIZE_EXPAND_FILL" value="3" enum="SizeFlags" is_bitfield="true">
1445 Sets the node's size flags to both fill and expand. See [constant SIZE_FILL] and [constant SIZE_EXPAND] for more information.
1446 </constant>
1447 <constant name="SIZE_SHRINK_CENTER" value="4" enum="SizeFlags" is_bitfield="true">
1448 Tells the parent [Container] to center the node in the available space. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
1449 </constant>
1450 <constant name="SIZE_SHRINK_END" value="8" enum="SizeFlags" is_bitfield="true">
1451 Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It is mutually exclusive with [constant SIZE_FILL] and other shrink size flags, but can be used with [constant SIZE_EXPAND] in some containers. Use with [member size_flags_horizontal] and [member size_flags_vertical].
1452 </constant>
1453 <constant name="MOUSE_FILTER_STOP" value="0" enum="MouseFilter">
1454 The control will receive mouse movement input events and mouse button input events if clicked on through [method _gui_input]. The control will also 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.
1455 </constant>
1456 <constant name="MOUSE_FILTER_PASS" value="1" enum="MouseFilter">
1457 The control will receive mouse movement input events and mouse button input events if clicked on through [method _gui_input]. The control will also receive the [signal mouse_entered] and [signal mouse_exited] signals.
1458 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 [constant MOUSE_FILTER_STOP], or a [CanvasItem] with [member CanvasItem.top_level] enabled. This will allow signals to fire in all controls it reaches. If no control handled it, the event will be passed to [method Node._shortcut_input] for further processing.
1459 </constant>
1460 <constant name="MOUSE_FILTER_IGNORE" value="2" enum="MouseFilter">
1461 The control will not receive any mouse movement input events nor mouse button input events through [method _gui_input]. The control will also 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. If a child has [constant MOUSE_FILTER_PASS] and an event was passed to this control, the event will further propagate up to the control's parent.
1462 [b]Note:[/b] If the control has received [signal mouse_entered] but not [signal mouse_exited], changing the [member mouse_filter] to [constant MOUSE_FILTER_IGNORE] will cause [signal mouse_exited] to be emitted.
1463 </constant>
1464 <constant name="GROW_DIRECTION_BEGIN" value="0" enum="GrowDirection">
1465 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.
1466 </constant>
1467 <constant name="GROW_DIRECTION_END" value="1" enum="GrowDirection">
1468 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.
1469 </constant>
1470 <constant name="GROW_DIRECTION_BOTH" value="2" enum="GrowDirection">
1471 The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.
1472 </constant>
1473 <constant name="ANCHOR_BEGIN" value="0" enum="Anchor">
1474 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].
1475 </constant>
1476 <constant name="ANCHOR_END" value="1" enum="Anchor">
1477 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].
1478 </constant>
1479 <constant name="LAYOUT_DIRECTION_INHERITED" value="0" enum="LayoutDirection">
1480 Automatic layout direction, determined from the parent control layout direction.
1481 </constant>
1482 <constant name="LAYOUT_DIRECTION_APPLICATION_LOCALE" value="1" enum="LayoutDirection">
1483 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 [member 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] ([member 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 [member ProjectSettings.internationalization/rendering/force_right_to_left_layout_direction].
1484 </constant>
1485 <constant name="LAYOUT_DIRECTION_LTR" value="2" enum="LayoutDirection">
1486 Left-to-right layout direction.
1487 </constant>
1488 <constant name="LAYOUT_DIRECTION_RTL" value="3" enum="LayoutDirection">
1489 Right-to-left layout direction.
1490 </constant>
1491 <constant name="LAYOUT_DIRECTION_SYSTEM_LOCALE" value="4" enum="LayoutDirection">
1492 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] ([member ProjectSettings.internationalization/rendering/text_driver]), left-to-right layout direction is always used regardless of the language.
1493 </constant>
1494 <constant name="LAYOUT_DIRECTION_MAX" value="5" enum="LayoutDirection">
1495 Represents the size of the [enum LayoutDirection] enum.
1496 </constant>
1497 <constant name="LAYOUT_DIRECTION_LOCALE" value="1" enum="LayoutDirection" deprecated="Use [constant LAYOUT_DIRECTION_APPLICATION_LOCALE] instead.">
1498 </constant>
1499 <constant name="TEXT_DIRECTION_INHERITED" value="3" enum="TextDirection">
1500 Text writing direction is the same as layout direction.
1501 </constant>
1502 <constant name="TEXT_DIRECTION_AUTO" value="0" enum="TextDirection">
1503 Automatic text writing direction, determined from the current locale and text content.
1504 </constant>
1505 <constant name="TEXT_DIRECTION_LTR" value="1" enum="TextDirection">
1506 Left-to-right text writing direction.
1507 </constant>
1508 <constant name="TEXT_DIRECTION_RTL" value="2" enum="TextDirection">
1509 Right-to-left text writing direction.
1510 </constant>
1511 </constants>
1512 </class>