class_control.rst 183 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Control.xml.
  6. .. _class_Control:
  7. Control
  8. =======
  9. **Inherits:** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`BaseButton<class_BaseButton>`, :ref:`ColorRect<class_ColorRect>`, :ref:`Container<class_Container>`, :ref:`GraphEdit<class_GraphEdit>`, :ref:`ItemList<class_ItemList>`, :ref:`Label<class_Label>`, :ref:`LineEdit<class_LineEdit>`, :ref:`MenuBar<class_MenuBar>`, :ref:`NinePatchRect<class_NinePatchRect>`, :ref:`Panel<class_Panel>`, :ref:`Range<class_Range>`, :ref:`ReferenceRect<class_ReferenceRect>`, :ref:`RichTextLabel<class_RichTextLabel>`, :ref:`Separator<class_Separator>`, :ref:`TabBar<class_TabBar>`, :ref:`TextEdit<class_TextEdit>`, :ref:`TextureRect<class_TextureRect>`, :ref:`Tree<class_Tree>`, :ref:`VideoStreamPlayer<class_VideoStreamPlayer>`
  11. Base class for all GUI controls. Adapts its position and size based on its parent control.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Base class for all UI-related nodes. **Control** features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, and offsets relative to the anchor. The offsets update automatically when the node, any of its parents, or the screen size change.
  16. For more information on Godot's UI system, anchors, offsets, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from **Control** and :ref:`Container<class_Container>` nodes.
  17. \ **User Interface nodes and input**\
  18. Godot propagates input events via viewports. Each :ref:`Viewport<class_Viewport>` is responsible for propagating :ref:`InputEvent<class_InputEvent>`\ s to their child nodes. As the :ref:`SceneTree.root<class_SceneTree_property_root>` is a :ref:`Window<class_Window>`, this already happens automatically for all UI elements in your game.
  19. Input events are propagated through the :ref:`SceneTree<class_SceneTree>` from the root node to all child nodes by calling :ref:`Node._input<class_Node_method__input>`. For UI elements specifically, it makes more sense to override the virtual method :ref:`_gui_input<class_Control_method__gui_input>`, which filters out unrelated input events, such as by checking z-order, :ref:`mouse_filter<class_Control_property_mouse_filter>`, focus, or if the event was inside of the control's bounding box.
  20. Call :ref:`accept_event<class_Control_method_accept_event>` so no other node receives the event. Once you accept an input, it becomes handled so :ref:`Node._unhandled_input<class_Node_method__unhandled_input>` will not process it.
  21. Only one **Control** node can be in focus. Only the node in focus will receive events. To get the focus, call :ref:`grab_focus<class_Control_method_grab_focus>`. **Control** nodes lose focus when another node grabs it, or if you hide the node in focus.
  22. Sets :ref:`mouse_filter<class_Control_property_mouse_filter>` to :ref:`MOUSE_FILTER_IGNORE<class_Control_constant_MOUSE_FILTER_IGNORE>` to tell a **Control** node to ignore mouse or touch events. You'll need it if you place an icon on top of a button.
  23. \ :ref:`Theme<class_Theme>` resources change the Control's appearance. If you change the :ref:`Theme<class_Theme>` on a **Control** node, it affects all of its children. To override some of the theme's parameters, call one of the ``add_theme_*_override`` methods, like :ref:`add_theme_font_override<class_Control_method_add_theme_font_override>`. You can override the theme with the Inspector.
  24. \ **Note:** Theme items are *not* :ref:`Object<class_Object>` properties. This means you can't access their values using :ref:`Object.get<class_Object_method_get>` and :ref:`Object.set<class_Object_method_set>`. Instead, use the ``get_theme_*`` and ``add_theme_*_override`` methods provided by this class.
  25. .. rst-class:: classref-introduction-group
  26. Tutorials
  27. ---------
  28. - :doc:`GUI documentation index <../tutorials/ui/index>`
  29. - :doc:`Custom drawing in 2D <../tutorials/2d/custom_drawing_in_2d>`
  30. - :doc:`Control node gallery <../tutorials/ui/control_node_gallery>`
  31. - `All GUI Demos <https://github.com/godotengine/godot-demo-projects/tree/master/gui>`__
  32. .. rst-class:: classref-reftable-group
  33. Properties
  34. ----------
  35. .. table::
  36. :widths: auto
  37. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  38. | :ref:`float<class_float>` | :ref:`anchor_bottom<class_Control_property_anchor_bottom>` | ``0.0`` |
  39. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  40. | :ref:`float<class_float>` | :ref:`anchor_left<class_Control_property_anchor_left>` | ``0.0`` |
  41. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  42. | :ref:`float<class_float>` | :ref:`anchor_right<class_Control_property_anchor_right>` | ``0.0`` |
  43. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  44. | :ref:`float<class_float>` | :ref:`anchor_top<class_Control_property_anchor_top>` | ``0.0`` |
  45. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  46. | :ref:`bool<class_bool>` | :ref:`auto_translate<class_Control_property_auto_translate>` | ``true`` |
  47. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  48. | :ref:`bool<class_bool>` | :ref:`clip_contents<class_Control_property_clip_contents>` | ``false`` |
  49. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  50. | :ref:`Vector2<class_Vector2>` | :ref:`custom_minimum_size<class_Control_property_custom_minimum_size>` | ``Vector2(0, 0)`` |
  51. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  52. | :ref:`FocusMode<enum_Control_FocusMode>` | :ref:`focus_mode<class_Control_property_focus_mode>` | ``0`` |
  53. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  54. | :ref:`NodePath<class_NodePath>` | :ref:`focus_neighbor_bottom<class_Control_property_focus_neighbor_bottom>` | ``NodePath("")`` |
  55. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  56. | :ref:`NodePath<class_NodePath>` | :ref:`focus_neighbor_left<class_Control_property_focus_neighbor_left>` | ``NodePath("")`` |
  57. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  58. | :ref:`NodePath<class_NodePath>` | :ref:`focus_neighbor_right<class_Control_property_focus_neighbor_right>` | ``NodePath("")`` |
  59. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  60. | :ref:`NodePath<class_NodePath>` | :ref:`focus_neighbor_top<class_Control_property_focus_neighbor_top>` | ``NodePath("")`` |
  61. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  62. | :ref:`NodePath<class_NodePath>` | :ref:`focus_next<class_Control_property_focus_next>` | ``NodePath("")`` |
  63. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  64. | :ref:`NodePath<class_NodePath>` | :ref:`focus_previous<class_Control_property_focus_previous>` | ``NodePath("")`` |
  65. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  66. | :ref:`Vector2<class_Vector2>` | :ref:`global_position<class_Control_property_global_position>` | |
  67. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  68. | :ref:`GrowDirection<enum_Control_GrowDirection>` | :ref:`grow_horizontal<class_Control_property_grow_horizontal>` | ``1`` |
  69. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  70. | :ref:`GrowDirection<enum_Control_GrowDirection>` | :ref:`grow_vertical<class_Control_property_grow_vertical>` | ``1`` |
  71. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  72. | :ref:`LayoutDirection<enum_Control_LayoutDirection>` | :ref:`layout_direction<class_Control_property_layout_direction>` | ``0`` |
  73. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  74. | :ref:`bool<class_bool>` | :ref:`localize_numeral_system<class_Control_property_localize_numeral_system>` | ``true`` |
  75. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  76. | :ref:`CursorShape<enum_Control_CursorShape>` | :ref:`mouse_default_cursor_shape<class_Control_property_mouse_default_cursor_shape>` | ``0`` |
  77. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  78. | :ref:`MouseFilter<enum_Control_MouseFilter>` | :ref:`mouse_filter<class_Control_property_mouse_filter>` | ``0`` |
  79. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  80. | :ref:`bool<class_bool>` | :ref:`mouse_force_pass_scroll_events<class_Control_property_mouse_force_pass_scroll_events>` | ``true`` |
  81. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  82. | :ref:`float<class_float>` | :ref:`offset_bottom<class_Control_property_offset_bottom>` | ``0.0`` |
  83. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  84. | :ref:`float<class_float>` | :ref:`offset_left<class_Control_property_offset_left>` | ``0.0`` |
  85. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  86. | :ref:`float<class_float>` | :ref:`offset_right<class_Control_property_offset_right>` | ``0.0`` |
  87. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  88. | :ref:`float<class_float>` | :ref:`offset_top<class_Control_property_offset_top>` | ``0.0`` |
  89. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  90. | :ref:`Vector2<class_Vector2>` | :ref:`pivot_offset<class_Control_property_pivot_offset>` | ``Vector2(0, 0)`` |
  91. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  92. | :ref:`Vector2<class_Vector2>` | :ref:`position<class_Control_property_position>` | ``Vector2(0, 0)`` |
  93. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  94. | :ref:`float<class_float>` | :ref:`rotation<class_Control_property_rotation>` | ``0.0`` |
  95. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  96. | :ref:`float<class_float>` | :ref:`rotation_degrees<class_Control_property_rotation_degrees>` | |
  97. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  98. | :ref:`Vector2<class_Vector2>` | :ref:`scale<class_Control_property_scale>` | ``Vector2(1, 1)`` |
  99. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  100. | :ref:`Node<class_Node>` | :ref:`shortcut_context<class_Control_property_shortcut_context>` | |
  101. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  102. | :ref:`Vector2<class_Vector2>` | :ref:`size<class_Control_property_size>` | ``Vector2(0, 0)`` |
  103. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  104. | |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> | :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` | ``1`` |
  105. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  106. | :ref:`float<class_float>` | :ref:`size_flags_stretch_ratio<class_Control_property_size_flags_stretch_ratio>` | ``1.0`` |
  107. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  108. | |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> | :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>` | ``1`` |
  109. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  110. | :ref:`Theme<class_Theme>` | :ref:`theme<class_Control_property_theme>` | |
  111. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  112. | :ref:`StringName<class_StringName>` | :ref:`theme_type_variation<class_Control_property_theme_type_variation>` | ``&""`` |
  113. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  114. | :ref:`String<class_String>` | :ref:`tooltip_text<class_Control_property_tooltip_text>` | ``""`` |
  115. +--------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------+
  116. .. rst-class:: classref-reftable-group
  117. Methods
  118. -------
  119. .. table::
  120. :widths: auto
  121. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`bool<class_bool>` | :ref:`_can_drop_data<class_Control_method__can_drop_data>` **(** :ref:`Vector2<class_Vector2>` at_position, :ref:`Variant<class_Variant>` data **)** |virtual| |const| |
  123. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`_drop_data<class_Control_method__drop_data>` **(** :ref:`Vector2<class_Vector2>` at_position, :ref:`Variant<class_Variant>` data **)** |virtual| |
  125. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | :ref:`Variant<class_Variant>` | :ref:`_get_drag_data<class_Control_method__get_drag_data>` **(** :ref:`Vector2<class_Vector2>` at_position **)** |virtual| |
  127. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :ref:`Vector2<class_Vector2>` | :ref:`_get_minimum_size<class_Control_method__get_minimum_size>` **(** **)** |virtual| |const| |
  129. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`String<class_String>` | :ref:`_get_tooltip<class_Control_method__get_tooltip>` **(** :ref:`Vector2<class_Vector2>` at_position **)** |virtual| |const| |
  131. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | void | :ref:`_gui_input<class_Control_method__gui_input>` **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual| |
  133. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`bool<class_bool>` | :ref:`_has_point<class_Control_method__has_point>` **(** :ref:`Vector2<class_Vector2>` point **)** |virtual| |const| |
  135. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`Object<class_Object>` | :ref:`_make_custom_tooltip<class_Control_method__make_custom_tooltip>` **(** :ref:`String<class_String>` for_text **)** |virtual| |const| |
  137. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`Vector3i[]<class_Vector3i>` | :ref:`_structured_text_parser<class_Control_method__structured_text_parser>` **(** :ref:`Array<class_Array>` args, :ref:`String<class_String>` text **)** |virtual| |const| |
  139. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | void | :ref:`accept_event<class_Control_method_accept_event>` **(** **)** |
  141. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | void | :ref:`add_theme_color_override<class_Control_method_add_theme_color_override>` **(** :ref:`StringName<class_StringName>` name, :ref:`Color<class_Color>` color **)** |
  143. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | void | :ref:`add_theme_constant_override<class_Control_method_add_theme_constant_override>` **(** :ref:`StringName<class_StringName>` name, :ref:`int<class_int>` constant **)** |
  145. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | void | :ref:`add_theme_font_override<class_Control_method_add_theme_font_override>` **(** :ref:`StringName<class_StringName>` name, :ref:`Font<class_Font>` font **)** |
  147. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | void | :ref:`add_theme_font_size_override<class_Control_method_add_theme_font_size_override>` **(** :ref:`StringName<class_StringName>` name, :ref:`int<class_int>` font_size **)** |
  149. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | void | :ref:`add_theme_icon_override<class_Control_method_add_theme_icon_override>` **(** :ref:`StringName<class_StringName>` name, :ref:`Texture2D<class_Texture2D>` texture **)** |
  151. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | void | :ref:`add_theme_stylebox_override<class_Control_method_add_theme_stylebox_override>` **(** :ref:`StringName<class_StringName>` name, :ref:`StyleBox<class_StyleBox>` stylebox **)** |
  153. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | void | :ref:`begin_bulk_theme_override<class_Control_method_begin_bulk_theme_override>` **(** **)** |
  155. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | void | :ref:`end_bulk_theme_override<class_Control_method_end_bulk_theme_override>` **(** **)** |
  157. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | :ref:`Control<class_Control>` | :ref:`find_next_valid_focus<class_Control_method_find_next_valid_focus>` **(** **)** |const| |
  159. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | :ref:`Control<class_Control>` | :ref:`find_prev_valid_focus<class_Control_method_find_prev_valid_focus>` **(** **)** |const| |
  161. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | void | :ref:`force_drag<class_Control_method_force_drag>` **(** :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` preview **)** |
  163. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. | :ref:`float<class_float>` | :ref:`get_anchor<class_Control_method_get_anchor>` **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const| |
  165. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  166. | :ref:`Vector2<class_Vector2>` | :ref:`get_begin<class_Control_method_get_begin>` **(** **)** |const| |
  167. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  168. | :ref:`Vector2<class_Vector2>` | :ref:`get_combined_minimum_size<class_Control_method_get_combined_minimum_size>` **(** **)** |const| |
  169. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  170. | :ref:`CursorShape<enum_Control_CursorShape>` | :ref:`get_cursor_shape<class_Control_method_get_cursor_shape>` **(** :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)** |const| |
  171. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  172. | :ref:`Vector2<class_Vector2>` | :ref:`get_end<class_Control_method_get_end>` **(** **)** |const| |
  173. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  174. | :ref:`NodePath<class_NodePath>` | :ref:`get_focus_neighbor<class_Control_method_get_focus_neighbor>` **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const| |
  175. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  176. | :ref:`Rect2<class_Rect2>` | :ref:`get_global_rect<class_Control_method_get_global_rect>` **(** **)** |const| |
  177. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  178. | :ref:`Vector2<class_Vector2>` | :ref:`get_minimum_size<class_Control_method_get_minimum_size>` **(** **)** |const| |
  179. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  180. | :ref:`float<class_float>` | :ref:`get_offset<class_Control_method_get_offset>` **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const| |
  181. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  182. | :ref:`Vector2<class_Vector2>` | :ref:`get_parent_area_size<class_Control_method_get_parent_area_size>` **(** **)** |const| |
  183. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  184. | :ref:`Control<class_Control>` | :ref:`get_parent_control<class_Control_method_get_parent_control>` **(** **)** |const| |
  185. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  186. | :ref:`Rect2<class_Rect2>` | :ref:`get_rect<class_Control_method_get_rect>` **(** **)** |const| |
  187. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  188. | :ref:`Vector2<class_Vector2>` | :ref:`get_screen_position<class_Control_method_get_screen_position>` **(** **)** |const| |
  189. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  190. | :ref:`Color<class_Color>` | :ref:`get_theme_color<class_Control_method_get_theme_color>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  191. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  192. | :ref:`int<class_int>` | :ref:`get_theme_constant<class_Control_method_get_theme_constant>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  193. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  194. | :ref:`float<class_float>` | :ref:`get_theme_default_base_scale<class_Control_method_get_theme_default_base_scale>` **(** **)** |const| |
  195. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  196. | :ref:`Font<class_Font>` | :ref:`get_theme_default_font<class_Control_method_get_theme_default_font>` **(** **)** |const| |
  197. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  198. | :ref:`int<class_int>` | :ref:`get_theme_default_font_size<class_Control_method_get_theme_default_font_size>` **(** **)** |const| |
  199. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  200. | :ref:`Font<class_Font>` | :ref:`get_theme_font<class_Control_method_get_theme_font>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  201. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  202. | :ref:`int<class_int>` | :ref:`get_theme_font_size<class_Control_method_get_theme_font_size>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  203. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  204. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_theme_icon<class_Control_method_get_theme_icon>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  205. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  206. | :ref:`StyleBox<class_StyleBox>` | :ref:`get_theme_stylebox<class_Control_method_get_theme_stylebox>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  207. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  208. | :ref:`String<class_String>` | :ref:`get_tooltip<class_Control_method_get_tooltip>` **(** :ref:`Vector2<class_Vector2>` at_position=Vector2(0, 0) **)** |const| |
  209. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  210. | void | :ref:`grab_click_focus<class_Control_method_grab_click_focus>` **(** **)** |
  211. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  212. | void | :ref:`grab_focus<class_Control_method_grab_focus>` **(** **)** |
  213. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  214. | :ref:`bool<class_bool>` | :ref:`has_focus<class_Control_method_has_focus>` **(** **)** |const| |
  215. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  216. | :ref:`bool<class_bool>` | :ref:`has_theme_color<class_Control_method_has_theme_color>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  217. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  218. | :ref:`bool<class_bool>` | :ref:`has_theme_color_override<class_Control_method_has_theme_color_override>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  219. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  220. | :ref:`bool<class_bool>` | :ref:`has_theme_constant<class_Control_method_has_theme_constant>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  221. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  222. | :ref:`bool<class_bool>` | :ref:`has_theme_constant_override<class_Control_method_has_theme_constant_override>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  223. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  224. | :ref:`bool<class_bool>` | :ref:`has_theme_font<class_Control_method_has_theme_font>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  225. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  226. | :ref:`bool<class_bool>` | :ref:`has_theme_font_override<class_Control_method_has_theme_font_override>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  227. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  228. | :ref:`bool<class_bool>` | :ref:`has_theme_font_size<class_Control_method_has_theme_font_size>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  229. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  230. | :ref:`bool<class_bool>` | :ref:`has_theme_font_size_override<class_Control_method_has_theme_font_size_override>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  231. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  232. | :ref:`bool<class_bool>` | :ref:`has_theme_icon<class_Control_method_has_theme_icon>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  233. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  234. | :ref:`bool<class_bool>` | :ref:`has_theme_icon_override<class_Control_method_has_theme_icon_override>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  235. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  236. | :ref:`bool<class_bool>` | :ref:`has_theme_stylebox<class_Control_method_has_theme_stylebox>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  237. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  238. | :ref:`bool<class_bool>` | :ref:`has_theme_stylebox_override<class_Control_method_has_theme_stylebox_override>` **(** :ref:`StringName<class_StringName>` name **)** |const| |
  239. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  240. | :ref:`bool<class_bool>` | :ref:`is_drag_successful<class_Control_method_is_drag_successful>` **(** **)** |const| |
  241. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  242. | :ref:`bool<class_bool>` | :ref:`is_layout_rtl<class_Control_method_is_layout_rtl>` **(** **)** |const| |
  243. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  244. | void | :ref:`release_focus<class_Control_method_release_focus>` **(** **)** |
  245. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  246. | void | :ref:`remove_theme_color_override<class_Control_method_remove_theme_color_override>` **(** :ref:`StringName<class_StringName>` name **)** |
  247. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  248. | void | :ref:`remove_theme_constant_override<class_Control_method_remove_theme_constant_override>` **(** :ref:`StringName<class_StringName>` name **)** |
  249. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  250. | void | :ref:`remove_theme_font_override<class_Control_method_remove_theme_font_override>` **(** :ref:`StringName<class_StringName>` name **)** |
  251. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  252. | void | :ref:`remove_theme_font_size_override<class_Control_method_remove_theme_font_size_override>` **(** :ref:`StringName<class_StringName>` name **)** |
  253. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  254. | void | :ref:`remove_theme_icon_override<class_Control_method_remove_theme_icon_override>` **(** :ref:`StringName<class_StringName>` name **)** |
  255. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  256. | void | :ref:`remove_theme_stylebox_override<class_Control_method_remove_theme_stylebox_override>` **(** :ref:`StringName<class_StringName>` name **)** |
  257. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  258. | void | :ref:`reset_size<class_Control_method_reset_size>` **(** **)** |
  259. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  260. | void | :ref:`set_anchor<class_Control_method_set_anchor>` **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` anchor, :ref:`bool<class_bool>` keep_offset=false, :ref:`bool<class_bool>` push_opposite_anchor=true **)** |
  261. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  262. | void | :ref:`set_anchor_and_offset<class_Control_method_set_anchor_and_offset>` **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` anchor, :ref:`float<class_float>` offset, :ref:`bool<class_bool>` push_opposite_anchor=false **)** |
  263. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  264. | void | :ref:`set_anchors_and_offsets_preset<class_Control_method_set_anchors_and_offsets_preset>` **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)** |
  265. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  266. | void | :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>` **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`bool<class_bool>` keep_offsets=false **)** |
  267. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  268. | void | :ref:`set_begin<class_Control_method_set_begin>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  269. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  270. | void | :ref:`set_drag_forwarding<class_Control_method_set_drag_forwarding>` **(** :ref:`Callable<class_Callable>` drag_func, :ref:`Callable<class_Callable>` can_drop_func, :ref:`Callable<class_Callable>` drop_func **)** |
  271. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  272. | void | :ref:`set_drag_preview<class_Control_method_set_drag_preview>` **(** :ref:`Control<class_Control>` control **)** |
  273. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  274. | void | :ref:`set_end<class_Control_method_set_end>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  275. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  276. | void | :ref:`set_focus_neighbor<class_Control_method_set_focus_neighbor>` **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)** |
  277. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  278. | void | :ref:`set_global_position<class_Control_method_set_global_position>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_offsets=false **)** |
  279. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  280. | void | :ref:`set_offset<class_Control_method_set_offset>` **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)** |
  281. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  282. | void | :ref:`set_offsets_preset<class_Control_method_set_offsets_preset>` **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)** |
  283. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  284. | void | :ref:`set_position<class_Control_method_set_position>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_offsets=false **)** |
  285. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  286. | void | :ref:`set_size<class_Control_method_set_size>` **(** :ref:`Vector2<class_Vector2>` size, :ref:`bool<class_bool>` keep_offsets=false **)** |
  287. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  288. | void | :ref:`update_minimum_size<class_Control_method_update_minimum_size>` **(** **)** |
  289. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  290. | void | :ref:`warp_mouse<class_Control_method_warp_mouse>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  291. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  292. .. rst-class:: classref-section-separator
  293. ----
  294. .. rst-class:: classref-descriptions-group
  295. Signals
  296. -------
  297. .. _class_Control_signal_focus_entered:
  298. .. rst-class:: classref-signal
  299. **focus_entered** **(** **)**
  300. Emitted when the node gains focus.
  301. .. rst-class:: classref-item-separator
  302. ----
  303. .. _class_Control_signal_focus_exited:
  304. .. rst-class:: classref-signal
  305. **focus_exited** **(** **)**
  306. Emitted when the node loses focus.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _class_Control_signal_gui_input:
  310. .. rst-class:: classref-signal
  311. **gui_input** **(** :ref:`InputEvent<class_InputEvent>` event **)**
  312. Emitted when the node receives an :ref:`InputEvent<class_InputEvent>`.
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_Control_signal_minimum_size_changed:
  316. .. rst-class:: classref-signal
  317. **minimum_size_changed** **(** **)**
  318. Emitted when the node's minimum size changes.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_Control_signal_mouse_entered:
  322. .. rst-class:: classref-signal
  323. **mouse_entered** **(** **)**
  324. Emitted when the mouse cursor enters the control's visible area, that is not occluded behind other Controls or Windows, provided its :ref:`mouse_filter<class_Control_property_mouse_filter>` lets the event reach it and regardless if it's currently focused or not.
  325. \ **Note:** :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` doesn't affect, which Control receives the signal.
  326. .. rst-class:: classref-item-separator
  327. ----
  328. .. _class_Control_signal_mouse_exited:
  329. .. rst-class:: classref-signal
  330. **mouse_exited** **(** **)**
  331. Emitted when the mouse cursor leaves the control's visible area, that is not occluded behind other Controls or Windows, provided its :ref:`mouse_filter<class_Control_property_mouse_filter>` lets the event reach it and regardless if it's currently focused or not.
  332. \ **Note:** :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` doesn't affect, which Control receives the signal.
  333. \ **Note:** If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this:
  334. ::
  335. func _on_mouse_exited():
  336. if not Rect2(Vector2(), size).has_point(get_local_mouse_position()):
  337. # Not hovering over area.
  338. .. rst-class:: classref-item-separator
  339. ----
  340. .. _class_Control_signal_resized:
  341. .. rst-class:: classref-signal
  342. **resized** **(** **)**
  343. Emitted when the control changes size.
  344. .. rst-class:: classref-item-separator
  345. ----
  346. .. _class_Control_signal_size_flags_changed:
  347. .. rst-class:: classref-signal
  348. **size_flags_changed** **(** **)**
  349. Emitted when one of the size flags changes. See :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` and :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>`.
  350. .. rst-class:: classref-item-separator
  351. ----
  352. .. _class_Control_signal_theme_changed:
  353. .. rst-class:: classref-signal
  354. **theme_changed** **(** **)**
  355. Emitted when the :ref:`NOTIFICATION_THEME_CHANGED<class_Control_constant_NOTIFICATION_THEME_CHANGED>` notification is sent.
  356. .. rst-class:: classref-section-separator
  357. ----
  358. .. rst-class:: classref-descriptions-group
  359. Enumerations
  360. ------------
  361. .. _enum_Control_FocusMode:
  362. .. rst-class:: classref-enumeration
  363. enum **FocusMode**:
  364. .. _class_Control_constant_FOCUS_NONE:
  365. .. rst-class:: classref-enumeration-constant
  366. :ref:`FocusMode<enum_Control_FocusMode>` **FOCUS_NONE** = ``0``
  367. The node cannot grab focus. Use with :ref:`focus_mode<class_Control_property_focus_mode>`.
  368. .. _class_Control_constant_FOCUS_CLICK:
  369. .. rst-class:: classref-enumeration-constant
  370. :ref:`FocusMode<enum_Control_FocusMode>` **FOCUS_CLICK** = ``1``
  371. The node can only grab focus on mouse clicks. Use with :ref:`focus_mode<class_Control_property_focus_mode>`.
  372. .. _class_Control_constant_FOCUS_ALL:
  373. .. rst-class:: classref-enumeration-constant
  374. :ref:`FocusMode<enum_Control_FocusMode>` **FOCUS_ALL** = ``2``
  375. The node can grab focus on mouse click, using the arrows and the Tab keys on the keyboard, or using the D-pad buttons on a gamepad. Use with :ref:`focus_mode<class_Control_property_focus_mode>`.
  376. .. rst-class:: classref-item-separator
  377. ----
  378. .. _enum_Control_CursorShape:
  379. .. rst-class:: classref-enumeration
  380. enum **CursorShape**:
  381. .. _class_Control_constant_CURSOR_ARROW:
  382. .. rst-class:: classref-enumeration-constant
  383. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_ARROW** = ``0``
  384. Show the system's arrow mouse cursor when the user hovers the node. Use with :ref:`mouse_default_cursor_shape<class_Control_property_mouse_default_cursor_shape>`.
  385. .. _class_Control_constant_CURSOR_IBEAM:
  386. .. rst-class:: classref-enumeration-constant
  387. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_IBEAM** = ``1``
  388. 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.
  389. .. _class_Control_constant_CURSOR_POINTING_HAND:
  390. .. rst-class:: classref-enumeration-constant
  391. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_POINTING_HAND** = ``2``
  392. Show the system's pointing hand mouse cursor when the user hovers the node.
  393. .. _class_Control_constant_CURSOR_CROSS:
  394. .. rst-class:: classref-enumeration-constant
  395. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_CROSS** = ``3``
  396. Show the system's cross mouse cursor when the user hovers the node.
  397. .. _class_Control_constant_CURSOR_WAIT:
  398. .. rst-class:: classref-enumeration-constant
  399. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_WAIT** = ``4``
  400. Show the system's wait mouse cursor when the user hovers the node. Often an hourglass.
  401. .. _class_Control_constant_CURSOR_BUSY:
  402. .. rst-class:: classref-enumeration-constant
  403. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_BUSY** = ``5``
  404. Show the system's busy mouse cursor when the user hovers the node. Often an arrow with a small hourglass.
  405. .. _class_Control_constant_CURSOR_DRAG:
  406. .. rst-class:: classref-enumeration-constant
  407. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_DRAG** = ``6``
  408. 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.
  409. .. _class_Control_constant_CURSOR_CAN_DROP:
  410. .. rst-class:: classref-enumeration-constant
  411. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_CAN_DROP** = ``7``
  412. 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.
  413. .. _class_Control_constant_CURSOR_FORBIDDEN:
  414. .. rst-class:: classref-enumeration-constant
  415. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_FORBIDDEN** = ``8``
  416. Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle.
  417. .. _class_Control_constant_CURSOR_VSIZE:
  418. .. rst-class:: classref-enumeration-constant
  419. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_VSIZE** = ``9``
  420. 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.
  421. .. _class_Control_constant_CURSOR_HSIZE:
  422. .. rst-class:: classref-enumeration-constant
  423. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_HSIZE** = ``10``
  424. 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.
  425. .. _class_Control_constant_CURSOR_BDIAGSIZE:
  426. .. rst-class:: classref-enumeration-constant
  427. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_BDIAGSIZE** = ``11``
  428. 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.
  429. .. _class_Control_constant_CURSOR_FDIAGSIZE:
  430. .. rst-class:: classref-enumeration-constant
  431. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_FDIAGSIZE** = ``12``
  432. 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 :ref:`CURSOR_BDIAGSIZE<class_Control_constant_CURSOR_BDIAGSIZE>`. It tells the user they can resize the window or the panel both horizontally and vertically.
  433. .. _class_Control_constant_CURSOR_MOVE:
  434. .. rst-class:: classref-enumeration-constant
  435. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_MOVE** = ``13``
  436. 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.
  437. .. _class_Control_constant_CURSOR_VSPLIT:
  438. .. rst-class:: classref-enumeration-constant
  439. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_VSPLIT** = ``14``
  440. Show the system's vertical split mouse cursor when the user hovers the node. On Windows, it's the same as :ref:`CURSOR_VSIZE<class_Control_constant_CURSOR_VSIZE>`.
  441. .. _class_Control_constant_CURSOR_HSPLIT:
  442. .. rst-class:: classref-enumeration-constant
  443. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_HSPLIT** = ``15``
  444. Show the system's horizontal split mouse cursor when the user hovers the node. On Windows, it's the same as :ref:`CURSOR_HSIZE<class_Control_constant_CURSOR_HSIZE>`.
  445. .. _class_Control_constant_CURSOR_HELP:
  446. .. rst-class:: classref-enumeration-constant
  447. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_HELP** = ``16``
  448. Show the system's help mouse cursor when the user hovers the node, a question mark.
  449. .. rst-class:: classref-item-separator
  450. ----
  451. .. _enum_Control_LayoutPreset:
  452. .. rst-class:: classref-enumeration
  453. enum **LayoutPreset**:
  454. .. _class_Control_constant_PRESET_TOP_LEFT:
  455. .. rst-class:: classref-enumeration-constant
  456. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_TOP_LEFT** = ``0``
  457. Snap all 4 anchors to the top-left of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  458. .. _class_Control_constant_PRESET_TOP_RIGHT:
  459. .. rst-class:: classref-enumeration-constant
  460. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_TOP_RIGHT** = ``1``
  461. Snap all 4 anchors to the top-right of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  462. .. _class_Control_constant_PRESET_BOTTOM_LEFT:
  463. .. rst-class:: classref-enumeration-constant
  464. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_BOTTOM_LEFT** = ``2``
  465. Snap all 4 anchors to the bottom-left of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  466. .. _class_Control_constant_PRESET_BOTTOM_RIGHT:
  467. .. rst-class:: classref-enumeration-constant
  468. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_BOTTOM_RIGHT** = ``3``
  469. Snap all 4 anchors to the bottom-right of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  470. .. _class_Control_constant_PRESET_CENTER_LEFT:
  471. .. rst-class:: classref-enumeration-constant
  472. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER_LEFT** = ``4``
  473. Snap all 4 anchors to the center of the left edge of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  474. .. _class_Control_constant_PRESET_CENTER_TOP:
  475. .. rst-class:: classref-enumeration-constant
  476. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER_TOP** = ``5``
  477. Snap all 4 anchors to the center of the top edge of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  478. .. _class_Control_constant_PRESET_CENTER_RIGHT:
  479. .. rst-class:: classref-enumeration-constant
  480. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER_RIGHT** = ``6``
  481. Snap all 4 anchors to the center of the right edge of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  482. .. _class_Control_constant_PRESET_CENTER_BOTTOM:
  483. .. rst-class:: classref-enumeration-constant
  484. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER_BOTTOM** = ``7``
  485. Snap all 4 anchors to the center of the bottom edge of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  486. .. _class_Control_constant_PRESET_CENTER:
  487. .. rst-class:: classref-enumeration-constant
  488. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER** = ``8``
  489. Snap all 4 anchors to the center of the parent control's bounds. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  490. .. _class_Control_constant_PRESET_LEFT_WIDE:
  491. .. rst-class:: classref-enumeration-constant
  492. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_LEFT_WIDE** = ``9``
  493. Snap all 4 anchors to the left edge of the parent control. The left offset becomes relative to the left edge and the top offset relative to the top left corner of the node's parent. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  494. .. _class_Control_constant_PRESET_TOP_WIDE:
  495. .. rst-class:: classref-enumeration-constant
  496. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_TOP_WIDE** = ``10``
  497. Snap all 4 anchors to the top edge of the parent control. The left offset becomes relative to the top left corner, the top offset relative to the top edge, and the right offset relative to the top right corner of the node's parent. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  498. .. _class_Control_constant_PRESET_RIGHT_WIDE:
  499. .. rst-class:: classref-enumeration-constant
  500. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_RIGHT_WIDE** = ``11``
  501. Snap all 4 anchors to the right edge of the parent control. The right offset becomes relative to the right edge and the top offset relative to the top right corner of the node's parent. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  502. .. _class_Control_constant_PRESET_BOTTOM_WIDE:
  503. .. rst-class:: classref-enumeration-constant
  504. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_BOTTOM_WIDE** = ``12``
  505. Snap all 4 anchors to the bottom edge of the parent control. The left offset becomes relative to the bottom left corner, the bottom offset relative to the bottom edge, and the right offset relative to the bottom right corner of the node's parent. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  506. .. _class_Control_constant_PRESET_VCENTER_WIDE:
  507. .. rst-class:: classref-enumeration-constant
  508. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_VCENTER_WIDE** = ``13``
  509. Snap all 4 anchors to a vertical line that cuts the parent control in half. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  510. .. _class_Control_constant_PRESET_HCENTER_WIDE:
  511. .. rst-class:: classref-enumeration-constant
  512. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_HCENTER_WIDE** = ``14``
  513. Snap all 4 anchors to a horizontal line that cuts the parent control in half. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  514. .. _class_Control_constant_PRESET_FULL_RECT:
  515. .. rst-class:: classref-enumeration-constant
  516. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_FULL_RECT** = ``15``
  517. Snap all 4 anchors to the respective corners of the parent control. Set all 4 offsets to 0 after you applied this preset and the **Control** will fit its parent control. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  518. .. rst-class:: classref-item-separator
  519. ----
  520. .. _enum_Control_LayoutPresetMode:
  521. .. rst-class:: classref-enumeration
  522. enum **LayoutPresetMode**:
  523. .. _class_Control_constant_PRESET_MODE_MINSIZE:
  524. .. rst-class:: classref-enumeration-constant
  525. :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` **PRESET_MODE_MINSIZE** = ``0``
  526. The control will be resized to its minimum size.
  527. .. _class_Control_constant_PRESET_MODE_KEEP_WIDTH:
  528. .. rst-class:: classref-enumeration-constant
  529. :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` **PRESET_MODE_KEEP_WIDTH** = ``1``
  530. The control's width will not change.
  531. .. _class_Control_constant_PRESET_MODE_KEEP_HEIGHT:
  532. .. rst-class:: classref-enumeration-constant
  533. :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` **PRESET_MODE_KEEP_HEIGHT** = ``2``
  534. The control's height will not change.
  535. .. _class_Control_constant_PRESET_MODE_KEEP_SIZE:
  536. .. rst-class:: classref-enumeration-constant
  537. :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` **PRESET_MODE_KEEP_SIZE** = ``3``
  538. The control's size will not change.
  539. .. rst-class:: classref-item-separator
  540. ----
  541. .. _enum_Control_SizeFlags:
  542. .. rst-class:: classref-enumeration
  543. flags **SizeFlags**:
  544. .. _class_Control_constant_SIZE_SHRINK_BEGIN:
  545. .. rst-class:: classref-enumeration-constant
  546. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_SHRINK_BEGIN** = ``0``
  547. Tells the parent :ref:`Container<class_Container>` to align the node with its start, either the top or the left edge. It is mutually exclusive with :ref:`SIZE_FILL<class_Control_constant_SIZE_FILL>` and other shrink size flags, but can be used with :ref:`SIZE_EXPAND<class_Control_constant_SIZE_EXPAND>` in some containers. Use with :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` and :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>`.
  548. \ **Note:** Setting this flag is equal to not having any size flags.
  549. .. _class_Control_constant_SIZE_FILL:
  550. .. rst-class:: classref-enumeration-constant
  551. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_FILL** = ``1``
  552. Tells the parent :ref:`Container<class_Container>` to expand the bounds of this node to fill all the available space without pushing any other node. It is mutually exclusive with shrink size flags. Use with :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` and :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>`.
  553. .. _class_Control_constant_SIZE_EXPAND:
  554. .. rst-class:: classref-enumeration-constant
  555. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_EXPAND** = ``2``
  556. Tells the parent :ref:`Container<class_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 :ref:`size_flags_stretch_ratio<class_Control_property_size_flags_stretch_ratio>`. Use with :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` and :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>`.
  557. .. _class_Control_constant_SIZE_EXPAND_FILL:
  558. .. rst-class:: classref-enumeration-constant
  559. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_EXPAND_FILL** = ``3``
  560. Sets the node's size flags to both fill and expand. See :ref:`SIZE_FILL<class_Control_constant_SIZE_FILL>` and :ref:`SIZE_EXPAND<class_Control_constant_SIZE_EXPAND>` for more information.
  561. .. _class_Control_constant_SIZE_SHRINK_CENTER:
  562. .. rst-class:: classref-enumeration-constant
  563. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_SHRINK_CENTER** = ``4``
  564. Tells the parent :ref:`Container<class_Container>` to center the node in the available space. It is mutually exclusive with :ref:`SIZE_FILL<class_Control_constant_SIZE_FILL>` and other shrink size flags, but can be used with :ref:`SIZE_EXPAND<class_Control_constant_SIZE_EXPAND>` in some containers. Use with :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` and :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>`.
  565. .. _class_Control_constant_SIZE_SHRINK_END:
  566. .. rst-class:: classref-enumeration-constant
  567. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_SHRINK_END** = ``8``
  568. Tells the parent :ref:`Container<class_Container>` to align the node with its end, either the bottom or the right edge. It is mutually exclusive with :ref:`SIZE_FILL<class_Control_constant_SIZE_FILL>` and other shrink size flags, but can be used with :ref:`SIZE_EXPAND<class_Control_constant_SIZE_EXPAND>` in some containers. Use with :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` and :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>`.
  569. .. rst-class:: classref-item-separator
  570. ----
  571. .. _enum_Control_MouseFilter:
  572. .. rst-class:: classref-enumeration
  573. enum **MouseFilter**:
  574. .. _class_Control_constant_MOUSE_FILTER_STOP:
  575. .. rst-class:: classref-enumeration-constant
  576. :ref:`MouseFilter<enum_Control_MouseFilter>` **MOUSE_FILTER_STOP** = ``0``
  577. The control will receive mouse movement input events and mouse button input events if clicked on through :ref:`_gui_input<class_Control_method__gui_input>`. And the control will receive the :ref:`mouse_entered<class_Control_signal_mouse_entered>` and :ref:`mouse_exited<class_Control_signal_mouse_exited>` signals. These events are automatically marked as handled, and they will not propagate further to other controls. This also results in blocking signals in other controls.
  578. .. _class_Control_constant_MOUSE_FILTER_PASS:
  579. .. rst-class:: classref-enumeration-constant
  580. :ref:`MouseFilter<enum_Control_MouseFilter>` **MOUSE_FILTER_PASS** = ``1``
  581. The control will receive mouse movement input events and mouse button input events if clicked on through :ref:`_gui_input<class_Control_method__gui_input>`. And the control will receive the :ref:`mouse_entered<class_Control_signal_mouse_entered>` and :ref:`mouse_exited<class_Control_signal_mouse_exited>` signals. If this control does not handle the event, the parent control (if any) will be considered, and so on until there is no more parent control to potentially handle it. This also allows signals to fire in other controls. If no control handled it, the event will be passed to :ref:`Node._shortcut_input<class_Node_method__shortcut_input>` for further processing.
  582. .. _class_Control_constant_MOUSE_FILTER_IGNORE:
  583. .. rst-class:: classref-enumeration-constant
  584. :ref:`MouseFilter<enum_Control_MouseFilter>` **MOUSE_FILTER_IGNORE** = ``2``
  585. The control will not receive mouse movement input events and mouse button input events if clicked on through :ref:`_gui_input<class_Control_method__gui_input>`. The control will also not receive the :ref:`mouse_entered<class_Control_signal_mouse_entered>` nor :ref:`mouse_exited<class_Control_signal_mouse_exited>` signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically.
  586. .. rst-class:: classref-item-separator
  587. ----
  588. .. _enum_Control_GrowDirection:
  589. .. rst-class:: classref-enumeration
  590. enum **GrowDirection**:
  591. .. _class_Control_constant_GROW_DIRECTION_BEGIN:
  592. .. rst-class:: classref-enumeration-constant
  593. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_BEGIN** = ``0``
  594. 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.
  595. .. _class_Control_constant_GROW_DIRECTION_END:
  596. .. rst-class:: classref-enumeration-constant
  597. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_END** = ``1``
  598. 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.
  599. .. _class_Control_constant_GROW_DIRECTION_BOTH:
  600. .. rst-class:: classref-enumeration-constant
  601. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_BOTH** = ``2``
  602. The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.
  603. .. rst-class:: classref-item-separator
  604. ----
  605. .. _enum_Control_Anchor:
  606. .. rst-class:: classref-enumeration
  607. enum **Anchor**:
  608. .. _class_Control_constant_ANCHOR_BEGIN:
  609. .. rst-class:: classref-enumeration-constant
  610. :ref:`Anchor<enum_Control_Anchor>` **ANCHOR_BEGIN** = ``0``
  611. 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 :ref:`anchor_left<class_Control_property_anchor_left>`. To change all 4 anchors at once, use :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  612. .. _class_Control_constant_ANCHOR_END:
  613. .. rst-class:: classref-enumeration-constant
  614. :ref:`Anchor<enum_Control_Anchor>` **ANCHOR_END** = ``1``
  615. 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 :ref:`anchor_left<class_Control_property_anchor_left>`. To change all 4 anchors at once, use :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  616. .. rst-class:: classref-item-separator
  617. ----
  618. .. _enum_Control_LayoutDirection:
  619. .. rst-class:: classref-enumeration
  620. enum **LayoutDirection**:
  621. .. _class_Control_constant_LAYOUT_DIRECTION_INHERITED:
  622. .. rst-class:: classref-enumeration-constant
  623. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **LAYOUT_DIRECTION_INHERITED** = ``0``
  624. Automatic layout direction, determined from the parent control layout direction.
  625. .. _class_Control_constant_LAYOUT_DIRECTION_LOCALE:
  626. .. rst-class:: classref-enumeration-constant
  627. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **LAYOUT_DIRECTION_LOCALE** = ``1``
  628. Automatic layout direction, determined from the current locale.
  629. .. _class_Control_constant_LAYOUT_DIRECTION_LTR:
  630. .. rst-class:: classref-enumeration-constant
  631. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **LAYOUT_DIRECTION_LTR** = ``2``
  632. Left-to-right layout direction.
  633. .. _class_Control_constant_LAYOUT_DIRECTION_RTL:
  634. .. rst-class:: classref-enumeration-constant
  635. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **LAYOUT_DIRECTION_RTL** = ``3``
  636. Right-to-left layout direction.
  637. .. rst-class:: classref-item-separator
  638. ----
  639. .. _enum_Control_TextDirection:
  640. .. rst-class:: classref-enumeration
  641. enum **TextDirection**:
  642. .. _class_Control_constant_TEXT_DIRECTION_INHERITED:
  643. .. rst-class:: classref-enumeration-constant
  644. :ref:`TextDirection<enum_Control_TextDirection>` **TEXT_DIRECTION_INHERITED** = ``3``
  645. Text writing direction is the same as layout direction.
  646. .. _class_Control_constant_TEXT_DIRECTION_AUTO:
  647. .. rst-class:: classref-enumeration-constant
  648. :ref:`TextDirection<enum_Control_TextDirection>` **TEXT_DIRECTION_AUTO** = ``0``
  649. Automatic text writing direction, determined from the current locale and text content.
  650. .. _class_Control_constant_TEXT_DIRECTION_LTR:
  651. .. rst-class:: classref-enumeration-constant
  652. :ref:`TextDirection<enum_Control_TextDirection>` **TEXT_DIRECTION_LTR** = ``1``
  653. Left-to-right text writing direction.
  654. .. _class_Control_constant_TEXT_DIRECTION_RTL:
  655. .. rst-class:: classref-enumeration-constant
  656. :ref:`TextDirection<enum_Control_TextDirection>` **TEXT_DIRECTION_RTL** = ``2``
  657. Right-to-left text writing direction.
  658. .. rst-class:: classref-section-separator
  659. ----
  660. .. rst-class:: classref-descriptions-group
  661. Constants
  662. ---------
  663. .. _class_Control_constant_NOTIFICATION_RESIZED:
  664. .. rst-class:: classref-constant
  665. **NOTIFICATION_RESIZED** = ``40``
  666. Sent when the node changes size. Use :ref:`size<class_Control_property_size>` to get the new size.
  667. .. _class_Control_constant_NOTIFICATION_MOUSE_ENTER:
  668. .. rst-class:: classref-constant
  669. **NOTIFICATION_MOUSE_ENTER** = ``41``
  670. Sent when the mouse cursor enters the control's visible area, that is not occluded behind other Controls or Windows, provided its :ref:`mouse_filter<class_Control_property_mouse_filter>` lets the event reach it and regardless if it's currently focused or not.
  671. \ **Note:** :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` doesn't affect, which Control receives the notification.
  672. .. _class_Control_constant_NOTIFICATION_MOUSE_EXIT:
  673. .. rst-class:: classref-constant
  674. **NOTIFICATION_MOUSE_EXIT** = ``42``
  675. Sent when the mouse cursor leaves the control's visible area, that is not occluded behind other Controls or Windows, provided its :ref:`mouse_filter<class_Control_property_mouse_filter>` lets the event reach it and regardless if it's currently focused or not.
  676. \ **Note:** :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` doesn't affect, which Control receives the notification.
  677. .. _class_Control_constant_NOTIFICATION_FOCUS_ENTER:
  678. .. rst-class:: classref-constant
  679. **NOTIFICATION_FOCUS_ENTER** = ``43``
  680. Sent when the node grabs focus.
  681. .. _class_Control_constant_NOTIFICATION_FOCUS_EXIT:
  682. .. rst-class:: classref-constant
  683. **NOTIFICATION_FOCUS_EXIT** = ``44``
  684. Sent when the node loses focus.
  685. .. _class_Control_constant_NOTIFICATION_THEME_CHANGED:
  686. .. rst-class:: classref-constant
  687. **NOTIFICATION_THEME_CHANGED** = ``45``
  688. Sent when the node needs to refresh its theme items. This happens in one of the following cases:
  689. - The :ref:`theme<class_Control_property_theme>` property is changed on this node or any of its ancestors.
  690. - The :ref:`theme_type_variation<class_Control_property_theme_type_variation>` property is changed on this node.
  691. - One of the node's theme property overrides is changed.
  692. - The node enters the scene tree.
  693. \ **Note:** As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree.
  694. .. _class_Control_constant_NOTIFICATION_SCROLL_BEGIN:
  695. .. rst-class:: classref-constant
  696. **NOTIFICATION_SCROLL_BEGIN** = ``47``
  697. Sent when this node is inside a :ref:`ScrollContainer<class_ScrollContainer>` which has begun being scrolled.
  698. .. _class_Control_constant_NOTIFICATION_SCROLL_END:
  699. .. rst-class:: classref-constant
  700. **NOTIFICATION_SCROLL_END** = ``48``
  701. Sent when this node is inside a :ref:`ScrollContainer<class_ScrollContainer>` which has stopped being scrolled.
  702. .. _class_Control_constant_NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
  703. .. rst-class:: classref-constant
  704. **NOTIFICATION_LAYOUT_DIRECTION_CHANGED** = ``49``
  705. Sent when control layout direction is changed.
  706. .. rst-class:: classref-section-separator
  707. ----
  708. .. rst-class:: classref-descriptions-group
  709. Property Descriptions
  710. ---------------------
  711. .. _class_Control_property_anchor_bottom:
  712. .. rst-class:: classref-property
  713. :ref:`float<class_float>` **anchor_bottom** = ``0.0``
  714. .. rst-class:: classref-property-setget
  715. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  716. Anchors the bottom edge of the node to the origin, the center, or the end of its parent control. It changes how the bottom offset updates when the node moves or changes size. You can use one of the :ref:`Anchor<enum_Control_Anchor>` constants for convenience.
  717. .. rst-class:: classref-item-separator
  718. ----
  719. .. _class_Control_property_anchor_left:
  720. .. rst-class:: classref-property
  721. :ref:`float<class_float>` **anchor_left** = ``0.0``
  722. .. rst-class:: classref-property-setget
  723. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  724. Anchors the left edge of the node to the origin, the center or the end of its parent control. It changes how the left offset updates when the node moves or changes size. You can use one of the :ref:`Anchor<enum_Control_Anchor>` constants for convenience.
  725. .. rst-class:: classref-item-separator
  726. ----
  727. .. _class_Control_property_anchor_right:
  728. .. rst-class:: classref-property
  729. :ref:`float<class_float>` **anchor_right** = ``0.0``
  730. .. rst-class:: classref-property-setget
  731. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  732. Anchors the right edge of the node to the origin, the center or the end of its parent control. It changes how the right offset updates when the node moves or changes size. You can use one of the :ref:`Anchor<enum_Control_Anchor>` constants for convenience.
  733. .. rst-class:: classref-item-separator
  734. ----
  735. .. _class_Control_property_anchor_top:
  736. .. rst-class:: classref-property
  737. :ref:`float<class_float>` **anchor_top** = ``0.0``
  738. .. rst-class:: classref-property-setget
  739. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  740. Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top offset updates when the node moves or changes size. You can use one of the :ref:`Anchor<enum_Control_Anchor>` constants for convenience.
  741. .. rst-class:: classref-item-separator
  742. ----
  743. .. _class_Control_property_auto_translate:
  744. .. rst-class:: classref-property
  745. :ref:`bool<class_bool>` **auto_translate** = ``true``
  746. .. rst-class:: classref-property-setget
  747. - void **set_auto_translate** **(** :ref:`bool<class_bool>` value **)**
  748. - :ref:`bool<class_bool>` **is_auto_translating** **(** **)**
  749. Toggles if any text should automatically change to its translated version depending on the current locale.
  750. Also decides if the node's strings should be parsed for POT generation.
  751. .. rst-class:: classref-item-separator
  752. ----
  753. .. _class_Control_property_clip_contents:
  754. .. rst-class:: classref-property
  755. :ref:`bool<class_bool>` **clip_contents** = ``false``
  756. .. rst-class:: classref-property-setget
  757. - void **set_clip_contents** **(** :ref:`bool<class_bool>` value **)**
  758. - :ref:`bool<class_bool>` **is_clipping_contents** **(** **)**
  759. Enables whether rendering of :ref:`CanvasItem<class_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 and won't receive input.
  760. .. rst-class:: classref-item-separator
  761. ----
  762. .. _class_Control_property_custom_minimum_size:
  763. .. rst-class:: classref-property
  764. :ref:`Vector2<class_Vector2>` **custom_minimum_size** = ``Vector2(0, 0)``
  765. .. rst-class:: classref-property-setget
  766. - void **set_custom_minimum_size** **(** :ref:`Vector2<class_Vector2>` value **)**
  767. - :ref:`Vector2<class_Vector2>` **get_custom_minimum_size** **(** **)**
  768. 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.
  769. .. rst-class:: classref-item-separator
  770. ----
  771. .. _class_Control_property_focus_mode:
  772. .. rst-class:: classref-property
  773. :ref:`FocusMode<enum_Control_FocusMode>` **focus_mode** = ``0``
  774. .. rst-class:: classref-property-setget
  775. - void **set_focus_mode** **(** :ref:`FocusMode<enum_Control_FocusMode>` value **)**
  776. - :ref:`FocusMode<enum_Control_FocusMode>` **get_focus_mode** **(** **)**
  777. 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, gamepad, and mouse signals.
  778. .. rst-class:: classref-item-separator
  779. ----
  780. .. _class_Control_property_focus_neighbor_bottom:
  781. .. rst-class:: classref-property
  782. :ref:`NodePath<class_NodePath>` **focus_neighbor_bottom** = ``NodePath("")``
  783. .. rst-class:: classref-property-setget
  784. - void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  785. - :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  786. Tells Godot which node it should give focus to if the user presses the down arrow on the keyboard or down on a gamepad by default. You can change the key by editing the :ref:`ProjectSettings.input/ui_down<class_ProjectSettings_property_input/ui_down>` input action. The node must be a **Control**. If this property is not set, Godot will give focus to the closest **Control** to the bottom of this one.
  787. .. rst-class:: classref-item-separator
  788. ----
  789. .. _class_Control_property_focus_neighbor_left:
  790. .. rst-class:: classref-property
  791. :ref:`NodePath<class_NodePath>` **focus_neighbor_left** = ``NodePath("")``
  792. .. rst-class:: classref-property-setget
  793. - void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  794. - :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  795. Tells Godot which node it should give focus to if the user presses the left arrow on the keyboard or left on a gamepad by default. You can change the key by editing the :ref:`ProjectSettings.input/ui_left<class_ProjectSettings_property_input/ui_left>` input action. The node must be a **Control**. If this property is not set, Godot will give focus to the closest **Control** to the left of this one.
  796. .. rst-class:: classref-item-separator
  797. ----
  798. .. _class_Control_property_focus_neighbor_right:
  799. .. rst-class:: classref-property
  800. :ref:`NodePath<class_NodePath>` **focus_neighbor_right** = ``NodePath("")``
  801. .. rst-class:: classref-property-setget
  802. - void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  803. - :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  804. Tells Godot which node it should give focus to if the user presses the right arrow on the keyboard or right on a gamepad by default. You can change the key by editing the :ref:`ProjectSettings.input/ui_right<class_ProjectSettings_property_input/ui_right>` input action. The node must be a **Control**. If this property is not set, Godot will give focus to the closest **Control** to the right of this one.
  805. .. rst-class:: classref-item-separator
  806. ----
  807. .. _class_Control_property_focus_neighbor_top:
  808. .. rst-class:: classref-property
  809. :ref:`NodePath<class_NodePath>` **focus_neighbor_top** = ``NodePath("")``
  810. .. rst-class:: classref-property-setget
  811. - void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  812. - :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  813. Tells Godot which node it should give focus to if the user presses the top arrow on the keyboard or top on a gamepad by default. You can change the key by editing the :ref:`ProjectSettings.input/ui_up<class_ProjectSettings_property_input/ui_up>` input action. The node must be a **Control**. If this property is not set, Godot will give focus to the closest **Control** to the top of this one.
  814. .. rst-class:: classref-item-separator
  815. ----
  816. .. _class_Control_property_focus_next:
  817. .. rst-class:: classref-property
  818. :ref:`NodePath<class_NodePath>` **focus_next** = ``NodePath("")``
  819. .. rst-class:: classref-property-setget
  820. - void **set_focus_next** **(** :ref:`NodePath<class_NodePath>` value **)**
  821. - :ref:`NodePath<class_NodePath>` **get_focus_next** **(** **)**
  822. Tells Godot which node it should give focus to if the user presses :kbd:`Tab` on a keyboard by default. You can change the key by editing the :ref:`ProjectSettings.input/ui_focus_next<class_ProjectSettings_property_input/ui_focus_next>` input action.
  823. If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
  824. .. rst-class:: classref-item-separator
  825. ----
  826. .. _class_Control_property_focus_previous:
  827. .. rst-class:: classref-property
  828. :ref:`NodePath<class_NodePath>` **focus_previous** = ``NodePath("")``
  829. .. rst-class:: classref-property-setget
  830. - void **set_focus_previous** **(** :ref:`NodePath<class_NodePath>` value **)**
  831. - :ref:`NodePath<class_NodePath>` **get_focus_previous** **(** **)**
  832. Tells Godot which node it should give focus to if the user presses :kbd:`Shift + Tab` on a keyboard by default. You can change the key by editing the :ref:`ProjectSettings.input/ui_focus_prev<class_ProjectSettings_property_input/ui_focus_prev>` input action.
  833. If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
  834. .. rst-class:: classref-item-separator
  835. ----
  836. .. _class_Control_property_global_position:
  837. .. rst-class:: classref-property
  838. :ref:`Vector2<class_Vector2>` **global_position**
  839. .. rst-class:: classref-property-setget
  840. - :ref:`Vector2<class_Vector2>` **get_global_position** **(** **)**
  841. The node's global position, relative to the world (usually to the :ref:`CanvasLayer<class_CanvasLayer>`).
  842. .. rst-class:: classref-item-separator
  843. ----
  844. .. _class_Control_property_grow_horizontal:
  845. .. rst-class:: classref-property
  846. :ref:`GrowDirection<enum_Control_GrowDirection>` **grow_horizontal** = ``1``
  847. .. rst-class:: classref-property-setget
  848. - void **set_h_grow_direction** **(** :ref:`GrowDirection<enum_Control_GrowDirection>` value **)**
  849. - :ref:`GrowDirection<enum_Control_GrowDirection>` **get_h_grow_direction** **(** **)**
  850. 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.
  851. .. rst-class:: classref-item-separator
  852. ----
  853. .. _class_Control_property_grow_vertical:
  854. .. rst-class:: classref-property
  855. :ref:`GrowDirection<enum_Control_GrowDirection>` **grow_vertical** = ``1``
  856. .. rst-class:: classref-property-setget
  857. - void **set_v_grow_direction** **(** :ref:`GrowDirection<enum_Control_GrowDirection>` value **)**
  858. - :ref:`GrowDirection<enum_Control_GrowDirection>` **get_v_grow_direction** **(** **)**
  859. 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.
  860. .. rst-class:: classref-item-separator
  861. ----
  862. .. _class_Control_property_layout_direction:
  863. .. rst-class:: classref-property
  864. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **layout_direction** = ``0``
  865. .. rst-class:: classref-property-setget
  866. - void **set_layout_direction** **(** :ref:`LayoutDirection<enum_Control_LayoutDirection>` value **)**
  867. - :ref:`LayoutDirection<enum_Control_LayoutDirection>` **get_layout_direction** **(** **)**
  868. Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
  869. .. rst-class:: classref-item-separator
  870. ----
  871. .. _class_Control_property_localize_numeral_system:
  872. .. rst-class:: classref-property
  873. :ref:`bool<class_bool>` **localize_numeral_system** = ``true``
  874. .. rst-class:: classref-property-setget
  875. - void **set_localize_numeral_system** **(** :ref:`bool<class_bool>` value **)**
  876. - :ref:`bool<class_bool>` **is_localizing_numeral_system** **(** **)**
  877. If ``true``, automatically converts code line numbers, list indices, :ref:`SpinBox<class_SpinBox>` and :ref:`ProgressBar<class_ProgressBar>` values from the Western Arabic (0..9) to the numeral systems used in current locale.
  878. \ **Note:** Numbers within the text are not automatically converted, it can be done manually, using :ref:`TextServer.format_number<class_TextServer_method_format_number>`.
  879. .. rst-class:: classref-item-separator
  880. ----
  881. .. _class_Control_property_mouse_default_cursor_shape:
  882. .. rst-class:: classref-property
  883. :ref:`CursorShape<enum_Control_CursorShape>` **mouse_default_cursor_shape** = ``0``
  884. .. rst-class:: classref-property-setget
  885. - void **set_default_cursor_shape** **(** :ref:`CursorShape<enum_Control_CursorShape>` value **)**
  886. - :ref:`CursorShape<enum_Control_CursorShape>` **get_default_cursor_shape** **(** **)**
  887. The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors.
  888. \ **Note:** On Linux, shapes may vary depending on the cursor theme of the system.
  889. .. rst-class:: classref-item-separator
  890. ----
  891. .. _class_Control_property_mouse_filter:
  892. .. rst-class:: classref-property
  893. :ref:`MouseFilter<enum_Control_MouseFilter>` **mouse_filter** = ``0``
  894. .. rst-class:: classref-property-setget
  895. - void **set_mouse_filter** **(** :ref:`MouseFilter<enum_Control_MouseFilter>` value **)**
  896. - :ref:`MouseFilter<enum_Control_MouseFilter>` **get_mouse_filter** **(** **)**
  897. Controls whether the control will be able to receive mouse button input events through :ref:`_gui_input<class_Control_method__gui_input>` and how these events should be handled. Also controls whether the control can receive the :ref:`mouse_entered<class_Control_signal_mouse_entered>`, and :ref:`mouse_exited<class_Control_signal_mouse_exited>` signals. See the constants to learn what each does.
  898. .. rst-class:: classref-item-separator
  899. ----
  900. .. _class_Control_property_mouse_force_pass_scroll_events:
  901. .. rst-class:: classref-property
  902. :ref:`bool<class_bool>` **mouse_force_pass_scroll_events** = ``true``
  903. .. rst-class:: classref-property-setget
  904. - void **set_force_pass_scroll_events** **(** :ref:`bool<class_bool>` value **)**
  905. - :ref:`bool<class_bool>` **is_force_pass_scroll_events** **(** **)**
  906. When enabled, scroll wheel events processed by :ref:`_gui_input<class_Control_method__gui_input>` will be passed to the parent control even if :ref:`mouse_filter<class_Control_property_mouse_filter>` is set to :ref:`MOUSE_FILTER_STOP<class_Control_constant_MOUSE_FILTER_STOP>`. As it defaults to true, this allows nested scrollable containers to work out of the box.
  907. You should disable it on the root of your UI if you do not want scroll events to go to the :ref:`Node._unhandled_input<class_Node_method__unhandled_input>` processing.
  908. .. rst-class:: classref-item-separator
  909. ----
  910. .. _class_Control_property_offset_bottom:
  911. .. rst-class:: classref-property
  912. :ref:`float<class_float>` **offset_bottom** = ``0.0``
  913. .. rst-class:: classref-property-setget
  914. - void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  915. - :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  916. Distance between the node's bottom edge and its parent control, based on :ref:`anchor_bottom<class_Control_property_anchor_bottom>`.
  917. Offsets are often controlled by one or multiple parent :ref:`Container<class_Container>` nodes, so you should not modify them manually if your node is a direct child of a :ref:`Container<class_Container>`. Offsets update automatically when you move or resize the node.
  918. .. rst-class:: classref-item-separator
  919. ----
  920. .. _class_Control_property_offset_left:
  921. .. rst-class:: classref-property
  922. :ref:`float<class_float>` **offset_left** = ``0.0``
  923. .. rst-class:: classref-property-setget
  924. - void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  925. - :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  926. Distance between the node's left edge and its parent control, based on :ref:`anchor_left<class_Control_property_anchor_left>`.
  927. Offsets are often controlled by one or multiple parent :ref:`Container<class_Container>` nodes, so you should not modify them manually if your node is a direct child of a :ref:`Container<class_Container>`. Offsets update automatically when you move or resize the node.
  928. .. rst-class:: classref-item-separator
  929. ----
  930. .. _class_Control_property_offset_right:
  931. .. rst-class:: classref-property
  932. :ref:`float<class_float>` **offset_right** = ``0.0``
  933. .. rst-class:: classref-property-setget
  934. - void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  935. - :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  936. Distance between the node's right edge and its parent control, based on :ref:`anchor_right<class_Control_property_anchor_right>`.
  937. Offsets are often controlled by one or multiple parent :ref:`Container<class_Container>` nodes, so you should not modify them manually if your node is a direct child of a :ref:`Container<class_Container>`. Offsets update automatically when you move or resize the node.
  938. .. rst-class:: classref-item-separator
  939. ----
  940. .. _class_Control_property_offset_top:
  941. .. rst-class:: classref-property
  942. :ref:`float<class_float>` **offset_top** = ``0.0``
  943. .. rst-class:: classref-property-setget
  944. - void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  945. - :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  946. Distance between the node's top edge and its parent control, based on :ref:`anchor_top<class_Control_property_anchor_top>`.
  947. Offsets are often controlled by one or multiple parent :ref:`Container<class_Container>` nodes, so you should not modify them manually if your node is a direct child of a :ref:`Container<class_Container>`. Offsets update automatically when you move or resize the node.
  948. .. rst-class:: classref-item-separator
  949. ----
  950. .. _class_Control_property_pivot_offset:
  951. .. rst-class:: classref-property
  952. :ref:`Vector2<class_Vector2>` **pivot_offset** = ``Vector2(0, 0)``
  953. .. rst-class:: classref-property-setget
  954. - void **set_pivot_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
  955. - :ref:`Vector2<class_Vector2>` **get_pivot_offset** **(** **)**
  956. By default, the node's pivot is its top-left corner. When you change its :ref:`rotation<class_Control_property_rotation>` or :ref:`scale<class_Control_property_scale>`, it will rotate or scale around this pivot. Set this property to :ref:`size<class_Control_property_size>` / 2 to pivot around the Control's center.
  957. .. rst-class:: classref-item-separator
  958. ----
  959. .. _class_Control_property_position:
  960. .. rst-class:: classref-property
  961. :ref:`Vector2<class_Vector2>` **position** = ``Vector2(0, 0)``
  962. .. rst-class:: classref-property-setget
  963. - :ref:`Vector2<class_Vector2>` **get_position** **(** **)**
  964. The node's position, relative to its containing node. It corresponds to the rectangle's top-left corner. The property is not affected by :ref:`pivot_offset<class_Control_property_pivot_offset>`.
  965. .. rst-class:: classref-item-separator
  966. ----
  967. .. _class_Control_property_rotation:
  968. .. rst-class:: classref-property
  969. :ref:`float<class_float>` **rotation** = ``0.0``
  970. .. rst-class:: classref-property-setget
  971. - void **set_rotation** **(** :ref:`float<class_float>` value **)**
  972. - :ref:`float<class_float>` **get_rotation** **(** **)**
  973. The node's rotation around its pivot, in radians. See :ref:`pivot_offset<class_Control_property_pivot_offset>` to change the pivot's position.
  974. \ **Note:** This property is edited in the inspector in degrees. If you want to use degrees in a script, use :ref:`rotation_degrees<class_Control_property_rotation_degrees>`.
  975. .. rst-class:: classref-item-separator
  976. ----
  977. .. _class_Control_property_rotation_degrees:
  978. .. rst-class:: classref-property
  979. :ref:`float<class_float>` **rotation_degrees**
  980. .. rst-class:: classref-property-setget
  981. - void **set_rotation_degrees** **(** :ref:`float<class_float>` value **)**
  982. - :ref:`float<class_float>` **get_rotation_degrees** **(** **)**
  983. Helper property to access :ref:`rotation<class_Control_property_rotation>` in degrees instead of radians.
  984. .. rst-class:: classref-item-separator
  985. ----
  986. .. _class_Control_property_scale:
  987. .. rst-class:: classref-property
  988. :ref:`Vector2<class_Vector2>` **scale** = ``Vector2(1, 1)``
  989. .. rst-class:: classref-property-setget
  990. - void **set_scale** **(** :ref:`Vector2<class_Vector2>` value **)**
  991. - :ref:`Vector2<class_Vector2>` **get_scale** **(** **)**
  992. The node's scale, relative to its :ref:`size<class_Control_property_size>`. Change this property to scale the node around its :ref:`pivot_offset<class_Control_property_pivot_offset>`. The Control's :ref:`tooltip_text<class_Control_property_tooltip_text>` will also scale according to this value.
  993. \ **Note:** This property is mainly intended to be used for animation purposes. To support multiple resolutions in your project, use an appropriate viewport stretch mode as described in the :doc:`documentation <../tutorials/rendering/multiple_resolutions>` instead of scaling Controls individually.
  994. \ **Note:** :ref:`FontFile.oversampling<class_FontFile_property_oversampling>` does *not* take **Control** :ref:`scale<class_Control_property_scale>` into account. This means that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font rendering by enabling :ref:`ProjectSettings.gui/theme/default_font_multichannel_signed_distance_field<class_ProjectSettings_property_gui/theme/default_font_multichannel_signed_distance_field>` (applies to the default project font only), or enabling **Multichannel Signed Distance Field** in the import options of a DynamicFont for custom fonts. On system fonts, :ref:`SystemFont.multichannel_signed_distance_field<class_SystemFont_property_multichannel_signed_distance_field>` can be enabled in the inspector.
  995. \ **Note:** If the Control node is a child of a :ref:`Container<class_Container>` node, the scale will be reset to ``Vector2(1, 1)`` when the scene is instantiated. To set the Control's scale when it's instantiated, wait for one frame using ``await get_tree().process_frame`` then set its :ref:`scale<class_Control_property_scale>` property.
  996. .. rst-class:: classref-item-separator
  997. ----
  998. .. _class_Control_property_shortcut_context:
  999. .. rst-class:: classref-property
  1000. :ref:`Node<class_Node>` **shortcut_context**
  1001. .. rst-class:: classref-property-setget
  1002. - void **set_shortcut_context** **(** :ref:`Node<class_Node>` value **)**
  1003. - :ref:`Node<class_Node>` **get_shortcut_context** **(** **)**
  1004. The :ref:`Node<class_Node>` which must be a parent of the focused **Control** for the shortcut to be activated. If ``null``, the shortcut can be activated when any control is focused (a global shortcut). This allows shortcuts to be accepted only when the user has a certain area of the GUI focused.
  1005. .. rst-class:: classref-item-separator
  1006. ----
  1007. .. _class_Control_property_size:
  1008. .. rst-class:: classref-property
  1009. :ref:`Vector2<class_Vector2>` **size** = ``Vector2(0, 0)``
  1010. .. rst-class:: classref-property-setget
  1011. - :ref:`Vector2<class_Vector2>` **get_size** **(** **)**
  1012. The size of the node's bounding rectangle, in the node's coordinate system. :ref:`Container<class_Container>` nodes update this property automatically.
  1013. .. rst-class:: classref-item-separator
  1014. ----
  1015. .. _class_Control_property_size_flags_horizontal:
  1016. .. rst-class:: classref-property
  1017. |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> **size_flags_horizontal** = ``1``
  1018. .. rst-class:: classref-property-setget
  1019. - void **set_h_size_flags** **(** |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> value **)**
  1020. - |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> **get_h_size_flags** **(** **)**
  1021. Tells the parent :ref:`Container<class_Container>` nodes how they should resize and place the node on the X axis. Use a combination of the :ref:`SizeFlags<enum_Control_SizeFlags>` constants to change the flags. See the constants to learn what each does.
  1022. .. rst-class:: classref-item-separator
  1023. ----
  1024. .. _class_Control_property_size_flags_stretch_ratio:
  1025. .. rst-class:: classref-property
  1026. :ref:`float<class_float>` **size_flags_stretch_ratio** = ``1.0``
  1027. .. rst-class:: classref-property-setget
  1028. - void **set_stretch_ratio** **(** :ref:`float<class_float>` value **)**
  1029. - :ref:`float<class_float>` **get_stretch_ratio** **(** **)**
  1030. If the node and at least one of its neighbors uses the :ref:`SIZE_EXPAND<class_Control_constant_SIZE_EXPAND>` size flag, the parent :ref:`Container<class_Container>` will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbor a ratio of 1, this node will take two thirds of the available space.
  1031. .. rst-class:: classref-item-separator
  1032. ----
  1033. .. _class_Control_property_size_flags_vertical:
  1034. .. rst-class:: classref-property
  1035. |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> **size_flags_vertical** = ``1``
  1036. .. rst-class:: classref-property-setget
  1037. - void **set_v_size_flags** **(** |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> value **)**
  1038. - |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> **get_v_size_flags** **(** **)**
  1039. Tells the parent :ref:`Container<class_Container>` nodes how they should resize and place the node on the Y axis. Use a combination of the :ref:`SizeFlags<enum_Control_SizeFlags>` constants to change the flags. See the constants to learn what each does.
  1040. .. rst-class:: classref-item-separator
  1041. ----
  1042. .. _class_Control_property_theme:
  1043. .. rst-class:: classref-property
  1044. :ref:`Theme<class_Theme>` **theme**
  1045. .. rst-class:: classref-property-setget
  1046. - void **set_theme** **(** :ref:`Theme<class_Theme>` value **)**
  1047. - :ref:`Theme<class_Theme>` **get_theme** **(** **)**
  1048. The :ref:`Theme<class_Theme>` resource this node and all its **Control** and :ref:`Window<class_Window>` children use. If a child node has its own :ref:`Theme<class_Theme>` resource set, theme items are merged with child's definitions having higher priority.
  1049. \ **Note:** :ref:`Window<class_Window>` styles will have no effect unless the window is embedded.
  1050. .. rst-class:: classref-item-separator
  1051. ----
  1052. .. _class_Control_property_theme_type_variation:
  1053. .. rst-class:: classref-property
  1054. :ref:`StringName<class_StringName>` **theme_type_variation** = ``&""``
  1055. .. rst-class:: classref-property-setget
  1056. - void **set_theme_type_variation** **(** :ref:`StringName<class_StringName>` value **)**
  1057. - :ref:`StringName<class_StringName>` **get_theme_type_variation** **(** **)**
  1058. The name of a theme type variation used by this **Control** to look up its own theme items. When empty, the class name of the node is used (e.g. ``Button`` for the :ref:`Button<class_Button>` control), as well as the class names of all parent classes (in order of inheritance).
  1059. When set, this property gives the highest priority to the type of the specified name. This type can in turn extend another type, forming a dependency chain. See :ref:`Theme.set_type_variation<class_Theme_method_set_type_variation>`. If the theme item cannot be found using this type or its base types, lookup falls back on the class names.
  1060. \ **Note:** To look up **Control**'s own items use various ``get_theme_*`` methods without specifying ``theme_type``.
  1061. \ **Note:** Theme items are looked for in the tree order, from branch to root, where each **Control** node is checked for its :ref:`theme<class_Control_property_theme>` property. The earliest match against any type/class name is returned. The project-level Theme and the default Theme are checked last.
  1062. .. rst-class:: classref-item-separator
  1063. ----
  1064. .. _class_Control_property_tooltip_text:
  1065. .. rst-class:: classref-property
  1066. :ref:`String<class_String>` **tooltip_text** = ``""``
  1067. .. rst-class:: classref-property-setget
  1068. - void **set_tooltip_text** **(** :ref:`String<class_String>` value **)**
  1069. - :ref:`String<class_String>` **get_tooltip_text** **(** **)**
  1070. The default tooltip text. The tooltip appears when the user's mouse cursor stays idle over this control for a few moments, provided that the :ref:`mouse_filter<class_Control_property_mouse_filter>` property is not :ref:`MOUSE_FILTER_IGNORE<class_Control_constant_MOUSE_FILTER_IGNORE>`. The time required for the tooltip to appear can be changed with the :ref:`ProjectSettings.gui/timers/tooltip_delay_sec<class_ProjectSettings_property_gui/timers/tooltip_delay_sec>` option. See also :ref:`get_tooltip<class_Control_method_get_tooltip>`.
  1071. The tooltip popup will use either a default implementation, or a custom one that you can provide by overriding :ref:`_make_custom_tooltip<class_Control_method__make_custom_tooltip>`. The default tooltip includes a :ref:`PopupPanel<class_PopupPanel>` and :ref:`Label<class_Label>` whose theme properties can be customized using :ref:`Theme<class_Theme>` methods with the ``"TooltipPanel"`` and ``"TooltipLabel"`` respectively. For example:
  1072. .. tabs::
  1073. .. code-tab:: gdscript
  1074. var style_box = StyleBoxFlat.new()
  1075. style_box.set_bg_color(Color(1, 1, 0))
  1076. style_box.set_border_width_all(2)
  1077. # We assume here that the `theme` property has been assigned a custom Theme beforehand.
  1078. theme.set_stylebox("panel", "TooltipPanel", style_box)
  1079. theme.set_color("font_color", "TooltipLabel", Color(0, 1, 1))
  1080. .. code-tab:: csharp
  1081. var styleBox = new StyleBoxFlat();
  1082. styleBox.SetBgColor(new Color(1, 1, 0));
  1083. styleBox.SetBorderWidthAll(2);
  1084. // We assume here that the `Theme` property has been assigned a custom Theme beforehand.
  1085. Theme.SetStyleBox("panel", "TooltipPanel", styleBox);
  1086. Theme.SetColor("font_color", "TooltipLabel", new Color(0, 1, 1));
  1087. .. rst-class:: classref-section-separator
  1088. ----
  1089. .. rst-class:: classref-descriptions-group
  1090. Method Descriptions
  1091. -------------------
  1092. .. _class_Control_method__can_drop_data:
  1093. .. rst-class:: classref-method
  1094. :ref:`bool<class_bool>` **_can_drop_data** **(** :ref:`Vector2<class_Vector2>` at_position, :ref:`Variant<class_Variant>` data **)** |virtual| |const|
  1095. Godot calls this method to test if ``data`` from a control's :ref:`_get_drag_data<class_Control_method__get_drag_data>` can be dropped at ``at_position``. ``at_position`` is local to this control.
  1096. This method should only be used to test the data. Process the data in :ref:`_drop_data<class_Control_method__drop_data>`.
  1097. .. tabs::
  1098. .. code-tab:: gdscript
  1099. func _can_drop_data(position, data):
  1100. # Check position if it is relevant to you
  1101. # Otherwise, just check data
  1102. return typeof(data) == TYPE_DICTIONARY and data.has("expected")
  1103. .. code-tab:: csharp
  1104. public override bool _CanDropData(Vector2 atPosition, Variant data)
  1105. {
  1106. // Check position if it is relevant to you
  1107. // Otherwise, just check data
  1108. return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("expected");
  1109. }
  1110. .. rst-class:: classref-item-separator
  1111. ----
  1112. .. _class_Control_method__drop_data:
  1113. .. rst-class:: classref-method
  1114. void **_drop_data** **(** :ref:`Vector2<class_Vector2>` at_position, :ref:`Variant<class_Variant>` data **)** |virtual|
  1115. Godot calls this method to pass you the ``data`` from a control's :ref:`_get_drag_data<class_Control_method__get_drag_data>` result. Godot first calls :ref:`_can_drop_data<class_Control_method__can_drop_data>` to test if ``data`` is allowed to drop at ``at_position`` where ``at_position`` is local to this control.
  1116. .. tabs::
  1117. .. code-tab:: gdscript
  1118. func _can_drop_data(position, data):
  1119. return typeof(data) == TYPE_DICTIONARY and data.has("color")
  1120. func _drop_data(position, data):
  1121. var color = data["color"]
  1122. .. code-tab:: csharp
  1123. public override bool _CanDropData(Vector2 atPosition, Variant data)
  1124. {
  1125. return data.VariantType == Variant.Type.Dictionary && dict.AsGodotDictionary().ContainsKey("color");
  1126. }
  1127. public override void _DropData(Vector2 atPosition, Variant data)
  1128. {
  1129. Color color = data.AsGodotDictionary()["color"].AsColor();
  1130. }
  1131. .. rst-class:: classref-item-separator
  1132. ----
  1133. .. _class_Control_method__get_drag_data:
  1134. .. rst-class:: classref-method
  1135. :ref:`Variant<class_Variant>` **_get_drag_data** **(** :ref:`Vector2<class_Vector2>` at_position **)** |virtual|
  1136. 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 :ref:`_can_drop_data<class_Control_method__can_drop_data>` and :ref:`_drop_data<class_Control_method__drop_data>`. ``at_position`` is local to this control. Drag may be forced with :ref:`force_drag<class_Control_method_force_drag>`.
  1137. A preview that will follow the mouse that should represent the data can be set with :ref:`set_drag_preview<class_Control_method_set_drag_preview>`. A good time to set the preview is in this method.
  1138. .. tabs::
  1139. .. code-tab:: gdscript
  1140. func _get_drag_data(position):
  1141. var mydata = make_data() # This is your custom method generating the drag data.
  1142. set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data.
  1143. return mydata
  1144. .. code-tab:: csharp
  1145. public override Variant _GetDragData(Vector2 atPosition)
  1146. {
  1147. var myData = MakeData(); // This is your custom method generating the drag data.
  1148. SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data.
  1149. return myData;
  1150. }
  1151. .. rst-class:: classref-item-separator
  1152. ----
  1153. .. _class_Control_method__get_minimum_size:
  1154. .. rst-class:: classref-method
  1155. :ref:`Vector2<class_Vector2>` **_get_minimum_size** **(** **)** |virtual| |const|
  1156. Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to :ref:`custom_minimum_size<class_Control_property_custom_minimum_size>` for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately).
  1157. If not overridden, defaults to :ref:`Vector2.ZERO<class_Vector2_constant_ZERO>`.
  1158. \ **Note:** This method will not be called when the script is attached to a **Control** node that already overrides its minimum size (e.g. :ref:`Label<class_Label>`, :ref:`Button<class_Button>`, :ref:`PanelContainer<class_PanelContainer>` etc.). It can only be used with most basic GUI nodes, like **Control**, :ref:`Container<class_Container>`, :ref:`Panel<class_Panel>` etc.
  1159. .. rst-class:: classref-item-separator
  1160. ----
  1161. .. _class_Control_method__get_tooltip:
  1162. .. rst-class:: classref-method
  1163. :ref:`String<class_String>` **_get_tooltip** **(** :ref:`Vector2<class_Vector2>` at_position **)** |virtual| |const|
  1164. Virtual method to be implemented by the user. Returns the tooltip text for the position ``at_position`` in control's local coordinates, which will typically appear when the cursor is resting over this control. See :ref:`get_tooltip<class_Control_method_get_tooltip>`.
  1165. \ **Note:** If this method returns an empty :ref:`String<class_String>`, no tooltip is displayed.
  1166. .. rst-class:: classref-item-separator
  1167. ----
  1168. .. _class_Control_method__gui_input:
  1169. .. rst-class:: classref-method
  1170. void **_gui_input** **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual|
  1171. Virtual method to be implemented by the user. Use this method to process and accept inputs on UI elements. See :ref:`accept_event<class_Control_method_accept_event>`.
  1172. \ **Example usage for clicking a control:**\
  1173. .. tabs::
  1174. .. code-tab:: gdscript
  1175. func _gui_input(event):
  1176. if event is InputEventMouseButton:
  1177. if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
  1178. print("I've been clicked D:")
  1179. .. code-tab:: csharp
  1180. public override void _GuiInput(InputEvent @event)
  1181. {
  1182. if (@event is InputEventMouseButton mb)
  1183. {
  1184. if (mb.ButtonIndex == MouseButton.Left && mb.Pressed)
  1185. {
  1186. GD.Print("I've been clicked D:");
  1187. }
  1188. }
  1189. }
  1190. The event won't trigger if:
  1191. \* clicking outside the control (see :ref:`_has_point<class_Control_method__has_point>`);
  1192. \* control has :ref:`mouse_filter<class_Control_property_mouse_filter>` set to :ref:`MOUSE_FILTER_IGNORE<class_Control_constant_MOUSE_FILTER_IGNORE>`;
  1193. \* control is obstructed by another **Control** on top of it, which doesn't have :ref:`mouse_filter<class_Control_property_mouse_filter>` set to :ref:`MOUSE_FILTER_IGNORE<class_Control_constant_MOUSE_FILTER_IGNORE>`;
  1194. \* control's parent has :ref:`mouse_filter<class_Control_property_mouse_filter>` set to :ref:`MOUSE_FILTER_STOP<class_Control_constant_MOUSE_FILTER_STOP>` or has accepted the event;
  1195. \* it happens outside the parent's rectangle and the parent has either :ref:`clip_contents<class_Control_property_clip_contents>` enabled.
  1196. \ **Note:** Event position is relative to the control origin.
  1197. .. rst-class:: classref-item-separator
  1198. ----
  1199. .. _class_Control_method__has_point:
  1200. .. rst-class:: classref-method
  1201. :ref:`bool<class_bool>` **_has_point** **(** :ref:`Vector2<class_Vector2>` point **)** |virtual| |const|
  1202. Virtual method to be implemented by the user. Returns whether the given ``point`` is inside this control.
  1203. If not overridden, default behavior is checking if the point is within control's Rect.
  1204. \ **Note:** If you want to check if a point is inside the control, you can use ``Rect2(Vector2.ZERO, size).has_point(point)``.
  1205. .. rst-class:: classref-item-separator
  1206. ----
  1207. .. _class_Control_method__make_custom_tooltip:
  1208. .. rst-class:: classref-method
  1209. :ref:`Object<class_Object>` **_make_custom_tooltip** **(** :ref:`String<class_String>` for_text **)** |virtual| |const|
  1210. Virtual method to be implemented by the user. Returns a **Control** node that should be used as a tooltip instead of the default one. The ``for_text`` includes the contents of the :ref:`tooltip_text<class_Control_property_tooltip_text>` property.
  1211. The returned node must be of type **Control** or Control-derived. It can have child nodes of any type. It is freed when the tooltip disappears, so make sure you always provide a new instance (if you want to use a pre-existing node from your scene tree, you can duplicate it and pass the duplicated instance). When ``null`` or a non-Control node is returned, the default tooltip will be used instead.
  1212. The returned node will be added as child to a :ref:`PopupPanel<class_PopupPanel>`, so you should only provide the contents of that panel. That :ref:`PopupPanel<class_PopupPanel>` can be themed using :ref:`Theme.set_stylebox<class_Theme_method_set_stylebox>` for the type ``"TooltipPanel"`` (see :ref:`tooltip_text<class_Control_property_tooltip_text>` for an example).
  1213. \ **Note:** The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its :ref:`custom_minimum_size<class_Control_property_custom_minimum_size>` to some non-zero value.
  1214. \ **Note:** The node (and any relevant children) should be :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` when returned, otherwise, the viewport that instantiates it will not be able to calculate its minimum size reliably.
  1215. \ **Example of usage with a custom-constructed node:**\
  1216. .. tabs::
  1217. .. code-tab:: gdscript
  1218. func _make_custom_tooltip(for_text):
  1219. var label = Label.new()
  1220. label.text = for_text
  1221. return label
  1222. .. code-tab:: csharp
  1223. public override Control _MakeCustomTooltip(string forText)
  1224. {
  1225. var label = new Label();
  1226. label.Text = forText;
  1227. return label;
  1228. }
  1229. \ **Example of usage with a custom scene instance:**\
  1230. .. tabs::
  1231. .. code-tab:: gdscript
  1232. func _make_custom_tooltip(for_text):
  1233. var tooltip = preload("res://some_tooltip_scene.tscn").instantiate()
  1234. tooltip.get_node("Label").text = for_text
  1235. return tooltip
  1236. .. code-tab:: csharp
  1237. public override Control _MakeCustomTooltip(string forText)
  1238. {
  1239. Node tooltip = ResourceLoader.Load<PackedScene>("res://some_tooltip_scene.tscn").Instantiate();
  1240. tooltip.GetNode<Label>("Label").Text = forText;
  1241. return tooltip;
  1242. }
  1243. .. rst-class:: classref-item-separator
  1244. ----
  1245. .. _class_Control_method__structured_text_parser:
  1246. .. rst-class:: classref-method
  1247. :ref:`Vector3i[]<class_Vector3i>` **_structured_text_parser** **(** :ref:`Array<class_Array>` args, :ref:`String<class_String>` text **)** |virtual| |const|
  1248. User defined BiDi algorithm override function.
  1249. Returns an :ref:`Array<class_Array>` of :ref:`Vector3i<class_Vector3i>` text ranges and text base directions, in the left-to-right order. Ranges should cover full source ``text`` without overlaps. BiDi algorithm will be used on each range separately.
  1250. .. rst-class:: classref-item-separator
  1251. ----
  1252. .. _class_Control_method_accept_event:
  1253. .. rst-class:: classref-method
  1254. void **accept_event** **(** **)**
  1255. Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to :ref:`Node._unhandled_input<class_Node_method__unhandled_input>` or :ref:`Node._unhandled_key_input<class_Node_method__unhandled_key_input>`.
  1256. \ **Note:** This does not affect the methods in :ref:`Input<class_Input>`, only the way events are propagated.
  1257. .. rst-class:: classref-item-separator
  1258. ----
  1259. .. _class_Control_method_add_theme_color_override:
  1260. .. rst-class:: classref-method
  1261. void **add_theme_color_override** **(** :ref:`StringName<class_StringName>` name, :ref:`Color<class_Color>` color **)**
  1262. Creates a local override for a theme :ref:`Color<class_Color>` with the specified ``name``. Local overrides always take precedence when fetching theme items for the control. An override can be removed with :ref:`remove_theme_color_override<class_Control_method_remove_theme_color_override>`.
  1263. See also :ref:`get_theme_color<class_Control_method_get_theme_color>`.
  1264. \ **Example of overriding a label's color and resetting it later:**\
  1265. .. tabs::
  1266. .. code-tab:: gdscript
  1267. # Given the child Label node "MyLabel", override its font color with a custom value.
  1268. $MyLabel.add_theme_color_override("font_color", Color(1, 0.5, 0))
  1269. # Reset the font color of the child label.
  1270. $MyLabel.remove_theme_color_override("font_color")
  1271. # Alternatively it can be overridden with the default value from the Label type.
  1272. $MyLabel.add_theme_color_override("font_color", get_theme_color("font_color", "Label"))
  1273. .. code-tab:: csharp
  1274. // Given the child Label node "MyLabel", override its font color with a custom value.
  1275. GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", new Color(1, 0.5f, 0));
  1276. // Reset the font color of the child label.
  1277. GetNode<Label>("MyLabel").RemoveThemeColorOverride("font_color");
  1278. // Alternatively it can be overridden with the default value from the Label type.
  1279. GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", GetThemeColor("font_color", "Label"));
  1280. .. rst-class:: classref-item-separator
  1281. ----
  1282. .. _class_Control_method_add_theme_constant_override:
  1283. .. rst-class:: classref-method
  1284. void **add_theme_constant_override** **(** :ref:`StringName<class_StringName>` name, :ref:`int<class_int>` constant **)**
  1285. Creates a local override for a theme constant with the specified ``name``. Local overrides always take precedence when fetching theme items for the control. An override can be removed with :ref:`remove_theme_constant_override<class_Control_method_remove_theme_constant_override>`.
  1286. See also :ref:`get_theme_constant<class_Control_method_get_theme_constant>`.
  1287. .. rst-class:: classref-item-separator
  1288. ----
  1289. .. _class_Control_method_add_theme_font_override:
  1290. .. rst-class:: classref-method
  1291. void **add_theme_font_override** **(** :ref:`StringName<class_StringName>` name, :ref:`Font<class_Font>` font **)**
  1292. Creates a local override for a theme :ref:`Font<class_Font>` with the specified ``name``. Local overrides always take precedence when fetching theme items for the control. An override can be removed with :ref:`remove_theme_font_override<class_Control_method_remove_theme_font_override>`.
  1293. See also :ref:`get_theme_font<class_Control_method_get_theme_font>`.
  1294. .. rst-class:: classref-item-separator
  1295. ----
  1296. .. _class_Control_method_add_theme_font_size_override:
  1297. .. rst-class:: classref-method
  1298. void **add_theme_font_size_override** **(** :ref:`StringName<class_StringName>` name, :ref:`int<class_int>` font_size **)**
  1299. Creates a local override for a theme font size with the specified ``name``. Local overrides always take precedence when fetching theme items for the control. An override can be removed with :ref:`remove_theme_font_size_override<class_Control_method_remove_theme_font_size_override>`.
  1300. See also :ref:`get_theme_font_size<class_Control_method_get_theme_font_size>`.
  1301. .. rst-class:: classref-item-separator
  1302. ----
  1303. .. _class_Control_method_add_theme_icon_override:
  1304. .. rst-class:: classref-method
  1305. void **add_theme_icon_override** **(** :ref:`StringName<class_StringName>` name, :ref:`Texture2D<class_Texture2D>` texture **)**
  1306. 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 with :ref:`remove_theme_icon_override<class_Control_method_remove_theme_icon_override>`.
  1307. See also :ref:`get_theme_icon<class_Control_method_get_theme_icon>`.
  1308. .. rst-class:: classref-item-separator
  1309. ----
  1310. .. _class_Control_method_add_theme_stylebox_override:
  1311. .. rst-class:: classref-method
  1312. void **add_theme_stylebox_override** **(** :ref:`StringName<class_StringName>` name, :ref:`StyleBox<class_StyleBox>` stylebox **)**
  1313. Creates a local override for a theme :ref:`StyleBox<class_StyleBox>` with the specified ``name``. Local overrides always take precedence when fetching theme items for the control. An override can be removed with :ref:`remove_theme_stylebox_override<class_Control_method_remove_theme_stylebox_override>`.
  1314. See also :ref:`get_theme_stylebox<class_Control_method_get_theme_stylebox>`.
  1315. \ **Example of modifying a property in a StyleBox by duplicating it:**\
  1316. .. tabs::
  1317. .. code-tab:: gdscript
  1318. # The snippet below assumes the child node MyButton has a StyleBoxFlat assigned.
  1319. # Resources are shared across instances, so we need to duplicate it
  1320. # to avoid modifying the appearance of all other buttons.
  1321. var new_stylebox_normal = $MyButton.get_theme_stylebox("normal").duplicate()
  1322. new_stylebox_normal.border_width_top = 3
  1323. new_stylebox_normal.border_color = Color(0, 1, 0.5)
  1324. $MyButton.add_theme_stylebox_override("normal", new_stylebox_normal)
  1325. # Remove the stylebox override.
  1326. $MyButton.remove_theme_stylebox_override("normal")
  1327. .. code-tab:: csharp
  1328. // The snippet below assumes the child node MyButton has a StyleBoxFlat assigned.
  1329. // Resources are shared across instances, so we need to duplicate it
  1330. // to avoid modifying the appearance of all other buttons.
  1331. StyleBoxFlat newStyleboxNormal = GetNode<Button>("MyButton").GetThemeStylebox("normal").Duplicate() as StyleBoxFlat;
  1332. newStyleboxNormal.BorderWidthTop = 3;
  1333. newStyleboxNormal.BorderColor = new Color(0, 1, 0.5f);
  1334. GetNode<Button>("MyButton").AddThemeStyleboxOverride("normal", newStyleboxNormal);
  1335. // Remove the stylebox override.
  1336. GetNode<Button>("MyButton").RemoveThemeStyleboxOverride("normal");
  1337. .. rst-class:: classref-item-separator
  1338. ----
  1339. .. _class_Control_method_begin_bulk_theme_override:
  1340. .. rst-class:: classref-method
  1341. void **begin_bulk_theme_override** **(** **)**
  1342. Prevents ``*_theme_*_override`` methods from emitting :ref:`NOTIFICATION_THEME_CHANGED<class_Control_constant_NOTIFICATION_THEME_CHANGED>` until :ref:`end_bulk_theme_override<class_Control_method_end_bulk_theme_override>` is called.
  1343. .. rst-class:: classref-item-separator
  1344. ----
  1345. .. _class_Control_method_end_bulk_theme_override:
  1346. .. rst-class:: classref-method
  1347. void **end_bulk_theme_override** **(** **)**
  1348. Ends a bulk theme override update. See :ref:`begin_bulk_theme_override<class_Control_method_begin_bulk_theme_override>`.
  1349. .. rst-class:: classref-item-separator
  1350. ----
  1351. .. _class_Control_method_find_next_valid_focus:
  1352. .. rst-class:: classref-method
  1353. :ref:`Control<class_Control>` **find_next_valid_focus** **(** **)** |const|
  1354. Finds the next (below in the tree) **Control** that can receive the focus.
  1355. .. rst-class:: classref-item-separator
  1356. ----
  1357. .. _class_Control_method_find_prev_valid_focus:
  1358. .. rst-class:: classref-method
  1359. :ref:`Control<class_Control>` **find_prev_valid_focus** **(** **)** |const|
  1360. Finds the previous (above in the tree) **Control** that can receive the focus.
  1361. .. rst-class:: classref-item-separator
  1362. ----
  1363. .. _class_Control_method_force_drag:
  1364. .. rst-class:: classref-method
  1365. void **force_drag** **(** :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` preview **)**
  1366. Forces drag and bypasses :ref:`_get_drag_data<class_Control_method__get_drag_data>` and :ref:`set_drag_preview<class_Control_method_set_drag_preview>` by passing ``data`` and ``preview``. Drag will start even if the mouse is neither over nor pressed on this control.
  1367. The methods :ref:`_can_drop_data<class_Control_method__can_drop_data>` and :ref:`_drop_data<class_Control_method__drop_data>` must be implemented on controls that want to receive drop data.
  1368. .. rst-class:: classref-item-separator
  1369. ----
  1370. .. _class_Control_method_get_anchor:
  1371. .. rst-class:: classref-method
  1372. :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  1373. Returns the anchor for the specified :ref:`Side<enum_@GlobalScope_Side>`. A getter method for :ref:`anchor_bottom<class_Control_property_anchor_bottom>`, :ref:`anchor_left<class_Control_property_anchor_left>`, :ref:`anchor_right<class_Control_property_anchor_right>` and :ref:`anchor_top<class_Control_property_anchor_top>`.
  1374. .. rst-class:: classref-item-separator
  1375. ----
  1376. .. _class_Control_method_get_begin:
  1377. .. rst-class:: classref-method
  1378. :ref:`Vector2<class_Vector2>` **get_begin** **(** **)** |const|
  1379. Returns :ref:`offset_left<class_Control_property_offset_left>` and :ref:`offset_top<class_Control_property_offset_top>`. See also :ref:`position<class_Control_property_position>`.
  1380. .. rst-class:: classref-item-separator
  1381. ----
  1382. .. _class_Control_method_get_combined_minimum_size:
  1383. .. rst-class:: classref-method
  1384. :ref:`Vector2<class_Vector2>` **get_combined_minimum_size** **(** **)** |const|
  1385. Returns combined minimum size from :ref:`custom_minimum_size<class_Control_property_custom_minimum_size>` and :ref:`get_minimum_size<class_Control_method_get_minimum_size>`.
  1386. .. rst-class:: classref-item-separator
  1387. ----
  1388. .. _class_Control_method_get_cursor_shape:
  1389. .. rst-class:: classref-method
  1390. :ref:`CursorShape<enum_Control_CursorShape>` **get_cursor_shape** **(** :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)** |const|
  1391. Returns the mouse cursor shape the control displays on mouse hover. See :ref:`CursorShape<enum_Control_CursorShape>`.
  1392. .. rst-class:: classref-item-separator
  1393. ----
  1394. .. _class_Control_method_get_end:
  1395. .. rst-class:: classref-method
  1396. :ref:`Vector2<class_Vector2>` **get_end** **(** **)** |const|
  1397. Returns :ref:`offset_right<class_Control_property_offset_right>` and :ref:`offset_bottom<class_Control_property_offset_bottom>`.
  1398. .. rst-class:: classref-item-separator
  1399. ----
  1400. .. _class_Control_method_get_focus_neighbor:
  1401. .. rst-class:: classref-method
  1402. :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  1403. Returns the focus neighbor for the specified :ref:`Side<enum_@GlobalScope_Side>`. A getter method for :ref:`focus_neighbor_bottom<class_Control_property_focus_neighbor_bottom>`, :ref:`focus_neighbor_left<class_Control_property_focus_neighbor_left>`, :ref:`focus_neighbor_right<class_Control_property_focus_neighbor_right>` and :ref:`focus_neighbor_top<class_Control_property_focus_neighbor_top>`.
  1404. .. rst-class:: classref-item-separator
  1405. ----
  1406. .. _class_Control_method_get_global_rect:
  1407. .. rst-class:: classref-method
  1408. :ref:`Rect2<class_Rect2>` **get_global_rect** **(** **)** |const|
  1409. Returns the position and size of the control relative to the containing canvas. See :ref:`global_position<class_Control_property_global_position>` and :ref:`size<class_Control_property_size>`.
  1410. \ **Note:** If the node itself or any parent :ref:`CanvasItem<class_CanvasItem>` between the node and the canvas have a non default rotation or skew, the resulting size is likely not meaningful.
  1411. \ **Note:** Setting :ref:`Viewport.gui_snap_controls_to_pixels<class_Viewport_property_gui_snap_controls_to_pixels>` to ``true`` can lead to rounding inaccuracies between the displayed control and the returned :ref:`Rect2<class_Rect2>`.
  1412. .. rst-class:: classref-item-separator
  1413. ----
  1414. .. _class_Control_method_get_minimum_size:
  1415. .. rst-class:: classref-method
  1416. :ref:`Vector2<class_Vector2>` **get_minimum_size** **(** **)** |const|
  1417. Returns the minimum size for this control. See :ref:`custom_minimum_size<class_Control_property_custom_minimum_size>`.
  1418. .. rst-class:: classref-item-separator
  1419. ----
  1420. .. _class_Control_method_get_offset:
  1421. .. rst-class:: classref-method
  1422. :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  1423. Returns the offset for the specified :ref:`Side<enum_@GlobalScope_Side>`. A getter method for :ref:`offset_bottom<class_Control_property_offset_bottom>`, :ref:`offset_left<class_Control_property_offset_left>`, :ref:`offset_right<class_Control_property_offset_right>` and :ref:`offset_top<class_Control_property_offset_top>`.
  1424. .. rst-class:: classref-item-separator
  1425. ----
  1426. .. _class_Control_method_get_parent_area_size:
  1427. .. rst-class:: classref-method
  1428. :ref:`Vector2<class_Vector2>` **get_parent_area_size** **(** **)** |const|
  1429. Returns the width/height occupied in the parent control.
  1430. .. rst-class:: classref-item-separator
  1431. ----
  1432. .. _class_Control_method_get_parent_control:
  1433. .. rst-class:: classref-method
  1434. :ref:`Control<class_Control>` **get_parent_control** **(** **)** |const|
  1435. Returns the parent control node.
  1436. .. rst-class:: classref-item-separator
  1437. ----
  1438. .. _class_Control_method_get_rect:
  1439. .. rst-class:: classref-method
  1440. :ref:`Rect2<class_Rect2>` **get_rect** **(** **)** |const|
  1441. Returns the position and size of the control in the coordinate system of the containing node. See :ref:`position<class_Control_property_position>`, :ref:`scale<class_Control_property_scale>` and :ref:`size<class_Control_property_size>`.
  1442. \ **Note:** If :ref:`rotation<class_Control_property_rotation>` is not the default rotation, the resulting size is not meaningful.
  1443. \ **Note:** Setting :ref:`Viewport.gui_snap_controls_to_pixels<class_Viewport_property_gui_snap_controls_to_pixels>` to ``true`` can lead to rounding inaccuracies between the displayed control and the returned :ref:`Rect2<class_Rect2>`.
  1444. .. rst-class:: classref-item-separator
  1445. ----
  1446. .. _class_Control_method_get_screen_position:
  1447. .. rst-class:: classref-method
  1448. :ref:`Vector2<class_Vector2>` **get_screen_position** **(** **)** |const|
  1449. Returns the position of this **Control** in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.
  1450. Equals to :ref:`global_position<class_Control_property_global_position>` if the window is embedded (see :ref:`Viewport.gui_embed_subwindows<class_Viewport_property_gui_embed_subwindows>`).
  1451. \ **Example usage for showing a popup:**\
  1452. ::
  1453. popup_menu.position = get_screen_position() + get_local_mouse_position()
  1454. popup_menu.reset_size()
  1455. popup_menu.popup()
  1456. .. rst-class:: classref-item-separator
  1457. ----
  1458. .. _class_Control_method_get_theme_color:
  1459. .. rst-class:: classref-method
  1460. :ref:`Color<class_Color>` **get_theme_color** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1461. Returns a :ref:`Color<class_Color>` from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has a color item with the specified ``name`` and ``theme_type``. If ``theme_type`` is omitted the class name of the current control is used as the type, or :ref:`theme_type_variation<class_Control_property_theme_type_variation>` if it is defined. If the type is a class name its parent classes are also checked, in order of inheritance. If the type is a variation its base types are checked, in order of dependency, then the control's class name and its parent classes are checked.
  1462. For the current control its local overrides are considered first (see :ref:`add_theme_color_override<class_Control_method_add_theme_color_override>`), then its assigned :ref:`theme<class_Control_property_theme>`. After the current control, each parent control and its assigned :ref:`theme<class_Control_property_theme>` are considered; controls without a :ref:`theme<class_Control_property_theme>` assigned are skipped. If no matching :ref:`Theme<class_Theme>` is found in the tree, the custom project :ref:`Theme<class_Theme>` (see :ref:`ProjectSettings.gui/theme/custom<class_ProjectSettings_property_gui/theme/custom>`) and the default :ref:`Theme<class_Theme>` are used (see :ref:`ThemeDB<class_ThemeDB>`).
  1463. .. tabs::
  1464. .. code-tab:: gdscript
  1465. func _ready():
  1466. # Get the font color defined for the current Control's class, if it exists.
  1467. modulate = get_theme_color("font_color")
  1468. # Get the font color defined for the Button class.
  1469. modulate = get_theme_color("font_color", "Button")
  1470. .. code-tab:: csharp
  1471. public override void _Ready()
  1472. {
  1473. // Get the font color defined for the current Control's class, if it exists.
  1474. Modulate = GetThemeColor("font_color");
  1475. // Get the font color defined for the Button class.
  1476. Modulate = GetThemeColor("font_color", "Button");
  1477. }
  1478. .. rst-class:: classref-item-separator
  1479. ----
  1480. .. _class_Control_method_get_theme_constant:
  1481. .. rst-class:: classref-method
  1482. :ref:`int<class_int>` **get_theme_constant** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1483. Returns a constant from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has a constant item with the specified ``name`` and ``theme_type``.
  1484. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1485. .. rst-class:: classref-item-separator
  1486. ----
  1487. .. _class_Control_method_get_theme_default_base_scale:
  1488. .. rst-class:: classref-method
  1489. :ref:`float<class_float>` **get_theme_default_base_scale** **(** **)** |const|
  1490. Returns the default base scale value from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has a valid :ref:`Theme.default_base_scale<class_Theme_property_default_base_scale>` value.
  1491. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1492. .. rst-class:: classref-item-separator
  1493. ----
  1494. .. _class_Control_method_get_theme_default_font:
  1495. .. rst-class:: classref-method
  1496. :ref:`Font<class_Font>` **get_theme_default_font** **(** **)** |const|
  1497. Returns the default font from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has a valid :ref:`Theme.default_font<class_Theme_property_default_font>` value.
  1498. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1499. .. rst-class:: classref-item-separator
  1500. ----
  1501. .. _class_Control_method_get_theme_default_font_size:
  1502. .. rst-class:: classref-method
  1503. :ref:`int<class_int>` **get_theme_default_font_size** **(** **)** |const|
  1504. Returns the default font size value from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has a valid :ref:`Theme.default_font_size<class_Theme_property_default_font_size>` value.
  1505. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1506. .. rst-class:: classref-item-separator
  1507. ----
  1508. .. _class_Control_method_get_theme_font:
  1509. .. rst-class:: classref-method
  1510. :ref:`Font<class_Font>` **get_theme_font** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1511. Returns a :ref:`Font<class_Font>` from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has a font item with the specified ``name`` and ``theme_type``.
  1512. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1513. .. rst-class:: classref-item-separator
  1514. ----
  1515. .. _class_Control_method_get_theme_font_size:
  1516. .. rst-class:: classref-method
  1517. :ref:`int<class_int>` **get_theme_font_size** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1518. Returns a font size from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has a font size item with the specified ``name`` and ``theme_type``.
  1519. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1520. .. rst-class:: classref-item-separator
  1521. ----
  1522. .. _class_Control_method_get_theme_icon:
  1523. .. rst-class:: classref-method
  1524. :ref:`Texture2D<class_Texture2D>` **get_theme_icon** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1525. Returns an icon from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has an icon item with the specified ``name`` and ``theme_type``.
  1526. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1527. .. rst-class:: classref-item-separator
  1528. ----
  1529. .. _class_Control_method_get_theme_stylebox:
  1530. .. rst-class:: classref-method
  1531. :ref:`StyleBox<class_StyleBox>` **get_theme_stylebox** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1532. Returns a :ref:`StyleBox<class_StyleBox>` from the first matching :ref:`Theme<class_Theme>` in the tree if that :ref:`Theme<class_Theme>` has a stylebox item with the specified ``name`` and ``theme_type``.
  1533. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1534. .. rst-class:: classref-item-separator
  1535. ----
  1536. .. _class_Control_method_get_tooltip:
  1537. .. rst-class:: classref-method
  1538. :ref:`String<class_String>` **get_tooltip** **(** :ref:`Vector2<class_Vector2>` at_position=Vector2(0, 0) **)** |const|
  1539. Returns the tooltip text for the position ``at_position`` in control's local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns :ref:`tooltip_text<class_Control_property_tooltip_text>`.
  1540. This method can be overridden to customize its behavior. See :ref:`_get_tooltip<class_Control_method__get_tooltip>`.
  1541. \ **Note:** If this method returns an empty :ref:`String<class_String>`, no tooltip is displayed.
  1542. .. rst-class:: classref-item-separator
  1543. ----
  1544. .. _class_Control_method_grab_click_focus:
  1545. .. rst-class:: classref-method
  1546. void **grab_click_focus** **(** **)**
  1547. Creates an :ref:`InputEventMouseButton<class_InputEventMouseButton>` that attempts to click the control. If the event is received, the control acquires focus.
  1548. .. tabs::
  1549. .. code-tab:: gdscript
  1550. func _process(delta):
  1551. grab_click_focus() # When clicking another Control node, this node will be clicked instead.
  1552. .. code-tab:: csharp
  1553. public override void _Process(double delta)
  1554. {
  1555. GrabClickFocus(); // When clicking another Control node, this node will be clicked instead.
  1556. }
  1557. .. rst-class:: classref-item-separator
  1558. ----
  1559. .. _class_Control_method_grab_focus:
  1560. .. rst-class:: classref-method
  1561. void **grab_focus** **(** **)**
  1562. Steal the focus from another control and become the focused control (see :ref:`focus_mode<class_Control_property_focus_mode>`).
  1563. \ **Note:** Using this method together with :ref:`Callable.call_deferred<class_Callable_method_call_deferred>` makes it more reliable, especially when called inside :ref:`Node._ready<class_Node_method__ready>`.
  1564. .. rst-class:: classref-item-separator
  1565. ----
  1566. .. _class_Control_method_has_focus:
  1567. .. rst-class:: classref-method
  1568. :ref:`bool<class_bool>` **has_focus** **(** **)** |const|
  1569. Returns ``true`` if this is the current focused control. See :ref:`focus_mode<class_Control_property_focus_mode>`.
  1570. .. rst-class:: classref-item-separator
  1571. ----
  1572. .. _class_Control_method_has_theme_color:
  1573. .. rst-class:: classref-method
  1574. :ref:`bool<class_bool>` **has_theme_color** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1575. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a color item with the specified ``name`` and ``theme_type``.
  1576. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1577. .. rst-class:: classref-item-separator
  1578. ----
  1579. .. _class_Control_method_has_theme_color_override:
  1580. .. rst-class:: classref-method
  1581. :ref:`bool<class_bool>` **has_theme_color_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1582. Returns ``true`` if there is a local override for a theme :ref:`Color<class_Color>` with the specified ``name`` in this **Control** node.
  1583. See :ref:`add_theme_color_override<class_Control_method_add_theme_color_override>`.
  1584. .. rst-class:: classref-item-separator
  1585. ----
  1586. .. _class_Control_method_has_theme_constant:
  1587. .. rst-class:: classref-method
  1588. :ref:`bool<class_bool>` **has_theme_constant** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1589. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a constant item with the specified ``name`` and ``theme_type``.
  1590. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1591. .. rst-class:: classref-item-separator
  1592. ----
  1593. .. _class_Control_method_has_theme_constant_override:
  1594. .. rst-class:: classref-method
  1595. :ref:`bool<class_bool>` **has_theme_constant_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1596. Returns ``true`` if there is a local override for a theme constant with the specified ``name`` in this **Control** node.
  1597. See :ref:`add_theme_constant_override<class_Control_method_add_theme_constant_override>`.
  1598. .. rst-class:: classref-item-separator
  1599. ----
  1600. .. _class_Control_method_has_theme_font:
  1601. .. rst-class:: classref-method
  1602. :ref:`bool<class_bool>` **has_theme_font** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1603. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a font item with the specified ``name`` and ``theme_type``.
  1604. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1605. .. rst-class:: classref-item-separator
  1606. ----
  1607. .. _class_Control_method_has_theme_font_override:
  1608. .. rst-class:: classref-method
  1609. :ref:`bool<class_bool>` **has_theme_font_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1610. Returns ``true`` if there is a local override for a theme :ref:`Font<class_Font>` with the specified ``name`` in this **Control** node.
  1611. See :ref:`add_theme_font_override<class_Control_method_add_theme_font_override>`.
  1612. .. rst-class:: classref-item-separator
  1613. ----
  1614. .. _class_Control_method_has_theme_font_size:
  1615. .. rst-class:: classref-method
  1616. :ref:`bool<class_bool>` **has_theme_font_size** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1617. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a font size item with the specified ``name`` and ``theme_type``.
  1618. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1619. .. rst-class:: classref-item-separator
  1620. ----
  1621. .. _class_Control_method_has_theme_font_size_override:
  1622. .. rst-class:: classref-method
  1623. :ref:`bool<class_bool>` **has_theme_font_size_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1624. Returns ``true`` if there is a local override for a theme font size with the specified ``name`` in this **Control** node.
  1625. See :ref:`add_theme_font_size_override<class_Control_method_add_theme_font_size_override>`.
  1626. .. rst-class:: classref-item-separator
  1627. ----
  1628. .. _class_Control_method_has_theme_icon:
  1629. .. rst-class:: classref-method
  1630. :ref:`bool<class_bool>` **has_theme_icon** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1631. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has an icon item with the specified ``name`` and ``theme_type``.
  1632. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1633. .. rst-class:: classref-item-separator
  1634. ----
  1635. .. _class_Control_method_has_theme_icon_override:
  1636. .. rst-class:: classref-method
  1637. :ref:`bool<class_bool>` **has_theme_icon_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1638. Returns ``true`` if there is a local override for a theme icon with the specified ``name`` in this **Control** node.
  1639. See :ref:`add_theme_icon_override<class_Control_method_add_theme_icon_override>`.
  1640. .. rst-class:: classref-item-separator
  1641. ----
  1642. .. _class_Control_method_has_theme_stylebox:
  1643. .. rst-class:: classref-method
  1644. :ref:`bool<class_bool>` **has_theme_stylebox** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1645. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a stylebox item with the specified ``name`` and ``theme_type``.
  1646. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1647. .. rst-class:: classref-item-separator
  1648. ----
  1649. .. _class_Control_method_has_theme_stylebox_override:
  1650. .. rst-class:: classref-method
  1651. :ref:`bool<class_bool>` **has_theme_stylebox_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1652. Returns ``true`` if there is a local override for a theme :ref:`StyleBox<class_StyleBox>` with the specified ``name`` in this **Control** node.
  1653. See :ref:`add_theme_stylebox_override<class_Control_method_add_theme_stylebox_override>`.
  1654. .. rst-class:: classref-item-separator
  1655. ----
  1656. .. _class_Control_method_is_drag_successful:
  1657. .. rst-class:: classref-method
  1658. :ref:`bool<class_bool>` **is_drag_successful** **(** **)** |const|
  1659. Returns ``true`` if a drag operation is successful. Alternative to :ref:`Viewport.gui_is_drag_successful<class_Viewport_method_gui_is_drag_successful>`.
  1660. Best used with :ref:`Node.NOTIFICATION_DRAG_END<class_Node_constant_NOTIFICATION_DRAG_END>`.
  1661. .. rst-class:: classref-item-separator
  1662. ----
  1663. .. _class_Control_method_is_layout_rtl:
  1664. .. rst-class:: classref-method
  1665. :ref:`bool<class_bool>` **is_layout_rtl** **(** **)** |const|
  1666. Returns ``true`` if layout is right-to-left.
  1667. .. rst-class:: classref-item-separator
  1668. ----
  1669. .. _class_Control_method_release_focus:
  1670. .. rst-class:: classref-method
  1671. void **release_focus** **(** **)**
  1672. Give up the focus. No other control will be able to receive input.
  1673. .. rst-class:: classref-item-separator
  1674. ----
  1675. .. _class_Control_method_remove_theme_color_override:
  1676. .. rst-class:: classref-method
  1677. void **remove_theme_color_override** **(** :ref:`StringName<class_StringName>` name **)**
  1678. Removes a local override for a theme :ref:`Color<class_Color>` with the specified ``name`` previously added by :ref:`add_theme_color_override<class_Control_method_add_theme_color_override>` or via the Inspector dock.
  1679. .. rst-class:: classref-item-separator
  1680. ----
  1681. .. _class_Control_method_remove_theme_constant_override:
  1682. .. rst-class:: classref-method
  1683. void **remove_theme_constant_override** **(** :ref:`StringName<class_StringName>` name **)**
  1684. Removes a local override for a theme constant with the specified ``name`` previously added by :ref:`add_theme_constant_override<class_Control_method_add_theme_constant_override>` or via the Inspector dock.
  1685. .. rst-class:: classref-item-separator
  1686. ----
  1687. .. _class_Control_method_remove_theme_font_override:
  1688. .. rst-class:: classref-method
  1689. void **remove_theme_font_override** **(** :ref:`StringName<class_StringName>` name **)**
  1690. Removes a local override for a theme :ref:`Font<class_Font>` with the specified ``name`` previously added by :ref:`add_theme_font_override<class_Control_method_add_theme_font_override>` or via the Inspector dock.
  1691. .. rst-class:: classref-item-separator
  1692. ----
  1693. .. _class_Control_method_remove_theme_font_size_override:
  1694. .. rst-class:: classref-method
  1695. void **remove_theme_font_size_override** **(** :ref:`StringName<class_StringName>` name **)**
  1696. Removes a local override for a theme font size with the specified ``name`` previously added by :ref:`add_theme_font_size_override<class_Control_method_add_theme_font_size_override>` or via the Inspector dock.
  1697. .. rst-class:: classref-item-separator
  1698. ----
  1699. .. _class_Control_method_remove_theme_icon_override:
  1700. .. rst-class:: classref-method
  1701. void **remove_theme_icon_override** **(** :ref:`StringName<class_StringName>` name **)**
  1702. Removes a local override for a theme icon with the specified ``name`` previously added by :ref:`add_theme_icon_override<class_Control_method_add_theme_icon_override>` or via the Inspector dock.
  1703. .. rst-class:: classref-item-separator
  1704. ----
  1705. .. _class_Control_method_remove_theme_stylebox_override:
  1706. .. rst-class:: classref-method
  1707. void **remove_theme_stylebox_override** **(** :ref:`StringName<class_StringName>` name **)**
  1708. Removes a local override for a theme :ref:`StyleBox<class_StyleBox>` with the specified ``name`` previously added by :ref:`add_theme_stylebox_override<class_Control_method_add_theme_stylebox_override>` or via the Inspector dock.
  1709. .. rst-class:: classref-item-separator
  1710. ----
  1711. .. _class_Control_method_reset_size:
  1712. .. rst-class:: classref-method
  1713. void **reset_size** **(** **)**
  1714. Resets the size to :ref:`get_combined_minimum_size<class_Control_method_get_combined_minimum_size>`. This is equivalent to calling ``set_size(Vector2())`` (or any size below the minimum).
  1715. .. rst-class:: classref-item-separator
  1716. ----
  1717. .. _class_Control_method_set_anchor:
  1718. .. rst-class:: classref-method
  1719. void **set_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` anchor, :ref:`bool<class_bool>` keep_offset=false, :ref:`bool<class_bool>` push_opposite_anchor=true **)**
  1720. Sets the anchor for the specified :ref:`Side<enum_@GlobalScope_Side>` to ``anchor``. A setter method for :ref:`anchor_bottom<class_Control_property_anchor_bottom>`, :ref:`anchor_left<class_Control_property_anchor_left>`, :ref:`anchor_right<class_Control_property_anchor_right>` and :ref:`anchor_top<class_Control_property_anchor_top>`.
  1721. If ``keep_offset`` is ``true``, offsets aren't updated after this operation.
  1722. 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.
  1723. .. rst-class:: classref-item-separator
  1724. ----
  1725. .. _class_Control_method_set_anchor_and_offset:
  1726. .. rst-class:: classref-method
  1727. void **set_anchor_and_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` anchor, :ref:`float<class_float>` offset, :ref:`bool<class_bool>` push_opposite_anchor=false **)**
  1728. Works the same as :ref:`set_anchor<class_Control_method_set_anchor>`, but instead of ``keep_offset`` argument and automatic update of offset, it allows to set the offset yourself (see :ref:`set_offset<class_Control_method_set_offset>`).
  1729. .. rst-class:: classref-item-separator
  1730. ----
  1731. .. _class_Control_method_set_anchors_and_offsets_preset:
  1732. .. rst-class:: classref-method
  1733. void **set_anchors_and_offsets_preset** **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)**
  1734. Sets both anchor preset and offset preset. See :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>` and :ref:`set_offsets_preset<class_Control_method_set_offsets_preset>`.
  1735. .. rst-class:: classref-item-separator
  1736. ----
  1737. .. _class_Control_method_set_anchors_preset:
  1738. .. rst-class:: classref-method
  1739. void **set_anchors_preset** **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`bool<class_bool>` keep_offsets=false **)**
  1740. Sets the anchors to a ``preset`` from :ref:`LayoutPreset<enum_Control_LayoutPreset>` enum. This is the code equivalent to using the Layout menu in the 2D editor.
  1741. If ``keep_offsets`` is ``true``, control's position will also be updated.
  1742. .. rst-class:: classref-item-separator
  1743. ----
  1744. .. _class_Control_method_set_begin:
  1745. .. rst-class:: classref-method
  1746. void **set_begin** **(** :ref:`Vector2<class_Vector2>` position **)**
  1747. Sets :ref:`offset_left<class_Control_property_offset_left>` and :ref:`offset_top<class_Control_property_offset_top>` at the same time. Equivalent of changing :ref:`position<class_Control_property_position>`.
  1748. .. rst-class:: classref-item-separator
  1749. ----
  1750. .. _class_Control_method_set_drag_forwarding:
  1751. .. rst-class:: classref-method
  1752. void **set_drag_forwarding** **(** :ref:`Callable<class_Callable>` drag_func, :ref:`Callable<class_Callable>` can_drop_func, :ref:`Callable<class_Callable>` drop_func **)**
  1753. Forwards the handling of this control's :ref:`_get_drag_data<class_Control_method__get_drag_data>`, :ref:`_can_drop_data<class_Control_method__can_drop_data>` and :ref:`_drop_data<class_Control_method__drop_data>` virtual functions to delegate callables.
  1754. For each argument, if not empty, the delegate callable is used, otherwise the local (virtual) function is used.
  1755. The function format for each callable should be exactly the same as the virtual functions described above.
  1756. .. rst-class:: classref-item-separator
  1757. ----
  1758. .. _class_Control_method_set_drag_preview:
  1759. .. rst-class:: classref-method
  1760. void **set_drag_preview** **(** :ref:`Control<class_Control>` control **)**
  1761. Shows the given control at the mouse pointer. A good time to call this method is in :ref:`_get_drag_data<class_Control_method__get_drag_data>`. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended.
  1762. .. tabs::
  1763. .. code-tab:: gdscript
  1764. @export var color = Color(1, 0, 0, 1)
  1765. func _get_drag_data(position):
  1766. # Use a control that is not in the tree
  1767. var cpb = ColorPickerButton.new()
  1768. cpb.color = color
  1769. cpb.size = Vector2(50, 50)
  1770. set_drag_preview(cpb)
  1771. return color
  1772. .. code-tab:: csharp
  1773. [Export]
  1774. private Color _color = new Color(1, 0, 0, 1);
  1775. public override Variant _GetDragData(Vector2 atPosition)
  1776. {
  1777. // Use a control that is not in the tree
  1778. var cpb = new ColorPickerButton();
  1779. cpb.Color = _color;
  1780. cpb.Size = new Vector2(50, 50);
  1781. SetDragPreview(cpb);
  1782. return _color;
  1783. }
  1784. .. rst-class:: classref-item-separator
  1785. ----
  1786. .. _class_Control_method_set_end:
  1787. .. rst-class:: classref-method
  1788. void **set_end** **(** :ref:`Vector2<class_Vector2>` position **)**
  1789. Sets :ref:`offset_right<class_Control_property_offset_right>` and :ref:`offset_bottom<class_Control_property_offset_bottom>` at the same time.
  1790. .. rst-class:: classref-item-separator
  1791. ----
  1792. .. _class_Control_method_set_focus_neighbor:
  1793. .. rst-class:: classref-method
  1794. void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  1795. Sets the focus neighbor for the specified :ref:`Side<enum_@GlobalScope_Side>` to the **Control** at ``neighbor`` node path. A setter method for :ref:`focus_neighbor_bottom<class_Control_property_focus_neighbor_bottom>`, :ref:`focus_neighbor_left<class_Control_property_focus_neighbor_left>`, :ref:`focus_neighbor_right<class_Control_property_focus_neighbor_right>` and :ref:`focus_neighbor_top<class_Control_property_focus_neighbor_top>`.
  1796. .. rst-class:: classref-item-separator
  1797. ----
  1798. .. _class_Control_method_set_global_position:
  1799. .. rst-class:: classref-method
  1800. void **set_global_position** **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_offsets=false **)**
  1801. Sets the :ref:`global_position<class_Control_property_global_position>` to given ``position``.
  1802. If ``keep_offsets`` is ``true``, control's anchors will be updated instead of offsets.
  1803. .. rst-class:: classref-item-separator
  1804. ----
  1805. .. _class_Control_method_set_offset:
  1806. .. rst-class:: classref-method
  1807. void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  1808. Sets the offset for the specified :ref:`Side<enum_@GlobalScope_Side>` to ``offset``. A setter method for :ref:`offset_bottom<class_Control_property_offset_bottom>`, :ref:`offset_left<class_Control_property_offset_left>`, :ref:`offset_right<class_Control_property_offset_right>` and :ref:`offset_top<class_Control_property_offset_top>`.
  1809. .. rst-class:: classref-item-separator
  1810. ----
  1811. .. _class_Control_method_set_offsets_preset:
  1812. .. rst-class:: classref-method
  1813. void **set_offsets_preset** **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)**
  1814. Sets the offsets to a ``preset`` from :ref:`LayoutPreset<enum_Control_LayoutPreset>` enum. This is the code equivalent to using the Layout menu in the 2D editor.
  1815. Use parameter ``resize_mode`` with constants from :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` to better determine the resulting size of the **Control**. Constant size will be ignored if used with presets that change size, e.g. :ref:`PRESET_LEFT_WIDE<class_Control_constant_PRESET_LEFT_WIDE>`.
  1816. Use parameter ``margin`` to determine the gap between the **Control** and the edges.
  1817. .. rst-class:: classref-item-separator
  1818. ----
  1819. .. _class_Control_method_set_position:
  1820. .. rst-class:: classref-method
  1821. void **set_position** **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_offsets=false **)**
  1822. Sets the :ref:`position<class_Control_property_position>` to given ``position``.
  1823. If ``keep_offsets`` is ``true``, control's anchors will be updated instead of offsets.
  1824. .. rst-class:: classref-item-separator
  1825. ----
  1826. .. _class_Control_method_set_size:
  1827. .. rst-class:: classref-method
  1828. void **set_size** **(** :ref:`Vector2<class_Vector2>` size, :ref:`bool<class_bool>` keep_offsets=false **)**
  1829. Sets the size (see :ref:`size<class_Control_property_size>`).
  1830. If ``keep_offsets`` is ``true``, control's anchors will be updated instead of offsets.
  1831. .. rst-class:: classref-item-separator
  1832. ----
  1833. .. _class_Control_method_update_minimum_size:
  1834. .. rst-class:: classref-method
  1835. void **update_minimum_size** **(** **)**
  1836. Invalidates the size cache in this node and in parent nodes up to top level. Intended to be used with :ref:`get_minimum_size<class_Control_method_get_minimum_size>` when the return value is changed. Setting :ref:`custom_minimum_size<class_Control_property_custom_minimum_size>` directly calls this method automatically.
  1837. .. rst-class:: classref-item-separator
  1838. ----
  1839. .. _class_Control_method_warp_mouse:
  1840. .. rst-class:: classref-method
  1841. void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` position **)**
  1842. Moves the mouse cursor to ``position``, relative to :ref:`position<class_Control_property_position>` of this **Control**.
  1843. \ **Note:** :ref:`warp_mouse<class_Control_method_warp_mouse>` is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.
  1844. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1845. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1846. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1847. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1848. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1849. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  1850. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`