class_control.rst 184 KB

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