class_control.rst 180 KB

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