class_control.rst 188 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367
  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/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/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_private_method__input>`. For UI elements specifically, it makes more sense to override the virtual method :ref:`_gui_input<class_Control_private_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_private_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_private_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_private_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_private_method__get_drag_data>` **(** :ref:`Vector2<class_Vector2>` at_position **)** |virtual| |
  128. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`Vector2<class_Vector2>` | :ref:`_get_minimum_size<class_Control_private_method__get_minimum_size>` **(** **)** |virtual| |const| |
  130. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`String<class_String>` | :ref:`_get_tooltip<class_Control_private_method__get_tooltip>` **(** :ref:`Vector2<class_Vector2>` at_position **)** |virtual| |const| |
  132. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | void | :ref:`_gui_input<class_Control_private_method__gui_input>` **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual| |
  134. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | :ref:`bool<class_bool>` | :ref:`_has_point<class_Control_private_method__has_point>` **(** :ref:`Vector2<class_Vector2>` point **)** |virtual| |const| |
  136. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | :ref:`Object<class_Object>` | :ref:`_make_custom_tooltip<class_Control_private_method__make_custom_tooltip>` **(** :ref:`String<class_String>` for_text **)** |virtual| |const| |
  138. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | :ref:`Vector3i[]<class_Vector3i>` | :ref:`_structured_text_parser<class_Control_private_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 (or any child 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 (and all child 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_private_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_private_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_private_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_private_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. \ **Note:** If the control has received :ref:`mouse_entered<class_Control_signal_mouse_entered>` but not :ref:`mouse_exited<class_Control_signal_mouse_exited>`, changing the :ref:`mouse_filter<class_Control_property_mouse_filter>` to :ref:`MOUSE_FILTER_IGNORE<class_Control_constant_MOUSE_FILTER_IGNORE>` will cause :ref:`mouse_exited<class_Control_signal_mouse_exited>` to be emitted.
  590. .. rst-class:: classref-item-separator
  591. ----
  592. .. _enum_Control_GrowDirection:
  593. .. rst-class:: classref-enumeration
  594. enum **GrowDirection**:
  595. .. _class_Control_constant_GROW_DIRECTION_BEGIN:
  596. .. rst-class:: classref-enumeration-constant
  597. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_BEGIN** = ``0``
  598. 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.
  599. .. _class_Control_constant_GROW_DIRECTION_END:
  600. .. rst-class:: classref-enumeration-constant
  601. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_END** = ``1``
  602. 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.
  603. .. _class_Control_constant_GROW_DIRECTION_BOTH:
  604. .. rst-class:: classref-enumeration-constant
  605. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_BOTH** = ``2``
  606. The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.
  607. .. rst-class:: classref-item-separator
  608. ----
  609. .. _enum_Control_Anchor:
  610. .. rst-class:: classref-enumeration
  611. enum **Anchor**:
  612. .. _class_Control_constant_ANCHOR_BEGIN:
  613. .. rst-class:: classref-enumeration-constant
  614. :ref:`Anchor<enum_Control_Anchor>` **ANCHOR_BEGIN** = ``0``
  615. 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>`.
  616. .. _class_Control_constant_ANCHOR_END:
  617. .. rst-class:: classref-enumeration-constant
  618. :ref:`Anchor<enum_Control_Anchor>` **ANCHOR_END** = ``1``
  619. 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>`.
  620. .. rst-class:: classref-item-separator
  621. ----
  622. .. _enum_Control_LayoutDirection:
  623. .. rst-class:: classref-enumeration
  624. enum **LayoutDirection**:
  625. .. _class_Control_constant_LAYOUT_DIRECTION_INHERITED:
  626. .. rst-class:: classref-enumeration-constant
  627. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **LAYOUT_DIRECTION_INHERITED** = ``0``
  628. Automatic layout direction, determined from the parent control layout direction.
  629. .. _class_Control_constant_LAYOUT_DIRECTION_LOCALE:
  630. .. rst-class:: classref-enumeration-constant
  631. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **LAYOUT_DIRECTION_LOCALE** = ``1``
  632. Automatic layout direction, determined from the current locale.
  633. .. _class_Control_constant_LAYOUT_DIRECTION_LTR:
  634. .. rst-class:: classref-enumeration-constant
  635. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **LAYOUT_DIRECTION_LTR** = ``2``
  636. Left-to-right layout direction.
  637. .. _class_Control_constant_LAYOUT_DIRECTION_RTL:
  638. .. rst-class:: classref-enumeration-constant
  639. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **LAYOUT_DIRECTION_RTL** = ``3``
  640. Right-to-left layout direction.
  641. .. rst-class:: classref-item-separator
  642. ----
  643. .. _enum_Control_TextDirection:
  644. .. rst-class:: classref-enumeration
  645. enum **TextDirection**:
  646. .. _class_Control_constant_TEXT_DIRECTION_INHERITED:
  647. .. rst-class:: classref-enumeration-constant
  648. :ref:`TextDirection<enum_Control_TextDirection>` **TEXT_DIRECTION_INHERITED** = ``3``
  649. Text writing direction is the same as layout direction.
  650. .. _class_Control_constant_TEXT_DIRECTION_AUTO:
  651. .. rst-class:: classref-enumeration-constant
  652. :ref:`TextDirection<enum_Control_TextDirection>` **TEXT_DIRECTION_AUTO** = ``0``
  653. Automatic text writing direction, determined from the current locale and text content.
  654. .. _class_Control_constant_TEXT_DIRECTION_LTR:
  655. .. rst-class:: classref-enumeration-constant
  656. :ref:`TextDirection<enum_Control_TextDirection>` **TEXT_DIRECTION_LTR** = ``1``
  657. Left-to-right text writing direction.
  658. .. _class_Control_constant_TEXT_DIRECTION_RTL:
  659. .. rst-class:: classref-enumeration-constant
  660. :ref:`TextDirection<enum_Control_TextDirection>` **TEXT_DIRECTION_RTL** = ``2``
  661. Right-to-left text writing direction.
  662. .. rst-class:: classref-section-separator
  663. ----
  664. .. rst-class:: classref-descriptions-group
  665. Constants
  666. ---------
  667. .. _class_Control_constant_NOTIFICATION_RESIZED:
  668. .. rst-class:: classref-constant
  669. **NOTIFICATION_RESIZED** = ``40``
  670. Sent when the node changes size. Use :ref:`size<class_Control_property_size>` to get the new size.
  671. .. _class_Control_constant_NOTIFICATION_MOUSE_ENTER:
  672. .. rst-class:: classref-constant
  673. **NOTIFICATION_MOUSE_ENTER** = ``41``
  674. Sent when the mouse cursor enters the control's (or any child control's) visible area, that is not occluded behind other Controls or Windows, provided its :ref:`mouse_filter<class_Control_property_mouse_filter>` lets the event reach it and regardless if it's currently focused or not.
  675. \ **Note:** :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` doesn't affect which Control receives the notification.
  676. See also :ref:`NOTIFICATION_MOUSE_ENTER_SELF<class_Control_constant_NOTIFICATION_MOUSE_ENTER_SELF>`.
  677. .. _class_Control_constant_NOTIFICATION_MOUSE_EXIT:
  678. .. rst-class:: classref-constant
  679. **NOTIFICATION_MOUSE_EXIT** = ``42``
  680. Sent when the mouse cursor leaves the control's (and all child control's) visible area, that is not occluded behind other Controls or Windows, provided its :ref:`mouse_filter<class_Control_property_mouse_filter>` lets the event reach it and regardless if it's currently focused or not.
  681. \ **Note:** :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` doesn't affect which Control receives the notification.
  682. See also :ref:`NOTIFICATION_MOUSE_EXIT_SELF<class_Control_constant_NOTIFICATION_MOUSE_EXIT_SELF>`.
  683. .. _class_Control_constant_NOTIFICATION_MOUSE_ENTER_SELF:
  684. .. rst-class:: classref-constant
  685. **NOTIFICATION_MOUSE_ENTER_SELF** = ``60``
  686. 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.
  687. \ **Note:** :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` doesn't affect which Control receives the notification.
  688. See also :ref:`NOTIFICATION_MOUSE_ENTER<class_Control_constant_NOTIFICATION_MOUSE_ENTER>`.
  689. .. _class_Control_constant_NOTIFICATION_MOUSE_EXIT_SELF:
  690. .. rst-class:: classref-constant
  691. **NOTIFICATION_MOUSE_EXIT_SELF** = ``61``
  692. 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.
  693. \ **Note:** :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` doesn't affect which Control receives the notification.
  694. See also :ref:`NOTIFICATION_MOUSE_EXIT<class_Control_constant_NOTIFICATION_MOUSE_EXIT>`.
  695. .. _class_Control_constant_NOTIFICATION_FOCUS_ENTER:
  696. .. rst-class:: classref-constant
  697. **NOTIFICATION_FOCUS_ENTER** = ``43``
  698. Sent when the node grabs focus.
  699. .. _class_Control_constant_NOTIFICATION_FOCUS_EXIT:
  700. .. rst-class:: classref-constant
  701. **NOTIFICATION_FOCUS_EXIT** = ``44``
  702. Sent when the node loses focus.
  703. .. _class_Control_constant_NOTIFICATION_THEME_CHANGED:
  704. .. rst-class:: classref-constant
  705. **NOTIFICATION_THEME_CHANGED** = ``45``
  706. Sent when the node needs to refresh its theme items. This happens in one of the following cases:
  707. - The :ref:`theme<class_Control_property_theme>` property is changed on this node or any of its ancestors.
  708. - The :ref:`theme_type_variation<class_Control_property_theme_type_variation>` property is changed on this node.
  709. - One of the node's theme property overrides is changed.
  710. - The node enters the scene tree.
  711. \ **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.
  712. .. _class_Control_constant_NOTIFICATION_SCROLL_BEGIN:
  713. .. rst-class:: classref-constant
  714. **NOTIFICATION_SCROLL_BEGIN** = ``47``
  715. 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.
  716. \ **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.
  717. .. _class_Control_constant_NOTIFICATION_SCROLL_END:
  718. .. rst-class:: classref-constant
  719. **NOTIFICATION_SCROLL_END** = ``48``
  720. 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.
  721. \ **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.
  722. .. _class_Control_constant_NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
  723. .. rst-class:: classref-constant
  724. **NOTIFICATION_LAYOUT_DIRECTION_CHANGED** = ``49``
  725. Sent when control layout direction is changed.
  726. .. rst-class:: classref-section-separator
  727. ----
  728. .. rst-class:: classref-descriptions-group
  729. Property Descriptions
  730. ---------------------
  731. .. _class_Control_property_anchor_bottom:
  732. .. rst-class:: classref-property
  733. :ref:`float<class_float>` **anchor_bottom** = ``0.0``
  734. .. rst-class:: classref-property-setget
  735. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  736. 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.
  737. .. rst-class:: classref-item-separator
  738. ----
  739. .. _class_Control_property_anchor_left:
  740. .. rst-class:: classref-property
  741. :ref:`float<class_float>` **anchor_left** = ``0.0``
  742. .. rst-class:: classref-property-setget
  743. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  744. 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.
  745. .. rst-class:: classref-item-separator
  746. ----
  747. .. _class_Control_property_anchor_right:
  748. .. rst-class:: classref-property
  749. :ref:`float<class_float>` **anchor_right** = ``0.0``
  750. .. rst-class:: classref-property-setget
  751. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  752. 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.
  753. .. rst-class:: classref-item-separator
  754. ----
  755. .. _class_Control_property_anchor_top:
  756. .. rst-class:: classref-property
  757. :ref:`float<class_float>` **anchor_top** = ``0.0``
  758. .. rst-class:: classref-property-setget
  759. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  760. 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.
  761. .. rst-class:: classref-item-separator
  762. ----
  763. .. _class_Control_property_auto_translate:
  764. .. rst-class:: classref-property
  765. :ref:`bool<class_bool>` **auto_translate** = ``true``
  766. .. rst-class:: classref-property-setget
  767. - void **set_auto_translate** **(** :ref:`bool<class_bool>` value **)**
  768. - :ref:`bool<class_bool>` **is_auto_translating** **(** **)**
  769. Toggles if any text should automatically change to its translated version depending on the current locale.
  770. Also decides if the node's strings should be parsed for POT generation.
  771. .. rst-class:: classref-item-separator
  772. ----
  773. .. _class_Control_property_clip_contents:
  774. .. rst-class:: classref-property
  775. :ref:`bool<class_bool>` **clip_contents** = ``false``
  776. .. rst-class:: classref-property-setget
  777. - void **set_clip_contents** **(** :ref:`bool<class_bool>` value **)**
  778. - :ref:`bool<class_bool>` **is_clipping_contents** **(** **)**
  779. 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.
  780. .. rst-class:: classref-item-separator
  781. ----
  782. .. _class_Control_property_custom_minimum_size:
  783. .. rst-class:: classref-property
  784. :ref:`Vector2<class_Vector2>` **custom_minimum_size** = ``Vector2(0, 0)``
  785. .. rst-class:: classref-property-setget
  786. - void **set_custom_minimum_size** **(** :ref:`Vector2<class_Vector2>` value **)**
  787. - :ref:`Vector2<class_Vector2>` **get_custom_minimum_size** **(** **)**
  788. 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.
  789. .. rst-class:: classref-item-separator
  790. ----
  791. .. _class_Control_property_focus_mode:
  792. .. rst-class:: classref-property
  793. :ref:`FocusMode<enum_Control_FocusMode>` **focus_mode** = ``0``
  794. .. rst-class:: classref-property-setget
  795. - void **set_focus_mode** **(** :ref:`FocusMode<enum_Control_FocusMode>` value **)**
  796. - :ref:`FocusMode<enum_Control_FocusMode>` **get_focus_mode** **(** **)**
  797. 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.
  798. .. rst-class:: classref-item-separator
  799. ----
  800. .. _class_Control_property_focus_neighbor_bottom:
  801. .. rst-class:: classref-property
  802. :ref:`NodePath<class_NodePath>` **focus_neighbor_bottom** = ``NodePath("")``
  803. .. rst-class:: classref-property-setget
  804. - void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  805. - :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  806. 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.
  807. .. rst-class:: classref-item-separator
  808. ----
  809. .. _class_Control_property_focus_neighbor_left:
  810. .. rst-class:: classref-property
  811. :ref:`NodePath<class_NodePath>` **focus_neighbor_left** = ``NodePath("")``
  812. .. rst-class:: classref-property-setget
  813. - void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  814. - :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  815. 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.
  816. .. rst-class:: classref-item-separator
  817. ----
  818. .. _class_Control_property_focus_neighbor_right:
  819. .. rst-class:: classref-property
  820. :ref:`NodePath<class_NodePath>` **focus_neighbor_right** = ``NodePath("")``
  821. .. rst-class:: classref-property-setget
  822. - void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  823. - :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  824. 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.
  825. .. rst-class:: classref-item-separator
  826. ----
  827. .. _class_Control_property_focus_neighbor_top:
  828. .. rst-class:: classref-property
  829. :ref:`NodePath<class_NodePath>` **focus_neighbor_top** = ``NodePath("")``
  830. .. rst-class:: classref-property-setget
  831. - void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  832. - :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  833. 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.
  834. .. rst-class:: classref-item-separator
  835. ----
  836. .. _class_Control_property_focus_next:
  837. .. rst-class:: classref-property
  838. :ref:`NodePath<class_NodePath>` **focus_next** = ``NodePath("")``
  839. .. rst-class:: classref-property-setget
  840. - void **set_focus_next** **(** :ref:`NodePath<class_NodePath>` value **)**
  841. - :ref:`NodePath<class_NodePath>` **get_focus_next** **(** **)**
  842. 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.
  843. If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
  844. .. rst-class:: classref-item-separator
  845. ----
  846. .. _class_Control_property_focus_previous:
  847. .. rst-class:: classref-property
  848. :ref:`NodePath<class_NodePath>` **focus_previous** = ``NodePath("")``
  849. .. rst-class:: classref-property-setget
  850. - void **set_focus_previous** **(** :ref:`NodePath<class_NodePath>` value **)**
  851. - :ref:`NodePath<class_NodePath>` **get_focus_previous** **(** **)**
  852. 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.
  853. If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
  854. .. rst-class:: classref-item-separator
  855. ----
  856. .. _class_Control_property_global_position:
  857. .. rst-class:: classref-property
  858. :ref:`Vector2<class_Vector2>` **global_position**
  859. .. rst-class:: classref-property-setget
  860. - :ref:`Vector2<class_Vector2>` **get_global_position** **(** **)**
  861. The node's global position, relative to the world (usually to the :ref:`CanvasLayer<class_CanvasLayer>`).
  862. .. rst-class:: classref-item-separator
  863. ----
  864. .. _class_Control_property_grow_horizontal:
  865. .. rst-class:: classref-property
  866. :ref:`GrowDirection<enum_Control_GrowDirection>` **grow_horizontal** = ``1``
  867. .. rst-class:: classref-property-setget
  868. - void **set_h_grow_direction** **(** :ref:`GrowDirection<enum_Control_GrowDirection>` value **)**
  869. - :ref:`GrowDirection<enum_Control_GrowDirection>` **get_h_grow_direction** **(** **)**
  870. 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.
  871. .. rst-class:: classref-item-separator
  872. ----
  873. .. _class_Control_property_grow_vertical:
  874. .. rst-class:: classref-property
  875. :ref:`GrowDirection<enum_Control_GrowDirection>` **grow_vertical** = ``1``
  876. .. rst-class:: classref-property-setget
  877. - void **set_v_grow_direction** **(** :ref:`GrowDirection<enum_Control_GrowDirection>` value **)**
  878. - :ref:`GrowDirection<enum_Control_GrowDirection>` **get_v_grow_direction** **(** **)**
  879. 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.
  880. .. rst-class:: classref-item-separator
  881. ----
  882. .. _class_Control_property_layout_direction:
  883. .. rst-class:: classref-property
  884. :ref:`LayoutDirection<enum_Control_LayoutDirection>` **layout_direction** = ``0``
  885. .. rst-class:: classref-property-setget
  886. - void **set_layout_direction** **(** :ref:`LayoutDirection<enum_Control_LayoutDirection>` value **)**
  887. - :ref:`LayoutDirection<enum_Control_LayoutDirection>` **get_layout_direction** **(** **)**
  888. Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
  889. .. rst-class:: classref-item-separator
  890. ----
  891. .. _class_Control_property_localize_numeral_system:
  892. .. rst-class:: classref-property
  893. :ref:`bool<class_bool>` **localize_numeral_system** = ``true``
  894. .. rst-class:: classref-property-setget
  895. - void **set_localize_numeral_system** **(** :ref:`bool<class_bool>` value **)**
  896. - :ref:`bool<class_bool>` **is_localizing_numeral_system** **(** **)**
  897. 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.
  898. \ **Note:** Numbers within the text are not automatically converted, it can be done manually, using :ref:`TextServer.format_number<class_TextServer_method_format_number>`.
  899. .. rst-class:: classref-item-separator
  900. ----
  901. .. _class_Control_property_mouse_default_cursor_shape:
  902. .. rst-class:: classref-property
  903. :ref:`CursorShape<enum_Control_CursorShape>` **mouse_default_cursor_shape** = ``0``
  904. .. rst-class:: classref-property-setget
  905. - void **set_default_cursor_shape** **(** :ref:`CursorShape<enum_Control_CursorShape>` value **)**
  906. - :ref:`CursorShape<enum_Control_CursorShape>` **get_default_cursor_shape** **(** **)**
  907. The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors.
  908. \ **Note:** On Linux, shapes may vary depending on the cursor theme of the system.
  909. .. rst-class:: classref-item-separator
  910. ----
  911. .. _class_Control_property_mouse_filter:
  912. .. rst-class:: classref-property
  913. :ref:`MouseFilter<enum_Control_MouseFilter>` **mouse_filter** = ``0``
  914. .. rst-class:: classref-property-setget
  915. - void **set_mouse_filter** **(** :ref:`MouseFilter<enum_Control_MouseFilter>` value **)**
  916. - :ref:`MouseFilter<enum_Control_MouseFilter>` **get_mouse_filter** **(** **)**
  917. Controls whether the control will be able to receive mouse button input events through :ref:`_gui_input<class_Control_private_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.
  918. .. rst-class:: classref-item-separator
  919. ----
  920. .. _class_Control_property_mouse_force_pass_scroll_events:
  921. .. rst-class:: classref-property
  922. :ref:`bool<class_bool>` **mouse_force_pass_scroll_events** = ``true``
  923. .. rst-class:: classref-property-setget
  924. - void **set_force_pass_scroll_events** **(** :ref:`bool<class_bool>` value **)**
  925. - :ref:`bool<class_bool>` **is_force_pass_scroll_events** **(** **)**
  926. When enabled, scroll wheel events processed by :ref:`_gui_input<class_Control_private_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.
  927. 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_private_method__unhandled_input>` processing.
  928. .. rst-class:: classref-item-separator
  929. ----
  930. .. _class_Control_property_offset_bottom:
  931. .. rst-class:: classref-property
  932. :ref:`float<class_float>` **offset_bottom** = ``0.0``
  933. .. rst-class:: classref-property-setget
  934. - void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  935. - :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  936. Distance between the node's bottom edge and its parent control, based on :ref:`anchor_bottom<class_Control_property_anchor_bottom>`.
  937. Offsets are often controlled by one or multiple parent :ref:`Container<class_Container>` nodes, so you should not modify them manually if your node is a direct child of a :ref:`Container<class_Container>`. Offsets update automatically when you move or resize the node.
  938. .. rst-class:: classref-item-separator
  939. ----
  940. .. _class_Control_property_offset_left:
  941. .. rst-class:: classref-property
  942. :ref:`float<class_float>` **offset_left** = ``0.0``
  943. .. rst-class:: classref-property-setget
  944. - void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  945. - :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  946. Distance between the node's left edge and its parent control, based on :ref:`anchor_left<class_Control_property_anchor_left>`.
  947. Offsets are often controlled by one or multiple parent :ref:`Container<class_Container>` nodes, so you should not modify them manually if your node is a direct child of a :ref:`Container<class_Container>`. Offsets update automatically when you move or resize the node.
  948. .. rst-class:: classref-item-separator
  949. ----
  950. .. _class_Control_property_offset_right:
  951. .. rst-class:: classref-property
  952. :ref:`float<class_float>` **offset_right** = ``0.0``
  953. .. rst-class:: classref-property-setget
  954. - void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  955. - :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  956. Distance between the node's right edge and its parent control, based on :ref:`anchor_right<class_Control_property_anchor_right>`.
  957. 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.
  958. .. rst-class:: classref-item-separator
  959. ----
  960. .. _class_Control_property_offset_top:
  961. .. rst-class:: classref-property
  962. :ref:`float<class_float>` **offset_top** = ``0.0``
  963. .. rst-class:: classref-property-setget
  964. - void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  965. - :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  966. Distance between the node's top edge and its parent control, based on :ref:`anchor_top<class_Control_property_anchor_top>`.
  967. 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.
  968. .. rst-class:: classref-item-separator
  969. ----
  970. .. _class_Control_property_pivot_offset:
  971. .. rst-class:: classref-property
  972. :ref:`Vector2<class_Vector2>` **pivot_offset** = ``Vector2(0, 0)``
  973. .. rst-class:: classref-property-setget
  974. - void **set_pivot_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
  975. - :ref:`Vector2<class_Vector2>` **get_pivot_offset** **(** **)**
  976. 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.
  977. .. rst-class:: classref-item-separator
  978. ----
  979. .. _class_Control_property_position:
  980. .. rst-class:: classref-property
  981. :ref:`Vector2<class_Vector2>` **position** = ``Vector2(0, 0)``
  982. .. rst-class:: classref-property-setget
  983. - :ref:`Vector2<class_Vector2>` **get_position** **(** **)**
  984. 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>`.
  985. .. rst-class:: classref-item-separator
  986. ----
  987. .. _class_Control_property_rotation:
  988. .. rst-class:: classref-property
  989. :ref:`float<class_float>` **rotation** = ``0.0``
  990. .. rst-class:: classref-property-setget
  991. - void **set_rotation** **(** :ref:`float<class_float>` value **)**
  992. - :ref:`float<class_float>` **get_rotation** **(** **)**
  993. The node's rotation around its pivot, in radians. See :ref:`pivot_offset<class_Control_property_pivot_offset>` to change the pivot's position.
  994. \ **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>`.
  995. .. rst-class:: classref-item-separator
  996. ----
  997. .. _class_Control_property_rotation_degrees:
  998. .. rst-class:: classref-property
  999. :ref:`float<class_float>` **rotation_degrees**
  1000. .. rst-class:: classref-property-setget
  1001. - void **set_rotation_degrees** **(** :ref:`float<class_float>` value **)**
  1002. - :ref:`float<class_float>` **get_rotation_degrees** **(** **)**
  1003. Helper property to access :ref:`rotation<class_Control_property_rotation>` in degrees instead of radians.
  1004. .. rst-class:: classref-item-separator
  1005. ----
  1006. .. _class_Control_property_scale:
  1007. .. rst-class:: classref-property
  1008. :ref:`Vector2<class_Vector2>` **scale** = ``Vector2(1, 1)``
  1009. .. rst-class:: classref-property-setget
  1010. - void **set_scale** **(** :ref:`Vector2<class_Vector2>` value **)**
  1011. - :ref:`Vector2<class_Vector2>` **get_scale** **(** **)**
  1012. 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.
  1013. \ **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.
  1014. \ **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.
  1015. \ **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.
  1016. .. rst-class:: classref-item-separator
  1017. ----
  1018. .. _class_Control_property_shortcut_context:
  1019. .. rst-class:: classref-property
  1020. :ref:`Node<class_Node>` **shortcut_context**
  1021. .. rst-class:: classref-property-setget
  1022. - void **set_shortcut_context** **(** :ref:`Node<class_Node>` value **)**
  1023. - :ref:`Node<class_Node>` **get_shortcut_context** **(** **)**
  1024. 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.
  1025. .. rst-class:: classref-item-separator
  1026. ----
  1027. .. _class_Control_property_size:
  1028. .. rst-class:: classref-property
  1029. :ref:`Vector2<class_Vector2>` **size** = ``Vector2(0, 0)``
  1030. .. rst-class:: classref-property-setget
  1031. - :ref:`Vector2<class_Vector2>` **get_size** **(** **)**
  1032. The size of the node's bounding rectangle, in the node's coordinate system. :ref:`Container<class_Container>` nodes update this property automatically.
  1033. .. rst-class:: classref-item-separator
  1034. ----
  1035. .. _class_Control_property_size_flags_horizontal:
  1036. .. rst-class:: classref-property
  1037. |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> **size_flags_horizontal** = ``1``
  1038. .. rst-class:: classref-property-setget
  1039. - void **set_h_size_flags** **(** |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> value **)**
  1040. - |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> **get_h_size_flags** **(** **)**
  1041. 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.
  1042. .. rst-class:: classref-item-separator
  1043. ----
  1044. .. _class_Control_property_size_flags_stretch_ratio:
  1045. .. rst-class:: classref-property
  1046. :ref:`float<class_float>` **size_flags_stretch_ratio** = ``1.0``
  1047. .. rst-class:: classref-property-setget
  1048. - void **set_stretch_ratio** **(** :ref:`float<class_float>` value **)**
  1049. - :ref:`float<class_float>` **get_stretch_ratio** **(** **)**
  1050. 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.
  1051. .. rst-class:: classref-item-separator
  1052. ----
  1053. .. _class_Control_property_size_flags_vertical:
  1054. .. rst-class:: classref-property
  1055. |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> **size_flags_vertical** = ``1``
  1056. .. rst-class:: classref-property-setget
  1057. - void **set_v_size_flags** **(** |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> value **)**
  1058. - |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> **get_v_size_flags** **(** **)**
  1059. 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.
  1060. .. rst-class:: classref-item-separator
  1061. ----
  1062. .. _class_Control_property_theme:
  1063. .. rst-class:: classref-property
  1064. :ref:`Theme<class_Theme>` **theme**
  1065. .. rst-class:: classref-property-setget
  1066. - void **set_theme** **(** :ref:`Theme<class_Theme>` value **)**
  1067. - :ref:`Theme<class_Theme>` **get_theme** **(** **)**
  1068. 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.
  1069. \ **Note:** :ref:`Window<class_Window>` styles will have no effect unless the window is embedded.
  1070. .. rst-class:: classref-item-separator
  1071. ----
  1072. .. _class_Control_property_theme_type_variation:
  1073. .. rst-class:: classref-property
  1074. :ref:`StringName<class_StringName>` **theme_type_variation** = ``&""``
  1075. .. rst-class:: classref-property-setget
  1076. - void **set_theme_type_variation** **(** :ref:`StringName<class_StringName>` value **)**
  1077. - :ref:`StringName<class_StringName>` **get_theme_type_variation** **(** **)**
  1078. 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).
  1079. 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.
  1080. \ **Note:** To look up **Control**'s own items use various ``get_theme_*`` methods without specifying ``theme_type``.
  1081. \ **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.
  1082. .. rst-class:: classref-item-separator
  1083. ----
  1084. .. _class_Control_property_tooltip_text:
  1085. .. rst-class:: classref-property
  1086. :ref:`String<class_String>` **tooltip_text** = ``""``
  1087. .. rst-class:: classref-property-setget
  1088. - void **set_tooltip_text** **(** :ref:`String<class_String>` value **)**
  1089. - :ref:`String<class_String>` **get_tooltip_text** **(** **)**
  1090. 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>`.
  1091. 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_private_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:
  1092. .. tabs::
  1093. .. code-tab:: gdscript
  1094. var style_box = StyleBoxFlat.new()
  1095. style_box.set_bg_color(Color(1, 1, 0))
  1096. style_box.set_border_width_all(2)
  1097. # We assume here that the `theme` property has been assigned a custom Theme beforehand.
  1098. theme.set_stylebox("panel", "TooltipPanel", style_box)
  1099. theme.set_color("font_color", "TooltipLabel", Color(0, 1, 1))
  1100. .. code-tab:: csharp
  1101. var styleBox = new StyleBoxFlat();
  1102. styleBox.SetBgColor(new Color(1, 1, 0));
  1103. styleBox.SetBorderWidthAll(2);
  1104. // We assume here that the `Theme` property has been assigned a custom Theme beforehand.
  1105. Theme.SetStyleBox("panel", "TooltipPanel", styleBox);
  1106. Theme.SetColor("font_color", "TooltipLabel", new Color(0, 1, 1));
  1107. .. rst-class:: classref-section-separator
  1108. ----
  1109. .. rst-class:: classref-descriptions-group
  1110. Method Descriptions
  1111. -------------------
  1112. .. _class_Control_private_method__can_drop_data:
  1113. .. rst-class:: classref-method
  1114. :ref:`bool<class_bool>` **_can_drop_data** **(** :ref:`Vector2<class_Vector2>` at_position, :ref:`Variant<class_Variant>` data **)** |virtual| |const|
  1115. Godot calls this method to test if ``data`` from a control's :ref:`_get_drag_data<class_Control_private_method__get_drag_data>` can be dropped at ``at_position``. ``at_position`` is local to this control.
  1116. This method should only be used to test the data. Process the data in :ref:`_drop_data<class_Control_private_method__drop_data>`.
  1117. .. tabs::
  1118. .. code-tab:: gdscript
  1119. func _can_drop_data(position, data):
  1120. # Check position if it is relevant to you
  1121. # Otherwise, just check data
  1122. return typeof(data) == TYPE_DICTIONARY and data.has("expected")
  1123. .. code-tab:: csharp
  1124. public override bool _CanDropData(Vector2 atPosition, Variant data)
  1125. {
  1126. // Check position if it is relevant to you
  1127. // Otherwise, just check data
  1128. return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("expected");
  1129. }
  1130. .. rst-class:: classref-item-separator
  1131. ----
  1132. .. _class_Control_private_method__drop_data:
  1133. .. rst-class:: classref-method
  1134. void **_drop_data** **(** :ref:`Vector2<class_Vector2>` at_position, :ref:`Variant<class_Variant>` data **)** |virtual|
  1135. Godot calls this method to pass you the ``data`` from a control's :ref:`_get_drag_data<class_Control_private_method__get_drag_data>` result. Godot first calls :ref:`_can_drop_data<class_Control_private_method__can_drop_data>` to test if ``data`` is allowed to drop at ``at_position`` where ``at_position`` is local to this control.
  1136. .. tabs::
  1137. .. code-tab:: gdscript
  1138. func _can_drop_data(position, data):
  1139. return typeof(data) == TYPE_DICTIONARY and data.has("color")
  1140. func _drop_data(position, data):
  1141. var color = data["color"]
  1142. .. code-tab:: csharp
  1143. public override bool _CanDropData(Vector2 atPosition, Variant data)
  1144. {
  1145. return data.VariantType == Variant.Type.Dictionary && dict.AsGodotDictionary().ContainsKey("color");
  1146. }
  1147. public override void _DropData(Vector2 atPosition, Variant data)
  1148. {
  1149. Color color = data.AsGodotDictionary()["color"].AsColor();
  1150. }
  1151. .. rst-class:: classref-item-separator
  1152. ----
  1153. .. _class_Control_private_method__get_drag_data:
  1154. .. rst-class:: classref-method
  1155. :ref:`Variant<class_Variant>` **_get_drag_data** **(** :ref:`Vector2<class_Vector2>` at_position **)** |virtual|
  1156. 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_private_method__can_drop_data>` and :ref:`_drop_data<class_Control_private_method__drop_data>`. ``at_position`` is local to this control. Drag may be forced with :ref:`force_drag<class_Control_method_force_drag>`.
  1157. 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.
  1158. .. tabs::
  1159. .. code-tab:: gdscript
  1160. func _get_drag_data(position):
  1161. var mydata = make_data() # This is your custom method generating the drag data.
  1162. set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data.
  1163. return mydata
  1164. .. code-tab:: csharp
  1165. public override Variant _GetDragData(Vector2 atPosition)
  1166. {
  1167. var myData = MakeData(); // This is your custom method generating the drag data.
  1168. SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data.
  1169. return myData;
  1170. }
  1171. .. rst-class:: classref-item-separator
  1172. ----
  1173. .. _class_Control_private_method__get_minimum_size:
  1174. .. rst-class:: classref-method
  1175. :ref:`Vector2<class_Vector2>` **_get_minimum_size** **(** **)** |virtual| |const|
  1176. 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).
  1177. If not overridden, defaults to :ref:`Vector2.ZERO<class_Vector2_constant_ZERO>`.
  1178. \ **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.
  1179. .. rst-class:: classref-item-separator
  1180. ----
  1181. .. _class_Control_private_method__get_tooltip:
  1182. .. rst-class:: classref-method
  1183. :ref:`String<class_String>` **_get_tooltip** **(** :ref:`Vector2<class_Vector2>` at_position **)** |virtual| |const|
  1184. 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>`.
  1185. \ **Note:** If this method returns an empty :ref:`String<class_String>`, no tooltip is displayed.
  1186. .. rst-class:: classref-item-separator
  1187. ----
  1188. .. _class_Control_private_method__gui_input:
  1189. .. rst-class:: classref-method
  1190. void **_gui_input** **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual|
  1191. 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>`.
  1192. \ **Example usage for clicking a control:**\
  1193. .. tabs::
  1194. .. code-tab:: gdscript
  1195. func _gui_input(event):
  1196. if event is InputEventMouseButton:
  1197. if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
  1198. print("I've been clicked D:")
  1199. .. code-tab:: csharp
  1200. public override void _GuiInput(InputEvent @event)
  1201. {
  1202. if (@event is InputEventMouseButton mb)
  1203. {
  1204. if (mb.ButtonIndex == MouseButton.Left && mb.Pressed)
  1205. {
  1206. GD.Print("I've been clicked D:");
  1207. }
  1208. }
  1209. }
  1210. The event won't trigger if:
  1211. \* clicking outside the control (see :ref:`_has_point<class_Control_private_method__has_point>`);
  1212. \* control has :ref:`mouse_filter<class_Control_property_mouse_filter>` set to :ref:`MOUSE_FILTER_IGNORE<class_Control_constant_MOUSE_FILTER_IGNORE>`;
  1213. \* 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>`;
  1214. \* 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;
  1215. \* it happens outside the parent's rectangle and the parent has either :ref:`clip_contents<class_Control_property_clip_contents>` enabled.
  1216. \ **Note:** Event position is relative to the control origin.
  1217. .. rst-class:: classref-item-separator
  1218. ----
  1219. .. _class_Control_private_method__has_point:
  1220. .. rst-class:: classref-method
  1221. :ref:`bool<class_bool>` **_has_point** **(** :ref:`Vector2<class_Vector2>` point **)** |virtual| |const|
  1222. Virtual method to be implemented by the user. Returns whether the given ``point`` is inside this control.
  1223. If not overridden, default behavior is checking if the point is within control's Rect.
  1224. \ **Note:** If you want to check if a point is inside the control, you can use ``Rect2(Vector2.ZERO, size).has_point(point)``.
  1225. .. rst-class:: classref-item-separator
  1226. ----
  1227. .. _class_Control_private_method__make_custom_tooltip:
  1228. .. rst-class:: classref-method
  1229. :ref:`Object<class_Object>` **_make_custom_tooltip** **(** :ref:`String<class_String>` for_text **)** |virtual| |const|
  1230. 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.
  1231. 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.
  1232. 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).
  1233. \ **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.
  1234. \ **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.
  1235. \ **Example of usage with a custom-constructed node:**\
  1236. .. tabs::
  1237. .. code-tab:: gdscript
  1238. func _make_custom_tooltip(for_text):
  1239. var label = Label.new()
  1240. label.text = for_text
  1241. return label
  1242. .. code-tab:: csharp
  1243. public override Control _MakeCustomTooltip(string forText)
  1244. {
  1245. var label = new Label();
  1246. label.Text = forText;
  1247. return label;
  1248. }
  1249. \ **Example of usage with a custom scene instance:**\
  1250. .. tabs::
  1251. .. code-tab:: gdscript
  1252. func _make_custom_tooltip(for_text):
  1253. var tooltip = preload("res://some_tooltip_scene.tscn").instantiate()
  1254. tooltip.get_node("Label").text = for_text
  1255. return tooltip
  1256. .. code-tab:: csharp
  1257. public override Control _MakeCustomTooltip(string forText)
  1258. {
  1259. Node tooltip = ResourceLoader.Load<PackedScene>("res://some_tooltip_scene.tscn").Instantiate();
  1260. tooltip.GetNode<Label>("Label").Text = forText;
  1261. return tooltip;
  1262. }
  1263. .. rst-class:: classref-item-separator
  1264. ----
  1265. .. _class_Control_private_method__structured_text_parser:
  1266. .. rst-class:: classref-method
  1267. :ref:`Vector3i[]<class_Vector3i>` **_structured_text_parser** **(** :ref:`Array<class_Array>` args, :ref:`String<class_String>` text **)** |virtual| |const|
  1268. User defined BiDi algorithm override function.
  1269. 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.
  1270. .. rst-class:: classref-item-separator
  1271. ----
  1272. .. _class_Control_method_accept_event:
  1273. .. rst-class:: classref-method
  1274. void **accept_event** **(** **)**
  1275. 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_private_method__unhandled_input>` or :ref:`Node._unhandled_key_input<class_Node_private_method__unhandled_key_input>`.
  1276. \ **Note:** This does not affect the methods in :ref:`Input<class_Input>`, only the way events are propagated.
  1277. .. rst-class:: classref-item-separator
  1278. ----
  1279. .. _class_Control_method_add_theme_color_override:
  1280. .. rst-class:: classref-method
  1281. void **add_theme_color_override** **(** :ref:`StringName<class_StringName>` name, :ref:`Color<class_Color>` color **)**
  1282. 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>`.
  1283. See also :ref:`get_theme_color<class_Control_method_get_theme_color>`.
  1284. \ **Example of overriding a label's color and resetting it later:**\
  1285. .. tabs::
  1286. .. code-tab:: gdscript
  1287. # Given the child Label node "MyLabel", override its font color with a custom value.
  1288. $MyLabel.add_theme_color_override("font_color", Color(1, 0.5, 0))
  1289. # Reset the font color of the child label.
  1290. $MyLabel.remove_theme_color_override("font_color")
  1291. # Alternatively it can be overridden with the default value from the Label type.
  1292. $MyLabel.add_theme_color_override("font_color", get_theme_color("font_color", "Label"))
  1293. .. code-tab:: csharp
  1294. // Given the child Label node "MyLabel", override its font color with a custom value.
  1295. GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", new Color(1, 0.5f, 0));
  1296. // Reset the font color of the child label.
  1297. GetNode<Label>("MyLabel").RemoveThemeColorOverride("font_color");
  1298. // Alternatively it can be overridden with the default value from the Label type.
  1299. GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", GetThemeColor("font_color", "Label"));
  1300. .. rst-class:: classref-item-separator
  1301. ----
  1302. .. _class_Control_method_add_theme_constant_override:
  1303. .. rst-class:: classref-method
  1304. void **add_theme_constant_override** **(** :ref:`StringName<class_StringName>` name, :ref:`int<class_int>` constant **)**
  1305. 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>`.
  1306. See also :ref:`get_theme_constant<class_Control_method_get_theme_constant>`.
  1307. .. rst-class:: classref-item-separator
  1308. ----
  1309. .. _class_Control_method_add_theme_font_override:
  1310. .. rst-class:: classref-method
  1311. void **add_theme_font_override** **(** :ref:`StringName<class_StringName>` name, :ref:`Font<class_Font>` font **)**
  1312. 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>`.
  1313. See also :ref:`get_theme_font<class_Control_method_get_theme_font>`.
  1314. .. rst-class:: classref-item-separator
  1315. ----
  1316. .. _class_Control_method_add_theme_font_size_override:
  1317. .. rst-class:: classref-method
  1318. void **add_theme_font_size_override** **(** :ref:`StringName<class_StringName>` name, :ref:`int<class_int>` font_size **)**
  1319. 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>`.
  1320. See also :ref:`get_theme_font_size<class_Control_method_get_theme_font_size>`.
  1321. .. rst-class:: classref-item-separator
  1322. ----
  1323. .. _class_Control_method_add_theme_icon_override:
  1324. .. rst-class:: classref-method
  1325. void **add_theme_icon_override** **(** :ref:`StringName<class_StringName>` name, :ref:`Texture2D<class_Texture2D>` texture **)**
  1326. 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>`.
  1327. See also :ref:`get_theme_icon<class_Control_method_get_theme_icon>`.
  1328. .. rst-class:: classref-item-separator
  1329. ----
  1330. .. _class_Control_method_add_theme_stylebox_override:
  1331. .. rst-class:: classref-method
  1332. void **add_theme_stylebox_override** **(** :ref:`StringName<class_StringName>` name, :ref:`StyleBox<class_StyleBox>` stylebox **)**
  1333. 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>`.
  1334. See also :ref:`get_theme_stylebox<class_Control_method_get_theme_stylebox>`.
  1335. \ **Example of modifying a property in a StyleBox by duplicating it:**\
  1336. .. tabs::
  1337. .. code-tab:: gdscript
  1338. # The snippet below assumes the child node MyButton has a StyleBoxFlat assigned.
  1339. # Resources are shared across instances, so we need to duplicate it
  1340. # to avoid modifying the appearance of all other buttons.
  1341. var new_stylebox_normal = $MyButton.get_theme_stylebox("normal").duplicate()
  1342. new_stylebox_normal.border_width_top = 3
  1343. new_stylebox_normal.border_color = Color(0, 1, 0.5)
  1344. $MyButton.add_theme_stylebox_override("normal", new_stylebox_normal)
  1345. # Remove the stylebox override.
  1346. $MyButton.remove_theme_stylebox_override("normal")
  1347. .. code-tab:: csharp
  1348. // The snippet below assumes the child node MyButton has a StyleBoxFlat assigned.
  1349. // Resources are shared across instances, so we need to duplicate it
  1350. // to avoid modifying the appearance of all other buttons.
  1351. StyleBoxFlat newStyleboxNormal = GetNode<Button>("MyButton").GetThemeStylebox("normal").Duplicate() as StyleBoxFlat;
  1352. newStyleboxNormal.BorderWidthTop = 3;
  1353. newStyleboxNormal.BorderColor = new Color(0, 1, 0.5f);
  1354. GetNode<Button>("MyButton").AddThemeStyleboxOverride("normal", newStyleboxNormal);
  1355. // Remove the stylebox override.
  1356. GetNode<Button>("MyButton").RemoveThemeStyleboxOverride("normal");
  1357. .. rst-class:: classref-item-separator
  1358. ----
  1359. .. _class_Control_method_begin_bulk_theme_override:
  1360. .. rst-class:: classref-method
  1361. void **begin_bulk_theme_override** **(** **)**
  1362. 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.
  1363. .. rst-class:: classref-item-separator
  1364. ----
  1365. .. _class_Control_method_end_bulk_theme_override:
  1366. .. rst-class:: classref-method
  1367. void **end_bulk_theme_override** **(** **)**
  1368. Ends a bulk theme override update. See :ref:`begin_bulk_theme_override<class_Control_method_begin_bulk_theme_override>`.
  1369. .. rst-class:: classref-item-separator
  1370. ----
  1371. .. _class_Control_method_find_next_valid_focus:
  1372. .. rst-class:: classref-method
  1373. :ref:`Control<class_Control>` **find_next_valid_focus** **(** **)** |const|
  1374. Finds the next (below in the tree) **Control** that can receive the focus.
  1375. .. rst-class:: classref-item-separator
  1376. ----
  1377. .. _class_Control_method_find_prev_valid_focus:
  1378. .. rst-class:: classref-method
  1379. :ref:`Control<class_Control>` **find_prev_valid_focus** **(** **)** |const|
  1380. Finds the previous (above in the tree) **Control** that can receive the focus.
  1381. .. rst-class:: classref-item-separator
  1382. ----
  1383. .. _class_Control_method_find_valid_focus_neighbor:
  1384. .. rst-class:: classref-method
  1385. :ref:`Control<class_Control>` **find_valid_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  1386. Finds the next **Control** that can receive the focus on the specified :ref:`Side<enum_@GlobalScope_Side>`.
  1387. \ **Note:** This is different from :ref:`get_focus_neighbor<class_Control_method_get_focus_neighbor>`, which returns the path of a specified focus neighbor.
  1388. .. rst-class:: classref-item-separator
  1389. ----
  1390. .. _class_Control_method_force_drag:
  1391. .. rst-class:: classref-method
  1392. void **force_drag** **(** :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` preview **)**
  1393. Forces drag and bypasses :ref:`_get_drag_data<class_Control_private_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.
  1394. The methods :ref:`_can_drop_data<class_Control_private_method__can_drop_data>` and :ref:`_drop_data<class_Control_private_method__drop_data>` must be implemented on controls that want to receive drop data.
  1395. .. rst-class:: classref-item-separator
  1396. ----
  1397. .. _class_Control_method_get_anchor:
  1398. .. rst-class:: classref-method
  1399. :ref:`float<class_float>` **get_anchor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  1400. 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>`.
  1401. .. rst-class:: classref-item-separator
  1402. ----
  1403. .. _class_Control_method_get_begin:
  1404. .. rst-class:: classref-method
  1405. :ref:`Vector2<class_Vector2>` **get_begin** **(** **)** |const|
  1406. 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>`.
  1407. .. rst-class:: classref-item-separator
  1408. ----
  1409. .. _class_Control_method_get_combined_minimum_size:
  1410. .. rst-class:: classref-method
  1411. :ref:`Vector2<class_Vector2>` **get_combined_minimum_size** **(** **)** |const|
  1412. 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>`.
  1413. .. rst-class:: classref-item-separator
  1414. ----
  1415. .. _class_Control_method_get_cursor_shape:
  1416. .. rst-class:: classref-method
  1417. :ref:`CursorShape<enum_Control_CursorShape>` **get_cursor_shape** **(** :ref:`Vector2<class_Vector2>` position=Vector2(0, 0) **)** |const|
  1418. Returns the mouse cursor shape the control displays on mouse hover. See :ref:`CursorShape<enum_Control_CursorShape>`.
  1419. .. rst-class:: classref-item-separator
  1420. ----
  1421. .. _class_Control_method_get_end:
  1422. .. rst-class:: classref-method
  1423. :ref:`Vector2<class_Vector2>` **get_end** **(** **)** |const|
  1424. Returns :ref:`offset_right<class_Control_property_offset_right>` and :ref:`offset_bottom<class_Control_property_offset_bottom>`.
  1425. .. rst-class:: classref-item-separator
  1426. ----
  1427. .. _class_Control_method_get_focus_neighbor:
  1428. .. rst-class:: classref-method
  1429. :ref:`NodePath<class_NodePath>` **get_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side **)** |const|
  1430. 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>`.
  1431. \ **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>`.
  1432. .. rst-class:: classref-item-separator
  1433. ----
  1434. .. _class_Control_method_get_global_rect:
  1435. .. rst-class:: classref-method
  1436. :ref:`Rect2<class_Rect2>` **get_global_rect** **(** **)** |const|
  1437. 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>`.
  1438. \ **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.
  1439. \ **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>`.
  1440. .. rst-class:: classref-item-separator
  1441. ----
  1442. .. _class_Control_method_get_minimum_size:
  1443. .. rst-class:: classref-method
  1444. :ref:`Vector2<class_Vector2>` **get_minimum_size** **(** **)** |const|
  1445. Returns the minimum size for this control. See :ref:`custom_minimum_size<class_Control_property_custom_minimum_size>`.
  1446. .. rst-class:: classref-item-separator
  1447. ----
  1448. .. _class_Control_method_get_offset:
  1449. .. rst-class:: classref-method
  1450. :ref:`float<class_float>` **get_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` offset **)** |const|
  1451. 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>`.
  1452. .. rst-class:: classref-item-separator
  1453. ----
  1454. .. _class_Control_method_get_parent_area_size:
  1455. .. rst-class:: classref-method
  1456. :ref:`Vector2<class_Vector2>` **get_parent_area_size** **(** **)** |const|
  1457. Returns the width/height occupied in the parent control.
  1458. .. rst-class:: classref-item-separator
  1459. ----
  1460. .. _class_Control_method_get_parent_control:
  1461. .. rst-class:: classref-method
  1462. :ref:`Control<class_Control>` **get_parent_control** **(** **)** |const|
  1463. Returns the parent control node.
  1464. .. rst-class:: classref-item-separator
  1465. ----
  1466. .. _class_Control_method_get_rect:
  1467. .. rst-class:: classref-method
  1468. :ref:`Rect2<class_Rect2>` **get_rect** **(** **)** |const|
  1469. 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>`.
  1470. \ **Note:** If :ref:`rotation<class_Control_property_rotation>` is not the default rotation, the resulting size is not meaningful.
  1471. \ **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>`.
  1472. .. rst-class:: classref-item-separator
  1473. ----
  1474. .. _class_Control_method_get_screen_position:
  1475. .. rst-class:: classref-method
  1476. :ref:`Vector2<class_Vector2>` **get_screen_position** **(** **)** |const|
  1477. Returns the position of this **Control** in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.
  1478. 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>`).
  1479. \ **Example usage for showing a popup:**\
  1480. ::
  1481. popup_menu.position = get_screen_position() + get_local_mouse_position()
  1482. popup_menu.reset_size()
  1483. popup_menu.popup()
  1484. .. rst-class:: classref-item-separator
  1485. ----
  1486. .. _class_Control_method_get_theme_color:
  1487. .. rst-class:: classref-method
  1488. :ref:`Color<class_Color>` **get_theme_color** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1489. 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.
  1490. 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>`).
  1491. .. tabs::
  1492. .. code-tab:: gdscript
  1493. func _ready():
  1494. # Get the font color defined for the current Control's class, if it exists.
  1495. modulate = get_theme_color("font_color")
  1496. # Get the font color defined for the Button class.
  1497. modulate = get_theme_color("font_color", "Button")
  1498. .. code-tab:: csharp
  1499. public override void _Ready()
  1500. {
  1501. // Get the font color defined for the current Control's class, if it exists.
  1502. Modulate = GetThemeColor("font_color");
  1503. // Get the font color defined for the Button class.
  1504. Modulate = GetThemeColor("font_color", "Button");
  1505. }
  1506. .. rst-class:: classref-item-separator
  1507. ----
  1508. .. _class_Control_method_get_theme_constant:
  1509. .. rst-class:: classref-method
  1510. :ref:`int<class_int>` **get_theme_constant** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1511. 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``.
  1512. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1513. .. rst-class:: classref-item-separator
  1514. ----
  1515. .. _class_Control_method_get_theme_default_base_scale:
  1516. .. rst-class:: classref-method
  1517. :ref:`float<class_float>` **get_theme_default_base_scale** **(** **)** |const|
  1518. 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.
  1519. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1520. .. rst-class:: classref-item-separator
  1521. ----
  1522. .. _class_Control_method_get_theme_default_font:
  1523. .. rst-class:: classref-method
  1524. :ref:`Font<class_Font>` **get_theme_default_font** **(** **)** |const|
  1525. 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.
  1526. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1527. .. rst-class:: classref-item-separator
  1528. ----
  1529. .. _class_Control_method_get_theme_default_font_size:
  1530. .. rst-class:: classref-method
  1531. :ref:`int<class_int>` **get_theme_default_font_size** **(** **)** |const|
  1532. 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.
  1533. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1534. .. rst-class:: classref-item-separator
  1535. ----
  1536. .. _class_Control_method_get_theme_font:
  1537. .. rst-class:: classref-method
  1538. :ref:`Font<class_Font>` **get_theme_font** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1539. 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``.
  1540. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1541. .. rst-class:: classref-item-separator
  1542. ----
  1543. .. _class_Control_method_get_theme_font_size:
  1544. .. rst-class:: classref-method
  1545. :ref:`int<class_int>` **get_theme_font_size** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1546. 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``.
  1547. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1548. .. rst-class:: classref-item-separator
  1549. ----
  1550. .. _class_Control_method_get_theme_icon:
  1551. .. rst-class:: classref-method
  1552. :ref:`Texture2D<class_Texture2D>` **get_theme_icon** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1553. 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``.
  1554. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1555. .. rst-class:: classref-item-separator
  1556. ----
  1557. .. _class_Control_method_get_theme_stylebox:
  1558. .. rst-class:: classref-method
  1559. :ref:`StyleBox<class_StyleBox>` **get_theme_stylebox** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1560. 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``.
  1561. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1562. .. rst-class:: classref-item-separator
  1563. ----
  1564. .. _class_Control_method_get_tooltip:
  1565. .. rst-class:: classref-method
  1566. :ref:`String<class_String>` **get_tooltip** **(** :ref:`Vector2<class_Vector2>` at_position=Vector2(0, 0) **)** |const|
  1567. 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>`.
  1568. This method can be overridden to customize its behavior. See :ref:`_get_tooltip<class_Control_private_method__get_tooltip>`.
  1569. \ **Note:** If this method returns an empty :ref:`String<class_String>`, no tooltip is displayed.
  1570. .. rst-class:: classref-item-separator
  1571. ----
  1572. .. _class_Control_method_grab_click_focus:
  1573. .. rst-class:: classref-method
  1574. void **grab_click_focus** **(** **)**
  1575. Creates an :ref:`InputEventMouseButton<class_InputEventMouseButton>` that attempts to click the control. If the event is received, the control acquires focus.
  1576. .. tabs::
  1577. .. code-tab:: gdscript
  1578. func _process(delta):
  1579. grab_click_focus() # When clicking another Control node, this node will be clicked instead.
  1580. .. code-tab:: csharp
  1581. public override void _Process(double delta)
  1582. {
  1583. GrabClickFocus(); // When clicking another Control node, this node will be clicked instead.
  1584. }
  1585. .. rst-class:: classref-item-separator
  1586. ----
  1587. .. _class_Control_method_grab_focus:
  1588. .. rst-class:: classref-method
  1589. void **grab_focus** **(** **)**
  1590. Steal the focus from another control and become the focused control (see :ref:`focus_mode<class_Control_property_focus_mode>`).
  1591. \ **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_private_method__ready>`.
  1592. .. rst-class:: classref-item-separator
  1593. ----
  1594. .. _class_Control_method_has_focus:
  1595. .. rst-class:: classref-method
  1596. :ref:`bool<class_bool>` **has_focus** **(** **)** |const|
  1597. Returns ``true`` if this is the current focused control. See :ref:`focus_mode<class_Control_property_focus_mode>`.
  1598. .. rst-class:: classref-item-separator
  1599. ----
  1600. .. _class_Control_method_has_theme_color:
  1601. .. rst-class:: classref-method
  1602. :ref:`bool<class_bool>` **has_theme_color** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1603. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a color item with the specified ``name`` and ``theme_type``.
  1604. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1605. .. rst-class:: classref-item-separator
  1606. ----
  1607. .. _class_Control_method_has_theme_color_override:
  1608. .. rst-class:: classref-method
  1609. :ref:`bool<class_bool>` **has_theme_color_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1610. Returns ``true`` if there is a local override for a theme :ref:`Color<class_Color>` with the specified ``name`` in this **Control** node.
  1611. See :ref:`add_theme_color_override<class_Control_method_add_theme_color_override>`.
  1612. .. rst-class:: classref-item-separator
  1613. ----
  1614. .. _class_Control_method_has_theme_constant:
  1615. .. rst-class:: classref-method
  1616. :ref:`bool<class_bool>` **has_theme_constant** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1617. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a constant item with the specified ``name`` and ``theme_type``.
  1618. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1619. .. rst-class:: classref-item-separator
  1620. ----
  1621. .. _class_Control_method_has_theme_constant_override:
  1622. .. rst-class:: classref-method
  1623. :ref:`bool<class_bool>` **has_theme_constant_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1624. Returns ``true`` if there is a local override for a theme constant with the specified ``name`` in this **Control** node.
  1625. See :ref:`add_theme_constant_override<class_Control_method_add_theme_constant_override>`.
  1626. .. rst-class:: classref-item-separator
  1627. ----
  1628. .. _class_Control_method_has_theme_font:
  1629. .. rst-class:: classref-method
  1630. :ref:`bool<class_bool>` **has_theme_font** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1631. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a font item with the specified ``name`` and ``theme_type``.
  1632. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1633. .. rst-class:: classref-item-separator
  1634. ----
  1635. .. _class_Control_method_has_theme_font_override:
  1636. .. rst-class:: classref-method
  1637. :ref:`bool<class_bool>` **has_theme_font_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1638. Returns ``true`` if there is a local override for a theme :ref:`Font<class_Font>` with the specified ``name`` in this **Control** node.
  1639. See :ref:`add_theme_font_override<class_Control_method_add_theme_font_override>`.
  1640. .. rst-class:: classref-item-separator
  1641. ----
  1642. .. _class_Control_method_has_theme_font_size:
  1643. .. rst-class:: classref-method
  1644. :ref:`bool<class_bool>` **has_theme_font_size** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1645. Returns ``true`` if there is a matching :ref:`Theme<class_Theme>` in the tree that has a font size item with the specified ``name`` and ``theme_type``.
  1646. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1647. .. rst-class:: classref-item-separator
  1648. ----
  1649. .. _class_Control_method_has_theme_font_size_override:
  1650. .. rst-class:: classref-method
  1651. :ref:`bool<class_bool>` **has_theme_font_size_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1652. Returns ``true`` if there is a local override for a theme font size with the specified ``name`` in this **Control** node.
  1653. See :ref:`add_theme_font_size_override<class_Control_method_add_theme_font_size_override>`.
  1654. .. rst-class:: classref-item-separator
  1655. ----
  1656. .. _class_Control_method_has_theme_icon:
  1657. .. rst-class:: classref-method
  1658. :ref:`bool<class_bool>` **has_theme_icon** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1659. 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``.
  1660. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1661. .. rst-class:: classref-item-separator
  1662. ----
  1663. .. _class_Control_method_has_theme_icon_override:
  1664. .. rst-class:: classref-method
  1665. :ref:`bool<class_bool>` **has_theme_icon_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1666. Returns ``true`` if there is a local override for a theme icon with the specified ``name`` in this **Control** node.
  1667. See :ref:`add_theme_icon_override<class_Control_method_add_theme_icon_override>`.
  1668. .. rst-class:: classref-item-separator
  1669. ----
  1670. .. _class_Control_method_has_theme_stylebox:
  1671. .. rst-class:: classref-method
  1672. :ref:`bool<class_bool>` **has_theme_stylebox** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  1673. 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``.
  1674. See :ref:`get_theme_color<class_Control_method_get_theme_color>` for details.
  1675. .. rst-class:: classref-item-separator
  1676. ----
  1677. .. _class_Control_method_has_theme_stylebox_override:
  1678. .. rst-class:: classref-method
  1679. :ref:`bool<class_bool>` **has_theme_stylebox_override** **(** :ref:`StringName<class_StringName>` name **)** |const|
  1680. Returns ``true`` if there is a local override for a theme :ref:`StyleBox<class_StyleBox>` with the specified ``name`` in this **Control** node.
  1681. See :ref:`add_theme_stylebox_override<class_Control_method_add_theme_stylebox_override>`.
  1682. .. rst-class:: classref-item-separator
  1683. ----
  1684. .. _class_Control_method_is_drag_successful:
  1685. .. rst-class:: classref-method
  1686. :ref:`bool<class_bool>` **is_drag_successful** **(** **)** |const|
  1687. Returns ``true`` if a drag operation is successful. Alternative to :ref:`Viewport.gui_is_drag_successful<class_Viewport_method_gui_is_drag_successful>`.
  1688. Best used with :ref:`Node.NOTIFICATION_DRAG_END<class_Node_constant_NOTIFICATION_DRAG_END>`.
  1689. .. rst-class:: classref-item-separator
  1690. ----
  1691. .. _class_Control_method_is_layout_rtl:
  1692. .. rst-class:: classref-method
  1693. :ref:`bool<class_bool>` **is_layout_rtl** **(** **)** |const|
  1694. Returns ``true`` if layout is right-to-left.
  1695. .. rst-class:: classref-item-separator
  1696. ----
  1697. .. _class_Control_method_release_focus:
  1698. .. rst-class:: classref-method
  1699. void **release_focus** **(** **)**
  1700. Give up the focus. No other control will be able to receive input.
  1701. .. rst-class:: classref-item-separator
  1702. ----
  1703. .. _class_Control_method_remove_theme_color_override:
  1704. .. rst-class:: classref-method
  1705. void **remove_theme_color_override** **(** :ref:`StringName<class_StringName>` name **)**
  1706. 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.
  1707. .. rst-class:: classref-item-separator
  1708. ----
  1709. .. _class_Control_method_remove_theme_constant_override:
  1710. .. rst-class:: classref-method
  1711. void **remove_theme_constant_override** **(** :ref:`StringName<class_StringName>` name **)**
  1712. 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.
  1713. .. rst-class:: classref-item-separator
  1714. ----
  1715. .. _class_Control_method_remove_theme_font_override:
  1716. .. rst-class:: classref-method
  1717. void **remove_theme_font_override** **(** :ref:`StringName<class_StringName>` name **)**
  1718. 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.
  1719. .. rst-class:: classref-item-separator
  1720. ----
  1721. .. _class_Control_method_remove_theme_font_size_override:
  1722. .. rst-class:: classref-method
  1723. void **remove_theme_font_size_override** **(** :ref:`StringName<class_StringName>` name **)**
  1724. 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.
  1725. .. rst-class:: classref-item-separator
  1726. ----
  1727. .. _class_Control_method_remove_theme_icon_override:
  1728. .. rst-class:: classref-method
  1729. void **remove_theme_icon_override** **(** :ref:`StringName<class_StringName>` name **)**
  1730. 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.
  1731. .. rst-class:: classref-item-separator
  1732. ----
  1733. .. _class_Control_method_remove_theme_stylebox_override:
  1734. .. rst-class:: classref-method
  1735. void **remove_theme_stylebox_override** **(** :ref:`StringName<class_StringName>` name **)**
  1736. 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.
  1737. .. rst-class:: classref-item-separator
  1738. ----
  1739. .. _class_Control_method_reset_size:
  1740. .. rst-class:: classref-method
  1741. void **reset_size** **(** **)**
  1742. 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).
  1743. .. rst-class:: classref-item-separator
  1744. ----
  1745. .. _class_Control_method_set_anchor:
  1746. .. rst-class:: classref-method
  1747. 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 **)**
  1748. 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>`.
  1749. If ``keep_offset`` is ``true``, offsets aren't updated after this operation.
  1750. 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.
  1751. .. rst-class:: classref-item-separator
  1752. ----
  1753. .. _class_Control_method_set_anchor_and_offset:
  1754. .. rst-class:: classref-method
  1755. 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 **)**
  1756. 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>`).
  1757. .. rst-class:: classref-item-separator
  1758. ----
  1759. .. _class_Control_method_set_anchors_and_offsets_preset:
  1760. .. rst-class:: classref-method
  1761. 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 **)**
  1762. 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>`.
  1763. .. rst-class:: classref-item-separator
  1764. ----
  1765. .. _class_Control_method_set_anchors_preset:
  1766. .. rst-class:: classref-method
  1767. void **set_anchors_preset** **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`bool<class_bool>` keep_offsets=false **)**
  1768. 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.
  1769. If ``keep_offsets`` is ``true``, control's position will also be updated.
  1770. .. rst-class:: classref-item-separator
  1771. ----
  1772. .. _class_Control_method_set_begin:
  1773. .. rst-class:: classref-method
  1774. void **set_begin** **(** :ref:`Vector2<class_Vector2>` position **)**
  1775. 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>`.
  1776. .. rst-class:: classref-item-separator
  1777. ----
  1778. .. _class_Control_method_set_drag_forwarding:
  1779. .. rst-class:: classref-method
  1780. void **set_drag_forwarding** **(** :ref:`Callable<class_Callable>` drag_func, :ref:`Callable<class_Callable>` can_drop_func, :ref:`Callable<class_Callable>` drop_func **)**
  1781. Forwards the handling of this control's :ref:`_get_drag_data<class_Control_private_method__get_drag_data>`, :ref:`_can_drop_data<class_Control_private_method__can_drop_data>` and :ref:`_drop_data<class_Control_private_method__drop_data>` virtual functions to delegate callables.
  1782. For each argument, if not empty, the delegate callable is used, otherwise the local (virtual) function is used.
  1783. The function format for each callable should be exactly the same as the virtual functions described above.
  1784. .. rst-class:: classref-item-separator
  1785. ----
  1786. .. _class_Control_method_set_drag_preview:
  1787. .. rst-class:: classref-method
  1788. void **set_drag_preview** **(** :ref:`Control<class_Control>` control **)**
  1789. Shows the given control at the mouse pointer. A good time to call this method is in :ref:`_get_drag_data<class_Control_private_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.
  1790. .. tabs::
  1791. .. code-tab:: gdscript
  1792. @export var color = Color(1, 0, 0, 1)
  1793. func _get_drag_data(position):
  1794. # Use a control that is not in the tree
  1795. var cpb = ColorPickerButton.new()
  1796. cpb.color = color
  1797. cpb.size = Vector2(50, 50)
  1798. set_drag_preview(cpb)
  1799. return color
  1800. .. code-tab:: csharp
  1801. [Export]
  1802. private Color _color = new Color(1, 0, 0, 1);
  1803. public override Variant _GetDragData(Vector2 atPosition)
  1804. {
  1805. // Use a control that is not in the tree
  1806. var cpb = new ColorPickerButton();
  1807. cpb.Color = _color;
  1808. cpb.Size = new Vector2(50, 50);
  1809. SetDragPreview(cpb);
  1810. return _color;
  1811. }
  1812. .. rst-class:: classref-item-separator
  1813. ----
  1814. .. _class_Control_method_set_end:
  1815. .. rst-class:: classref-method
  1816. void **set_end** **(** :ref:`Vector2<class_Vector2>` position **)**
  1817. Sets :ref:`offset_right<class_Control_property_offset_right>` and :ref:`offset_bottom<class_Control_property_offset_bottom>` at the same time.
  1818. .. rst-class:: classref-item-separator
  1819. ----
  1820. .. _class_Control_method_set_focus_neighbor:
  1821. .. rst-class:: classref-method
  1822. void **set_focus_neighbor** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`NodePath<class_NodePath>` neighbor **)**
  1823. 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>`.
  1824. .. rst-class:: classref-item-separator
  1825. ----
  1826. .. _class_Control_method_set_global_position:
  1827. .. rst-class:: classref-method
  1828. void **set_global_position** **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_offsets=false **)**
  1829. Sets the :ref:`global_position<class_Control_property_global_position>` to given ``position``.
  1830. If ``keep_offsets`` is ``true``, control's anchors will be updated instead of offsets.
  1831. .. rst-class:: classref-item-separator
  1832. ----
  1833. .. _class_Control_method_set_offset:
  1834. .. rst-class:: classref-method
  1835. void **set_offset** **(** :ref:`Side<enum_@GlobalScope_Side>` side, :ref:`float<class_float>` offset **)**
  1836. 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>`.
  1837. .. rst-class:: classref-item-separator
  1838. ----
  1839. .. _class_Control_method_set_offsets_preset:
  1840. .. rst-class:: classref-method
  1841. void **set_offsets_preset** **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)**
  1842. 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.
  1843. 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>`.
  1844. Use parameter ``margin`` to determine the gap between the **Control** and the edges.
  1845. .. rst-class:: classref-item-separator
  1846. ----
  1847. .. _class_Control_method_set_position:
  1848. .. rst-class:: classref-method
  1849. void **set_position** **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_offsets=false **)**
  1850. Sets the :ref:`position<class_Control_property_position>` to given ``position``.
  1851. If ``keep_offsets`` is ``true``, control's anchors will be updated instead of offsets.
  1852. .. rst-class:: classref-item-separator
  1853. ----
  1854. .. _class_Control_method_set_size:
  1855. .. rst-class:: classref-method
  1856. void **set_size** **(** :ref:`Vector2<class_Vector2>` size, :ref:`bool<class_bool>` keep_offsets=false **)**
  1857. Sets the size (see :ref:`size<class_Control_property_size>`).
  1858. If ``keep_offsets`` is ``true``, control's anchors will be updated instead of offsets.
  1859. .. rst-class:: classref-item-separator
  1860. ----
  1861. .. _class_Control_method_update_minimum_size:
  1862. .. rst-class:: classref-method
  1863. void **update_minimum_size** **(** **)**
  1864. 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.
  1865. .. rst-class:: classref-item-separator
  1866. ----
  1867. .. _class_Control_method_warp_mouse:
  1868. .. rst-class:: classref-method
  1869. void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` position **)**
  1870. Moves the mouse cursor to ``position``, relative to :ref:`position<class_Control_property_position>` of this **Control**.
  1871. \ **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.
  1872. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1873. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1874. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1875. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1876. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1877. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  1878. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`