/
Control.hx
1604 lines (1245 loc) · 67.7 KB
/
Control.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Automatically generated Godot externs: DO NOT EDIT
// MIT licensed, see LICENSE.md
package godot;
import cs.system.*;
/**
Base class for all UI-related nodes. `godot.Control` features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, and margins that represent an offset to the anchor. The margins update automatically when the node, any of its parents, or the screen size change.
For more information on Godot's UI system, anchors, margins, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from `godot.Control` and `godot.Container` nodes.
User Interface nodes and input
Godot sends input events to the scene's root node first, by calling `godot.Node._Input`. `godot.Node._Input` forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls `godot.MainLoop._InputEvent`. Call `godot.Control.acceptEvent` so no other node receives the event. Once you accept an input, it becomes handled so `godot.Node._UnhandledInput` will not process it.
Only one `godot.Control` node can be in keyboard focus. Only the node in focus will receive keyboard events. To get the focus, call `godot.Control.grabFocus`. `godot.Control` nodes lose focus when another node grabs it, or if you hide the node in focus.
Sets `godot.Control.mouseFilter` to `godot.Control_MouseFilterEnum.ignore` to tell a `godot.Control` node to ignore mouse or touch events. You'll need it if you place an icon on top of a button.
`godot.Theme` resources change the Control's appearance. If you change the `godot.Theme` on a `godot.Control` node, it affects all of its children. To override some of the theme's parameters, call one of the `add_*_override` methods, like `godot.Control.addFontOverride`. You can override the theme with the inspector.
Note: Theme items are not `godot.Object` properties. This means you can't access their values using `godot.Object.get` and `godot.Object.set`. Instead, use `godot.Control.getColor`, `godot.Control.getConstant`, `godot.Control.getFont`, `godot.Control.getIcon`, `godot.Control.getStylebox`, and the `add_*_override` methods provided by this class.
**/
@:libType
@:csNative
@:native("Godot.Control")
@:autoBuild(godot.Godot.buildUserClass())
extern class Control extends godot.CanvasItem {
/**
`focus_entered` signal.
**/
public var onFocusEntered(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onFocusEntered():Signal<Void->Void> {
return new Signal(this, "focus_entered", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
`focus_exited` signal.
**/
public var onFocusExited(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onFocusExited():Signal<Void->Void> {
return new Signal(this, "focus_exited", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
`gui_input` signal.
**/
public var onGuiInput(get, never):Signal<(event:InputEvent)->Void>;
@:dox(hide) @:noCompletion inline function get_onGuiInput():Signal<(event:InputEvent)->Void> {
return new Signal(this, "gui_input", Signal.SignalHandlerInputEventVoid.connectSignal, Signal.SignalHandlerInputEventVoid.disconnectSignal, Signal.SignalHandlerInputEventVoid.isSignalConnected);
}
/**
`minimum_size_changed` signal.
**/
public var onMinimumSizeChanged(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onMinimumSizeChanged():Signal<Void->Void> {
return new Signal(this, "minimum_size_changed", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
`modal_closed` signal.
**/
public var onModalClosed(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onModalClosed():Signal<Void->Void> {
return new Signal(this, "modal_closed", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
`mouse_entered` signal.
**/
public var onMouseEntered(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onMouseEntered():Signal<Void->Void> {
return new Signal(this, "mouse_entered", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
`mouse_exited` signal.
**/
public var onMouseExited(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onMouseExited():Signal<Void->Void> {
return new Signal(this, "mouse_exited", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
`resized` signal.
**/
public var onResized(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onResized():Signal<Void->Void> {
return new Signal(this, "resized", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
`size_flags_changed` signal.
**/
public var onSizeFlagsChanged(get, never):Signal<Void->Void>;
@:dox(hide) @:noCompletion inline function get_onSizeFlagsChanged():Signal<Void->Void> {
return new Signal(this, "size_flags_changed", Signal.SignalHandlerVoidVoid.connectSignal, Signal.SignalHandlerVoidVoid.disconnectSignal, Signal.SignalHandlerVoidVoid.isSignalConnected);
}
/**
Changing this property replaces the current `godot.Theme` resource this node and all its `godot.Control` children use.
**/
@:native("Theme")
public var theme:godot.Theme;
/**
If the node and at least one of its neighbours uses the `godot.Control_SizeFlags.expand` size flag, the parent `godot.Container` will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbour a ratio of 1, this node will take two thirds of the available space.
**/
@:native("SizeFlagsStretchRatio")
public var sizeFlagsStretchRatio:Single;
/**
Tells the parent `godot.Container` nodes how they should resize and place the node on the Y axis. Use one of the `godot.Control_SizeFlags` constants to change the flags. See the constants to learn what each does.
**/
@:native("SizeFlagsVertical")
public var sizeFlagsVertical:Int;
/**
Tells the parent `godot.Container` nodes how they should resize and place the node on the X axis. Use one of the `godot.Control_SizeFlags` constants to change the flags. See the constants to learn what each does.
**/
@:native("SizeFlagsHorizontal")
public var sizeFlagsHorizontal:Int;
/**
Enables whether input should propagate when you close the control as modal.
If `false`, stops event handling at the viewport input event handling. The viewport first hides the modal and after marks the input as handled.
**/
@:native("InputPassOnModalCloseClick")
public var inputPassOnModalCloseClick:Bool;
/**
The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors.
Note: On Linux, shapes may vary depending on the cursor theme of the system.
**/
@:native("MouseDefaultCursorShape")
public var mouseDefaultCursorShape:godot.Control_CursorShape;
/**
Controls whether the control will be able to receive mouse button input events through `godot.Control._GuiInput` and how these events should be handled. Also controls whether the control can receive the `mouse_entered`, and `mouse_exited` signals. See the constants to learn what each does.
**/
@:native("MouseFilter")
public var mouseFilter:godot.Control_MouseFilterEnum;
/**
The focus access mode for the control (None, Click or All). Only one Control can be focused at the same time, and it will receive keyboard signals.
**/
@:native("FocusMode")
public var focusMode:godot.Control_FocusModeEnum;
/**
Tells Godot which node it should give keyboard focus to if the user presses Shift+Tab on a keyboard by default. You can change the key by editing the `ui_focus_prev` input action.
If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
**/
@:native("FocusPrevious")
public var focusPrevious:godot.NodePath;
/**
Tells Godot which node it should give keyboard focus to if the user presses Tab on a keyboard by default. You can change the key by editing the `ui_focus_next` input action.
If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
**/
@:native("FocusNext")
public var focusNext:godot.NodePath;
/**
Tells Godot which node it should give keyboard focus to if the user presses the down arrow on the keyboard or down on a gamepad by default. You can change the key by editing the `ui_down` input action. The node must be a `godot.Control`. If this property is not set, Godot will give focus to the closest `godot.Control` to the bottom of this one.
**/
@:native("FocusNeighbourBottom")
public var focusNeighbourBottom:godot.NodePath;
/**
Tells Godot which node it should give keyboard focus to if the user presses the right arrow on the keyboard or right on a gamepad by default. You can change the key by editing the `ui_right` input action. The node must be a `godot.Control`. If this property is not set, Godot will give focus to the closest `godot.Control` to the bottom of this one.
**/
@:native("FocusNeighbourRight")
public var focusNeighbourRight:godot.NodePath;
/**
Tells Godot which node it should give keyboard focus to if the user presses the top arrow on the keyboard or top on a gamepad by default. You can change the key by editing the `ui_top` input action. The node must be a `godot.Control`. If this property is not set, Godot will give focus to the closest `godot.Control` to the bottom of this one.
**/
@:native("FocusNeighbourTop")
public var focusNeighbourTop:godot.NodePath;
/**
Tells Godot which node it should give keyboard focus to if the user presses the left arrow on the keyboard or left on a gamepad by default. You can change the key by editing the `ui_left` input action. The node must be a `godot.Control`. If this property is not set, Godot will give focus to the closest `godot.Control` to the left of this one.
**/
@:native("FocusNeighbourLeft")
public var focusNeighbourLeft:godot.NodePath;
/**
Changes the tooltip text. The tooltip appears when the user's mouse cursor stays idle over this control for a few moments, provided that the `godot.Control.mouseFilter` property is not `godot.Control_MouseFilterEnum.ignore`. You can change the time required for the tooltip to appear with `gui/timers/tooltip_delay_sec` option in Project Settings.
The tooltip popup will use either a default implementation, or a custom one that you can provide by overriding `godot.Control._MakeCustomTooltip`. The default tooltip includes a `godot.PopupPanel` and `godot.Label` whose theme properties can be customized using `godot.Theme` methods with the `"TooltipPanel"` and `"TooltipLabel"` respectively. For example:
```
var style_box = StyleBoxFlat.new()
style_box.set_bg_color(Color(1, 1, 0))
style_box.set_border_width_all(2)
# We assume here that the `theme` property has been assigned a custom Theme beforehand.
theme.set_stylebox("panel", "TooltipPanel", style_box)
theme.set_color("font_color", "TooltipLabel", Color(0, 1, 1))
```
**/
@:native("HintTooltip")
public var hintTooltip:std.String;
/**
Enables whether rendering of `godot.CanvasItem` based children should be clipped to this control's rectangle. If `true`, parts of a child which would be visibly outside of this control's rectangle will not be rendered.
**/
@:native("RectClipContent")
public var rectClipContent:Bool;
/**
By default, the node's pivot is its top-left corner. When you change its `godot.Control.rectRotation` or `godot.Control.rectScale`, it will rotate or scale around this pivot. Set this property to `godot.Control.rectSize` / 2 to pivot around the Control's center.
**/
@:native("RectPivotOffset")
public var rectPivotOffset:godot.Vector2;
/**
The node's scale, relative to its `godot.Control.rectSize`. Change this property to scale the node around its `godot.Control.rectPivotOffset`. The Control's `godot.Control.hintTooltip` will also scale according to this value.
Note: This property is mainly intended to be used for animation purposes. Text inside the Control will look pixelated or blurry when the Control is scaled. To support multiple resolutions in your project, use an appropriate viewport stretch mode as described in the [https://docs.godotengine.org/en/3.4/tutorials/rendering/multiple_resolutions.html](documentation) instead of scaling Controls individually.
Note: If the Control node is a child of a `godot.Container` node, the scale will be reset to `Vector2(1, 1)` when the scene is instanced. To set the Control's scale when it's instanced, wait for one frame using `yield(get_tree(), "idle_frame")` then set its `godot.Control.rectScale` property.
**/
@:native("RectScale")
public var rectScale:godot.Vector2;
/**
The node's rotation around its pivot, in degrees. See `godot.Control.rectPivotOffset` to change the pivot's position.
**/
@:native("RectRotation")
public var rectRotation:Single;
/**
The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes.
**/
@:native("RectMinSize")
public var rectMinSize:godot.Vector2;
/**
The size of the node's bounding rectangle, in pixels. `godot.Container` nodes update this property automatically.
**/
@:native("RectSize")
public var rectSize:godot.Vector2;
/**
The node's global position, relative to the world (usually to the top-left corner of the window).
**/
@:native("RectGlobalPosition")
public var rectGlobalPosition:godot.Vector2;
/**
The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by `godot.Control.rectPivotOffset`.
**/
@:native("RectPosition")
public var rectPosition:godot.Vector2;
/**
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.
**/
@:native("GrowVertical")
public var growVertical:godot.Control_GrowDirection;
/**
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.
**/
@:native("GrowHorizontal")
public var growHorizontal:godot.Control_GrowDirection;
/**
Distance between the node's bottom edge and its parent control, based on `godot.Control.anchorBottom`.
Margins are often controlled by one or multiple parent `godot.Container` nodes, so you should not modify them manually if your node is a direct child of a `godot.Container`. Margins update automatically when you move or resize the node.
**/
@:native("MarginBottom")
public var marginBottom:Single;
/**
Distance between the node's right edge and its parent control, based on `godot.Control.anchorRight`.
Margins are often controlled by one or multiple parent `godot.Container` nodes, so you should not modify them manually if your node is a direct child of a `godot.Container`. Margins update automatically when you move or resize the node.
**/
@:native("MarginRight")
public var marginRight:Single;
/**
Distance between the node's top edge and its parent control, based on `godot.Control.anchorTop`.
Margins are often controlled by one or multiple parent `godot.Container` nodes, so you should not modify them manually if your node is a direct child of a `godot.Container`. Margins update automatically when you move or resize the node.
**/
@:native("MarginTop")
public var marginTop:Single;
/**
Distance between the node's left edge and its parent control, based on `godot.Control.anchorLeft`.
Margins are often controlled by one or multiple parent `godot.Container` nodes, so you should not modify them manually if your node is a direct child of a `godot.Container`. Margins update automatically when you move or resize the node.
**/
@:native("MarginLeft")
public var marginLeft:Single;
/**
Anchors the bottom edge of the node to the origin, the center, or the end of its parent control. It changes how the bottom margin updates when the node moves or changes size. You can use one of the `godot.Control_Anchor` constants for convenience.
**/
@:native("AnchorBottom")
public var anchorBottom:Single;
/**
Anchors the right edge of the node to the origin, the center or the end of its parent control. It changes how the right margin updates when the node moves or changes size. You can use one of the `godot.Control_Anchor` constants for convenience.
**/
@:native("AnchorRight")
public var anchorRight:Single;
/**
Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top margin updates when the node moves or changes size. You can use one of the `godot.Control_Anchor` constants for convenience.
**/
@:native("AnchorTop")
public var anchorTop:Single;
/**
Anchors the left edge of the node to the origin, the center or the end of its parent control. It changes how the left margin updates when the node moves or changes size. You can use one of the `godot.Control_Anchor` constants for convenience.
**/
@:native("AnchorLeft")
public var anchorLeft:Single;
/**
Sent when this node is inside a `godot.ScrollContainer` which has stopped being scrolled.
**/
@:native("NotificationScrollEnd")
public static var NOTIFICATION_SCROLL_END(default, never):Int;
/**
Sent when this node is inside a `godot.ScrollContainer` which has begun being scrolled.
**/
@:native("NotificationScrollBegin")
public static var NOTIFICATION_SCROLL_BEGIN(default, never):Int;
/**
Sent when an open modal dialog closes. See `godot.Control.showModal`.
**/
@:native("NotificationModalClose")
public static var NOTIFICATION_MODAL_CLOSE(default, never):Int;
/**
Sent when the node's `godot.Control.theme` changes, right before Godot redraws the control. Happens when you call one of the `add_*_override` methods.
**/
@:native("NotificationThemeChanged")
public static var NOTIFICATION_THEME_CHANGED(default, never):Int;
/**
Sent when the node loses focus.
**/
@:native("NotificationFocusExit")
public static var NOTIFICATION_FOCUS_EXIT(default, never):Int;
/**
Sent when the node grabs focus.
**/
@:native("NotificationFocusEnter")
public static var NOTIFICATION_FOCUS_ENTER(default, never):Int;
/**
Sent when the mouse pointer exits the node.
**/
@:native("NotificationMouseExit")
public static var NOTIFICATION_MOUSE_EXIT(default, never):Int;
/**
Sent when the mouse pointer enters the node.
**/
@:native("NotificationMouseEnter")
public static var NOTIFICATION_MOUSE_ENTER(default, never):Int;
/**
Sent when the node changes size. Use `godot.Control.rectSize` to get the new size.
**/
@:native("NotificationResized")
public static var NOTIFICATION_RESIZED(default, never):Int;
@:native("new")
public function new():Void;
/**
Virtual method to be implemented by the user. Returns whether `godot.Control._GuiInput` should not be called for children controls outside this control's rectangle. Input will be clipped to the Rect of this `godot.Control`. Similar to `godot.Control.rectClipContent`, but doesn't affect visibility.
If not overridden, defaults to `false`.
**/
@:native("_ClipsInput")
public function _ClipsInput():Bool;
/**
Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to `godot.Control.rectMinSize` for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately).
If not overridden, defaults to `Vector2.ZERO`.
**/
@:native("_GetMinimumSize")
public function _GetMinimumSize():godot.Vector2;
/**
Virtual method to be implemented by the user. Use this method to process and accept inputs on UI elements. See `godot.Control.acceptEvent`.
Example: clicking a control.
```
func _gui_input(event):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
print("I've been clicked D:")
```
The event won't trigger if:
* clicking outside the control (see `godot.Control.hasPoint`);
* control has `godot.Control.mouseFilter` set to `godot.Control_MouseFilterEnum.ignore`;
* control is obstructed by another `godot.Control` on top of it, which doesn't have `godot.Control.mouseFilter` set to `godot.Control_MouseFilterEnum.ignore`;
* control's parent has `godot.Control.mouseFilter` set to `godot.Control_MouseFilterEnum.stop` or has accepted the event;
* it happens outside the parent's rectangle and the parent has either `godot.Control.rectClipContent` or `godot.Control._ClipsInput` enabled.
Note: Event position is relative to the control origin.
**/
@:native("_GuiInput")
public function _GuiInput(event:godot.InputEvent):Void;
/**
Virtual method to be implemented by the user. Returns a `godot.Control` node that should be used as a tooltip instead of the default one. The `for_text` includes the contents of the `godot.Control.hintTooltip` property.
The returned node must be of type `godot.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 `null` or a non-Control node is returned, the default tooltip will be used instead.
The returned node will be added as child to a `godot.PopupPanel`, so you should only provide the contents of that panel. That `godot.PopupPanel` can be themed using `godot.Theme.setStylebox` for the type `"TooltipPanel"` (see `godot.Control.hintTooltip` for an example).
Note: The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its `godot.Control.rectMinSize` to some non-zero value.
Example of usage with a custom-constructed node:
```
func _make_custom_tooltip(for_text):
var label = Label.new()
label.text = for_text
return label
```
Example of usage with a custom scene instance:
```
func _make_custom_tooltip(for_text):
var tooltip = preload("res://SomeTooltipScene.tscn").instance()
tooltip.get_node("Label").text = for_text
return tooltip
```
**/
@:native("_MakeCustomTooltip")
public function _MakeCustomTooltip(forText:std.String):godot.Control;
/**
Godot calls this method to test if `data` from a control's `godot.Control.getDragData` can be dropped at `position`. `position` is local to this control.
This method should only be used to test the data. Process the data in `godot.Control.dropData`.
```
func can_drop_data(position, data):
# Check position if it is relevant to you
# Otherwise, just check data
return typeof(data) == TYPE_DICTIONARY and data.has("expected")
```
**/
@:native("CanDropData")
public function canDropData(position:godot.Vector2, data:Dynamic):Bool;
/**
Godot calls this method to pass you the `data` from a control's `godot.Control.getDragData` result. Godot first calls `godot.Control.canDropData` to test if `data` is allowed to drop at `position` where `position` is local to this control.
```
func can_drop_data(position, data):
return typeof(data) == TYPE_DICTIONARY and data.has("color")
func drop_data(position, data):
color = data["color"]
```
**/
@:native("DropData")
public function dropData(position:godot.Vector2, data:Dynamic):Void;
/**
Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns `null` if there is no data to drag. Controls that want to receive drop data should implement `godot.Control.canDropData` and `godot.Control.dropData`. `position` is local to this control. Drag may be forced with `godot.Control.forceDrag`.
A preview that will follow the mouse that should represent the data can be set with `godot.Control.setDragPreview`. A good time to set the preview is in this method.
```
func get_drag_data(position):
var mydata = make_data()
set_drag_preview(make_preview(mydata))
return mydata
```
**/
@:native("GetDragData")
public function getDragData(position:godot.Vector2):Dynamic;
/**
Virtual method to be implemented by the user. Returns whether the given `point` is inside this control.
If not overridden, default behavior is checking if the point is within control's Rect.
Note: If you want to check if a point is inside the control, you can use `get_rect().has_point(point)`.
**/
@:native("HasPoint")
public function hasPoint(point:godot.Vector2):Bool;
/**
Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to `godot.Node._UnhandledInput` or `godot.Node._UnhandledKeyInput`.
**/
@:native("AcceptEvent")
public function acceptEvent():Void;
/**
Returns the minimum size for this control. See `godot.Control.rectMinSize`.
**/
@:native("GetMinimumSize")
public function getMinimumSize():godot.Vector2;
/**
Returns combined minimum size from `godot.Control.rectMinSize` and `godot.Control.getMinimumSize`.
**/
@:native("GetCombinedMinimumSize")
public function getCombinedMinimumSize():godot.Vector2;
#if doc_gen
/**
Sets the anchors to a `preset` from `godot.Control_LayoutPreset` enum. This is the code equivalent to using the Layout menu in the 2D editor.
If `keep_margins` is `true`, control's position will also be updated.
**/
@:native("SetAnchorsPreset")
public function setAnchorsPreset(preset:godot.Control_LayoutPreset, ?keepMargins:Bool):Void;
#else
/**
Sets the anchors to a `preset` from `godot.Control_LayoutPreset` enum. This is the code equivalent to using the Layout menu in the 2D editor.
If `keep_margins` is `true`, control's position will also be updated.
**/
@:native("SetAnchorsPreset")
public overload function setAnchorsPreset(preset:godot.Control_LayoutPreset):Void;
/**
Sets the anchors to a `preset` from `godot.Control_LayoutPreset` enum. This is the code equivalent to using the Layout menu in the 2D editor.
If `keep_margins` is `true`, control's position will also be updated.
**/
@:native("SetAnchorsPreset")
public overload function setAnchorsPreset(preset:godot.Control_LayoutPreset, keepMargins:Bool):Void;
#end
#if doc_gen
/**
Sets the margins to a `preset` from `godot.Control_LayoutPreset` enum. This is the code equivalent to using the Layout menu in the 2D editor.
Use parameter `resize_mode` with constants from `godot.Control_LayoutPresetMode` to better determine the resulting size of the `godot.Control`. Constant size will be ignored if used with presets that change size, e.g. `PRESET_LEFT_WIDE`.
Use parameter `margin` to determine the gap between the `godot.Control` and the edges.
**/
@:native("SetMarginsPreset")
public function setMarginsPreset(preset:godot.Control_LayoutPreset, ?resizeMode:godot.Control_LayoutPresetMode, ?margin:Int):Void;
#else
/**
Sets the margins to a `preset` from `godot.Control_LayoutPreset` enum. This is the code equivalent to using the Layout menu in the 2D editor.
Use parameter `resize_mode` with constants from `godot.Control_LayoutPresetMode` to better determine the resulting size of the `godot.Control`. Constant size will be ignored if used with presets that change size, e.g. `PRESET_LEFT_WIDE`.
Use parameter `margin` to determine the gap between the `godot.Control` and the edges.
**/
@:native("SetMarginsPreset")
public overload function setMarginsPreset(preset:godot.Control_LayoutPreset):Void;
/**
Sets the margins to a `preset` from `godot.Control_LayoutPreset` enum. This is the code equivalent to using the Layout menu in the 2D editor.
Use parameter `resize_mode` with constants from `godot.Control_LayoutPresetMode` to better determine the resulting size of the `godot.Control`. Constant size will be ignored if used with presets that change size, e.g. `PRESET_LEFT_WIDE`.
Use parameter `margin` to determine the gap between the `godot.Control` and the edges.
**/
@:native("SetMarginsPreset")
public overload function setMarginsPreset(preset:godot.Control_LayoutPreset, resizeMode:godot.Control_LayoutPresetMode):Void;
/**
Sets the margins to a `preset` from `godot.Control_LayoutPreset` enum. This is the code equivalent to using the Layout menu in the 2D editor.
Use parameter `resize_mode` with constants from `godot.Control_LayoutPresetMode` to better determine the resulting size of the `godot.Control`. Constant size will be ignored if used with presets that change size, e.g. `PRESET_LEFT_WIDE`.
Use parameter `margin` to determine the gap between the `godot.Control` and the edges.
**/
@:native("SetMarginsPreset")
public overload function setMarginsPreset(preset:godot.Control_LayoutPreset, resizeMode:godot.Control_LayoutPresetMode, margin:Int):Void;
#end
#if doc_gen
/**
Sets both anchor preset and margin preset. See `godot.Control.setAnchorsPreset` and `godot.Control.setMarginsPreset`.
**/
@:native("SetAnchorsAndMarginsPreset")
public function setAnchorsAndMarginsPreset(preset:godot.Control_LayoutPreset, ?resizeMode:godot.Control_LayoutPresetMode, ?margin:Int):Void;
#else
/**
Sets both anchor preset and margin preset. See `godot.Control.setAnchorsPreset` and `godot.Control.setMarginsPreset`.
**/
@:native("SetAnchorsAndMarginsPreset")
public overload function setAnchorsAndMarginsPreset(preset:godot.Control_LayoutPreset):Void;
/**
Sets both anchor preset and margin preset. See `godot.Control.setAnchorsPreset` and `godot.Control.setMarginsPreset`.
**/
@:native("SetAnchorsAndMarginsPreset")
public overload function setAnchorsAndMarginsPreset(preset:godot.Control_LayoutPreset, resizeMode:godot.Control_LayoutPresetMode):Void;
/**
Sets both anchor preset and margin preset. See `godot.Control.setAnchorsPreset` and `godot.Control.setMarginsPreset`.
**/
@:native("SetAnchorsAndMarginsPreset")
public overload function setAnchorsAndMarginsPreset(preset:godot.Control_LayoutPreset, resizeMode:godot.Control_LayoutPresetMode, margin:Int):Void;
#end
#if doc_gen
/**
Sets the anchor identified by `margin` constant from `godot.Margin` enum to value `anchor`. A setter method for `godot.Control.anchorBottom`, `godot.Control.anchorLeft`, `godot.Control.anchorRight` and `godot.Control.anchorTop`.
If `keep_margin` is `true`, margins aren't updated after this operation.
If `push_opposite_anchor` is `true` 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 `push_opposite_anchor` was `false`, the left anchor would get value 0.5.
**/
@:native("SetAnchor")
public function setAnchor(margin:godot.Margin, anchor:Single, ?keepMargin:Bool, ?pushOppositeAnchor:Bool):Void;
#else
/**
Sets the anchor identified by `margin` constant from `godot.Margin` enum to value `anchor`. A setter method for `godot.Control.anchorBottom`, `godot.Control.anchorLeft`, `godot.Control.anchorRight` and `godot.Control.anchorTop`.
If `keep_margin` is `true`, margins aren't updated after this operation.
If `push_opposite_anchor` is `true` 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 `push_opposite_anchor` was `false`, the left anchor would get value 0.5.
**/
@:native("SetAnchor")
public overload function setAnchor(margin:godot.Margin, anchor:Single):Void;
/**
Sets the anchor identified by `margin` constant from `godot.Margin` enum to value `anchor`. A setter method for `godot.Control.anchorBottom`, `godot.Control.anchorLeft`, `godot.Control.anchorRight` and `godot.Control.anchorTop`.
If `keep_margin` is `true`, margins aren't updated after this operation.
If `push_opposite_anchor` is `true` 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 `push_opposite_anchor` was `false`, the left anchor would get value 0.5.
**/
@:native("SetAnchor")
public overload function setAnchor(margin:godot.Margin, anchor:Single, keepMargin:Bool):Void;
/**
Sets the anchor identified by `margin` constant from `godot.Margin` enum to value `anchor`. A setter method for `godot.Control.anchorBottom`, `godot.Control.anchorLeft`, `godot.Control.anchorRight` and `godot.Control.anchorTop`.
If `keep_margin` is `true`, margins aren't updated after this operation.
If `push_opposite_anchor` is `true` 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 `push_opposite_anchor` was `false`, the left anchor would get value 0.5.
**/
@:native("SetAnchor")
public overload function setAnchor(margin:godot.Margin, anchor:Single, keepMargin:Bool, pushOppositeAnchor:Bool):Void;
#end
/**
Returns the anchor identified by `margin` constant from `godot.Margin` enum. A getter method for `godot.Control.anchorBottom`, `godot.Control.anchorLeft`, `godot.Control.anchorRight` and `godot.Control.anchorTop`.
**/
@:native("GetAnchor")
public function getAnchor(margin:godot.Margin):Single;
/**
Sets the margin identified by `margin` constant from `godot.Margin` enum to given `offset`. A setter method for `godot.Control.marginBottom`, `godot.Control.marginLeft`, `godot.Control.marginRight` and `godot.Control.marginTop`.
**/
@:native("SetMargin")
public function setMargin(margin:godot.Margin, offset:Single):Void;
#if doc_gen
/**
Works the same as `godot.Control.setAnchor`, but instead of `keep_margin` argument and automatic update of margin, it allows to set the margin offset yourself (see `godot.Control.setMargin`).
**/
@:native("SetAnchorAndMargin")
public function setAnchorAndMargin(margin:godot.Margin, anchor:Single, offset:Single, ?pushOppositeAnchor:Bool):Void;
#else
/**
Works the same as `godot.Control.setAnchor`, but instead of `keep_margin` argument and automatic update of margin, it allows to set the margin offset yourself (see `godot.Control.setMargin`).
**/
@:native("SetAnchorAndMargin")
public overload function setAnchorAndMargin(margin:godot.Margin, anchor:Single, offset:Single):Void;
/**
Works the same as `godot.Control.setAnchor`, but instead of `keep_margin` argument and automatic update of margin, it allows to set the margin offset yourself (see `godot.Control.setMargin`).
**/
@:native("SetAnchorAndMargin")
public overload function setAnchorAndMargin(margin:godot.Margin, anchor:Single, offset:Single, pushOppositeAnchor:Bool):Void;
#end
/**
Sets `godot.Control.marginLeft` and `godot.Control.marginTop` at the same time. Equivalent of changing `godot.Control.rectPosition`.
**/
@:native("SetBegin")
public function setBegin(position:godot.Vector2):Void;
/**
Sets `godot.Control.marginRight` and `godot.Control.marginBottom` at the same time.
**/
@:native("SetEnd")
public function setEnd(position:godot.Vector2):Void;
#if doc_gen
/**
Sets the `godot.Control.rectPosition` to given `position`.
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetPosition")
public function setPosition(position:godot.Vector2, ?keepMargins:Bool):Void;
#else
/**
Sets the `godot.Control.rectPosition` to given `position`.
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetPosition")
public overload function setPosition(position:godot.Vector2):Void;
/**
Sets the `godot.Control.rectPosition` to given `position`.
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetPosition")
public overload function setPosition(position:godot.Vector2, keepMargins:Bool):Void;
#end
#if doc_gen
/**
Sets the size (see `godot.Control.rectSize`).
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetSize")
public function setSize(size:godot.Vector2, ?keepMargins:Bool):Void;
#else
/**
Sets the size (see `godot.Control.rectSize`).
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetSize")
public overload function setSize(size:godot.Vector2):Void;
/**
Sets the size (see `godot.Control.rectSize`).
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetSize")
public overload function setSize(size:godot.Vector2, keepMargins:Bool):Void;
#end
@:native("SetCustomMinimumSize")
public function setCustomMinimumSize(size:godot.Vector2):Void;
#if doc_gen
/**
Sets the `godot.Control.rectGlobalPosition` to given `position`.
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetGlobalPosition")
public function setGlobalPosition(position:godot.Vector2, ?keepMargins:Bool):Void;
#else
/**
Sets the `godot.Control.rectGlobalPosition` to given `position`.
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetGlobalPosition")
public overload function setGlobalPosition(position:godot.Vector2):Void;
/**
Sets the `godot.Control.rectGlobalPosition` to given `position`.
If `keep_margins` is `true`, control's anchors will be updated instead of margins.
**/
@:native("SetGlobalPosition")
public overload function setGlobalPosition(position:godot.Vector2, keepMargins:Bool):Void;
#end
/**
Sets the rotation (in radians).
**/
@:native("SetRotation")
public function setRotation(radians:Single):Void;
@:native("SetRotationDegrees")
public function setRotationDegrees(degrees:Single):Void;
@:native("SetScale")
public function setScale(scale:godot.Vector2):Void;
@:native("SetPivotOffset")
public function setPivotOffset(pivotOffset:godot.Vector2):Void;
/**
Returns the anchor identified by `margin` constant from `godot.Margin` enum. A getter method for `godot.Control.marginBottom`, `godot.Control.marginLeft`, `godot.Control.marginRight` and `godot.Control.marginTop`.
**/
@:native("GetMargin")
public function getMargin(margin:godot.Margin):Single;
/**
Returns `godot.Control.marginLeft` and `godot.Control.marginTop`. See also `godot.Control.rectPosition`.
**/
@:native("GetBegin")
public function getBegin():godot.Vector2;
/**
Returns `godot.Control.marginRight` and `godot.Control.marginBottom`.
**/
@:native("GetEnd")
public function getEnd():godot.Vector2;
@:native("GetPosition")
public function getPosition():godot.Vector2;
@:native("GetSize")
public function getSize():godot.Vector2;
/**
Returns the rotation (in radians).
**/
@:native("GetRotation")
public function getRotation():Single;
@:native("GetRotationDegrees")
public function getRotationDegrees():Single;
@:native("GetScale")
public function getScale():godot.Vector2;
@:native("GetPivotOffset")
public function getPivotOffset():godot.Vector2;
@:native("GetCustomMinimumSize")
public function getCustomMinimumSize():godot.Vector2;
/**
Returns the width/height occupied in the parent control.
**/
@:native("GetParentAreaSize")
public function getParentAreaSize():godot.Vector2;
@:native("GetGlobalPosition")
public function getGlobalPosition():godot.Vector2;
/**
Returns the position and size of the control relative to the top-left corner of the parent Control. See `godot.Control.rectPosition` and `godot.Control.rectSize`.
**/
@:native("GetRect")
public function getRect():godot.Rect2;
/**
Returns the position and size of the control relative to the top-left corner of the screen. See `godot.Control.rectPosition` and `godot.Control.rectSize`.
**/
@:native("GetGlobalRect")
public function getGlobalRect():godot.Rect2;
#if doc_gen
/**
Displays a control as modal. Control must be a subwindow. Modal controls capture the input signals until closed or the area outside them is accessed. When a modal control loses focus, or the ESC key is pressed, they automatically hide. Modal controls are used extensively for popup dialogs and menus.
If `exclusive` is `true`, other controls will not receive input and clicking outside this control will not close it.
**/
@:native("ShowModal")
public function showModal(?exclusive:Bool):Void;
#else
/**
Displays a control as modal. Control must be a subwindow. Modal controls capture the input signals until closed or the area outside them is accessed. When a modal control loses focus, or the ESC key is pressed, they automatically hide. Modal controls are used extensively for popup dialogs and menus.
If `exclusive` is `true`, other controls will not receive input and clicking outside this control will not close it.
**/
@:native("ShowModal")
public overload function showModal():Void;
/**
Displays a control as modal. Control must be a subwindow. Modal controls capture the input signals until closed or the area outside them is accessed. When a modal control loses focus, or the ESC key is pressed, they automatically hide. Modal controls are used extensively for popup dialogs and menus.
If `exclusive` is `true`, other controls will not receive input and clicking outside this control will not close it.
**/
@:native("ShowModal")
public overload function showModal(exclusive:Bool):Void;
#end
@:native("SetFocusMode")
public function setFocusMode(mode:godot.Control_FocusModeEnum):Void;
@:native("GetFocusMode")
public function getFocusMode():godot.Control_FocusModeEnum;
/**
Returns `true` if this is the current focused control. See `godot.Control.focusMode`.
**/
@:native("HasFocus")
public function hasFocus():Bool;
/**
Steal the focus from another control and become the focused control (see `godot.Control.focusMode`).
**/
@:native("GrabFocus")
public function grabFocus():Void;
/**
Give up the focus. No other control will be able to receive keyboard input.
**/
@:native("ReleaseFocus")
public function releaseFocus():Void;
/**
Finds the previous (above in the tree) `godot.Control` that can receive the focus.
**/
@:native("FindPrevValidFocus")
public function findPrevValidFocus():godot.Control;
/**
Finds the next (below in the tree) `godot.Control` that can receive the focus.
**/
@:native("FindNextValidFocus")
public function findNextValidFocus():godot.Control;
/**
Returns the control that has the keyboard focus or `null` if none.
**/
@:native("GetFocusOwner")
public function getFocusOwner():godot.Control;
@:native("SetHSizeFlags")
public function setHSizeFlags(flags:Int):Void;
@:native("GetHSizeFlags")
public function getHSizeFlags():Int;
@:native("SetStretchRatio")
public function setStretchRatio(ratio:Single):Void;
@:native("GetStretchRatio")
public function getStretchRatio():Single;
@:native("SetVSizeFlags")
public function setVSizeFlags(flags:Int):Void;
@:native("GetVSizeFlags")
public function getVSizeFlags():Int;
@:native("SetTheme")
public function setTheme(theme:godot.Theme):Void;
@:native("GetTheme")
public function getTheme():godot.Theme;
/**
Creates a local override for a theme icon with the specified `name`. Local overrides always take precedence when fetching theme items for the control. An override can be removed by assigning it a `null` value.
See also `godot.Control.getIcon`.
**/
@:native("AddIconOverride")
public function addIconOverride(name:std.String, texture:godot.Texture):Void;
/**
Creates a local override for a theme shader with the specified `name`. Local overrides always take precedence when fetching theme items for the control. An override can be removed by assigning it a `null` value.
**/
@:native("AddShaderOverride")
public function addShaderOverride(name:std.String, shader:godot.Shader):Void;
/**
Creates a local override for a theme `godot.StyleBox` with the specified `name`. Local overrides always take precedence when fetching theme items for the control. An override can be removed by assigning it a `null` value.
See also `godot.Control.getStylebox`.
Example of modifying a property in a StyleBox by duplicating it:
```