class_control.rst 186 KB

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