class_control.rst 206 KB

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