1 /** 2 All user interface nodes inherit from Control. A control's anchors and margins adapt its position and size relative to its parent. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.control; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.canvasitem; 25 import godot.node; 26 import godot.inputevent; 27 import godot.font; 28 import godot.texture; 29 import godot.shader; 30 import godot.stylebox; 31 import godot.theme; 32 /** 33 All user interface nodes inherit from Control. A control's anchors and margins adapt its position and size relative to its parent. 34 35 Base class for all UI-related nodes. $(D 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. 36 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 $(D Control) and $(D Container) nodes. 37 $(B User Interface nodes and input) 38 Godot sends input events to the scene's root node first, by calling $(D Node._input). $(D 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 $(D MainLoop._inputEvent). Call $(D acceptEvent) so no other node receives the event. Once you accept an input, it becomes handled so $(D Node._unhandledInput) will not process it. 39 Only one $(D Control) node can be in keyboard focus. Only the node in focus will receive keyboard events. To get the focus, call $(D grabFocus). $(D Control) nodes lose focus when another node grabs it, or if you hide the node in focus. 40 Sets $(D mouseFilter) to $(D constant MOUSE_FILTER_IGNORE) to tell a $(D Control) node to ignore mouse or touch events. You'll need it if you place an icon on top of a button. 41 $(D Theme) resources change the Control's appearance. If you change the $(D Theme) on a $(D Control) node, it affects all of its children. To override some of the theme's parameters, call one of the `add_*_override` methods, like $(D addFontOverride). You can override the theme with the inspector. 42 $(B Note:) Theme items are $(I not) $(D GodotObject) properties. This means you can't access their values using $(D GodotObject.get) and $(D GodotObject.set). Instead, use $(D getColor), $(D getConstant), $(D getFont), $(D getIcon), $(D getStylebox), and the `add_*_override` methods provided by this class. 43 */ 44 @GodotBaseClass struct Control 45 { 46 package(godot) enum string _GODOT_internal_name = "Control"; 47 public: 48 @nogc nothrow: 49 union { /** */ godot_object _godot_object; /** */ CanvasItem _GODOT_base; } 50 alias _GODOT_base this; 51 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 52 package(godot) __gshared bool _classBindingInitialized = false; 53 package(godot) static struct GDNativeClassBinding 54 { 55 __gshared: 56 @GodotName("_clips_input") GodotMethod!(bool) _clipsInput; 57 @GodotName("_get_minimum_size") GodotMethod!(Vector2) _getMinimumSize; 58 @GodotName("_get_tooltip") GodotMethod!(String) _getTooltip; 59 @GodotName("_gui_input") GodotMethod!(void, InputEvent) _guiInput; 60 @GodotName("_make_custom_tooltip") GodotMethod!(Control, String) _makeCustomTooltip; 61 @GodotName("_override_changed") GodotMethod!(void) _overrideChanged; 62 @GodotName("_set_anchor") GodotMethod!(void, long, double) _setAnchor; 63 @GodotName("_set_global_position") GodotMethod!(void, Vector2) _setGlobalPosition; 64 @GodotName("_set_position") GodotMethod!(void, Vector2) _setPosition; 65 @GodotName("_set_size") GodotMethod!(void, Vector2) _setSize; 66 @GodotName("_size_changed") GodotMethod!(void) _sizeChanged; 67 @GodotName("_theme_changed") GodotMethod!(void) _themeChanged; 68 @GodotName("_update_minimum_size") GodotMethod!(void) _updateMinimumSize; 69 @GodotName("accept_event") GodotMethod!(void) acceptEvent; 70 @GodotName("add_color_override") GodotMethod!(void, String, Color) addColorOverride; 71 @GodotName("add_constant_override") GodotMethod!(void, String, long) addConstantOverride; 72 @GodotName("add_font_override") GodotMethod!(void, String, Font) addFontOverride; 73 @GodotName("add_icon_override") GodotMethod!(void, String, Texture) addIconOverride; 74 @GodotName("add_shader_override") GodotMethod!(void, String, Shader) addShaderOverride; 75 @GodotName("add_stylebox_override") GodotMethod!(void, String, StyleBox) addStyleboxOverride; 76 @GodotName("can_drop_data") GodotMethod!(bool, Vector2, Variant) canDropData; 77 @GodotName("drop_data") GodotMethod!(void, Vector2, Variant) dropData; 78 @GodotName("find_next_valid_focus") GodotMethod!(Control) findNextValidFocus; 79 @GodotName("find_prev_valid_focus") GodotMethod!(Control) findPrevValidFocus; 80 @GodotName("force_drag") GodotMethod!(void, Variant, Control) forceDrag; 81 @GodotName("get_anchor") GodotMethod!(double, long) getAnchor; 82 @GodotName("get_begin") GodotMethod!(Vector2) getBegin; 83 @GodotName("get_color") GodotMethod!(Color, String, String) getColor; 84 @GodotName("get_combined_minimum_size") GodotMethod!(Vector2) getCombinedMinimumSize; 85 @GodotName("get_constant") GodotMethod!(long, String, String) getConstant; 86 @GodotName("get_cursor_shape") GodotMethod!(Control.CursorShape, Vector2) getCursorShape; 87 @GodotName("get_custom_minimum_size") GodotMethod!(Vector2) getCustomMinimumSize; 88 @GodotName("get_default_cursor_shape") GodotMethod!(Control.CursorShape) getDefaultCursorShape; 89 @GodotName("get_drag_data") GodotMethod!(Variant, Vector2) getDragData; 90 @GodotName("get_end") GodotMethod!(Vector2) getEnd; 91 @GodotName("get_focus_mode") GodotMethod!(Control.FocusMode) getFocusMode; 92 @GodotName("get_focus_neighbour") GodotMethod!(NodePath, long) getFocusNeighbour; 93 @GodotName("get_focus_next") GodotMethod!(NodePath) getFocusNext; 94 @GodotName("get_focus_owner") GodotMethod!(Control) getFocusOwner; 95 @GodotName("get_focus_previous") GodotMethod!(NodePath) getFocusPrevious; 96 @GodotName("get_font") GodotMethod!(Font, String, String) getFont; 97 @GodotName("get_global_position") GodotMethod!(Vector2) getGlobalPosition; 98 @GodotName("get_global_rect") GodotMethod!(Rect2) getGlobalRect; 99 @GodotName("get_h_grow_direction") GodotMethod!(Control.GrowDirection) getHGrowDirection; 100 @GodotName("get_h_size_flags") GodotMethod!(long) getHSizeFlags; 101 @GodotName("get_icon") GodotMethod!(Texture, String, String) getIcon; 102 @GodotName("get_margin") GodotMethod!(double, long) getMargin; 103 @GodotName("get_minimum_size") GodotMethod!(Vector2) getMinimumSize; 104 @GodotName("get_mouse_filter") GodotMethod!(Control.MouseFilter) getMouseFilter; 105 @GodotName("get_parent_area_size") GodotMethod!(Vector2) getParentAreaSize; 106 @GodotName("get_parent_control") GodotMethod!(Control) getParentControl; 107 @GodotName("get_pass_on_modal_close_click") GodotMethod!(bool) getPassOnModalCloseClick; 108 @GodotName("get_pivot_offset") GodotMethod!(Vector2) getPivotOffset; 109 @GodotName("get_position") GodotMethod!(Vector2) getPosition; 110 @GodotName("get_rect") GodotMethod!(Rect2) getRect; 111 @GodotName("get_rotation") GodotMethod!(double) getRotation; 112 @GodotName("get_rotation_degrees") GodotMethod!(double) getRotationDegrees; 113 @GodotName("get_scale") GodotMethod!(Vector2) getScale; 114 @GodotName("get_size") GodotMethod!(Vector2) getSize; 115 @GodotName("get_stretch_ratio") GodotMethod!(double) getStretchRatio; 116 @GodotName("get_stylebox") GodotMethod!(StyleBox, String, String) getStylebox; 117 @GodotName("get_theme") GodotMethod!(Theme) getTheme; 118 @GodotName("get_tooltip") GodotMethod!(String, Vector2) getTooltip; 119 @GodotName("get_v_grow_direction") GodotMethod!(Control.GrowDirection) getVGrowDirection; 120 @GodotName("get_v_size_flags") GodotMethod!(long) getVSizeFlags; 121 @GodotName("grab_click_focus") GodotMethod!(void) grabClickFocus; 122 @GodotName("grab_focus") GodotMethod!(void) grabFocus; 123 @GodotName("has_color") GodotMethod!(bool, String, String) hasColor; 124 @GodotName("has_color_override") GodotMethod!(bool, String) hasColorOverride; 125 @GodotName("has_constant") GodotMethod!(bool, String, String) hasConstant; 126 @GodotName("has_constant_override") GodotMethod!(bool, String) hasConstantOverride; 127 @GodotName("has_focus") GodotMethod!(bool) hasFocus; 128 @GodotName("has_font") GodotMethod!(bool, String, String) hasFont; 129 @GodotName("has_font_override") GodotMethod!(bool, String) hasFontOverride; 130 @GodotName("has_icon") GodotMethod!(bool, String, String) hasIcon; 131 @GodotName("has_icon_override") GodotMethod!(bool, String) hasIconOverride; 132 @GodotName("has_point") GodotMethod!(bool, Vector2) hasPoint; 133 @GodotName("has_shader_override") GodotMethod!(bool, String) hasShaderOverride; 134 @GodotName("has_stylebox") GodotMethod!(bool, String, String) hasStylebox; 135 @GodotName("has_stylebox_override") GodotMethod!(bool, String) hasStyleboxOverride; 136 @GodotName("is_clipping_contents") GodotMethod!(bool) isClippingContents; 137 @GodotName("minimum_size_changed") GodotMethod!(void) minimumSizeChanged; 138 @GodotName("release_focus") GodotMethod!(void) releaseFocus; 139 @GodotName("set_anchor") GodotMethod!(void, long, double, bool, bool) setAnchor; 140 @GodotName("set_anchor_and_margin") GodotMethod!(void, long, double, double, bool) setAnchorAndMargin; 141 @GodotName("set_anchors_and_margins_preset") GodotMethod!(void, long, long, long) setAnchorsAndMarginsPreset; 142 @GodotName("set_anchors_preset") GodotMethod!(void, long, bool) setAnchorsPreset; 143 @GodotName("set_begin") GodotMethod!(void, Vector2) setBegin; 144 @GodotName("set_clip_contents") GodotMethod!(void, bool) setClipContents; 145 @GodotName("set_custom_minimum_size") GodotMethod!(void, Vector2) setCustomMinimumSize; 146 @GodotName("set_default_cursor_shape") GodotMethod!(void, long) setDefaultCursorShape; 147 @GodotName("set_drag_forwarding") GodotMethod!(void, Control) setDragForwarding; 148 @GodotName("set_drag_preview") GodotMethod!(void, Control) setDragPreview; 149 @GodotName("set_end") GodotMethod!(void, Vector2) setEnd; 150 @GodotName("set_focus_mode") GodotMethod!(void, long) setFocusMode; 151 @GodotName("set_focus_neighbour") GodotMethod!(void, long, NodePath) setFocusNeighbour; 152 @GodotName("set_focus_next") GodotMethod!(void, NodePath) setFocusNext; 153 @GodotName("set_focus_previous") GodotMethod!(void, NodePath) setFocusPrevious; 154 @GodotName("set_global_position") GodotMethod!(void, Vector2, bool) setGlobalPosition; 155 @GodotName("set_h_grow_direction") GodotMethod!(void, long) setHGrowDirection; 156 @GodotName("set_h_size_flags") GodotMethod!(void, long) setHSizeFlags; 157 @GodotName("set_margin") GodotMethod!(void, long, double) setMargin; 158 @GodotName("set_margins_preset") GodotMethod!(void, long, long, long) setMarginsPreset; 159 @GodotName("set_mouse_filter") GodotMethod!(void, long) setMouseFilter; 160 @GodotName("set_pass_on_modal_close_click") GodotMethod!(void, bool) setPassOnModalCloseClick; 161 @GodotName("set_pivot_offset") GodotMethod!(void, Vector2) setPivotOffset; 162 @GodotName("set_position") GodotMethod!(void, Vector2, bool) setPosition; 163 @GodotName("set_rotation") GodotMethod!(void, double) setRotation; 164 @GodotName("set_rotation_degrees") GodotMethod!(void, double) setRotationDegrees; 165 @GodotName("set_scale") GodotMethod!(void, Vector2) setScale; 166 @GodotName("set_size") GodotMethod!(void, Vector2, bool) setSize; 167 @GodotName("set_stretch_ratio") GodotMethod!(void, double) setStretchRatio; 168 @GodotName("set_theme") GodotMethod!(void, Theme) setTheme; 169 @GodotName("set_tooltip") GodotMethod!(void, String) setTooltip; 170 @GodotName("set_v_grow_direction") GodotMethod!(void, long) setVGrowDirection; 171 @GodotName("set_v_size_flags") GodotMethod!(void, long) setVSizeFlags; 172 @GodotName("show_modal") GodotMethod!(void, bool) showModal; 173 @GodotName("warp_mouse") GodotMethod!(void, Vector2) warpMouse; 174 } 175 /// 176 pragma(inline, true) bool opEquals(in Control other) const 177 { return _godot_object.ptr is other._godot_object.ptr; } 178 /// 179 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 180 { _godot_object.ptr = n; return null; } 181 /// 182 pragma(inline, true) bool opEquals(typeof(null) n) const 183 { return _godot_object.ptr is n; } 184 /// 185 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 186 mixin baseCasts; 187 /// Construct a new instance of Control. 188 /// Note: use `memnew!Control` instead. 189 static Control _new() 190 { 191 static godot_class_constructor constructor; 192 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Control"); 193 if(constructor is null) return typeof(this).init; 194 return cast(Control)(constructor()); 195 } 196 @disable new(size_t s); 197 /// 198 enum Anchor : int 199 { 200 /** 201 Snaps one of the 4 anchor's sides to the origin of the node's `Rect`, in the top left. Use it with one of the `anchor_*` member variables, like $(D anchorLeft). To change all 4 anchors at once, use $(D setAnchorsPreset). 202 */ 203 anchorBegin = 0, 204 /** 205 Snaps one of the 4 anchor's sides to the end of the node's `Rect`, in the bottom right. Use it with one of the `anchor_*` member variables, like $(D anchorLeft). To change all 4 anchors at once, use $(D setAnchorsPreset). 206 */ 207 anchorEnd = 1, 208 } 209 /// 210 enum FocusMode : int 211 { 212 /** 213 The node cannot grab focus. Use with $(D focusMode). 214 */ 215 focusNone = 0, 216 /** 217 The node can only grab focus on mouse clicks. Use with $(D focusMode). 218 */ 219 focusClick = 1, 220 /** 221 The node can grab focus on mouse click or using the arrows and the Tab keys on the keyboard. Use with $(D focusMode). 222 */ 223 focusAll = 2, 224 } 225 /// 226 enum LayoutPresetMode : int 227 { 228 /** 229 The control will be resized to its minimum size. 230 */ 231 presetModeMinsize = 0, 232 /** 233 The control's width will not change. 234 */ 235 presetModeKeepWidth = 1, 236 /** 237 The control's height will not change. 238 */ 239 presetModeKeepHeight = 2, 240 /** 241 The control's size will not change. 242 */ 243 presetModeKeepSize = 3, 244 } 245 /// 246 enum MouseFilter : int 247 { 248 /** 249 The control will receive mouse button input events through $(D _guiInput) if clicked on. And the control will receive the $(D mouseEntered) and $(D mouseExited) 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. 250 */ 251 mouseFilterStop = 0, 252 /** 253 The control will receive mouse button input events through $(D _guiInput) if clicked on. And the control will receive the $(D mouseEntered) and $(D mouseExited) signals. If this control does not handle the event, the parent control (if any) will be considered, and so on until there is no more parent control to potentially handle it. This also allows signals to fire in other controls. Even if no control handled it at all, the event will still be handled automatically, so unhandled input will not be fired. 254 */ 255 mouseFilterPass = 1, 256 /** 257 The control will not receive mouse button input events through $(D _guiInput). The control will also not receive the $(D mouseEntered) nor $(D mouseExited) signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically. 258 */ 259 mouseFilterIgnore = 2, 260 } 261 /// 262 enum CursorShape : int 263 { 264 /** 265 Show the system's arrow mouse cursor when the user hovers the node. Use with $(D mouseDefaultCursorShape). 266 */ 267 cursorArrow = 0, 268 /** 269 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. 270 */ 271 cursorIbeam = 1, 272 /** 273 Show the system's pointing hand mouse cursor when the user hovers the node. 274 */ 275 cursorPointingHand = 2, 276 /** 277 Show the system's cross mouse cursor when the user hovers the node. 278 */ 279 cursorCross = 3, 280 /** 281 Show the system's wait mouse cursor, often an hourglass, when the user hovers the node. 282 */ 283 cursorWait = 4, 284 /** 285 Show the system's busy mouse cursor when the user hovers the node. Often an hourglass. 286 */ 287 cursorBusy = 5, 288 /** 289 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. 290 */ 291 cursorDrag = 6, 292 /** 293 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. 294 */ 295 cursorCanDrop = 7, 296 /** 297 Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle. 298 */ 299 cursorForbidden = 8, 300 /** 301 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. 302 */ 303 cursorVsize = 9, 304 /** 305 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. 306 */ 307 cursorHsize = 10, 308 /** 309 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. 310 */ 311 cursorBdiagsize = 11, 312 /** 313 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 $(D constant CURSOR_BDIAGSIZE). It tells the user they can resize the window or the panel both horizontally and vertically. 314 */ 315 cursorFdiagsize = 12, 316 /** 317 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. 318 */ 319 cursorMove = 13, 320 /** 321 Show the system's vertical split mouse cursor when the user hovers the node. On Windows, it's the same as $(D constant CURSOR_VSIZE). 322 */ 323 cursorVsplit = 14, 324 /** 325 Show the system's horizontal split mouse cursor when the user hovers the node. On Windows, it's the same as $(D constant CURSOR_HSIZE). 326 */ 327 cursorHsplit = 15, 328 /** 329 Show the system's help mouse cursor when the user hovers the node, a question mark. 330 */ 331 cursorHelp = 16, 332 } 333 /// 334 enum GrowDirection : int 335 { 336 /** 337 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. 338 */ 339 growDirectionBegin = 0, 340 /** 341 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. 342 */ 343 growDirectionEnd = 1, 344 /** 345 The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size. 346 */ 347 growDirectionBoth = 2, 348 } 349 /// 350 enum SizeFlags : int 351 { 352 /** 353 Tells the parent $(D Container) to expand the bounds of this node to fill all the available space without pushing any other node. Use with $(D sizeFlagsHorizontal) and $(D sizeFlagsVertical). 354 */ 355 sizeFill = 1, 356 /** 357 Tells the parent $(D 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 $(D sizeFlagsStretchRatio). Use with $(D sizeFlagsHorizontal) and $(D sizeFlagsVertical). 358 */ 359 sizeExpand = 2, 360 /** 361 Sets the node's size flags to both fill and expand. See the 2 constants above for more information. 362 */ 363 sizeExpandFill = 3, 364 /** 365 Tells the parent $(D Container) to center the node in itself. It centers the control based on its bounding box, so it doesn't work with the fill or expand size flags. Use with $(D sizeFlagsHorizontal) and $(D sizeFlagsVertical). 366 */ 367 sizeShrinkCenter = 4, 368 /** 369 Tells the parent $(D Container) to align the node with its end, either the bottom or the right edge. It doesn't work with the fill or expand size flags. Use with $(D sizeFlagsHorizontal) and $(D sizeFlagsVertical). 370 */ 371 sizeShrinkEnd = 8, 372 } 373 /// 374 enum LayoutPreset : int 375 { 376 /** 377 Snap all 4 anchors to the top-left of the parent control's bounds. Use with $(D setAnchorsPreset). 378 */ 379 presetTopLeft = 0, 380 /** 381 Snap all 4 anchors to the top-right of the parent control's bounds. Use with $(D setAnchorsPreset). 382 */ 383 presetTopRight = 1, 384 /** 385 Snap all 4 anchors to the bottom-left of the parent control's bounds. Use with $(D setAnchorsPreset). 386 */ 387 presetBottomLeft = 2, 388 /** 389 Snap all 4 anchors to the bottom-right of the parent control's bounds. Use with $(D setAnchorsPreset). 390 */ 391 presetBottomRight = 3, 392 /** 393 Snap all 4 anchors to the center of the left edge of the parent control's bounds. Use with $(D setAnchorsPreset). 394 */ 395 presetCenterLeft = 4, 396 /** 397 Snap all 4 anchors to the center of the top edge of the parent control's bounds. Use with $(D setAnchorsPreset). 398 */ 399 presetCenterTop = 5, 400 /** 401 Snap all 4 anchors to the center of the right edge of the parent control's bounds. Use with $(D setAnchorsPreset). 402 */ 403 presetCenterRight = 6, 404 /** 405 Snap all 4 anchors to the center of the bottom edge of the parent control's bounds. Use with $(D setAnchorsPreset). 406 */ 407 presetCenterBottom = 7, 408 /** 409 Snap all 4 anchors to the center of the parent control's bounds. Use with $(D setAnchorsPreset). 410 */ 411 presetCenter = 8, 412 /** 413 Snap all 4 anchors to the left edge of the parent control. The left margin becomes relative to the left edge and the top margin relative to the top left corner of the node's parent. Use with $(D setAnchorsPreset). 414 */ 415 presetLeftWide = 9, 416 /** 417 Snap all 4 anchors to the top edge of the parent control. The left margin becomes relative to the top left corner, the top margin relative to the top edge, and the right margin relative to the top right corner of the node's parent. Use with $(D setAnchorsPreset). 418 */ 419 presetTopWide = 10, 420 /** 421 Snap all 4 anchors to the right edge of the parent control. The right margin becomes relative to the right edge and the top margin relative to the top right corner of the node's parent. Use with $(D setAnchorsPreset). 422 */ 423 presetRightWide = 11, 424 /** 425 Snap all 4 anchors to the bottom edge of the parent control. The left margin becomes relative to the bottom left corner, the bottom margin relative to the bottom edge, and the right margin relative to the bottom right corner of the node's parent. Use with $(D setAnchorsPreset). 426 */ 427 presetBottomWide = 12, 428 /** 429 Snap all 4 anchors to a vertical line that cuts the parent control in half. Use with $(D setAnchorsPreset). 430 */ 431 presetVcenterWide = 13, 432 /** 433 Snap all 4 anchors to a horizontal line that cuts the parent control in half. Use with $(D setAnchorsPreset). 434 */ 435 presetHcenterWide = 14, 436 /** 437 Snap all 4 anchors to the respective corners of the parent control. Set all 4 margins to 0 after you applied this preset and the $(D Control) will fit its parent control. This is equivalent to the "Full Rect" layout option in the editor. Use with $(D setAnchorsPreset). 438 */ 439 presetWide = 15, 440 } 441 /// 442 enum Constants : int 443 { 444 anchorBegin = 0, 445 mouseFilterStop = 0, 446 focusNone = 0, 447 cursorArrow = 0, 448 growDirectionBegin = 0, 449 presetModeMinsize = 0, 450 presetTopLeft = 0, 451 mouseFilterPass = 1, 452 anchorEnd = 1, 453 sizeFill = 1, 454 presetModeKeepWidth = 1, 455 growDirectionEnd = 1, 456 cursorIbeam = 1, 457 focusClick = 1, 458 presetTopRight = 1, 459 focusAll = 2, 460 sizeExpand = 2, 461 presetModeKeepHeight = 2, 462 cursorPointingHand = 2, 463 mouseFilterIgnore = 2, 464 growDirectionBoth = 2, 465 presetBottomLeft = 2, 466 presetBottomRight = 3, 467 sizeExpandFill = 3, 468 presetModeKeepSize = 3, 469 cursorCross = 3, 470 presetCenterLeft = 4, 471 cursorWait = 4, 472 sizeShrinkCenter = 4, 473 cursorBusy = 5, 474 presetCenterTop = 5, 475 cursorDrag = 6, 476 presetCenterRight = 6, 477 presetCenterBottom = 7, 478 cursorCanDrop = 7, 479 cursorForbidden = 8, 480 presetCenter = 8, 481 sizeShrinkEnd = 8, 482 presetLeftWide = 9, 483 cursorVsize = 9, 484 presetTopWide = 10, 485 cursorHsize = 10, 486 presetRightWide = 11, 487 cursorBdiagsize = 11, 488 cursorFdiagsize = 12, 489 presetBottomWide = 12, 490 cursorMove = 13, 491 presetVcenterWide = 13, 492 cursorVsplit = 14, 493 presetHcenterWide = 14, 494 cursorHsplit = 15, 495 presetWide = 15, 496 cursorHelp = 16, 497 /** 498 Sent when the node changes size. Use $(D rectSize) to get the new size. 499 */ 500 notificationResized = 40, 501 /** 502 Sent when the mouse pointer enters the node. 503 */ 504 notificationMouseEnter = 41, 505 /** 506 Sent when the mouse pointer exits the node. 507 */ 508 notificationMouseExit = 42, 509 /** 510 Sent when the node grabs focus. 511 */ 512 notificationFocusEnter = 43, 513 /** 514 Sent when the node loses focus. 515 */ 516 notificationFocusExit = 44, 517 /** 518 Sent when the node's $(D theme) changes, right before Godot redraws the control. Happens when you call one of the `add_*_override` methods. 519 */ 520 notificationThemeChanged = 45, 521 /** 522 Sent when an open modal dialog closes. See $(D showModal). 523 */ 524 notificationModalClose = 46, 525 /** 526 Sent when this node is inside a $(D ScrollContainer) which has begun being scrolled. 527 */ 528 notificationScrollBegin = 47, 529 /** 530 Sent when this node is inside a $(D ScrollContainer) which has stopped being scrolled. 531 */ 532 notificationScrollEnd = 48, 533 } 534 /** 535 Virtual method to be implemented by the user. Returns whether $(D _guiInput) should not be called for children controls outside this control's rectangle. Input will be clipped to the Rect of this $(D Control). Similar to $(D rectClipContent), but doesn't affect visibility. 536 If not overridden, defaults to `false`. 537 */ 538 bool _clipsInput() 539 { 540 Array _GODOT_args = Array.make(); 541 String _GODOT_method_name = String("_clips_input"); 542 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool); 543 } 544 /** 545 Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to $(D rectMinSize) for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately). 546 If not overridden, defaults to $(D constant Vector2.ZERO). 547 */ 548 Vector2 _getMinimumSize() 549 { 550 Array _GODOT_args = Array.make(); 551 String _GODOT_method_name = String("_get_minimum_size"); 552 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Vector2); 553 } 554 /** 555 556 */ 557 String _getTooltip() const 558 { 559 Array _GODOT_args = Array.make(); 560 String _GODOT_method_name = String("_get_tooltip"); 561 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!String); 562 } 563 /** 564 Virtual method to be implemented by the user. Use this method to process and accept inputs on UI elements. See $(D acceptEvent). 565 Example: clicking a control. 566 567 568 func _gui_input(event): 569 if event is InputEventMouseButton: 570 if event.button_index == BUTTON_LEFT and event.pressed: 571 print("I've been clicked D:") 572 573 574 The event won't trigger if: 575 * clicking outside the control (see $(D hasPoint)); 576 * control has $(D mouseFilter) set to $(D constant MOUSE_FILTER_IGNORE); 577 * control is obstructed by another $(D Control) on top of it, which doesn't have $(D mouseFilter) set to $(D constant MOUSE_FILTER_IGNORE); 578 * control's parent has $(D mouseFilter) set to $(D constant MOUSE_FILTER_STOP) or has accepted the event; 579 * it happens outside the parent's rectangle and the parent has either $(D rectClipContent) or $(D _clipsInput) enabled. 580 */ 581 void _guiInput(InputEvent event) 582 { 583 Array _GODOT_args = Array.make(); 584 _GODOT_args.append(event); 585 String _GODOT_method_name = String("_gui_input"); 586 this.callv(_GODOT_method_name, _GODOT_args); 587 } 588 /** 589 Virtual method to be implemented by the user. Returns a $(D Control) node that should be used as a tooltip instead of the default one. The `for_text` includes the contents of the $(D hintTooltip) property. 590 The returned node must be of type $(D 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. 591 The returned node will be added as child to a $(D PopupPanel), so you should only provide the contents of that panel. That $(D PopupPanel) can be themed using $(D Theme.setStylebox) for the type `"TooltipPanel"` (see $(D hintTooltip) for an example). 592 $(B Note:) The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its $(D rectMinSize) to some non-zero value. 593 Example of usage with a custom-constructed node: 594 595 596 func _make_custom_tooltip(for_text): 597 var label = Label.new() 598 label.text = for_text 599 return label 600 601 602 Example of usage with a custom scene instance: 603 604 605 func _make_custom_tooltip(for_text): 606 var tooltip = preload("res://SomeTooltipScene.tscn").instance() 607 tooltip.get_node("Label").text = for_text 608 return tooltip 609 610 611 */ 612 Control _makeCustomTooltip(in String for_text) 613 { 614 Array _GODOT_args = Array.make(); 615 _GODOT_args.append(for_text); 616 String _GODOT_method_name = String("_make_custom_tooltip"); 617 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Control); 618 } 619 /** 620 621 */ 622 void _overrideChanged() 623 { 624 Array _GODOT_args = Array.make(); 625 String _GODOT_method_name = String("_override_changed"); 626 this.callv(_GODOT_method_name, _GODOT_args); 627 } 628 /** 629 630 */ 631 void _setAnchor(in long margin, in double anchor) 632 { 633 Array _GODOT_args = Array.make(); 634 _GODOT_args.append(margin); 635 _GODOT_args.append(anchor); 636 String _GODOT_method_name = String("_set_anchor"); 637 this.callv(_GODOT_method_name, _GODOT_args); 638 } 639 /** 640 641 */ 642 void _setGlobalPosition(in Vector2 position) 643 { 644 Array _GODOT_args = Array.make(); 645 _GODOT_args.append(position); 646 String _GODOT_method_name = String("_set_global_position"); 647 this.callv(_GODOT_method_name, _GODOT_args); 648 } 649 /** 650 651 */ 652 void _setPosition(in Vector2 margin) 653 { 654 Array _GODOT_args = Array.make(); 655 _GODOT_args.append(margin); 656 String _GODOT_method_name = String("_set_position"); 657 this.callv(_GODOT_method_name, _GODOT_args); 658 } 659 /** 660 661 */ 662 void _setSize(in Vector2 size) 663 { 664 Array _GODOT_args = Array.make(); 665 _GODOT_args.append(size); 666 String _GODOT_method_name = String("_set_size"); 667 this.callv(_GODOT_method_name, _GODOT_args); 668 } 669 /** 670 671 */ 672 void _sizeChanged() 673 { 674 Array _GODOT_args = Array.make(); 675 String _GODOT_method_name = String("_size_changed"); 676 this.callv(_GODOT_method_name, _GODOT_args); 677 } 678 /** 679 680 */ 681 void _themeChanged() 682 { 683 Array _GODOT_args = Array.make(); 684 String _GODOT_method_name = String("_theme_changed"); 685 this.callv(_GODOT_method_name, _GODOT_args); 686 } 687 /** 688 689 */ 690 void _updateMinimumSize() 691 { 692 Array _GODOT_args = Array.make(); 693 String _GODOT_method_name = String("_update_minimum_size"); 694 this.callv(_GODOT_method_name, _GODOT_args); 695 } 696 /** 697 Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to $(D Node._unhandledInput) or $(D Node._unhandledKeyInput). 698 */ 699 void acceptEvent() 700 { 701 checkClassBinding!(typeof(this))(); 702 ptrcall!(void)(GDNativeClassBinding.acceptEvent, _godot_object); 703 } 704 /** 705 Overrides the $(D Color) with given `name` in the $(D theme) resource the control uses. 706 $(B Note:) Unlike other theme overrides, there is no way to undo a color override without manually assigning the previous color. 707 $(B Example of overriding a label's color and resetting it later:) 708 709 710 # Override the child node "MyLabel"'s font color to orange. 711 $MyLabel.add_color_override("font_color", Color(1, 0.5, 0)) 712 713 # Reset the color by creating a new node to get the default value: 714 var default_label_color = Label.new().get_color("font_color") 715 $MyLabel.add_color_override("font_color", default_label_color) 716 717 718 */ 719 void addColorOverride(in String name, in Color color) 720 { 721 checkClassBinding!(typeof(this))(); 722 ptrcall!(void)(GDNativeClassBinding.addColorOverride, _godot_object, name, color); 723 } 724 /** 725 Overrides an integer constant with given `name` in the $(D theme) resource the control uses. If the `constant` is `0`, the override is cleared and the constant from assigned $(D Theme) is used. 726 */ 727 void addConstantOverride(in String name, in long constant) 728 { 729 checkClassBinding!(typeof(this))(); 730 ptrcall!(void)(GDNativeClassBinding.addConstantOverride, _godot_object, name, constant); 731 } 732 /** 733 Overrides the font with given `name` in the $(D theme) resource the control uses. If `font` is `null` or invalid, the override is cleared and the font from assigned $(D Theme) is used. 734 */ 735 void addFontOverride(in String name, Font font) 736 { 737 checkClassBinding!(typeof(this))(); 738 ptrcall!(void)(GDNativeClassBinding.addFontOverride, _godot_object, name, font); 739 } 740 /** 741 Overrides the icon with given `name` in the $(D theme) resource the control uses. If `icon` is `null` or invalid, the override is cleared and the icon from assigned $(D Theme) is used. 742 */ 743 void addIconOverride(in String name, Texture texture) 744 { 745 checkClassBinding!(typeof(this))(); 746 ptrcall!(void)(GDNativeClassBinding.addIconOverride, _godot_object, name, texture); 747 } 748 /** 749 Overrides the $(D Shader) with given `name` in the $(D theme) resource the control uses. If `shader` is `null` or invalid, the override is cleared and the shader from assigned $(D Theme) is used. 750 */ 751 void addShaderOverride(in String name, Shader shader) 752 { 753 checkClassBinding!(typeof(this))(); 754 ptrcall!(void)(GDNativeClassBinding.addShaderOverride, _godot_object, name, shader); 755 } 756 /** 757 Overrides the $(D StyleBox) with given `name` in the $(D theme) resource the control uses. If `stylebox` is empty or invalid, the override is cleared and the $(D StyleBox) from assigned $(D Theme) is used. 758 $(B Example of modifying a property in a StyleBox by duplicating it:) 759 760 761 # The snippet below assumes the child node MyButton has a StyleBoxFlat assigned. 762 # Resources are shared across instances, so we need to duplicate it 763 # to avoid modifying the appearance of all other buttons. 764 var new_stylebox_normal = $MyButton.get_stylebox("normal").duplicate() 765 new_stylebox_normal.border_width_top = 3 766 new_stylebox_normal.border_color = Color(0, 1, 0.5) 767 $MyButton.add_stylebox_override("normal", new_stylebox_normal) 768 769 # Remove the stylebox override: 770 $MyButton.add_stylebox_override("normal", null) 771 772 773 */ 774 void addStyleboxOverride(in String name, StyleBox stylebox) 775 { 776 checkClassBinding!(typeof(this))(); 777 ptrcall!(void)(GDNativeClassBinding.addStyleboxOverride, _godot_object, name, stylebox); 778 } 779 /** 780 Godot calls this method to test if `data` from a control's $(D getDragData) can be dropped at `position`. `position` is local to this control. 781 This method should only be used to test the data. Process the data in $(D dropData). 782 783 784 func can_drop_data(position, data): 785 # Check position if it is relevant to you 786 # Otherwise, just check data 787 return typeof(data) == TYPE_DICTIONARY and data.has("expected") 788 789 790 */ 791 bool canDropData(VariantArg1)(in Vector2 position, in VariantArg1 data) 792 { 793 Array _GODOT_args = Array.make(); 794 _GODOT_args.append(position); 795 _GODOT_args.append(data); 796 String _GODOT_method_name = String("can_drop_data"); 797 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool); 798 } 799 /** 800 Godot calls this method to pass you the `data` from a control's $(D getDragData) result. Godot first calls $(D canDropData) to test if `data` is allowed to drop at `position` where `position` is local to this control. 801 802 803 func can_drop_data(position, data): 804 return typeof(data) == TYPE_DICTIONARY and data.has("color") 805 806 func drop_data(position, data): 807 color = data$(D "color") 808 809 810 */ 811 void dropData(VariantArg1)(in Vector2 position, in VariantArg1 data) 812 { 813 Array _GODOT_args = Array.make(); 814 _GODOT_args.append(position); 815 _GODOT_args.append(data); 816 String _GODOT_method_name = String("drop_data"); 817 this.callv(_GODOT_method_name, _GODOT_args); 818 } 819 /** 820 Finds the next (below in the tree) $(D Control) that can receive the focus. 821 */ 822 Control findNextValidFocus() const 823 { 824 checkClassBinding!(typeof(this))(); 825 return ptrcall!(Control)(GDNativeClassBinding.findNextValidFocus, _godot_object); 826 } 827 /** 828 Finds the previous (above in the tree) $(D Control) that can receive the focus. 829 */ 830 Control findPrevValidFocus() const 831 { 832 checkClassBinding!(typeof(this))(); 833 return ptrcall!(Control)(GDNativeClassBinding.findPrevValidFocus, _godot_object); 834 } 835 /** 836 Forces drag and bypasses $(D getDragData) and $(D setDragPreview) by passing `data` and `preview`. Drag will start even if the mouse is neither over nor pressed on this control. 837 The methods $(D canDropData) and $(D dropData) must be implemented on controls that want to receive drop data. 838 */ 839 void forceDrag(VariantArg0)(in VariantArg0 data, Control preview) 840 { 841 checkClassBinding!(typeof(this))(); 842 ptrcall!(void)(GDNativeClassBinding.forceDrag, _godot_object, data, preview); 843 } 844 /** 845 Returns the anchor identified by `margin` constant from $(D margin) enum. A getter method for $(D anchorBottom), $(D anchorLeft), $(D anchorRight) and $(D anchorTop). 846 */ 847 double getAnchor(in long margin) const 848 { 849 checkClassBinding!(typeof(this))(); 850 return ptrcall!(double)(GDNativeClassBinding.getAnchor, _godot_object, margin); 851 } 852 /** 853 Returns $(D marginLeft) and $(D marginTop). See also $(D rectPosition). 854 */ 855 Vector2 getBegin() const 856 { 857 checkClassBinding!(typeof(this))(); 858 return ptrcall!(Vector2)(GDNativeClassBinding.getBegin, _godot_object); 859 } 860 /** 861 Returns a color from assigned $(D Theme) with given `name` and associated with $(D Control) of given `node_type`. 862 863 864 func _ready(): 865 modulate = get_color("font_color", "Button") #get the color defined for button fonts 866 867 868 */ 869 Color getColor(in String name, in String node_type = gs!"") const 870 { 871 checkClassBinding!(typeof(this))(); 872 return ptrcall!(Color)(GDNativeClassBinding.getColor, _godot_object, name, node_type); 873 } 874 /** 875 Returns combined minimum size from $(D rectMinSize) and $(D getMinimumSize). 876 */ 877 Vector2 getCombinedMinimumSize() const 878 { 879 checkClassBinding!(typeof(this))(); 880 return ptrcall!(Vector2)(GDNativeClassBinding.getCombinedMinimumSize, _godot_object); 881 } 882 /** 883 Returns a constant from assigned $(D Theme) with given `name` and associated with $(D Control) of given `node_type`. 884 */ 885 long getConstant(in String name, in String node_type = gs!"") const 886 { 887 checkClassBinding!(typeof(this))(); 888 return ptrcall!(long)(GDNativeClassBinding.getConstant, _godot_object, name, node_type); 889 } 890 /** 891 Returns the mouse cursor shape the control displays on mouse hover. See $(D cursorshape). 892 */ 893 Control.CursorShape getCursorShape(in Vector2 position = Vector2(0, 0)) const 894 { 895 checkClassBinding!(typeof(this))(); 896 return ptrcall!(Control.CursorShape)(GDNativeClassBinding.getCursorShape, _godot_object, position); 897 } 898 /** 899 900 */ 901 Vector2 getCustomMinimumSize() const 902 { 903 checkClassBinding!(typeof(this))(); 904 return ptrcall!(Vector2)(GDNativeClassBinding.getCustomMinimumSize, _godot_object); 905 } 906 /** 907 908 */ 909 Control.CursorShape getDefaultCursorShape() const 910 { 911 checkClassBinding!(typeof(this))(); 912 return ptrcall!(Control.CursorShape)(GDNativeClassBinding.getDefaultCursorShape, _godot_object); 913 } 914 /** 915 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 $(D canDropData) and $(D dropData). `position` is local to this control. Drag may be forced with $(D forceDrag). 916 A preview that will follow the mouse that should represent the data can be set with $(D setDragPreview). A good time to set the preview is in this method. 917 918 919 func get_drag_data(position): 920 var mydata = make_data() 921 set_drag_preview(make_preview(mydata)) 922 return mydata 923 924 925 */ 926 Variant getDragData(in Vector2 position) 927 { 928 Array _GODOT_args = Array.make(); 929 _GODOT_args.append(position); 930 String _GODOT_method_name = String("get_drag_data"); 931 return this.callv(_GODOT_method_name, _GODOT_args); 932 } 933 /** 934 Returns $(D marginRight) and $(D marginBottom). 935 */ 936 Vector2 getEnd() const 937 { 938 checkClassBinding!(typeof(this))(); 939 return ptrcall!(Vector2)(GDNativeClassBinding.getEnd, _godot_object); 940 } 941 /** 942 943 */ 944 Control.FocusMode getFocusMode() const 945 { 946 checkClassBinding!(typeof(this))(); 947 return ptrcall!(Control.FocusMode)(GDNativeClassBinding.getFocusMode, _godot_object); 948 } 949 /** 950 Returns the focus neighbour identified by `margin` constant from $(D margin) enum. A getter method for $(D focusNeighbourBottom), $(D focusNeighbourLeft), $(D focusNeighbourRight) and $(D focusNeighbourTop). 951 */ 952 NodePath getFocusNeighbour(in long margin) const 953 { 954 checkClassBinding!(typeof(this))(); 955 return ptrcall!(NodePath)(GDNativeClassBinding.getFocusNeighbour, _godot_object, margin); 956 } 957 /** 958 959 */ 960 NodePath getFocusNext() const 961 { 962 checkClassBinding!(typeof(this))(); 963 return ptrcall!(NodePath)(GDNativeClassBinding.getFocusNext, _godot_object); 964 } 965 /** 966 Returns the control that has the keyboard focus or `null` if none. 967 */ 968 Control getFocusOwner() const 969 { 970 checkClassBinding!(typeof(this))(); 971 return ptrcall!(Control)(GDNativeClassBinding.getFocusOwner, _godot_object); 972 } 973 /** 974 975 */ 976 NodePath getFocusPrevious() const 977 { 978 checkClassBinding!(typeof(this))(); 979 return ptrcall!(NodePath)(GDNativeClassBinding.getFocusPrevious, _godot_object); 980 } 981 /** 982 Returns a font from assigned $(D Theme) with given `name` and associated with $(D Control) of given `node_type`. 983 */ 984 Ref!Font getFont(in String name, in String node_type = gs!"") const 985 { 986 checkClassBinding!(typeof(this))(); 987 return ptrcall!(Font)(GDNativeClassBinding.getFont, _godot_object, name, node_type); 988 } 989 /** 990 991 */ 992 Vector2 getGlobalPosition() const 993 { 994 checkClassBinding!(typeof(this))(); 995 return ptrcall!(Vector2)(GDNativeClassBinding.getGlobalPosition, _godot_object); 996 } 997 /** 998 Returns the position and size of the control relative to the top-left corner of the screen. See $(D rectPosition) and $(D rectSize). 999 */ 1000 Rect2 getGlobalRect() const 1001 { 1002 checkClassBinding!(typeof(this))(); 1003 return ptrcall!(Rect2)(GDNativeClassBinding.getGlobalRect, _godot_object); 1004 } 1005 /** 1006 1007 */ 1008 Control.GrowDirection getHGrowDirection() const 1009 { 1010 checkClassBinding!(typeof(this))(); 1011 return ptrcall!(Control.GrowDirection)(GDNativeClassBinding.getHGrowDirection, _godot_object); 1012 } 1013 /** 1014 1015 */ 1016 long getHSizeFlags() const 1017 { 1018 checkClassBinding!(typeof(this))(); 1019 return ptrcall!(long)(GDNativeClassBinding.getHSizeFlags, _godot_object); 1020 } 1021 /** 1022 Returns an icon from assigned $(D Theme) with given `name` and associated with $(D Control) of given `node_type`. 1023 */ 1024 Ref!Texture getIcon(in String name, in String node_type = gs!"") const 1025 { 1026 checkClassBinding!(typeof(this))(); 1027 return ptrcall!(Texture)(GDNativeClassBinding.getIcon, _godot_object, name, node_type); 1028 } 1029 /** 1030 Returns the anchor identified by `margin` constant from $(D margin) enum. A getter method for $(D marginBottom), $(D marginLeft), $(D marginRight) and $(D marginTop). 1031 */ 1032 double getMargin(in long margin) const 1033 { 1034 checkClassBinding!(typeof(this))(); 1035 return ptrcall!(double)(GDNativeClassBinding.getMargin, _godot_object, margin); 1036 } 1037 /** 1038 Returns the minimum size for this control. See $(D rectMinSize). 1039 */ 1040 Vector2 getMinimumSize() const 1041 { 1042 checkClassBinding!(typeof(this))(); 1043 return ptrcall!(Vector2)(GDNativeClassBinding.getMinimumSize, _godot_object); 1044 } 1045 /** 1046 1047 */ 1048 Control.MouseFilter getMouseFilter() const 1049 { 1050 checkClassBinding!(typeof(this))(); 1051 return ptrcall!(Control.MouseFilter)(GDNativeClassBinding.getMouseFilter, _godot_object); 1052 } 1053 /** 1054 Returns the width/height occupied in the parent control. 1055 */ 1056 Vector2 getParentAreaSize() const 1057 { 1058 checkClassBinding!(typeof(this))(); 1059 return ptrcall!(Vector2)(GDNativeClassBinding.getParentAreaSize, _godot_object); 1060 } 1061 /** 1062 Returns the parent control node. 1063 */ 1064 Control getParentControl() const 1065 { 1066 checkClassBinding!(typeof(this))(); 1067 return ptrcall!(Control)(GDNativeClassBinding.getParentControl, _godot_object); 1068 } 1069 /** 1070 1071 */ 1072 bool getPassOnModalCloseClick() const 1073 { 1074 checkClassBinding!(typeof(this))(); 1075 return ptrcall!(bool)(GDNativeClassBinding.getPassOnModalCloseClick, _godot_object); 1076 } 1077 /** 1078 1079 */ 1080 Vector2 getPivotOffset() const 1081 { 1082 checkClassBinding!(typeof(this))(); 1083 return ptrcall!(Vector2)(GDNativeClassBinding.getPivotOffset, _godot_object); 1084 } 1085 /** 1086 1087 */ 1088 Vector2 getPosition() const 1089 { 1090 checkClassBinding!(typeof(this))(); 1091 return ptrcall!(Vector2)(GDNativeClassBinding.getPosition, _godot_object); 1092 } 1093 /** 1094 Returns the position and size of the control relative to the top-left corner of the parent Control. See $(D rectPosition) and $(D rectSize). 1095 */ 1096 Rect2 getRect() const 1097 { 1098 checkClassBinding!(typeof(this))(); 1099 return ptrcall!(Rect2)(GDNativeClassBinding.getRect, _godot_object); 1100 } 1101 /** 1102 Returns the rotation (in radians). 1103 */ 1104 double getRotation() const 1105 { 1106 checkClassBinding!(typeof(this))(); 1107 return ptrcall!(double)(GDNativeClassBinding.getRotation, _godot_object); 1108 } 1109 /** 1110 1111 */ 1112 double getRotationDegrees() const 1113 { 1114 checkClassBinding!(typeof(this))(); 1115 return ptrcall!(double)(GDNativeClassBinding.getRotationDegrees, _godot_object); 1116 } 1117 /** 1118 1119 */ 1120 Vector2 getScale() const 1121 { 1122 checkClassBinding!(typeof(this))(); 1123 return ptrcall!(Vector2)(GDNativeClassBinding.getScale, _godot_object); 1124 } 1125 /** 1126 1127 */ 1128 Vector2 getSize() const 1129 { 1130 checkClassBinding!(typeof(this))(); 1131 return ptrcall!(Vector2)(GDNativeClassBinding.getSize, _godot_object); 1132 } 1133 /** 1134 1135 */ 1136 double getStretchRatio() const 1137 { 1138 checkClassBinding!(typeof(this))(); 1139 return ptrcall!(double)(GDNativeClassBinding.getStretchRatio, _godot_object); 1140 } 1141 /** 1142 Returns a $(D StyleBox) from assigned $(D Theme) with given `name` and associated with $(D Control) of given `node_type`. 1143 */ 1144 Ref!StyleBox getStylebox(in String name, in String node_type = gs!"") const 1145 { 1146 checkClassBinding!(typeof(this))(); 1147 return ptrcall!(StyleBox)(GDNativeClassBinding.getStylebox, _godot_object, name, node_type); 1148 } 1149 /** 1150 1151 */ 1152 Ref!Theme getTheme() const 1153 { 1154 checkClassBinding!(typeof(this))(); 1155 return ptrcall!(Theme)(GDNativeClassBinding.getTheme, _godot_object); 1156 } 1157 /** 1158 Returns the tooltip, which will appear when the cursor is resting over this control. See $(D hintTooltip). 1159 */ 1160 String getTooltip(in Vector2 at_position = Vector2(0, 0)) const 1161 { 1162 checkClassBinding!(typeof(this))(); 1163 return ptrcall!(String)(GDNativeClassBinding.getTooltip, _godot_object, at_position); 1164 } 1165 /** 1166 1167 */ 1168 Control.GrowDirection getVGrowDirection() const 1169 { 1170 checkClassBinding!(typeof(this))(); 1171 return ptrcall!(Control.GrowDirection)(GDNativeClassBinding.getVGrowDirection, _godot_object); 1172 } 1173 /** 1174 1175 */ 1176 long getVSizeFlags() const 1177 { 1178 checkClassBinding!(typeof(this))(); 1179 return ptrcall!(long)(GDNativeClassBinding.getVSizeFlags, _godot_object); 1180 } 1181 /** 1182 Creates an $(D InputEventMouseButton) that attempts to click the control. If the event is received, the control acquires focus. 1183 1184 1185 func _process(delta): 1186 grab_click_focus() #when clicking another Control node, this node will be clicked instead 1187 1188 1189 */ 1190 void grabClickFocus() 1191 { 1192 checkClassBinding!(typeof(this))(); 1193 ptrcall!(void)(GDNativeClassBinding.grabClickFocus, _godot_object); 1194 } 1195 /** 1196 Steal the focus from another control and become the focused control (see $(D focusMode)). 1197 */ 1198 void grabFocus() 1199 { 1200 checkClassBinding!(typeof(this))(); 1201 ptrcall!(void)(GDNativeClassBinding.grabFocus, _godot_object); 1202 } 1203 /** 1204 Returns `true` if $(D Color) with given `name` and associated with $(D Control) of given `node_type` exists in assigned $(D Theme). 1205 */ 1206 bool hasColor(in String name, in String node_type = gs!"") const 1207 { 1208 checkClassBinding!(typeof(this))(); 1209 return ptrcall!(bool)(GDNativeClassBinding.hasColor, _godot_object, name, node_type); 1210 } 1211 /** 1212 Returns `true` if $(D Color) with given `name` has a valid override in this $(D Control) node. 1213 */ 1214 bool hasColorOverride(in String name) const 1215 { 1216 checkClassBinding!(typeof(this))(); 1217 return ptrcall!(bool)(GDNativeClassBinding.hasColorOverride, _godot_object, name); 1218 } 1219 /** 1220 Returns `true` if constant with given `name` and associated with $(D Control) of given `node_type` exists in assigned $(D Theme). 1221 */ 1222 bool hasConstant(in String name, in String node_type = gs!"") const 1223 { 1224 checkClassBinding!(typeof(this))(); 1225 return ptrcall!(bool)(GDNativeClassBinding.hasConstant, _godot_object, name, node_type); 1226 } 1227 /** 1228 Returns `true` if constant with given `name` has a valid override in this $(D Control) node. 1229 */ 1230 bool hasConstantOverride(in String name) const 1231 { 1232 checkClassBinding!(typeof(this))(); 1233 return ptrcall!(bool)(GDNativeClassBinding.hasConstantOverride, _godot_object, name); 1234 } 1235 /** 1236 Returns `true` if this is the current focused control. See $(D focusMode). 1237 */ 1238 bool hasFocus() const 1239 { 1240 checkClassBinding!(typeof(this))(); 1241 return ptrcall!(bool)(GDNativeClassBinding.hasFocus, _godot_object); 1242 } 1243 /** 1244 Returns `true` if font with given `name` and associated with $(D Control) of given `node_type` exists in assigned $(D Theme). 1245 */ 1246 bool hasFont(in String name, in String node_type = gs!"") const 1247 { 1248 checkClassBinding!(typeof(this))(); 1249 return ptrcall!(bool)(GDNativeClassBinding.hasFont, _godot_object, name, node_type); 1250 } 1251 /** 1252 Returns `true` if font with given `name` has a valid override in this $(D Control) node. 1253 */ 1254 bool hasFontOverride(in String name) const 1255 { 1256 checkClassBinding!(typeof(this))(); 1257 return ptrcall!(bool)(GDNativeClassBinding.hasFontOverride, _godot_object, name); 1258 } 1259 /** 1260 Returns `true` if icon with given `name` and associated with $(D Control) of given `node_type` exists in assigned $(D Theme). 1261 */ 1262 bool hasIcon(in String name, in String node_type = gs!"") const 1263 { 1264 checkClassBinding!(typeof(this))(); 1265 return ptrcall!(bool)(GDNativeClassBinding.hasIcon, _godot_object, name, node_type); 1266 } 1267 /** 1268 Returns `true` if icon with given `name` has a valid override in this $(D Control) node. 1269 */ 1270 bool hasIconOverride(in String name) const 1271 { 1272 checkClassBinding!(typeof(this))(); 1273 return ptrcall!(bool)(GDNativeClassBinding.hasIconOverride, _godot_object, name); 1274 } 1275 /** 1276 Virtual method to be implemented by the user. Returns whether the given `point` is inside this control. 1277 If not overridden, default behavior is checking if the point is within control's Rect. 1278 $(B Note:) If you want to check if a point is inside the control, you can use `get_rect().has_point(point)`. 1279 */ 1280 bool hasPoint(in Vector2 point) 1281 { 1282 Array _GODOT_args = Array.make(); 1283 _GODOT_args.append(point); 1284 String _GODOT_method_name = String("has_point"); 1285 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool); 1286 } 1287 /** 1288 Returns `true` if $(D Shader) with given `name` has a valid override in this $(D Control) node. 1289 */ 1290 bool hasShaderOverride(in String name) const 1291 { 1292 checkClassBinding!(typeof(this))(); 1293 return ptrcall!(bool)(GDNativeClassBinding.hasShaderOverride, _godot_object, name); 1294 } 1295 /** 1296 Returns `true` if $(D StyleBox) with given `name` and associated with $(D Control) of given `node_type` exists in assigned $(D Theme). 1297 */ 1298 bool hasStylebox(in String name, in String node_type = gs!"") const 1299 { 1300 checkClassBinding!(typeof(this))(); 1301 return ptrcall!(bool)(GDNativeClassBinding.hasStylebox, _godot_object, name, node_type); 1302 } 1303 /** 1304 Returns `true` if $(D StyleBox) with given `name` has a valid override in this $(D Control) node. 1305 */ 1306 bool hasStyleboxOverride(in String name) const 1307 { 1308 checkClassBinding!(typeof(this))(); 1309 return ptrcall!(bool)(GDNativeClassBinding.hasStyleboxOverride, _godot_object, name); 1310 } 1311 /** 1312 1313 */ 1314 bool isClippingContents() 1315 { 1316 checkClassBinding!(typeof(this))(); 1317 return ptrcall!(bool)(GDNativeClassBinding.isClippingContents, _godot_object); 1318 } 1319 /** 1320 Invalidates the size cache in this node and in parent nodes up to toplevel. Intended to be used with $(D getMinimumSize) when the return value is changed. Setting $(D rectMinSize) directly calls this method automatically. 1321 */ 1322 void minimumSizeChanged() 1323 { 1324 checkClassBinding!(typeof(this))(); 1325 ptrcall!(void)(GDNativeClassBinding.minimumSizeChanged, _godot_object); 1326 } 1327 /** 1328 Give up the focus. No other control will be able to receive keyboard input. 1329 */ 1330 void releaseFocus() 1331 { 1332 checkClassBinding!(typeof(this))(); 1333 ptrcall!(void)(GDNativeClassBinding.releaseFocus, _godot_object); 1334 } 1335 /** 1336 Sets the anchor identified by `margin` constant from $(D margin) enum to value `anchor`. A setter method for $(D anchorBottom), $(D anchorLeft), $(D anchorRight) and $(D anchorTop). 1337 If `keep_margin` is `true`, margins aren't updated after this operation. 1338 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. 1339 */ 1340 void setAnchor(in long margin, in double anchor, in bool keep_margin = false, in bool push_opposite_anchor = true) 1341 { 1342 checkClassBinding!(typeof(this))(); 1343 ptrcall!(void)(GDNativeClassBinding.setAnchor, _godot_object, margin, anchor, keep_margin, push_opposite_anchor); 1344 } 1345 /** 1346 Works the same as $(D setAnchor), but instead of `keep_margin` argument and automatic update of margin, it allows to set the margin offset yourself (see $(D setMargin)). 1347 */ 1348 void setAnchorAndMargin(in long margin, in double anchor, in double offset, in bool push_opposite_anchor = false) 1349 { 1350 checkClassBinding!(typeof(this))(); 1351 ptrcall!(void)(GDNativeClassBinding.setAnchorAndMargin, _godot_object, margin, anchor, offset, push_opposite_anchor); 1352 } 1353 /** 1354 Sets both anchor preset and margin preset. See $(D setAnchorsPreset) and $(D setMarginsPreset). 1355 */ 1356 void setAnchorsAndMarginsPreset(in long preset, in long resize_mode = 0, in long margin = 0) 1357 { 1358 checkClassBinding!(typeof(this))(); 1359 ptrcall!(void)(GDNativeClassBinding.setAnchorsAndMarginsPreset, _godot_object, preset, resize_mode, margin); 1360 } 1361 /** 1362 Sets the anchors to a `preset` from $(D Control.layoutpreset) enum. This is the code equivalent to using the Layout menu in the 2D editor. 1363 If `keep_margins` is `true`, control's position will also be updated. 1364 */ 1365 void setAnchorsPreset(in long preset, in bool keep_margins = false) 1366 { 1367 checkClassBinding!(typeof(this))(); 1368 ptrcall!(void)(GDNativeClassBinding.setAnchorsPreset, _godot_object, preset, keep_margins); 1369 } 1370 /** 1371 Sets $(D marginLeft) and $(D marginTop) at the same time. Equivalent of changing $(D rectPosition). 1372 */ 1373 void setBegin(in Vector2 position) 1374 { 1375 checkClassBinding!(typeof(this))(); 1376 ptrcall!(void)(GDNativeClassBinding.setBegin, _godot_object, position); 1377 } 1378 /** 1379 1380 */ 1381 void setClipContents(in bool enable) 1382 { 1383 checkClassBinding!(typeof(this))(); 1384 ptrcall!(void)(GDNativeClassBinding.setClipContents, _godot_object, enable); 1385 } 1386 /** 1387 1388 */ 1389 void setCustomMinimumSize(in Vector2 size) 1390 { 1391 checkClassBinding!(typeof(this))(); 1392 ptrcall!(void)(GDNativeClassBinding.setCustomMinimumSize, _godot_object, size); 1393 } 1394 /** 1395 1396 */ 1397 void setDefaultCursorShape(in long shape) 1398 { 1399 checkClassBinding!(typeof(this))(); 1400 ptrcall!(void)(GDNativeClassBinding.setDefaultCursorShape, _godot_object, shape); 1401 } 1402 /** 1403 Forwards the handling of this control's drag and drop to `target` control. 1404 Forwarding can be implemented in the target control similar to the methods $(D getDragData), $(D canDropData), and $(D dropData) but with two differences: 1405 1. The function name must be suffixed with $(B _fw) 1406 2. The function must take an extra argument that is the control doing the forwarding 1407 1408 1409 # ThisControl.gd 1410 extends Control 1411 func _ready(): 1412 set_drag_forwarding(target_control) 1413 1414 # TargetControl.gd 1415 extends Control 1416 func can_drop_data_fw(position, data, from_control): 1417 return true 1418 1419 func drop_data_fw(position, data, from_control): 1420 my_handle_data(data) 1421 1422 func get_drag_data_fw(position, from_control): 1423 set_drag_preview(my_preview) 1424 return my_data() 1425 1426 1427 */ 1428 void setDragForwarding(Control target) 1429 { 1430 checkClassBinding!(typeof(this))(); 1431 ptrcall!(void)(GDNativeClassBinding.setDragForwarding, _godot_object, target); 1432 } 1433 /** 1434 Shows the given control at the mouse pointer. A good time to call this method is in $(D getDragData). 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. 1435 1436 1437 export (Color, RGBA) var color = Color(1, 0, 0, 1) 1438 1439 func get_drag_data(position): 1440 # Use a control that is not in the tree 1441 var cpb = ColorPickerButton.new() 1442 cpb.color = color 1443 cpb.rect_size = Vector2(50, 50) 1444 set_drag_preview(cpb) 1445 return color 1446 1447 1448 */ 1449 void setDragPreview(Control control) 1450 { 1451 checkClassBinding!(typeof(this))(); 1452 ptrcall!(void)(GDNativeClassBinding.setDragPreview, _godot_object, control); 1453 } 1454 /** 1455 Sets $(D marginRight) and $(D marginBottom) at the same time. 1456 */ 1457 void setEnd(in Vector2 position) 1458 { 1459 checkClassBinding!(typeof(this))(); 1460 ptrcall!(void)(GDNativeClassBinding.setEnd, _godot_object, position); 1461 } 1462 /** 1463 1464 */ 1465 void setFocusMode(in long mode) 1466 { 1467 checkClassBinding!(typeof(this))(); 1468 ptrcall!(void)(GDNativeClassBinding.setFocusMode, _godot_object, mode); 1469 } 1470 /** 1471 Sets the anchor identified by `margin` constant from $(D margin) enum to $(D Control) at `neighbor` node path. A setter method for $(D focusNeighbourBottom), $(D focusNeighbourLeft), $(D focusNeighbourRight) and $(D focusNeighbourTop). 1472 */ 1473 void setFocusNeighbour(NodePathArg1)(in long margin, in NodePathArg1 neighbour) 1474 { 1475 checkClassBinding!(typeof(this))(); 1476 ptrcall!(void)(GDNativeClassBinding.setFocusNeighbour, _godot_object, margin, neighbour); 1477 } 1478 /** 1479 1480 */ 1481 void setFocusNext(NodePathArg0)(in NodePathArg0 next) 1482 { 1483 checkClassBinding!(typeof(this))(); 1484 ptrcall!(void)(GDNativeClassBinding.setFocusNext, _godot_object, next); 1485 } 1486 /** 1487 1488 */ 1489 void setFocusPrevious(NodePathArg0)(in NodePathArg0 previous) 1490 { 1491 checkClassBinding!(typeof(this))(); 1492 ptrcall!(void)(GDNativeClassBinding.setFocusPrevious, _godot_object, previous); 1493 } 1494 /** 1495 Sets the $(D rectGlobalPosition) to given `position`. 1496 If `keep_margins` is `true`, control's anchors will be updated instead of margins. 1497 */ 1498 void setGlobalPosition(in Vector2 position, in bool keep_margins = false) 1499 { 1500 checkClassBinding!(typeof(this))(); 1501 ptrcall!(void)(GDNativeClassBinding.setGlobalPosition, _godot_object, position, keep_margins); 1502 } 1503 /** 1504 1505 */ 1506 void setHGrowDirection(in long direction) 1507 { 1508 checkClassBinding!(typeof(this))(); 1509 ptrcall!(void)(GDNativeClassBinding.setHGrowDirection, _godot_object, direction); 1510 } 1511 /** 1512 1513 */ 1514 void setHSizeFlags(in long flags) 1515 { 1516 checkClassBinding!(typeof(this))(); 1517 ptrcall!(void)(GDNativeClassBinding.setHSizeFlags, _godot_object, flags); 1518 } 1519 /** 1520 Sets the margin identified by `margin` constant from $(D margin) enum to given `offset`. A setter method for $(D marginBottom), $(D marginLeft), $(D marginRight) and $(D marginTop). 1521 */ 1522 void setMargin(in long margin, in double offset) 1523 { 1524 checkClassBinding!(typeof(this))(); 1525 ptrcall!(void)(GDNativeClassBinding.setMargin, _godot_object, margin, offset); 1526 } 1527 /** 1528 Sets the margins to a `preset` from $(D Control.layoutpreset) enum. This is the code equivalent to using the Layout menu in the 2D editor. 1529 Use parameter `resize_mode` with constants from $(D Control.layoutpresetmode) to better determine the resulting size of the $(D Control). Constant size will be ignored if used with presets that change size, e.g. `PRESET_LEFT_WIDE`. 1530 Use parameter `margin` to determine the gap between the $(D Control) and the edges. 1531 */ 1532 void setMarginsPreset(in long preset, in long resize_mode = 0, in long margin = 0) 1533 { 1534 checkClassBinding!(typeof(this))(); 1535 ptrcall!(void)(GDNativeClassBinding.setMarginsPreset, _godot_object, preset, resize_mode, margin); 1536 } 1537 /** 1538 1539 */ 1540 void setMouseFilter(in long filter) 1541 { 1542 checkClassBinding!(typeof(this))(); 1543 ptrcall!(void)(GDNativeClassBinding.setMouseFilter, _godot_object, filter); 1544 } 1545 /** 1546 1547 */ 1548 void setPassOnModalCloseClick(in bool enabled) 1549 { 1550 checkClassBinding!(typeof(this))(); 1551 ptrcall!(void)(GDNativeClassBinding.setPassOnModalCloseClick, _godot_object, enabled); 1552 } 1553 /** 1554 1555 */ 1556 void setPivotOffset(in Vector2 pivot_offset) 1557 { 1558 checkClassBinding!(typeof(this))(); 1559 ptrcall!(void)(GDNativeClassBinding.setPivotOffset, _godot_object, pivot_offset); 1560 } 1561 /** 1562 Sets the $(D rectPosition) to given `position`. 1563 If `keep_margins` is `true`, control's anchors will be updated instead of margins. 1564 */ 1565 void setPosition(in Vector2 position, in bool keep_margins = false) 1566 { 1567 checkClassBinding!(typeof(this))(); 1568 ptrcall!(void)(GDNativeClassBinding.setPosition, _godot_object, position, keep_margins); 1569 } 1570 /** 1571 Sets the rotation (in radians). 1572 */ 1573 void setRotation(in double radians) 1574 { 1575 checkClassBinding!(typeof(this))(); 1576 ptrcall!(void)(GDNativeClassBinding.setRotation, _godot_object, radians); 1577 } 1578 /** 1579 1580 */ 1581 void setRotationDegrees(in double degrees) 1582 { 1583 checkClassBinding!(typeof(this))(); 1584 ptrcall!(void)(GDNativeClassBinding.setRotationDegrees, _godot_object, degrees); 1585 } 1586 /** 1587 1588 */ 1589 void setScale(in Vector2 scale) 1590 { 1591 checkClassBinding!(typeof(this))(); 1592 ptrcall!(void)(GDNativeClassBinding.setScale, _godot_object, scale); 1593 } 1594 /** 1595 Sets the size (see $(D rectSize)). 1596 If `keep_margins` is `true`, control's anchors will be updated instead of margins. 1597 */ 1598 void setSize(in Vector2 size, in bool keep_margins = false) 1599 { 1600 checkClassBinding!(typeof(this))(); 1601 ptrcall!(void)(GDNativeClassBinding.setSize, _godot_object, size, keep_margins); 1602 } 1603 /** 1604 1605 */ 1606 void setStretchRatio(in double ratio) 1607 { 1608 checkClassBinding!(typeof(this))(); 1609 ptrcall!(void)(GDNativeClassBinding.setStretchRatio, _godot_object, ratio); 1610 } 1611 /** 1612 1613 */ 1614 void setTheme(Theme theme) 1615 { 1616 checkClassBinding!(typeof(this))(); 1617 ptrcall!(void)(GDNativeClassBinding.setTheme, _godot_object, theme); 1618 } 1619 /** 1620 1621 */ 1622 void setTooltip(in String tooltip) 1623 { 1624 checkClassBinding!(typeof(this))(); 1625 ptrcall!(void)(GDNativeClassBinding.setTooltip, _godot_object, tooltip); 1626 } 1627 /** 1628 1629 */ 1630 void setVGrowDirection(in long direction) 1631 { 1632 checkClassBinding!(typeof(this))(); 1633 ptrcall!(void)(GDNativeClassBinding.setVGrowDirection, _godot_object, direction); 1634 } 1635 /** 1636 1637 */ 1638 void setVSizeFlags(in long flags) 1639 { 1640 checkClassBinding!(typeof(this))(); 1641 ptrcall!(void)(GDNativeClassBinding.setVSizeFlags, _godot_object, flags); 1642 } 1643 /** 1644 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. 1645 If `exclusive` is `true`, other controls will not receive input and clicking outside this control will not close it. 1646 */ 1647 void showModal(in bool exclusive = false) 1648 { 1649 checkClassBinding!(typeof(this))(); 1650 ptrcall!(void)(GDNativeClassBinding.showModal, _godot_object, exclusive); 1651 } 1652 /** 1653 Moves the mouse cursor to `to_position`, relative to $(D rectPosition) of this $(D Control). 1654 */ 1655 void warpMouse(in Vector2 to_position) 1656 { 1657 checkClassBinding!(typeof(this))(); 1658 ptrcall!(void)(GDNativeClassBinding.warpMouse, _godot_object, to_position); 1659 } 1660 /** 1661 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 $(D anchor) constants for convenience. 1662 */ 1663 @property double anchorBottom() 1664 { 1665 return getAnchor(3); 1666 } 1667 /// ditto 1668 @property void anchorBottom(double v) 1669 { 1670 _setAnchor(3, v); 1671 } 1672 /** 1673 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 $(D anchor) constants for convenience. 1674 */ 1675 @property double anchorLeft() 1676 { 1677 return getAnchor(0); 1678 } 1679 /// ditto 1680 @property void anchorLeft(double v) 1681 { 1682 _setAnchor(0, v); 1683 } 1684 /** 1685 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 $(D anchor) constants for convenience. 1686 */ 1687 @property double anchorRight() 1688 { 1689 return getAnchor(2); 1690 } 1691 /// ditto 1692 @property void anchorRight(double v) 1693 { 1694 _setAnchor(2, v); 1695 } 1696 /** 1697 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 $(D anchor) constants for convenience. 1698 */ 1699 @property double anchorTop() 1700 { 1701 return getAnchor(1); 1702 } 1703 /// ditto 1704 @property void anchorTop(double v) 1705 { 1706 _setAnchor(1, v); 1707 } 1708 /** 1709 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. 1710 */ 1711 @property Control.FocusMode focusMode() 1712 { 1713 return getFocusMode(); 1714 } 1715 /// ditto 1716 @property void focusMode(long v) 1717 { 1718 setFocusMode(v); 1719 } 1720 /** 1721 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 $(D Control). If this property is not set, Godot will give focus to the closest $(D Control) to the bottom of this one. 1722 */ 1723 @property NodePath focusNeighbourBottom() 1724 { 1725 return getFocusNeighbour(3); 1726 } 1727 /// ditto 1728 @property void focusNeighbourBottom(NodePath v) 1729 { 1730 setFocusNeighbour(3, v); 1731 } 1732 /** 1733 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 $(D Control). If this property is not set, Godot will give focus to the closest $(D Control) to the left of this one. 1734 */ 1735 @property NodePath focusNeighbourLeft() 1736 { 1737 return getFocusNeighbour(0); 1738 } 1739 /// ditto 1740 @property void focusNeighbourLeft(NodePath v) 1741 { 1742 setFocusNeighbour(0, v); 1743 } 1744 /** 1745 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 $(D Control). If this property is not set, Godot will give focus to the closest $(D Control) to the bottom of this one. 1746 */ 1747 @property NodePath focusNeighbourRight() 1748 { 1749 return getFocusNeighbour(2); 1750 } 1751 /// ditto 1752 @property void focusNeighbourRight(NodePath v) 1753 { 1754 setFocusNeighbour(2, v); 1755 } 1756 /** 1757 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 $(D Control). If this property is not set, Godot will give focus to the closest $(D Control) to the bottom of this one. 1758 */ 1759 @property NodePath focusNeighbourTop() 1760 { 1761 return getFocusNeighbour(1); 1762 } 1763 /// ditto 1764 @property void focusNeighbourTop(NodePath v) 1765 { 1766 setFocusNeighbour(1, v); 1767 } 1768 /** 1769 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. 1770 If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree. 1771 */ 1772 @property NodePath focusNext() 1773 { 1774 return getFocusNext(); 1775 } 1776 /// ditto 1777 @property void focusNext(NodePath v) 1778 { 1779 setFocusNext(v); 1780 } 1781 /** 1782 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. 1783 If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree. 1784 */ 1785 @property NodePath focusPrevious() 1786 { 1787 return getFocusPrevious(); 1788 } 1789 /// ditto 1790 @property void focusPrevious(NodePath v) 1791 { 1792 setFocusPrevious(v); 1793 } 1794 /** 1795 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. 1796 */ 1797 @property Control.GrowDirection growHorizontal() 1798 { 1799 return getHGrowDirection(); 1800 } 1801 /// ditto 1802 @property void growHorizontal(long v) 1803 { 1804 setHGrowDirection(v); 1805 } 1806 /** 1807 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. 1808 */ 1809 @property Control.GrowDirection growVertical() 1810 { 1811 return getVGrowDirection(); 1812 } 1813 /// ditto 1814 @property void growVertical(long v) 1815 { 1816 setVGrowDirection(v); 1817 } 1818 /** 1819 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 $(D mouseFilter) property is not $(D constant MOUSE_FILTER_IGNORE). You can change the time required for the tooltip to appear with `gui/timers/tooltip_delay_sec` option in Project Settings. 1820 The tooltip popup will use either a default implementation, or a custom one that you can provide by overriding $(D _makeCustomTooltip). The default tooltip includes a $(D PopupPanel) and $(D Label) whose theme properties can be customized using $(D Theme) methods with the `"TooltipPanel"` and `"TooltipLabel"` respectively. For example: 1821 1822 1823 var style_box = StyleBoxFlat.new() 1824 style_box.set_bg_color(Color(1, 1, 0)) 1825 style_box.set_border_width_all(2) 1826 # We assume here that the `theme` property has been assigned a custom Theme beforehand. 1827 theme.set_stylebox("panel", "TooltipPanel", style_box) 1828 theme.set_color("font_color", "TooltipLabel", Color(0, 1, 1)) 1829 1830 1831 */ 1832 @property String hintTooltip() 1833 { 1834 return _getTooltip(); 1835 } 1836 /// ditto 1837 @property void hintTooltip(String v) 1838 { 1839 setTooltip(v); 1840 } 1841 /** 1842 Enables whether input should propagate when you close the control as modal. 1843 If `false`, stops event handling at the viewport input event handling. The viewport first hides the modal and after marks the input as handled. 1844 */ 1845 @property bool inputPassOnModalCloseClick() 1846 { 1847 return getPassOnModalCloseClick(); 1848 } 1849 /// ditto 1850 @property void inputPassOnModalCloseClick(bool v) 1851 { 1852 setPassOnModalCloseClick(v); 1853 } 1854 /** 1855 Distance between the node's bottom edge and its parent control, based on $(D anchorBottom). 1856 Margins are often controlled by one or multiple parent $(D Container) nodes, so you should not modify them manually if your node is a direct child of a $(D Container). Margins update automatically when you move or resize the node. 1857 */ 1858 @property double marginBottom() 1859 { 1860 return getMargin(3); 1861 } 1862 /// ditto 1863 @property void marginBottom(double v) 1864 { 1865 setMargin(3, v); 1866 } 1867 /** 1868 Distance between the node's left edge and its parent control, based on $(D anchorLeft). 1869 Margins are often controlled by one or multiple parent $(D Container) nodes, so you should not modify them manually if your node is a direct child of a $(D Container). Margins update automatically when you move or resize the node. 1870 */ 1871 @property double marginLeft() 1872 { 1873 return getMargin(0); 1874 } 1875 /// ditto 1876 @property void marginLeft(double v) 1877 { 1878 setMargin(0, v); 1879 } 1880 /** 1881 Distance between the node's right edge and its parent control, based on $(D anchorRight). 1882 Margins are often controlled by one or multiple parent $(D Container) nodes, so you should not modify them manually if your node is a direct child of a $(D Container). Margins update automatically when you move or resize the node. 1883 */ 1884 @property double marginRight() 1885 { 1886 return getMargin(2); 1887 } 1888 /// ditto 1889 @property void marginRight(double v) 1890 { 1891 setMargin(2, v); 1892 } 1893 /** 1894 Distance between the node's top edge and its parent control, based on $(D anchorTop). 1895 Margins are often controlled by one or multiple parent $(D Container) nodes, so you should not modify them manually if your node is a direct child of a $(D Container). Margins update automatically when you move or resize the node. 1896 */ 1897 @property double marginTop() 1898 { 1899 return getMargin(1); 1900 } 1901 /// ditto 1902 @property void marginTop(double v) 1903 { 1904 setMargin(1, v); 1905 } 1906 /** 1907 The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors. 1908 $(B Note:) On Linux, shapes may vary depending on the cursor theme of the system. 1909 */ 1910 @property Control.CursorShape mouseDefaultCursorShape() 1911 { 1912 return getDefaultCursorShape(); 1913 } 1914 /// ditto 1915 @property void mouseDefaultCursorShape(long v) 1916 { 1917 setDefaultCursorShape(v); 1918 } 1919 /** 1920 Controls whether the control will be able to receive mouse button input events through $(D _guiInput) and how these events should be handled. Also controls whether the control can receive the $(D mouseEntered), and $(D mouseExited) signals. See the constants to learn what each does. 1921 */ 1922 @property Control.MouseFilter mouseFilter() 1923 { 1924 return getMouseFilter(); 1925 } 1926 /// ditto 1927 @property void mouseFilter(long v) 1928 { 1929 setMouseFilter(v); 1930 } 1931 /** 1932 Enables whether rendering of $(D 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. 1933 */ 1934 @property bool rectClipContent() 1935 { 1936 return isClippingContents(); 1937 } 1938 /// ditto 1939 @property void rectClipContent(bool v) 1940 { 1941 setClipContents(v); 1942 } 1943 /** 1944 The node's global position, relative to the world (usually to the top-left corner of the window). 1945 */ 1946 @property Vector2 rectGlobalPosition() 1947 { 1948 return getGlobalPosition(); 1949 } 1950 /// ditto 1951 @property void rectGlobalPosition(Vector2 v) 1952 { 1953 _setGlobalPosition(v); 1954 } 1955 /** 1956 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. 1957 */ 1958 @property Vector2 rectMinSize() 1959 { 1960 return getCustomMinimumSize(); 1961 } 1962 /// ditto 1963 @property void rectMinSize(Vector2 v) 1964 { 1965 setCustomMinimumSize(v); 1966 } 1967 /** 1968 By default, the node's pivot is its top-left corner. When you change its $(D rectScale), it will scale around this pivot. Set this property to $(D rectSize) / 2 to center the pivot in the node's rectangle. 1969 */ 1970 @property Vector2 rectPivotOffset() 1971 { 1972 return getPivotOffset(); 1973 } 1974 /// ditto 1975 @property void rectPivotOffset(Vector2 v) 1976 { 1977 setPivotOffset(v); 1978 } 1979 /** 1980 The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by $(D rectPivotOffset). 1981 */ 1982 @property Vector2 rectPosition() 1983 { 1984 return getPosition(); 1985 } 1986 /// ditto 1987 @property void rectPosition(Vector2 v) 1988 { 1989 _setPosition(v); 1990 } 1991 /** 1992 The node's rotation around its pivot, in degrees. See $(D rectPivotOffset) to change the pivot's position. 1993 */ 1994 @property double rectRotation() 1995 { 1996 return getRotationDegrees(); 1997 } 1998 /// ditto 1999 @property void rectRotation(double v) 2000 { 2001 setRotationDegrees(v); 2002 } 2003 /** 2004 The node's scale, relative to its $(D rectSize). Change this property to scale the node around its $(D rectPivotOffset). The Control's $(D hintTooltip) will also scale according to this value. 2005 $(B 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 $(D url=https://docs.godotengine.org/en/3.3/tutorials/viewports/multiple_resolutions.html)documentation$(D /url) instead of scaling Controls individually. 2006 $(B Note:) If the Control node is a child of a $(D 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 $(D rectScale) property. 2007 */ 2008 @property Vector2 rectScale() 2009 { 2010 return getScale(); 2011 } 2012 /// ditto 2013 @property void rectScale(Vector2 v) 2014 { 2015 setScale(v); 2016 } 2017 /** 2018 The size of the node's bounding rectangle, in pixels. $(D Container) nodes update this property automatically. 2019 */ 2020 @property Vector2 rectSize() 2021 { 2022 return getSize(); 2023 } 2024 /// ditto 2025 @property void rectSize(Vector2 v) 2026 { 2027 _setSize(v); 2028 } 2029 /** 2030 Tells the parent $(D Container) nodes how they should resize and place the node on the X axis. Use one of the $(D sizeflags) constants to change the flags. See the constants to learn what each does. 2031 */ 2032 @property long sizeFlagsHorizontal() 2033 { 2034 return getHSizeFlags(); 2035 } 2036 /// ditto 2037 @property void sizeFlagsHorizontal(long v) 2038 { 2039 setHSizeFlags(v); 2040 } 2041 /** 2042 If the node and at least one of its neighbours uses the $(D constant SIZE_EXPAND) size flag, the parent $(D 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. 2043 */ 2044 @property double sizeFlagsStretchRatio() 2045 { 2046 return getStretchRatio(); 2047 } 2048 /// ditto 2049 @property void sizeFlagsStretchRatio(double v) 2050 { 2051 setStretchRatio(v); 2052 } 2053 /** 2054 Tells the parent $(D Container) nodes how they should resize and place the node on the Y axis. Use one of the $(D sizeflags) constants to change the flags. See the constants to learn what each does. 2055 */ 2056 @property long sizeFlagsVertical() 2057 { 2058 return getVSizeFlags(); 2059 } 2060 /// ditto 2061 @property void sizeFlagsVertical(long v) 2062 { 2063 setVSizeFlags(v); 2064 } 2065 /** 2066 Changing this property replaces the current $(D Theme) resource this node and all its $(D Control) children use. 2067 */ 2068 @property Theme theme() 2069 { 2070 return getTheme(); 2071 } 2072 /// ditto 2073 @property void theme(Theme v) 2074 { 2075 setTheme(v); 2076 } 2077 }