class_control.rst 185 KB

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