class_control.rst 157 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814
  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/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/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:`NinePatchRect<class_NinePatchRect>`, :ref:`Panel<class_Panel>`, :ref:`Popup<class_Popup>`, :ref:`Range<class_Range>`, :ref:`ReferenceRect<class_ReferenceRect>`, :ref:`RichTextLabel<class_RichTextLabel>`, :ref:`Separator<class_Separator>`, :ref:`Tabs<class_Tabs>`, :ref:`TextEdit<class_TextEdit>`, :ref:`TextureRect<class_TextureRect>`, :ref:`Tree<class_Tree>`, :ref:`VideoPlayer<class_VideoPlayer>`
  11. All user interface nodes inherit from Control. A control's anchors and margins adapt its position and size relative to its parent.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Base class for all UI-related nodes. **Control** features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, and margins that represent an offset to the anchor. The margins update automatically when the node, any of its parents, or the screen size change.
  16. For more information on Godot's UI system, anchors, margins, 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 sends input events to the scene's root node first, by calling :ref:`Node._input<class_Node_method__input>`. :ref:`Node._input<class_Node_method__input>` forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls :ref:`MainLoop._input_event<class_MainLoop_method__input_event>`. Call :ref:`accept_event<class_Control_method_accept_event>` so no other node receives the event. Once you accept an input, it becomes handled so :ref:`Node._unhandled_input<class_Node_method__unhandled_input>` will not process it.
  19. Only one **Control** node can be in keyboard focus. Only the node in focus will receive keyboard 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.
  20. 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.
  21. \ :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_*_override`` methods, like :ref:`add_font_override<class_Control_method_add_font_override>`. You can override the theme with the inspector.
  22. \ **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 :ref:`get_color<class_Control_method_get_color>`, :ref:`get_constant<class_Control_method_get_constant>`, :ref:`get_font<class_Control_method_get_font>`, :ref:`get_icon<class_Control_method_get_icon>`, :ref:`get_stylebox<class_Control_method_get_stylebox>`, and the ``add_*_override`` methods provided by this class.
  23. .. rst-class:: classref-introduction-group
  24. Tutorials
  25. ---------
  26. - :doc:`GUI tutorial index <../tutorials/ui/index>`
  27. - :doc:`Custom drawing in 2D <../tutorials/2d/custom_drawing_in_2d>`
  28. - :doc:`Control node gallery <../tutorials/ui/control_node_gallery>`
  29. - `All GUI Demos <https://github.com/godotengine/godot-demo-projects/tree/master/gui>`__
  30. .. rst-class:: classref-reftable-group
  31. Properties
  32. ----------
  33. .. table::
  34. :widths: auto
  35. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  36. | :ref:`float<class_float>` | :ref:`anchor_bottom<class_Control_property_anchor_bottom>` | ``0.0`` |
  37. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  38. | :ref:`float<class_float>` | :ref:`anchor_left<class_Control_property_anchor_left>` | ``0.0`` |
  39. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  40. | :ref:`float<class_float>` | :ref:`anchor_right<class_Control_property_anchor_right>` | ``0.0`` |
  41. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  42. | :ref:`float<class_float>` | :ref:`anchor_top<class_Control_property_anchor_top>` | ``0.0`` |
  43. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  44. | :ref:`FocusMode<enum_Control_FocusMode>` | :ref:`focus_mode<class_Control_property_focus_mode>` | ``0`` |
  45. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  46. | :ref:`NodePath<class_NodePath>` | :ref:`focus_neighbour_bottom<class_Control_property_focus_neighbour_bottom>` | ``NodePath("")`` |
  47. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  48. | :ref:`NodePath<class_NodePath>` | :ref:`focus_neighbour_left<class_Control_property_focus_neighbour_left>` | ``NodePath("")`` |
  49. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  50. | :ref:`NodePath<class_NodePath>` | :ref:`focus_neighbour_right<class_Control_property_focus_neighbour_right>` | ``NodePath("")`` |
  51. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  52. | :ref:`NodePath<class_NodePath>` | :ref:`focus_neighbour_top<class_Control_property_focus_neighbour_top>` | ``NodePath("")`` |
  53. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  54. | :ref:`NodePath<class_NodePath>` | :ref:`focus_next<class_Control_property_focus_next>` | ``NodePath("")`` |
  55. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  56. | :ref:`NodePath<class_NodePath>` | :ref:`focus_previous<class_Control_property_focus_previous>` | ``NodePath("")`` |
  57. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  58. | :ref:`GrowDirection<enum_Control_GrowDirection>` | :ref:`grow_horizontal<class_Control_property_grow_horizontal>` | ``1`` |
  59. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  60. | :ref:`GrowDirection<enum_Control_GrowDirection>` | :ref:`grow_vertical<class_Control_property_grow_vertical>` | ``1`` |
  61. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  62. | :ref:`String<class_String>` | :ref:`hint_tooltip<class_Control_property_hint_tooltip>` | ``""`` |
  63. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  64. | :ref:`bool<class_bool>` | :ref:`input_pass_on_modal_close_click<class_Control_property_input_pass_on_modal_close_click>` | ``true`` |
  65. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  66. | :ref:`float<class_float>` | :ref:`margin_bottom<class_Control_property_margin_bottom>` | ``0.0`` |
  67. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  68. | :ref:`float<class_float>` | :ref:`margin_left<class_Control_property_margin_left>` | ``0.0`` |
  69. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  70. | :ref:`float<class_float>` | :ref:`margin_right<class_Control_property_margin_right>` | ``0.0`` |
  71. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  72. | :ref:`float<class_float>` | :ref:`margin_top<class_Control_property_margin_top>` | ``0.0`` |
  73. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  74. | :ref:`CursorShape<enum_Control_CursorShape>` | :ref:`mouse_default_cursor_shape<class_Control_property_mouse_default_cursor_shape>` | ``0`` |
  75. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  76. | :ref:`MouseFilter<enum_Control_MouseFilter>` | :ref:`mouse_filter<class_Control_property_mouse_filter>` | ``0`` |
  77. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  78. | :ref:`bool<class_bool>` | :ref:`rect_clip_content<class_Control_property_rect_clip_content>` | ``false`` |
  79. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  80. | :ref:`Vector2<class_Vector2>` | :ref:`rect_global_position<class_Control_property_rect_global_position>` | |
  81. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  82. | :ref:`Vector2<class_Vector2>` | :ref:`rect_min_size<class_Control_property_rect_min_size>` | ``Vector2( 0, 0 )`` |
  83. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  84. | :ref:`Vector2<class_Vector2>` | :ref:`rect_pivot_offset<class_Control_property_rect_pivot_offset>` | ``Vector2( 0, 0 )`` |
  85. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  86. | :ref:`Vector2<class_Vector2>` | :ref:`rect_position<class_Control_property_rect_position>` | ``Vector2( 0, 0 )`` |
  87. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  88. | :ref:`float<class_float>` | :ref:`rect_rotation<class_Control_property_rect_rotation>` | ``0.0`` |
  89. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  90. | :ref:`Vector2<class_Vector2>` | :ref:`rect_scale<class_Control_property_rect_scale>` | ``Vector2( 1, 1 )`` |
  91. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  92. | :ref:`Vector2<class_Vector2>` | :ref:`rect_size<class_Control_property_rect_size>` | ``Vector2( 0, 0 )`` |
  93. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  94. | :ref:`int<class_int>` | :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` | ``1`` |
  95. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  96. | :ref:`float<class_float>` | :ref:`size_flags_stretch_ratio<class_Control_property_size_flags_stretch_ratio>` | ``1.0`` |
  97. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  98. | :ref:`int<class_int>` | :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>` | ``1`` |
  99. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  100. | :ref:`Theme<class_Theme>` | :ref:`theme<class_Control_property_theme>` | |
  101. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  102. | :ref:`String<class_String>` | :ref:`theme_type_variation<class_Control_property_theme_type_variation>` | ``""`` |
  103. +--------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------+
  104. .. rst-class:: classref-reftable-group
  105. Methods
  106. -------
  107. .. table::
  108. :widths: auto
  109. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`bool<class_bool>` | :ref:`_clips_input<class_Control_method__clips_input>` **(** **)** |virtual| |
  111. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`Vector2<class_Vector2>` | :ref:`_get_minimum_size<class_Control_method__get_minimum_size>` **(** **)** |virtual| |
  113. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | void | :ref:`_gui_input<class_Control_method__gui_input>` **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual| |
  115. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`Control<class_Control>` | :ref:`_make_custom_tooltip<class_Control_method__make_custom_tooltip>` **(** :ref:`String<class_String>` for_text **)** |virtual| |
  117. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`accept_event<class_Control_method_accept_event>` **(** **)** |
  119. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | void | :ref:`add_color_override<class_Control_method_add_color_override>` **(** :ref:`String<class_String>` name, :ref:`Color<class_Color>` color **)** |
  121. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | void | :ref:`add_constant_override<class_Control_method_add_constant_override>` **(** :ref:`String<class_String>` name, :ref:`int<class_int>` constant **)** |
  123. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`add_font_override<class_Control_method_add_font_override>` **(** :ref:`String<class_String>` name, :ref:`Font<class_Font>` font **)** |
  125. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`add_icon_override<class_Control_method_add_icon_override>` **(** :ref:`String<class_String>` name, :ref:`Texture<class_Texture>` texture **)** |
  127. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`add_shader_override<class_Control_method_add_shader_override>` **(** :ref:`String<class_String>` name, :ref:`Shader<class_Shader>` shader **)** |
  129. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | void | :ref:`add_stylebox_override<class_Control_method_add_stylebox_override>` **(** :ref:`String<class_String>` name, :ref:`StyleBox<class_StyleBox>` stylebox **)** |
  131. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`bool<class_bool>` | :ref:`can_drop_data<class_Control_method_can_drop_data>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`Variant<class_Variant>` data **)** |virtual| |
  133. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | void | :ref:`drop_data<class_Control_method_drop_data>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`Variant<class_Variant>` data **)** |virtual| |
  135. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`Control<class_Control>` | :ref:`find_next_valid_focus<class_Control_method_find_next_valid_focus>` **(** **)** |const| |
  137. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`Control<class_Control>` | :ref:`find_prev_valid_focus<class_Control_method_find_prev_valid_focus>` **(** **)** |const| |
  139. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | void | :ref:`force_drag<class_Control_method_force_drag>` **(** :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` preview **)** |
  141. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | :ref:`float<class_float>` | :ref:`get_anchor<class_Control_method_get_anchor>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const| |
  143. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | :ref:`Vector2<class_Vector2>` | :ref:`get_begin<class_Control_method_get_begin>` **(** **)** |const| |
  145. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | :ref:`Color<class_Color>` | :ref:`get_color<class_Control_method_get_color>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  147. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | :ref:`Vector2<class_Vector2>` | :ref:`get_combined_minimum_size<class_Control_method_get_combined_minimum_size>` **(** **)** |const| |
  149. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | :ref:`int<class_int>` | :ref:`get_constant<class_Control_method_get_constant>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  151. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | :ref:`CursorShape<enum_Control_CursorShape>` | :ref:`get_cursor_shape<class_Control_method_get_cursor_shape>` **(** :ref:`Vector2<class_Vector2>` position=Vector2( 0, 0 ) **)** |const| |
  153. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | :ref:`Variant<class_Variant>` | :ref:`get_drag_data<class_Control_method_get_drag_data>` **(** :ref:`Vector2<class_Vector2>` position **)** |virtual| |
  155. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | :ref:`Vector2<class_Vector2>` | :ref:`get_end<class_Control_method_get_end>` **(** **)** |const| |
  157. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | :ref:`NodePath<class_NodePath>` | :ref:`get_focus_neighbour<class_Control_method_get_focus_neighbour>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const| |
  159. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | :ref:`Control<class_Control>` | :ref:`get_focus_owner<class_Control_method_get_focus_owner>` **(** **)** |const| |
  161. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | :ref:`Font<class_Font>` | :ref:`get_font<class_Control_method_get_font>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  163. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. | :ref:`Rect2<class_Rect2>` | :ref:`get_global_rect<class_Control_method_get_global_rect>` **(** **)** |const| |
  165. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  166. | :ref:`Texture<class_Texture>` | :ref:`get_icon<class_Control_method_get_icon>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  167. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  168. | :ref:`float<class_float>` | :ref:`get_margin<class_Control_method_get_margin>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const| |
  169. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  170. | :ref:`Vector2<class_Vector2>` | :ref:`get_minimum_size<class_Control_method_get_minimum_size>` **(** **)** |const| |
  171. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  172. | :ref:`Vector2<class_Vector2>` | :ref:`get_parent_area_size<class_Control_method_get_parent_area_size>` **(** **)** |const| |
  173. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  174. | :ref:`Control<class_Control>` | :ref:`get_parent_control<class_Control_method_get_parent_control>` **(** **)** |const| |
  175. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  176. | :ref:`Rect2<class_Rect2>` | :ref:`get_rect<class_Control_method_get_rect>` **(** **)** |const| |
  177. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  178. | :ref:`float<class_float>` | :ref:`get_rotation<class_Control_method_get_rotation>` **(** **)** |const| |
  179. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  180. | :ref:`StyleBox<class_StyleBox>` | :ref:`get_stylebox<class_Control_method_get_stylebox>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  181. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  182. | :ref:`Font<class_Font>` | :ref:`get_theme_default_font<class_Control_method_get_theme_default_font>` **(** **)** |const| |
  183. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  184. | :ref:`String<class_String>` | :ref:`get_tooltip<class_Control_method_get_tooltip>` **(** :ref:`Vector2<class_Vector2>` at_position=Vector2( 0, 0 ) **)** |const| |
  185. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  186. | void | :ref:`grab_click_focus<class_Control_method_grab_click_focus>` **(** **)** |
  187. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  188. | void | :ref:`grab_focus<class_Control_method_grab_focus>` **(** **)** |
  189. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  190. | :ref:`bool<class_bool>` | :ref:`has_color<class_Control_method_has_color>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  191. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  192. | :ref:`bool<class_bool>` | :ref:`has_color_override<class_Control_method_has_color_override>` **(** :ref:`String<class_String>` name **)** |const| |
  193. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  194. | :ref:`bool<class_bool>` | :ref:`has_constant<class_Control_method_has_constant>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  195. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  196. | :ref:`bool<class_bool>` | :ref:`has_constant_override<class_Control_method_has_constant_override>` **(** :ref:`String<class_String>` name **)** |const| |
  197. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  198. | :ref:`bool<class_bool>` | :ref:`has_focus<class_Control_method_has_focus>` **(** **)** |const| |
  199. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  200. | :ref:`bool<class_bool>` | :ref:`has_font<class_Control_method_has_font>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  201. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  202. | :ref:`bool<class_bool>` | :ref:`has_font_override<class_Control_method_has_font_override>` **(** :ref:`String<class_String>` name **)** |const| |
  203. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  204. | :ref:`bool<class_bool>` | :ref:`has_icon<class_Control_method_has_icon>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  205. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  206. | :ref:`bool<class_bool>` | :ref:`has_icon_override<class_Control_method_has_icon_override>` **(** :ref:`String<class_String>` name **)** |const| |
  207. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  208. | :ref:`bool<class_bool>` | :ref:`has_point<class_Control_method_has_point>` **(** :ref:`Vector2<class_Vector2>` point **)** |virtual| |
  209. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  210. | :ref:`bool<class_bool>` | :ref:`has_shader_override<class_Control_method_has_shader_override>` **(** :ref:`String<class_String>` name **)** |const| |
  211. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  212. | :ref:`bool<class_bool>` | :ref:`has_stylebox<class_Control_method_has_stylebox>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const| |
  213. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  214. | :ref:`bool<class_bool>` | :ref:`has_stylebox_override<class_Control_method_has_stylebox_override>` **(** :ref:`String<class_String>` name **)** |const| |
  215. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  216. | :ref:`bool<class_bool>` | :ref:`is_drag_successful<class_Control_method_is_drag_successful>` **(** **)** |const| |
  217. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  218. | void | :ref:`minimum_size_changed<class_Control_method_minimum_size_changed>` **(** **)** |
  219. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  220. | void | :ref:`release_focus<class_Control_method_release_focus>` **(** **)** |
  221. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  222. | void | :ref:`remove_color_override<class_Control_method_remove_color_override>` **(** :ref:`String<class_String>` name **)** |
  223. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  224. | void | :ref:`remove_constant_override<class_Control_method_remove_constant_override>` **(** :ref:`String<class_String>` name **)** |
  225. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  226. | void | :ref:`remove_font_override<class_Control_method_remove_font_override>` **(** :ref:`String<class_String>` name **)** |
  227. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  228. | void | :ref:`remove_icon_override<class_Control_method_remove_icon_override>` **(** :ref:`String<class_String>` name **)** |
  229. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  230. | void | :ref:`remove_shader_override<class_Control_method_remove_shader_override>` **(** :ref:`String<class_String>` name **)** |
  231. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  232. | void | :ref:`remove_stylebox_override<class_Control_method_remove_stylebox_override>` **(** :ref:`String<class_String>` name **)** |
  233. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  234. | void | :ref:`set_anchor<class_Control_method_set_anchor>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` anchor, :ref:`bool<class_bool>` keep_margin=false, :ref:`bool<class_bool>` push_opposite_anchor=true **)** |
  235. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  236. | void | :ref:`set_anchor_and_margin<class_Control_method_set_anchor_and_margin>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` anchor, :ref:`float<class_float>` offset, :ref:`bool<class_bool>` push_opposite_anchor=false **)** |
  237. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  238. | void | :ref:`set_anchors_and_margins_preset<class_Control_method_set_anchors_and_margins_preset>` **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)** |
  239. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  240. | void | :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>` **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`bool<class_bool>` keep_margins=false **)** |
  241. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  242. | void | :ref:`set_begin<class_Control_method_set_begin>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  243. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  244. | void | :ref:`set_drag_forwarding<class_Control_method_set_drag_forwarding>` **(** :ref:`Control<class_Control>` target **)** |
  245. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  246. | void | :ref:`set_drag_preview<class_Control_method_set_drag_preview>` **(** :ref:`Control<class_Control>` control **)** |
  247. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  248. | void | :ref:`set_end<class_Control_method_set_end>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  249. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  250. | void | :ref:`set_focus_neighbour<class_Control_method_set_focus_neighbour>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`NodePath<class_NodePath>` neighbour **)** |
  251. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  252. | void | :ref:`set_global_position<class_Control_method_set_global_position>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_margins=false **)** |
  253. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  254. | void | :ref:`set_margin<class_Control_method_set_margin>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` offset **)** |
  255. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  256. | void | :ref:`set_margins_preset<class_Control_method_set_margins_preset>` **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)** |
  257. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  258. | void | :ref:`set_position<class_Control_method_set_position>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_margins=false **)** |
  259. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  260. | void | :ref:`set_rotation<class_Control_method_set_rotation>` **(** :ref:`float<class_float>` radians **)** |
  261. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  262. | void | :ref:`set_size<class_Control_method_set_size>` **(** :ref:`Vector2<class_Vector2>` size, :ref:`bool<class_bool>` keep_margins=false **)** |
  263. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  264. | void | :ref:`show_modal<class_Control_method_show_modal>` **(** :ref:`bool<class_bool>` exclusive=false **)** |
  265. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  266. | void | :ref:`warp_mouse<class_Control_method_warp_mouse>` **(** :ref:`Vector2<class_Vector2>` to_position **)** |
  267. +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  268. .. rst-class:: classref-section-separator
  269. ----
  270. .. rst-class:: classref-descriptions-group
  271. Signals
  272. -------
  273. .. _class_Control_signal_focus_entered:
  274. .. rst-class:: classref-signal
  275. **focus_entered** **(** **)**
  276. Emitted when the node gains keyboard focus.
  277. .. rst-class:: classref-item-separator
  278. ----
  279. .. _class_Control_signal_focus_exited:
  280. .. rst-class:: classref-signal
  281. **focus_exited** **(** **)**
  282. Emitted when the node loses keyboard focus.
  283. .. rst-class:: classref-item-separator
  284. ----
  285. .. _class_Control_signal_gui_input:
  286. .. rst-class:: classref-signal
  287. **gui_input** **(** :ref:`InputEvent<class_InputEvent>` event **)**
  288. Emitted when the node receives an :ref:`InputEvent<class_InputEvent>`.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_Control_signal_minimum_size_changed:
  292. .. rst-class:: classref-signal
  293. **minimum_size_changed** **(** **)**
  294. Emitted when the node's minimum size changes.
  295. .. rst-class:: classref-item-separator
  296. ----
  297. .. _class_Control_signal_modal_closed:
  298. .. rst-class:: classref-signal
  299. **modal_closed** **(** **)**
  300. Emitted when a modal **Control** is closed. See :ref:`show_modal<class_Control_method_show_modal>`.
  301. .. rst-class:: classref-item-separator
  302. ----
  303. .. _class_Control_signal_mouse_entered:
  304. .. rst-class:: classref-signal
  305. **mouse_entered** **(** **)**
  306. Emitted when the mouse enters the control's ``Rect`` area, provided its :ref:`mouse_filter<class_Control_property_mouse_filter>` lets the event reach it.
  307. \ **Note:** :ref:`mouse_entered<class_Control_signal_mouse_entered>` will not be emitted if the mouse enters a child **Control** node before entering the parent's ``Rect`` area, at least until the mouse is moved to reach the parent's ``Rect`` area.
  308. .. rst-class:: classref-item-separator
  309. ----
  310. .. _class_Control_signal_mouse_exited:
  311. .. rst-class:: classref-signal
  312. **mouse_exited** **(** **)**
  313. Emitted when the mouse leaves the control's ``Rect`` area, provided its :ref:`mouse_filter<class_Control_property_mouse_filter>` lets the event reach it.
  314. \ **Note:** :ref:`mouse_exited<class_Control_signal_mouse_exited>` will be emitted if the mouse enters a child **Control** node, even if the mouse cursor is still inside the parent's ``Rect`` area.
  315. If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this:
  316. ::
  317. func _on_mouse_exited():
  318. if not Rect2(Vector2(), rect_size).has_point(get_local_mouse_position()):
  319. # Not hovering over area.
  320. .. rst-class:: classref-item-separator
  321. ----
  322. .. _class_Control_signal_resized:
  323. .. rst-class:: classref-signal
  324. **resized** **(** **)**
  325. Emitted when the control changes size.
  326. .. rst-class:: classref-item-separator
  327. ----
  328. .. _class_Control_signal_size_flags_changed:
  329. .. rst-class:: classref-signal
  330. **size_flags_changed** **(** **)**
  331. 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>`.
  332. .. rst-class:: classref-section-separator
  333. ----
  334. .. rst-class:: classref-descriptions-group
  335. Enumerations
  336. ------------
  337. .. _enum_Control_FocusMode:
  338. .. rst-class:: classref-enumeration
  339. enum **FocusMode**:
  340. .. _class_Control_constant_FOCUS_NONE:
  341. .. rst-class:: classref-enumeration-constant
  342. :ref:`FocusMode<enum_Control_FocusMode>` **FOCUS_NONE** = ``0``
  343. The node cannot grab focus. Use with :ref:`focus_mode<class_Control_property_focus_mode>`.
  344. .. _class_Control_constant_FOCUS_CLICK:
  345. .. rst-class:: classref-enumeration-constant
  346. :ref:`FocusMode<enum_Control_FocusMode>` **FOCUS_CLICK** = ``1``
  347. The node can only grab focus on mouse clicks. Use with :ref:`focus_mode<class_Control_property_focus_mode>`.
  348. .. _class_Control_constant_FOCUS_ALL:
  349. .. rst-class:: classref-enumeration-constant
  350. :ref:`FocusMode<enum_Control_FocusMode>` **FOCUS_ALL** = ``2``
  351. The node can grab focus on mouse click or using the arrows and the Tab keys on the keyboard. Use with :ref:`focus_mode<class_Control_property_focus_mode>`.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _enum_Control_CursorShape:
  355. .. rst-class:: classref-enumeration
  356. enum **CursorShape**:
  357. .. _class_Control_constant_CURSOR_ARROW:
  358. .. rst-class:: classref-enumeration-constant
  359. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_ARROW** = ``0``
  360. 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>`.
  361. .. _class_Control_constant_CURSOR_IBEAM:
  362. .. rst-class:: classref-enumeration-constant
  363. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_IBEAM** = ``1``
  364. 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.
  365. .. _class_Control_constant_CURSOR_POINTING_HAND:
  366. .. rst-class:: classref-enumeration-constant
  367. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_POINTING_HAND** = ``2``
  368. Show the system's pointing hand mouse cursor when the user hovers the node.
  369. .. _class_Control_constant_CURSOR_CROSS:
  370. .. rst-class:: classref-enumeration-constant
  371. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_CROSS** = ``3``
  372. Show the system's cross mouse cursor when the user hovers the node.
  373. .. _class_Control_constant_CURSOR_WAIT:
  374. .. rst-class:: classref-enumeration-constant
  375. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_WAIT** = ``4``
  376. Show the system's wait mouse cursor when the user hovers the node. Often an hourglass.
  377. .. _class_Control_constant_CURSOR_BUSY:
  378. .. rst-class:: classref-enumeration-constant
  379. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_BUSY** = ``5``
  380. Show the system's busy mouse cursor when the user hovers the node. Often an arrow with a small hourglass.
  381. .. _class_Control_constant_CURSOR_DRAG:
  382. .. rst-class:: classref-enumeration-constant
  383. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_DRAG** = ``6``
  384. 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.
  385. .. _class_Control_constant_CURSOR_CAN_DROP:
  386. .. rst-class:: classref-enumeration-constant
  387. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_CAN_DROP** = ``7``
  388. 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.
  389. .. _class_Control_constant_CURSOR_FORBIDDEN:
  390. .. rst-class:: classref-enumeration-constant
  391. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_FORBIDDEN** = ``8``
  392. Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle.
  393. .. _class_Control_constant_CURSOR_VSIZE:
  394. .. rst-class:: classref-enumeration-constant
  395. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_VSIZE** = ``9``
  396. 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.
  397. .. _class_Control_constant_CURSOR_HSIZE:
  398. .. rst-class:: classref-enumeration-constant
  399. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_HSIZE** = ``10``
  400. 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.
  401. .. _class_Control_constant_CURSOR_BDIAGSIZE:
  402. .. rst-class:: classref-enumeration-constant
  403. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_BDIAGSIZE** = ``11``
  404. 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.
  405. .. _class_Control_constant_CURSOR_FDIAGSIZE:
  406. .. rst-class:: classref-enumeration-constant
  407. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_FDIAGSIZE** = ``12``
  408. 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.
  409. .. _class_Control_constant_CURSOR_MOVE:
  410. .. rst-class:: classref-enumeration-constant
  411. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_MOVE** = ``13``
  412. 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.
  413. .. _class_Control_constant_CURSOR_VSPLIT:
  414. .. rst-class:: classref-enumeration-constant
  415. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_VSPLIT** = ``14``
  416. 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>`.
  417. .. _class_Control_constant_CURSOR_HSPLIT:
  418. .. rst-class:: classref-enumeration-constant
  419. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_HSPLIT** = ``15``
  420. 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>`.
  421. .. _class_Control_constant_CURSOR_HELP:
  422. .. rst-class:: classref-enumeration-constant
  423. :ref:`CursorShape<enum_Control_CursorShape>` **CURSOR_HELP** = ``16``
  424. Show the system's help mouse cursor when the user hovers the node, a question mark.
  425. .. rst-class:: classref-item-separator
  426. ----
  427. .. _enum_Control_LayoutPreset:
  428. .. rst-class:: classref-enumeration
  429. enum **LayoutPreset**:
  430. .. _class_Control_constant_PRESET_TOP_LEFT:
  431. .. rst-class:: classref-enumeration-constant
  432. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_TOP_LEFT** = ``0``
  433. 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>`.
  434. .. _class_Control_constant_PRESET_TOP_RIGHT:
  435. .. rst-class:: classref-enumeration-constant
  436. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_TOP_RIGHT** = ``1``
  437. 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>`.
  438. .. _class_Control_constant_PRESET_BOTTOM_LEFT:
  439. .. rst-class:: classref-enumeration-constant
  440. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_BOTTOM_LEFT** = ``2``
  441. 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>`.
  442. .. _class_Control_constant_PRESET_BOTTOM_RIGHT:
  443. .. rst-class:: classref-enumeration-constant
  444. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_BOTTOM_RIGHT** = ``3``
  445. 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>`.
  446. .. _class_Control_constant_PRESET_CENTER_LEFT:
  447. .. rst-class:: classref-enumeration-constant
  448. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER_LEFT** = ``4``
  449. 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>`.
  450. .. _class_Control_constant_PRESET_CENTER_TOP:
  451. .. rst-class:: classref-enumeration-constant
  452. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER_TOP** = ``5``
  453. 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>`.
  454. .. _class_Control_constant_PRESET_CENTER_RIGHT:
  455. .. rst-class:: classref-enumeration-constant
  456. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER_RIGHT** = ``6``
  457. 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>`.
  458. .. _class_Control_constant_PRESET_CENTER_BOTTOM:
  459. .. rst-class:: classref-enumeration-constant
  460. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER_BOTTOM** = ``7``
  461. 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>`.
  462. .. _class_Control_constant_PRESET_CENTER:
  463. .. rst-class:: classref-enumeration-constant
  464. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_CENTER** = ``8``
  465. 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>`.
  466. .. _class_Control_constant_PRESET_LEFT_WIDE:
  467. .. rst-class:: classref-enumeration-constant
  468. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_LEFT_WIDE** = ``9``
  469. Snap all 4 anchors to the left edge of the parent control. The left margin becomes relative to the left edge and the top margin relative to the top left corner of the node's parent. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  470. .. _class_Control_constant_PRESET_TOP_WIDE:
  471. .. rst-class:: classref-enumeration-constant
  472. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_TOP_WIDE** = ``10``
  473. Snap all 4 anchors to the top edge of the parent control. The left margin becomes relative to the top left corner, the top margin relative to the top edge, and the right margin relative to the top right corner of the node's parent. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  474. .. _class_Control_constant_PRESET_RIGHT_WIDE:
  475. .. rst-class:: classref-enumeration-constant
  476. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_RIGHT_WIDE** = ``11``
  477. Snap all 4 anchors to the right edge of the parent control. The right margin becomes relative to the right edge and the top margin relative to the top right corner of the node's parent. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  478. .. _class_Control_constant_PRESET_BOTTOM_WIDE:
  479. .. rst-class:: classref-enumeration-constant
  480. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_BOTTOM_WIDE** = ``12``
  481. Snap all 4 anchors to the bottom edge of the parent control. The left margin becomes relative to the bottom left corner, the bottom margin relative to the bottom edge, and the right margin relative to the bottom right corner of the node's parent. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  482. .. _class_Control_constant_PRESET_VCENTER_WIDE:
  483. .. rst-class:: classref-enumeration-constant
  484. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_VCENTER_WIDE** = ``13``
  485. 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>`.
  486. .. _class_Control_constant_PRESET_HCENTER_WIDE:
  487. .. rst-class:: classref-enumeration-constant
  488. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_HCENTER_WIDE** = ``14``
  489. 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>`.
  490. .. _class_Control_constant_PRESET_WIDE:
  491. .. rst-class:: classref-enumeration-constant
  492. :ref:`LayoutPreset<enum_Control_LayoutPreset>` **PRESET_WIDE** = ``15``
  493. Snap all 4 anchors to the respective corners of the parent control. Set all 4 margins to 0 after you applied this preset and the **Control** will fit its parent control. This is equivalent to the "Full Rect" layout option in the editor. Use with :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>`.
  494. .. rst-class:: classref-item-separator
  495. ----
  496. .. _enum_Control_LayoutPresetMode:
  497. .. rst-class:: classref-enumeration
  498. enum **LayoutPresetMode**:
  499. .. _class_Control_constant_PRESET_MODE_MINSIZE:
  500. .. rst-class:: classref-enumeration-constant
  501. :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` **PRESET_MODE_MINSIZE** = ``0``
  502. The control will be resized to its minimum size.
  503. .. _class_Control_constant_PRESET_MODE_KEEP_WIDTH:
  504. .. rst-class:: classref-enumeration-constant
  505. :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` **PRESET_MODE_KEEP_WIDTH** = ``1``
  506. The control's width will not change.
  507. .. _class_Control_constant_PRESET_MODE_KEEP_HEIGHT:
  508. .. rst-class:: classref-enumeration-constant
  509. :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` **PRESET_MODE_KEEP_HEIGHT** = ``2``
  510. The control's height will not change.
  511. .. _class_Control_constant_PRESET_MODE_KEEP_SIZE:
  512. .. rst-class:: classref-enumeration-constant
  513. :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` **PRESET_MODE_KEEP_SIZE** = ``3``
  514. The control's size will not change.
  515. .. rst-class:: classref-item-separator
  516. ----
  517. .. _enum_Control_SizeFlags:
  518. .. rst-class:: classref-enumeration
  519. enum **SizeFlags**:
  520. .. _class_Control_constant_SIZE_FILL:
  521. .. rst-class:: classref-enumeration-constant
  522. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_FILL** = ``1``
  523. 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. Use with :ref:`size_flags_horizontal<class_Control_property_size_flags_horizontal>` and :ref:`size_flags_vertical<class_Control_property_size_flags_vertical>`.
  524. .. _class_Control_constant_SIZE_EXPAND:
  525. .. rst-class:: classref-enumeration-constant
  526. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_EXPAND** = ``2``
  527. 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>`.
  528. .. _class_Control_constant_SIZE_EXPAND_FILL:
  529. .. rst-class:: classref-enumeration-constant
  530. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_EXPAND_FILL** = ``3``
  531. Sets the node's size flags to both fill and expand. See the 2 constants above for more information.
  532. .. _class_Control_constant_SIZE_SHRINK_CENTER:
  533. .. rst-class:: classref-enumeration-constant
  534. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_SHRINK_CENTER** = ``4``
  535. Tells the parent :ref:`Container<class_Container>` to center the node in itself. It centers the control based on its bounding box, so it doesn't work with the fill or expand 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>`.
  536. .. _class_Control_constant_SIZE_SHRINK_END:
  537. .. rst-class:: classref-enumeration-constant
  538. :ref:`SizeFlags<enum_Control_SizeFlags>` **SIZE_SHRINK_END** = ``8``
  539. Tells the parent :ref:`Container<class_Container>` to align the node with its end, either the bottom or the right edge. It doesn't work with the fill or expand 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>`.
  540. .. rst-class:: classref-item-separator
  541. ----
  542. .. _enum_Control_MouseFilter:
  543. .. rst-class:: classref-enumeration
  544. enum **MouseFilter**:
  545. .. _class_Control_constant_MOUSE_FILTER_STOP:
  546. .. rst-class:: classref-enumeration-constant
  547. :ref:`MouseFilter<enum_Control_MouseFilter>` **MOUSE_FILTER_STOP** = ``0``
  548. The control will receive mouse button input events through :ref:`_gui_input<class_Control_method__gui_input>` if clicked on. And the control will receive the :ref:`mouse_entered<class_Control_signal_mouse_entered>` and :ref:`mouse_exited<class_Control_signal_mouse_exited>` signals. These events are automatically marked as handled, and they will not propagate further to other controls. This also results in blocking signals in other controls.
  549. .. _class_Control_constant_MOUSE_FILTER_PASS:
  550. .. rst-class:: classref-enumeration-constant
  551. :ref:`MouseFilter<enum_Control_MouseFilter>` **MOUSE_FILTER_PASS** = ``1``
  552. The control will receive mouse button input events through :ref:`_gui_input<class_Control_method__gui_input>` if clicked on. And the control will receive the :ref:`mouse_entered<class_Control_signal_mouse_entered>` and :ref:`mouse_exited<class_Control_signal_mouse_exited>` signals. If this control does not handle the event, the parent control (if any) will be considered, and so on until there is no more parent control to potentially handle it. This also allows signals to fire in other controls. Even if no control handled it at all, the event will still be handled automatically, so unhandled input will not be fired.
  553. .. _class_Control_constant_MOUSE_FILTER_IGNORE:
  554. .. rst-class:: classref-enumeration-constant
  555. :ref:`MouseFilter<enum_Control_MouseFilter>` **MOUSE_FILTER_IGNORE** = ``2``
  556. The control will not receive mouse button input events through :ref:`_gui_input<class_Control_method__gui_input>`. The control will also not receive the :ref:`mouse_entered<class_Control_signal_mouse_entered>` nor :ref:`mouse_exited<class_Control_signal_mouse_exited>` signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically.
  557. .. rst-class:: classref-item-separator
  558. ----
  559. .. _enum_Control_GrowDirection:
  560. .. rst-class:: classref-enumeration
  561. enum **GrowDirection**:
  562. .. _class_Control_constant_GROW_DIRECTION_BEGIN:
  563. .. rst-class:: classref-enumeration-constant
  564. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_BEGIN** = ``0``
  565. 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.
  566. .. _class_Control_constant_GROW_DIRECTION_END:
  567. .. rst-class:: classref-enumeration-constant
  568. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_END** = ``1``
  569. 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.
  570. .. _class_Control_constant_GROW_DIRECTION_BOTH:
  571. .. rst-class:: classref-enumeration-constant
  572. :ref:`GrowDirection<enum_Control_GrowDirection>` **GROW_DIRECTION_BOTH** = ``2``
  573. The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.
  574. .. rst-class:: classref-item-separator
  575. ----
  576. .. _enum_Control_Anchor:
  577. .. rst-class:: classref-enumeration
  578. enum **Anchor**:
  579. .. _class_Control_constant_ANCHOR_BEGIN:
  580. .. rst-class:: classref-enumeration-constant
  581. :ref:`Anchor<enum_Control_Anchor>` **ANCHOR_BEGIN** = ``0``
  582. 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>`.
  583. .. _class_Control_constant_ANCHOR_END:
  584. .. rst-class:: classref-enumeration-constant
  585. :ref:`Anchor<enum_Control_Anchor>` **ANCHOR_END** = ``1``
  586. 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>`.
  587. .. rst-class:: classref-section-separator
  588. ----
  589. .. rst-class:: classref-descriptions-group
  590. Constants
  591. ---------
  592. .. _class_Control_constant_NOTIFICATION_RESIZED:
  593. .. rst-class:: classref-constant
  594. **NOTIFICATION_RESIZED** = ``40``
  595. Sent when the node changes size. Use :ref:`rect_size<class_Control_property_rect_size>` to get the new size.
  596. .. _class_Control_constant_NOTIFICATION_MOUSE_ENTER:
  597. .. rst-class:: classref-constant
  598. **NOTIFICATION_MOUSE_ENTER** = ``41``
  599. Sent when the mouse pointer enters the node.
  600. .. _class_Control_constant_NOTIFICATION_MOUSE_EXIT:
  601. .. rst-class:: classref-constant
  602. **NOTIFICATION_MOUSE_EXIT** = ``42``
  603. Sent when the mouse pointer exits the node.
  604. .. _class_Control_constant_NOTIFICATION_FOCUS_ENTER:
  605. .. rst-class:: classref-constant
  606. **NOTIFICATION_FOCUS_ENTER** = ``43``
  607. Sent when the node grabs focus.
  608. .. _class_Control_constant_NOTIFICATION_FOCUS_EXIT:
  609. .. rst-class:: classref-constant
  610. **NOTIFICATION_FOCUS_EXIT** = ``44``
  611. Sent when the node loses focus.
  612. .. _class_Control_constant_NOTIFICATION_THEME_CHANGED:
  613. .. rst-class:: classref-constant
  614. **NOTIFICATION_THEME_CHANGED** = ``45``
  615. Sent when the node's :ref:`theme<class_Control_property_theme>` changes, right before Godot redraws the control. Happens when you call one of the ``add_*_override`` methods.
  616. .. _class_Control_constant_NOTIFICATION_MODAL_CLOSE:
  617. .. rst-class:: classref-constant
  618. **NOTIFICATION_MODAL_CLOSE** = ``46``
  619. Sent when an open modal dialog closes. See :ref:`show_modal<class_Control_method_show_modal>`.
  620. .. _class_Control_constant_NOTIFICATION_SCROLL_BEGIN:
  621. .. rst-class:: classref-constant
  622. **NOTIFICATION_SCROLL_BEGIN** = ``47``
  623. Sent when this node is inside a :ref:`ScrollContainer<class_ScrollContainer>` which has begun being scrolled.
  624. .. _class_Control_constant_NOTIFICATION_SCROLL_END:
  625. .. rst-class:: classref-constant
  626. **NOTIFICATION_SCROLL_END** = ``48``
  627. Sent when this node is inside a :ref:`ScrollContainer<class_ScrollContainer>` which has stopped being scrolled.
  628. .. rst-class:: classref-section-separator
  629. ----
  630. .. rst-class:: classref-descriptions-group
  631. Property Descriptions
  632. ---------------------
  633. .. _class_Control_property_anchor_bottom:
  634. .. rst-class:: classref-property
  635. :ref:`float<class_float>` **anchor_bottom** = ``0.0``
  636. .. rst-class:: classref-property-setget
  637. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  638. Anchors the bottom edge of the node to the origin, the center, or the end of its parent control. It changes how the bottom margin updates when the node moves or changes size. You can use one of the :ref:`Anchor<enum_Control_Anchor>` constants for convenience.
  639. .. rst-class:: classref-item-separator
  640. ----
  641. .. _class_Control_property_anchor_left:
  642. .. rst-class:: classref-property
  643. :ref:`float<class_float>` **anchor_left** = ``0.0``
  644. .. rst-class:: classref-property-setget
  645. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  646. Anchors the left edge of the node to the origin, the center or the end of its parent control. It changes how the left margin updates when the node moves or changes size. You can use one of the :ref:`Anchor<enum_Control_Anchor>` constants for convenience.
  647. .. rst-class:: classref-item-separator
  648. ----
  649. .. _class_Control_property_anchor_right:
  650. .. rst-class:: classref-property
  651. :ref:`float<class_float>` **anchor_right** = ``0.0``
  652. .. rst-class:: classref-property-setget
  653. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  654. Anchors the right edge of the node to the origin, the center or the end of its parent control. It changes how the right margin updates when the node moves or changes size. You can use one of the :ref:`Anchor<enum_Control_Anchor>` constants for convenience.
  655. .. rst-class:: classref-item-separator
  656. ----
  657. .. _class_Control_property_anchor_top:
  658. .. rst-class:: classref-property
  659. :ref:`float<class_float>` **anchor_top** = ``0.0``
  660. .. rst-class:: classref-property-setget
  661. - :ref:`float<class_float>` **get_anchor** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  662. Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top margin updates when the node moves or changes size. You can use one of the :ref:`Anchor<enum_Control_Anchor>` constants for convenience.
  663. .. rst-class:: classref-item-separator
  664. ----
  665. .. _class_Control_property_focus_mode:
  666. .. rst-class:: classref-property
  667. :ref:`FocusMode<enum_Control_FocusMode>` **focus_mode** = ``0``
  668. .. rst-class:: classref-property-setget
  669. - void **set_focus_mode** **(** :ref:`FocusMode<enum_Control_FocusMode>` value **)**
  670. - :ref:`FocusMode<enum_Control_FocusMode>` **get_focus_mode** **(** **)**
  671. 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 signals.
  672. .. rst-class:: classref-item-separator
  673. ----
  674. .. _class_Control_property_focus_neighbour_bottom:
  675. .. rst-class:: classref-property
  676. :ref:`NodePath<class_NodePath>` **focus_neighbour_bottom** = ``NodePath("")``
  677. .. rst-class:: classref-property-setget
  678. - void **set_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`NodePath<class_NodePath>` neighbour **)**
  679. - :ref:`NodePath<class_NodePath>` **get_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  680. Tells Godot which node it should give keyboard 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 ``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.
  681. .. rst-class:: classref-item-separator
  682. ----
  683. .. _class_Control_property_focus_neighbour_left:
  684. .. rst-class:: classref-property
  685. :ref:`NodePath<class_NodePath>` **focus_neighbour_left** = ``NodePath("")``
  686. .. rst-class:: classref-property-setget
  687. - void **set_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`NodePath<class_NodePath>` neighbour **)**
  688. - :ref:`NodePath<class_NodePath>` **get_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  689. Tells Godot which node it should give keyboard 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 ``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.
  690. .. rst-class:: classref-item-separator
  691. ----
  692. .. _class_Control_property_focus_neighbour_right:
  693. .. rst-class:: classref-property
  694. :ref:`NodePath<class_NodePath>` **focus_neighbour_right** = ``NodePath("")``
  695. .. rst-class:: classref-property-setget
  696. - void **set_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`NodePath<class_NodePath>` neighbour **)**
  697. - :ref:`NodePath<class_NodePath>` **get_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  698. Tells Godot which node it should give keyboard 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 ``ui_right`` input action. The node must be a **Control**. If this property is not set, Godot will give focus to the closest **Control** to the bottom of this one.
  699. .. rst-class:: classref-item-separator
  700. ----
  701. .. _class_Control_property_focus_neighbour_top:
  702. .. rst-class:: classref-property
  703. :ref:`NodePath<class_NodePath>` **focus_neighbour_top** = ``NodePath("")``
  704. .. rst-class:: classref-property-setget
  705. - void **set_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`NodePath<class_NodePath>` neighbour **)**
  706. - :ref:`NodePath<class_NodePath>` **get_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  707. Tells Godot which node it should give keyboard 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 ``ui_top`` 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.
  708. .. rst-class:: classref-item-separator
  709. ----
  710. .. _class_Control_property_focus_next:
  711. .. rst-class:: classref-property
  712. :ref:`NodePath<class_NodePath>` **focus_next** = ``NodePath("")``
  713. .. rst-class:: classref-property-setget
  714. - void **set_focus_next** **(** :ref:`NodePath<class_NodePath>` value **)**
  715. - :ref:`NodePath<class_NodePath>` **get_focus_next** **(** **)**
  716. Tells Godot which node it should give keyboard focus to if the user presses Tab on a keyboard by default. You can change the key by editing the ``ui_focus_next`` input action.
  717. If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
  718. .. rst-class:: classref-item-separator
  719. ----
  720. .. _class_Control_property_focus_previous:
  721. .. rst-class:: classref-property
  722. :ref:`NodePath<class_NodePath>` **focus_previous** = ``NodePath("")``
  723. .. rst-class:: classref-property-setget
  724. - void **set_focus_previous** **(** :ref:`NodePath<class_NodePath>` value **)**
  725. - :ref:`NodePath<class_NodePath>` **get_focus_previous** **(** **)**
  726. Tells Godot which node it should give keyboard focus to if the user presses Shift+Tab on a keyboard by default. You can change the key by editing the ``ui_focus_prev`` input action.
  727. If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.
  728. .. rst-class:: classref-item-separator
  729. ----
  730. .. _class_Control_property_grow_horizontal:
  731. .. rst-class:: classref-property
  732. :ref:`GrowDirection<enum_Control_GrowDirection>` **grow_horizontal** = ``1``
  733. .. rst-class:: classref-property-setget
  734. - void **set_h_grow_direction** **(** :ref:`GrowDirection<enum_Control_GrowDirection>` value **)**
  735. - :ref:`GrowDirection<enum_Control_GrowDirection>` **get_h_grow_direction** **(** **)**
  736. 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.
  737. .. rst-class:: classref-item-separator
  738. ----
  739. .. _class_Control_property_grow_vertical:
  740. .. rst-class:: classref-property
  741. :ref:`GrowDirection<enum_Control_GrowDirection>` **grow_vertical** = ``1``
  742. .. rst-class:: classref-property-setget
  743. - void **set_v_grow_direction** **(** :ref:`GrowDirection<enum_Control_GrowDirection>` value **)**
  744. - :ref:`GrowDirection<enum_Control_GrowDirection>` **get_v_grow_direction** **(** **)**
  745. 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.
  746. .. rst-class:: classref-item-separator
  747. ----
  748. .. _class_Control_property_hint_tooltip:
  749. .. rst-class:: classref-property
  750. :ref:`String<class_String>` **hint_tooltip** = ``""``
  751. .. rst-class:: classref-property-setget
  752. - void **set_tooltip** **(** :ref:`String<class_String>` value **)**
  753. Changes the 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>`. You can change the time required for the tooltip to appear with ``gui/timers/tooltip_delay_sec`` option in Project Settings.
  754. The tooltip popup will use either a default implementation, or a custom one that you can provide by overriding :ref:`_make_custom_tooltip<class_Control_method__make_custom_tooltip>`. The default tooltip includes a :ref:`PopupPanel<class_PopupPanel>` and :ref:`Label<class_Label>` whose theme properties can be customized using :ref:`Theme<class_Theme>` methods with the ``"TooltipPanel"`` and ``"TooltipLabel"`` respectively. For example:
  755. ::
  756. var style_box = StyleBoxFlat.new()
  757. style_box.set_bg_color(Color(1, 1, 0))
  758. style_box.set_border_width_all(2)
  759. # We assume here that the `theme` property has been assigned a custom Theme beforehand.
  760. theme.set_stylebox("panel", "TooltipPanel", style_box)
  761. theme.set_color("font_color", "TooltipLabel", Color(0, 1, 1))
  762. .. rst-class:: classref-item-separator
  763. ----
  764. .. _class_Control_property_input_pass_on_modal_close_click:
  765. .. rst-class:: classref-property
  766. :ref:`bool<class_bool>` **input_pass_on_modal_close_click** = ``true``
  767. .. rst-class:: classref-property-setget
  768. - void **set_pass_on_modal_close_click** **(** :ref:`bool<class_bool>` value **)**
  769. - :ref:`bool<class_bool>` **get_pass_on_modal_close_click** **(** **)**
  770. Enables whether input should propagate when you close the control as modal.
  771. If ``false``, stops event handling at the viewport input event handling. The viewport first hides the modal and after marks the input as handled.
  772. .. rst-class:: classref-item-separator
  773. ----
  774. .. _class_Control_property_margin_bottom:
  775. .. rst-class:: classref-property
  776. :ref:`float<class_float>` **margin_bottom** = ``0.0``
  777. .. rst-class:: classref-property-setget
  778. - void **set_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` offset **)**
  779. - :ref:`float<class_float>` **get_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  780. Distance between the node's bottom edge and its parent control, based on :ref:`anchor_bottom<class_Control_property_anchor_bottom>`.
  781. Margins 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>`. Margins update automatically when you move or resize the node.
  782. .. rst-class:: classref-item-separator
  783. ----
  784. .. _class_Control_property_margin_left:
  785. .. rst-class:: classref-property
  786. :ref:`float<class_float>` **margin_left** = ``0.0``
  787. .. rst-class:: classref-property-setget
  788. - void **set_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` offset **)**
  789. - :ref:`float<class_float>` **get_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  790. Distance between the node's left edge and its parent control, based on :ref:`anchor_left<class_Control_property_anchor_left>`.
  791. Margins 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>`. Margins update automatically when you move or resize the node.
  792. .. rst-class:: classref-item-separator
  793. ----
  794. .. _class_Control_property_margin_right:
  795. .. rst-class:: classref-property
  796. :ref:`float<class_float>` **margin_right** = ``0.0``
  797. .. rst-class:: classref-property-setget
  798. - void **set_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` offset **)**
  799. - :ref:`float<class_float>` **get_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  800. Distance between the node's right edge and its parent control, based on :ref:`anchor_right<class_Control_property_anchor_right>`.
  801. Margins 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>`. Margins update automatically when you move or resize the node.
  802. .. rst-class:: classref-item-separator
  803. ----
  804. .. _class_Control_property_margin_top:
  805. .. rst-class:: classref-property
  806. :ref:`float<class_float>` **margin_top** = ``0.0``
  807. .. rst-class:: classref-property-setget
  808. - void **set_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` offset **)**
  809. - :ref:`float<class_float>` **get_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  810. Distance between the node's top edge and its parent control, based on :ref:`anchor_top<class_Control_property_anchor_top>`.
  811. Margins 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>`. Margins update automatically when you move or resize the node.
  812. .. rst-class:: classref-item-separator
  813. ----
  814. .. _class_Control_property_mouse_default_cursor_shape:
  815. .. rst-class:: classref-property
  816. :ref:`CursorShape<enum_Control_CursorShape>` **mouse_default_cursor_shape** = ``0``
  817. .. rst-class:: classref-property-setget
  818. - void **set_default_cursor_shape** **(** :ref:`CursorShape<enum_Control_CursorShape>` value **)**
  819. - :ref:`CursorShape<enum_Control_CursorShape>` **get_default_cursor_shape** **(** **)**
  820. The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors.
  821. \ **Note:** On Linux, shapes may vary depending on the cursor theme of the system.
  822. .. rst-class:: classref-item-separator
  823. ----
  824. .. _class_Control_property_mouse_filter:
  825. .. rst-class:: classref-property
  826. :ref:`MouseFilter<enum_Control_MouseFilter>` **mouse_filter** = ``0``
  827. .. rst-class:: classref-property-setget
  828. - void **set_mouse_filter** **(** :ref:`MouseFilter<enum_Control_MouseFilter>` value **)**
  829. - :ref:`MouseFilter<enum_Control_MouseFilter>` **get_mouse_filter** **(** **)**
  830. Controls whether the control will be able to receive mouse button input events through :ref:`_gui_input<class_Control_method__gui_input>` and how these events should be handled. Also controls whether the control can receive the :ref:`mouse_entered<class_Control_signal_mouse_entered>`, and :ref:`mouse_exited<class_Control_signal_mouse_exited>` signals. See the constants to learn what each does.
  831. .. rst-class:: classref-item-separator
  832. ----
  833. .. _class_Control_property_rect_clip_content:
  834. .. rst-class:: classref-property
  835. :ref:`bool<class_bool>` **rect_clip_content** = ``false``
  836. .. rst-class:: classref-property-setget
  837. - void **set_clip_contents** **(** :ref:`bool<class_bool>` value **)**
  838. - :ref:`bool<class_bool>` **is_clipping_contents** **(** **)**
  839. 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.
  840. .. rst-class:: classref-item-separator
  841. ----
  842. .. _class_Control_property_rect_global_position:
  843. .. rst-class:: classref-property
  844. :ref:`Vector2<class_Vector2>` **rect_global_position**
  845. .. rst-class:: classref-property-setget
  846. - :ref:`Vector2<class_Vector2>` **get_global_position** **(** **)**
  847. The node's global position, relative to the world (usually to the top-left corner of the window).
  848. .. rst-class:: classref-item-separator
  849. ----
  850. .. _class_Control_property_rect_min_size:
  851. .. rst-class:: classref-property
  852. :ref:`Vector2<class_Vector2>` **rect_min_size** = ``Vector2( 0, 0 )``
  853. .. rst-class:: classref-property-setget
  854. - void **set_custom_minimum_size** **(** :ref:`Vector2<class_Vector2>` value **)**
  855. - :ref:`Vector2<class_Vector2>` **get_custom_minimum_size** **(** **)**
  856. The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes.
  857. .. rst-class:: classref-item-separator
  858. ----
  859. .. _class_Control_property_rect_pivot_offset:
  860. .. rst-class:: classref-property
  861. :ref:`Vector2<class_Vector2>` **rect_pivot_offset** = ``Vector2( 0, 0 )``
  862. .. rst-class:: classref-property-setget
  863. - void **set_pivot_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
  864. - :ref:`Vector2<class_Vector2>` **get_pivot_offset** **(** **)**
  865. By default, the node's pivot is its top-left corner. When you change its :ref:`rect_rotation<class_Control_property_rect_rotation>` or :ref:`rect_scale<class_Control_property_rect_scale>`, it will rotate or scale around this pivot. Set this property to :ref:`rect_size<class_Control_property_rect_size>` / 2 to pivot around the Control's center.
  866. .. rst-class:: classref-item-separator
  867. ----
  868. .. _class_Control_property_rect_position:
  869. .. rst-class:: classref-property
  870. :ref:`Vector2<class_Vector2>` **rect_position** = ``Vector2( 0, 0 )``
  871. .. rst-class:: classref-property-setget
  872. - :ref:`Vector2<class_Vector2>` **get_position** **(** **)**
  873. The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by :ref:`rect_pivot_offset<class_Control_property_rect_pivot_offset>`.
  874. .. rst-class:: classref-item-separator
  875. ----
  876. .. _class_Control_property_rect_rotation:
  877. .. rst-class:: classref-property
  878. :ref:`float<class_float>` **rect_rotation** = ``0.0``
  879. .. rst-class:: classref-property-setget
  880. - void **set_rotation_degrees** **(** :ref:`float<class_float>` value **)**
  881. - :ref:`float<class_float>` **get_rotation_degrees** **(** **)**
  882. The node's rotation around its pivot, in degrees. See :ref:`rect_pivot_offset<class_Control_property_rect_pivot_offset>` to change the pivot's position.
  883. .. rst-class:: classref-item-separator
  884. ----
  885. .. _class_Control_property_rect_scale:
  886. .. rst-class:: classref-property
  887. :ref:`Vector2<class_Vector2>` **rect_scale** = ``Vector2( 1, 1 )``
  888. .. rst-class:: classref-property-setget
  889. - void **set_scale** **(** :ref:`Vector2<class_Vector2>` value **)**
  890. - :ref:`Vector2<class_Vector2>` **get_scale** **(** **)**
  891. The node's scale, relative to its :ref:`rect_size<class_Control_property_rect_size>`. Change this property to scale the node around its :ref:`rect_pivot_offset<class_Control_property_rect_pivot_offset>`. The Control's :ref:`hint_tooltip<class_Control_property_hint_tooltip>` will also scale according to this value.
  892. \ **Note:** This property is mainly intended to be used for animation purposes. Text inside the Control will look pixelated or blurry when the Control is scaled. To support multiple resolutions in your project, use an appropriate viewport stretch mode as described in the :doc:`documentation <../tutorials/rendering/multiple_resolutions>` instead of scaling Controls individually.
  893. \ **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 instanced. To set the Control's scale when it's instanced, wait for one frame using ``yield(get_tree(), "idle_frame")`` then set its :ref:`rect_scale<class_Control_property_rect_scale>` property.
  894. .. rst-class:: classref-item-separator
  895. ----
  896. .. _class_Control_property_rect_size:
  897. .. rst-class:: classref-property
  898. :ref:`Vector2<class_Vector2>` **rect_size** = ``Vector2( 0, 0 )``
  899. .. rst-class:: classref-property-setget
  900. - :ref:`Vector2<class_Vector2>` **get_size** **(** **)**
  901. The size of the node's bounding rectangle, in pixels. :ref:`Container<class_Container>` nodes update this property automatically.
  902. .. rst-class:: classref-item-separator
  903. ----
  904. .. _class_Control_property_size_flags_horizontal:
  905. .. rst-class:: classref-property
  906. :ref:`int<class_int>` **size_flags_horizontal** = ``1``
  907. .. rst-class:: classref-property-setget
  908. - void **set_h_size_flags** **(** :ref:`int<class_int>` value **)**
  909. - :ref:`int<class_int>` **get_h_size_flags** **(** **)**
  910. Tells the parent :ref:`Container<class_Container>` nodes how they should resize and place the node on the X axis. Use one of the :ref:`SizeFlags<enum_Control_SizeFlags>` constants to change the flags. See the constants to learn what each does.
  911. .. rst-class:: classref-item-separator
  912. ----
  913. .. _class_Control_property_size_flags_stretch_ratio:
  914. .. rst-class:: classref-property
  915. :ref:`float<class_float>` **size_flags_stretch_ratio** = ``1.0``
  916. .. rst-class:: classref-property-setget
  917. - void **set_stretch_ratio** **(** :ref:`float<class_float>` value **)**
  918. - :ref:`float<class_float>` **get_stretch_ratio** **(** **)**
  919. If the node and at least one of its neighbours 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 neighbour a ratio of 1, this node will take two thirds of the available space.
  920. .. rst-class:: classref-item-separator
  921. ----
  922. .. _class_Control_property_size_flags_vertical:
  923. .. rst-class:: classref-property
  924. :ref:`int<class_int>` **size_flags_vertical** = ``1``
  925. .. rst-class:: classref-property-setget
  926. - void **set_v_size_flags** **(** :ref:`int<class_int>` value **)**
  927. - :ref:`int<class_int>` **get_v_size_flags** **(** **)**
  928. Tells the parent :ref:`Container<class_Container>` nodes how they should resize and place the node on the Y axis. Use one of the :ref:`SizeFlags<enum_Control_SizeFlags>` constants to change the flags. See the constants to learn what each does.
  929. .. rst-class:: classref-item-separator
  930. ----
  931. .. _class_Control_property_theme:
  932. .. rst-class:: classref-property
  933. :ref:`Theme<class_Theme>` **theme**
  934. .. rst-class:: classref-property-setget
  935. - void **set_theme** **(** :ref:`Theme<class_Theme>` value **)**
  936. - :ref:`Theme<class_Theme>` **get_theme** **(** **)**
  937. Changing this property replaces the current :ref:`Theme<class_Theme>` resource this node and all its **Control** children use.
  938. .. rst-class:: classref-item-separator
  939. ----
  940. .. _class_Control_property_theme_type_variation:
  941. .. rst-class:: classref-property
  942. :ref:`String<class_String>` **theme_type_variation** = ``""``
  943. .. rst-class:: classref-property-setget
  944. - void **set_theme_type_variation** **(** :ref:`String<class_String>` value **)**
  945. - :ref:`String<class_String>` **get_theme_type_variation** **(** **)**
  946. 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).
  947. 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.
  948. \ **Note:** To look up **Control**'s own items use various ``get_*`` methods without specifying ``theme_type``.
  949. \ **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.
  950. .. rst-class:: classref-section-separator
  951. ----
  952. .. rst-class:: classref-descriptions-group
  953. Method Descriptions
  954. -------------------
  955. .. _class_Control_method__clips_input:
  956. .. rst-class:: classref-method
  957. :ref:`bool<class_bool>` **_clips_input** **(** **)** |virtual|
  958. Virtual method to be implemented by the user. Returns whether :ref:`_gui_input<class_Control_method__gui_input>` should not be called for children controls outside this control's rectangle. Input will be clipped to the Rect of this **Control**. Similar to :ref:`rect_clip_content<class_Control_property_rect_clip_content>`, but doesn't affect visibility.
  959. If not overridden, defaults to ``false``.
  960. .. rst-class:: classref-item-separator
  961. ----
  962. .. _class_Control_method__get_minimum_size:
  963. .. rst-class:: classref-method
  964. :ref:`Vector2<class_Vector2>` **_get_minimum_size** **(** **)** |virtual|
  965. Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to :ref:`rect_min_size<class_Control_property_rect_min_size>` for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately).
  966. If not overridden, defaults to :ref:`Vector2.ZERO<class_Vector2_constant_ZERO>`.
  967. \ **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.
  968. .. rst-class:: classref-item-separator
  969. ----
  970. .. _class_Control_method__gui_input:
  971. .. rst-class:: classref-method
  972. void **_gui_input** **(** :ref:`InputEvent<class_InputEvent>` event **)** |virtual|
  973. 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>`.
  974. Example: clicking a control.
  975. ::
  976. func _gui_input(event):
  977. if event is InputEventMouseButton:
  978. if event.button_index == BUTTON_LEFT and event.pressed:
  979. print("I've been clicked D:")
  980. The event won't trigger if:
  981. \* clicking outside the control (see :ref:`has_point<class_Control_method_has_point>`);
  982. \* control has :ref:`mouse_filter<class_Control_property_mouse_filter>` set to :ref:`MOUSE_FILTER_IGNORE<class_Control_constant_MOUSE_FILTER_IGNORE>`;
  983. \* 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>`;
  984. \* 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;
  985. \* it happens outside the parent's rectangle and the parent has either :ref:`rect_clip_content<class_Control_property_rect_clip_content>` or :ref:`_clips_input<class_Control_method__clips_input>` enabled.
  986. \ **Note:** Event position is relative to the control origin.
  987. .. rst-class:: classref-item-separator
  988. ----
  989. .. _class_Control_method__make_custom_tooltip:
  990. .. rst-class:: classref-method
  991. :ref:`Control<class_Control>` **_make_custom_tooltip** **(** :ref:`String<class_String>` for_text **)** |virtual|
  992. 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:`hint_tooltip<class_Control_property_hint_tooltip>` property.
  993. 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.
  994. 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:`hint_tooltip<class_Control_property_hint_tooltip>` for an example).
  995. \ **Note:** The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its :ref:`rect_min_size<class_Control_property_rect_min_size>` to some non-zero value.
  996. Example of usage with a custom-constructed node:
  997. ::
  998. func _make_custom_tooltip(for_text):
  999. var label = Label.new()
  1000. label.text = for_text
  1001. return label
  1002. Example of usage with a custom scene instance:
  1003. ::
  1004. func _make_custom_tooltip(for_text):
  1005. var tooltip = preload("res://SomeTooltipScene.tscn").instance()
  1006. tooltip.get_node("Label").text = for_text
  1007. return tooltip
  1008. .. rst-class:: classref-item-separator
  1009. ----
  1010. .. _class_Control_method_accept_event:
  1011. .. rst-class:: classref-method
  1012. void **accept_event** **(** **)**
  1013. Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to :ref:`Node._unhandled_input<class_Node_method__unhandled_input>` or :ref:`Node._unhandled_key_input<class_Node_method__unhandled_key_input>`.
  1014. .. rst-class:: classref-item-separator
  1015. ----
  1016. .. _class_Control_method_add_color_override:
  1017. .. rst-class:: classref-method
  1018. void **add_color_override** **(** :ref:`String<class_String>` name, :ref:`Color<class_Color>` color **)**
  1019. 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.
  1020. See also :ref:`get_color<class_Control_method_get_color>`, :ref:`remove_color_override<class_Control_method_remove_color_override>`.
  1021. \ **Example of overriding a label's color and resetting it later:**\
  1022. ::
  1023. # Given the child Label node "MyLabel", override its font color with a custom value.
  1024. $MyLabel.add_color_override("font_color", Color(1, 0.5, 0))
  1025. # Reset the font color of the child label.
  1026. $MyLabel.add_color_override("font_color", get_color("font_color", "Label"))
  1027. .. rst-class:: classref-item-separator
  1028. ----
  1029. .. _class_Control_method_add_constant_override:
  1030. .. rst-class:: classref-method
  1031. void **add_constant_override** **(** :ref:`String<class_String>` name, :ref:`int<class_int>` constant **)**
  1032. Creates a local override for a theme constant with the specified ``name``. Local overrides always take precedence when fetching theme items for the control.
  1033. See also :ref:`get_constant<class_Control_method_get_constant>`, :ref:`remove_constant_override<class_Control_method_remove_constant_override>`.
  1034. .. rst-class:: classref-item-separator
  1035. ----
  1036. .. _class_Control_method_add_font_override:
  1037. .. rst-class:: classref-method
  1038. void **add_font_override** **(** :ref:`String<class_String>` name, :ref:`Font<class_Font>` font **)**
  1039. 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.
  1040. \ **Note:** An override can be removed by assigning it a ``null`` value. This behavior is deprecated and will be removed in 4.0, use :ref:`remove_font_override<class_Control_method_remove_font_override>` instead.
  1041. See also :ref:`get_font<class_Control_method_get_font>`.
  1042. .. rst-class:: classref-item-separator
  1043. ----
  1044. .. _class_Control_method_add_icon_override:
  1045. .. rst-class:: classref-method
  1046. void **add_icon_override** **(** :ref:`String<class_String>` name, :ref:`Texture<class_Texture>` texture **)**
  1047. Creates a local override for a theme icon with the specified ``name``. Local overrides always take precedence when fetching theme items for the control.
  1048. \ **Note:** An override can be removed by assigning it a ``null`` value. This behavior is deprecated and will be removed in 4.0, use :ref:`remove_icon_override<class_Control_method_remove_icon_override>` instead.
  1049. See also :ref:`get_icon<class_Control_method_get_icon>`.
  1050. .. rst-class:: classref-item-separator
  1051. ----
  1052. .. _class_Control_method_add_shader_override:
  1053. .. rst-class:: classref-method
  1054. void **add_shader_override** **(** :ref:`String<class_String>` name, :ref:`Shader<class_Shader>` shader **)**
  1055. Creates a local override for a theme shader with the specified ``name``. Local overrides always take precedence when fetching theme items for the control.
  1056. \ **Note:** An override can be removed by assigning it a ``null`` value. This behavior is deprecated and will be removed in 4.0, use :ref:`remove_shader_override<class_Control_method_remove_shader_override>` instead.
  1057. .. rst-class:: classref-item-separator
  1058. ----
  1059. .. _class_Control_method_add_stylebox_override:
  1060. .. rst-class:: classref-method
  1061. void **add_stylebox_override** **(** :ref:`String<class_String>` name, :ref:`StyleBox<class_StyleBox>` stylebox **)**
  1062. 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.
  1063. \ **Note:** An override can be removed by assigning it a ``null`` value. This behavior is deprecated and will be removed in 4.0, use :ref:`remove_stylebox_override<class_Control_method_remove_stylebox_override>` instead.
  1064. See also :ref:`get_stylebox<class_Control_method_get_stylebox>`.
  1065. \ **Example of modifying a property in a StyleBox by duplicating it:**\
  1066. ::
  1067. # The snippet below assumes the child node MyButton has a StyleBoxFlat assigned.
  1068. # Resources are shared across instances, so we need to duplicate it
  1069. # to avoid modifying the appearance of all other buttons.
  1070. var new_stylebox_normal = $MyButton.get_stylebox("normal").duplicate()
  1071. new_stylebox_normal.border_width_top = 3
  1072. new_stylebox_normal.border_color = Color(0, 1, 0.5)
  1073. $MyButton.add_stylebox_override("normal", new_stylebox_normal)
  1074. # Remove the stylebox override.
  1075. $MyButton.add_stylebox_override("normal", null)
  1076. .. rst-class:: classref-item-separator
  1077. ----
  1078. .. _class_Control_method_can_drop_data:
  1079. .. rst-class:: classref-method
  1080. :ref:`bool<class_bool>` **can_drop_data** **(** :ref:`Vector2<class_Vector2>` position, :ref:`Variant<class_Variant>` data **)** |virtual|
  1081. Godot calls this method to test if ``data`` from a control's :ref:`get_drag_data<class_Control_method_get_drag_data>` can be dropped at ``position``. ``position`` is local to this control.
  1082. This method should only be used to test the data. Process the data in :ref:`drop_data<class_Control_method_drop_data>`.
  1083. ::
  1084. func can_drop_data(position, data):
  1085. # Check position if it is relevant to you
  1086. # Otherwise, just check data
  1087. return typeof(data) == TYPE_DICTIONARY and data.has("expected")
  1088. .. rst-class:: classref-item-separator
  1089. ----
  1090. .. _class_Control_method_drop_data:
  1091. .. rst-class:: classref-method
  1092. void **drop_data** **(** :ref:`Vector2<class_Vector2>` position, :ref:`Variant<class_Variant>` data **)** |virtual|
  1093. Godot calls this method to pass you the ``data`` from a control's :ref:`get_drag_data<class_Control_method_get_drag_data>` result. Godot first calls :ref:`can_drop_data<class_Control_method_can_drop_data>` to test if ``data`` is allowed to drop at ``position`` where ``position`` is local to this control.
  1094. ::
  1095. func can_drop_data(position, data):
  1096. return typeof(data) == TYPE_DICTIONARY and data.has("color")
  1097. func drop_data(position, data):
  1098. color = data["color"]
  1099. .. rst-class:: classref-item-separator
  1100. ----
  1101. .. _class_Control_method_find_next_valid_focus:
  1102. .. rst-class:: classref-method
  1103. :ref:`Control<class_Control>` **find_next_valid_focus** **(** **)** |const|
  1104. Finds the next (below in the tree) **Control** that can receive the focus.
  1105. .. rst-class:: classref-item-separator
  1106. ----
  1107. .. _class_Control_method_find_prev_valid_focus:
  1108. .. rst-class:: classref-method
  1109. :ref:`Control<class_Control>` **find_prev_valid_focus** **(** **)** |const|
  1110. Finds the previous (above in the tree) **Control** that can receive the focus.
  1111. .. rst-class:: classref-item-separator
  1112. ----
  1113. .. _class_Control_method_force_drag:
  1114. .. rst-class:: classref-method
  1115. void **force_drag** **(** :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` preview **)**
  1116. Forces drag and bypasses :ref:`get_drag_data<class_Control_method_get_drag_data>` and :ref:`set_drag_preview<class_Control_method_set_drag_preview>` by passing ``data`` and ``preview``. Drag will start even if the mouse is neither over nor pressed on this control.
  1117. The methods :ref:`can_drop_data<class_Control_method_can_drop_data>` and :ref:`drop_data<class_Control_method_drop_data>` must be implemented on controls that want to receive drop data.
  1118. .. rst-class:: classref-item-separator
  1119. ----
  1120. .. _class_Control_method_get_anchor:
  1121. .. rst-class:: classref-method
  1122. :ref:`float<class_float>` **get_anchor** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  1123. Returns the anchor identified by ``margin`` constant from :ref:`Margin<enum_@GlobalScope_Margin>` enum. 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>`.
  1124. .. rst-class:: classref-item-separator
  1125. ----
  1126. .. _class_Control_method_get_begin:
  1127. .. rst-class:: classref-method
  1128. :ref:`Vector2<class_Vector2>` **get_begin** **(** **)** |const|
  1129. Returns :ref:`margin_left<class_Control_property_margin_left>` and :ref:`margin_top<class_Control_property_margin_top>`. See also :ref:`rect_position<class_Control_property_rect_position>`.
  1130. .. rst-class:: classref-item-separator
  1131. ----
  1132. .. _class_Control_method_get_color:
  1133. .. rst-class:: classref-method
  1134. :ref:`Color<class_Color>` **get_color** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1135. 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.
  1136. For the current control its local overrides are considered first (see :ref:`add_color_override<class_Control_method_add_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, a 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.
  1137. ::
  1138. func _ready():
  1139. # Get the font color defined for the current Control's class, if it exists.
  1140. modulate = get_color("font_color")
  1141. # Get the font color defined for the Button class.
  1142. modulate = get_color("font_color", "Button")
  1143. .. rst-class:: classref-item-separator
  1144. ----
  1145. .. _class_Control_method_get_combined_minimum_size:
  1146. .. rst-class:: classref-method
  1147. :ref:`Vector2<class_Vector2>` **get_combined_minimum_size** **(** **)** |const|
  1148. Returns combined minimum size from :ref:`rect_min_size<class_Control_property_rect_min_size>` and :ref:`get_minimum_size<class_Control_method_get_minimum_size>`.
  1149. .. rst-class:: classref-item-separator
  1150. ----
  1151. .. _class_Control_method_get_constant:
  1152. .. rst-class:: classref-method
  1153. :ref:`int<class_int>` **get_constant** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1154. 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``.
  1155. See :ref:`get_color<class_Control_method_get_color>` for details.
  1156. .. rst-class:: classref-item-separator
  1157. ----
  1158. .. _class_Control_method_get_cursor_shape:
  1159. .. rst-class:: classref-method
  1160. :ref:`CursorShape<enum_Control_CursorShape>` **get_cursor_shape** **(** :ref:`Vector2<class_Vector2>` position=Vector2( 0, 0 ) **)** |const|
  1161. Returns the mouse cursor shape the control displays on mouse hover. See :ref:`CursorShape<enum_Control_CursorShape>`.
  1162. .. rst-class:: classref-item-separator
  1163. ----
  1164. .. _class_Control_method_get_drag_data:
  1165. .. rst-class:: classref-method
  1166. :ref:`Variant<class_Variant>` **get_drag_data** **(** :ref:`Vector2<class_Vector2>` position **)** |virtual|
  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_method_can_drop_data>` and :ref:`drop_data<class_Control_method_drop_data>`. ``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. ::
  1170. func get_drag_data(position):
  1171. var mydata = make_data()
  1172. set_drag_preview(make_preview(mydata))
  1173. return mydata
  1174. .. rst-class:: classref-item-separator
  1175. ----
  1176. .. _class_Control_method_get_end:
  1177. .. rst-class:: classref-method
  1178. :ref:`Vector2<class_Vector2>` **get_end** **(** **)** |const|
  1179. Returns :ref:`margin_right<class_Control_property_margin_right>` and :ref:`margin_bottom<class_Control_property_margin_bottom>`.
  1180. .. rst-class:: classref-item-separator
  1181. ----
  1182. .. _class_Control_method_get_focus_neighbour:
  1183. .. rst-class:: classref-method
  1184. :ref:`NodePath<class_NodePath>` **get_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  1185. Returns the focus neighbour identified by ``margin`` constant from :ref:`Margin<enum_@GlobalScope_Margin>` enum. A getter method for :ref:`focus_neighbour_bottom<class_Control_property_focus_neighbour_bottom>`, :ref:`focus_neighbour_left<class_Control_property_focus_neighbour_left>`, :ref:`focus_neighbour_right<class_Control_property_focus_neighbour_right>` and :ref:`focus_neighbour_top<class_Control_property_focus_neighbour_top>`.
  1186. .. rst-class:: classref-item-separator
  1187. ----
  1188. .. _class_Control_method_get_focus_owner:
  1189. .. rst-class:: classref-method
  1190. :ref:`Control<class_Control>` **get_focus_owner** **(** **)** |const|
  1191. Returns the control that has the keyboard focus or ``null`` if none.
  1192. .. rst-class:: classref-item-separator
  1193. ----
  1194. .. _class_Control_method_get_font:
  1195. .. rst-class:: classref-method
  1196. :ref:`Font<class_Font>` **get_font** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1197. 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``.
  1198. See :ref:`get_color<class_Control_method_get_color>` for details.
  1199. .. rst-class:: classref-item-separator
  1200. ----
  1201. .. _class_Control_method_get_global_rect:
  1202. .. rst-class:: classref-method
  1203. :ref:`Rect2<class_Rect2>` **get_global_rect** **(** **)** |const|
  1204. Returns the position and size of the control relative to the top-left corner of the screen. See :ref:`rect_position<class_Control_property_rect_position>` and :ref:`rect_size<class_Control_property_rect_size>`.
  1205. .. rst-class:: classref-item-separator
  1206. ----
  1207. .. _class_Control_method_get_icon:
  1208. .. rst-class:: classref-method
  1209. :ref:`Texture<class_Texture>` **get_icon** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1210. 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``.
  1211. See :ref:`get_color<class_Control_method_get_color>` for details.
  1212. .. rst-class:: classref-item-separator
  1213. ----
  1214. .. _class_Control_method_get_margin:
  1215. .. rst-class:: classref-method
  1216. :ref:`float<class_float>` **get_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  1217. Returns the anchor identified by ``margin`` constant from :ref:`Margin<enum_@GlobalScope_Margin>` enum. A getter method for :ref:`margin_bottom<class_Control_property_margin_bottom>`, :ref:`margin_left<class_Control_property_margin_left>`, :ref:`margin_right<class_Control_property_margin_right>` and :ref:`margin_top<class_Control_property_margin_top>`.
  1218. .. rst-class:: classref-item-separator
  1219. ----
  1220. .. _class_Control_method_get_minimum_size:
  1221. .. rst-class:: classref-method
  1222. :ref:`Vector2<class_Vector2>` **get_minimum_size** **(** **)** |const|
  1223. Returns the minimum size for this control. See :ref:`rect_min_size<class_Control_property_rect_min_size>`.
  1224. .. rst-class:: classref-item-separator
  1225. ----
  1226. .. _class_Control_method_get_parent_area_size:
  1227. .. rst-class:: classref-method
  1228. :ref:`Vector2<class_Vector2>` **get_parent_area_size** **(** **)** |const|
  1229. Returns the width/height occupied in the parent control.
  1230. .. rst-class:: classref-item-separator
  1231. ----
  1232. .. _class_Control_method_get_parent_control:
  1233. .. rst-class:: classref-method
  1234. :ref:`Control<class_Control>` **get_parent_control** **(** **)** |const|
  1235. Returns the parent control node.
  1236. .. rst-class:: classref-item-separator
  1237. ----
  1238. .. _class_Control_method_get_rect:
  1239. .. rst-class:: classref-method
  1240. :ref:`Rect2<class_Rect2>` **get_rect** **(** **)** |const|
  1241. Returns the position and size of the control relative to the top-left corner of the parent Control. See :ref:`rect_position<class_Control_property_rect_position>` and :ref:`rect_size<class_Control_property_rect_size>`.
  1242. .. rst-class:: classref-item-separator
  1243. ----
  1244. .. _class_Control_method_get_rotation:
  1245. .. rst-class:: classref-method
  1246. :ref:`float<class_float>` **get_rotation** **(** **)** |const|
  1247. Returns the rotation (in radians).
  1248. .. rst-class:: classref-item-separator
  1249. ----
  1250. .. _class_Control_method_get_stylebox:
  1251. .. rst-class:: classref-method
  1252. :ref:`StyleBox<class_StyleBox>` **get_stylebox** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1253. 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``.
  1254. See :ref:`get_color<class_Control_method_get_color>` for details.
  1255. .. rst-class:: classref-item-separator
  1256. ----
  1257. .. _class_Control_method_get_theme_default_font:
  1258. .. rst-class:: classref-method
  1259. :ref:`Font<class_Font>` **get_theme_default_font** **(** **)** |const|
  1260. 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.
  1261. See :ref:`get_color<class_Control_method_get_color>` for details.
  1262. .. rst-class:: classref-item-separator
  1263. ----
  1264. .. _class_Control_method_get_tooltip:
  1265. .. rst-class:: classref-method
  1266. :ref:`String<class_String>` **get_tooltip** **(** :ref:`Vector2<class_Vector2>` at_position=Vector2( 0, 0 ) **)** |const|
  1267. Returns the tooltip, which will appear when the cursor is resting over this control. See :ref:`hint_tooltip<class_Control_property_hint_tooltip>`.
  1268. .. rst-class:: classref-item-separator
  1269. ----
  1270. .. _class_Control_method_grab_click_focus:
  1271. .. rst-class:: classref-method
  1272. void **grab_click_focus** **(** **)**
  1273. Creates an :ref:`InputEventMouseButton<class_InputEventMouseButton>` that attempts to click the control. If the event is received, the control acquires focus.
  1274. ::
  1275. func _process(delta):
  1276. grab_click_focus() #when clicking another Control node, this node will be clicked instead
  1277. .. rst-class:: classref-item-separator
  1278. ----
  1279. .. _class_Control_method_grab_focus:
  1280. .. rst-class:: classref-method
  1281. void **grab_focus** **(** **)**
  1282. Steal the focus from another control and become the focused control (see :ref:`focus_mode<class_Control_property_focus_mode>`).
  1283. \ **Note**: Using this method together with :ref:`Object.call_deferred<class_Object_method_call_deferred>` makes it more reliable, especially when called inside :ref:`Node._ready<class_Node_method__ready>`.
  1284. .. rst-class:: classref-item-separator
  1285. ----
  1286. .. _class_Control_method_has_color:
  1287. .. rst-class:: classref-method
  1288. :ref:`bool<class_bool>` **has_color** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1289. 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``.
  1290. See :ref:`get_color<class_Control_method_get_color>` for details.
  1291. .. rst-class:: classref-item-separator
  1292. ----
  1293. .. _class_Control_method_has_color_override:
  1294. .. rst-class:: classref-method
  1295. :ref:`bool<class_bool>` **has_color_override** **(** :ref:`String<class_String>` name **)** |const|
  1296. Returns ``true`` if there is a local override for a theme :ref:`Color<class_Color>` with the specified ``name`` in this **Control** node.
  1297. See :ref:`add_color_override<class_Control_method_add_color_override>`.
  1298. .. rst-class:: classref-item-separator
  1299. ----
  1300. .. _class_Control_method_has_constant:
  1301. .. rst-class:: classref-method
  1302. :ref:`bool<class_bool>` **has_constant** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1303. 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``.
  1304. See :ref:`get_color<class_Control_method_get_color>` for details.
  1305. .. rst-class:: classref-item-separator
  1306. ----
  1307. .. _class_Control_method_has_constant_override:
  1308. .. rst-class:: classref-method
  1309. :ref:`bool<class_bool>` **has_constant_override** **(** :ref:`String<class_String>` name **)** |const|
  1310. Returns ``true`` if there is a local override for a theme constant with the specified ``name`` in this **Control** node.
  1311. See :ref:`add_constant_override<class_Control_method_add_constant_override>`.
  1312. .. rst-class:: classref-item-separator
  1313. ----
  1314. .. _class_Control_method_has_focus:
  1315. .. rst-class:: classref-method
  1316. :ref:`bool<class_bool>` **has_focus** **(** **)** |const|
  1317. Returns ``true`` if this is the current focused control. See :ref:`focus_mode<class_Control_property_focus_mode>`.
  1318. .. rst-class:: classref-item-separator
  1319. ----
  1320. .. _class_Control_method_has_font:
  1321. .. rst-class:: classref-method
  1322. :ref:`bool<class_bool>` **has_font** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1323. 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``.
  1324. See :ref:`get_color<class_Control_method_get_color>` for details.
  1325. .. rst-class:: classref-item-separator
  1326. ----
  1327. .. _class_Control_method_has_font_override:
  1328. .. rst-class:: classref-method
  1329. :ref:`bool<class_bool>` **has_font_override** **(** :ref:`String<class_String>` name **)** |const|
  1330. Returns ``true`` if there is a local override for a theme :ref:`Font<class_Font>` with the specified ``name`` in this **Control** node.
  1331. See :ref:`add_font_override<class_Control_method_add_font_override>`.
  1332. .. rst-class:: classref-item-separator
  1333. ----
  1334. .. _class_Control_method_has_icon:
  1335. .. rst-class:: classref-method
  1336. :ref:`bool<class_bool>` **has_icon** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1337. 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``.
  1338. See :ref:`get_color<class_Control_method_get_color>` for details.
  1339. .. rst-class:: classref-item-separator
  1340. ----
  1341. .. _class_Control_method_has_icon_override:
  1342. .. rst-class:: classref-method
  1343. :ref:`bool<class_bool>` **has_icon_override** **(** :ref:`String<class_String>` name **)** |const|
  1344. Returns ``true`` if there is a local override for a theme icon with the specified ``name`` in this **Control** node.
  1345. See :ref:`add_icon_override<class_Control_method_add_icon_override>`.
  1346. .. rst-class:: classref-item-separator
  1347. ----
  1348. .. _class_Control_method_has_point:
  1349. .. rst-class:: classref-method
  1350. :ref:`bool<class_bool>` **has_point** **(** :ref:`Vector2<class_Vector2>` point **)** |virtual|
  1351. Virtual method to be implemented by the user. Returns whether the given ``point`` is inside this control.
  1352. If not overridden, default behavior is checking if the point is within control's Rect.
  1353. \ **Note:** If you want to check if a point is inside the control, you can use ``get_rect().has_point(point)``.
  1354. .. rst-class:: classref-item-separator
  1355. ----
  1356. .. _class_Control_method_has_shader_override:
  1357. .. rst-class:: classref-method
  1358. :ref:`bool<class_bool>` **has_shader_override** **(** :ref:`String<class_String>` name **)** |const|
  1359. Returns ``true`` if there is a local override for a theme shader with the specified ``name`` in this **Control** node.
  1360. See :ref:`add_shader_override<class_Control_method_add_shader_override>`.
  1361. .. rst-class:: classref-item-separator
  1362. ----
  1363. .. _class_Control_method_has_stylebox:
  1364. .. rst-class:: classref-method
  1365. :ref:`bool<class_bool>` **has_stylebox** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` theme_type="" **)** |const|
  1366. 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``.
  1367. See :ref:`get_color<class_Control_method_get_color>` for details.
  1368. .. rst-class:: classref-item-separator
  1369. ----
  1370. .. _class_Control_method_has_stylebox_override:
  1371. .. rst-class:: classref-method
  1372. :ref:`bool<class_bool>` **has_stylebox_override** **(** :ref:`String<class_String>` name **)** |const|
  1373. Returns ``true`` if there is a local override for a theme :ref:`StyleBox<class_StyleBox>` with the specified ``name`` in this **Control** node.
  1374. See :ref:`add_stylebox_override<class_Control_method_add_stylebox_override>`.
  1375. .. rst-class:: classref-item-separator
  1376. ----
  1377. .. _class_Control_method_is_drag_successful:
  1378. .. rst-class:: classref-method
  1379. :ref:`bool<class_bool>` **is_drag_successful** **(** **)** |const|
  1380. Returns ``true`` if a drag operation is successful. Alternative to :ref:`Viewport.gui_is_drag_successful<class_Viewport_method_gui_is_drag_successful>`.
  1381. Best used with :ref:`Node.NOTIFICATION_DRAG_END<class_Node_constant_NOTIFICATION_DRAG_END>`.
  1382. .. rst-class:: classref-item-separator
  1383. ----
  1384. .. _class_Control_method_minimum_size_changed:
  1385. .. rst-class:: classref-method
  1386. void **minimum_size_changed** **(** **)**
  1387. Invalidates the size cache in this node and in parent nodes up to toplevel. Intended to be used with :ref:`get_minimum_size<class_Control_method_get_minimum_size>` when the return value is changed. Setting :ref:`rect_min_size<class_Control_property_rect_min_size>` directly calls this method automatically.
  1388. .. rst-class:: classref-item-separator
  1389. ----
  1390. .. _class_Control_method_release_focus:
  1391. .. rst-class:: classref-method
  1392. void **release_focus** **(** **)**
  1393. Give up the focus. No other control will be able to receive keyboard input.
  1394. .. rst-class:: classref-item-separator
  1395. ----
  1396. .. _class_Control_method_remove_color_override:
  1397. .. rst-class:: classref-method
  1398. void **remove_color_override** **(** :ref:`String<class_String>` name **)**
  1399. Removes a theme override for a :ref:`Color<class_Color>` with the given ``name``.
  1400. .. rst-class:: classref-item-separator
  1401. ----
  1402. .. _class_Control_method_remove_constant_override:
  1403. .. rst-class:: classref-method
  1404. void **remove_constant_override** **(** :ref:`String<class_String>` name **)**
  1405. Removes a theme override for a constant with the given ``name``.
  1406. .. rst-class:: classref-item-separator
  1407. ----
  1408. .. _class_Control_method_remove_font_override:
  1409. .. rst-class:: classref-method
  1410. void **remove_font_override** **(** :ref:`String<class_String>` name **)**
  1411. Removes a theme override for a :ref:`Font<class_Font>` with the given ``name``.
  1412. .. rst-class:: classref-item-separator
  1413. ----
  1414. .. _class_Control_method_remove_icon_override:
  1415. .. rst-class:: classref-method
  1416. void **remove_icon_override** **(** :ref:`String<class_String>` name **)**
  1417. Removes a theme override for an icon with the given ``name``.
  1418. .. rst-class:: classref-item-separator
  1419. ----
  1420. .. _class_Control_method_remove_shader_override:
  1421. .. rst-class:: classref-method
  1422. void **remove_shader_override** **(** :ref:`String<class_String>` name **)**
  1423. Removes a theme override for a shader with the given ``name``.
  1424. .. rst-class:: classref-item-separator
  1425. ----
  1426. .. _class_Control_method_remove_stylebox_override:
  1427. .. rst-class:: classref-method
  1428. void **remove_stylebox_override** **(** :ref:`String<class_String>` name **)**
  1429. Removes a theme override for a :ref:`StyleBox<class_StyleBox>` with the given ``name``.
  1430. .. rst-class:: classref-item-separator
  1431. ----
  1432. .. _class_Control_method_set_anchor:
  1433. .. rst-class:: classref-method
  1434. void **set_anchor** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` anchor, :ref:`bool<class_bool>` keep_margin=false, :ref:`bool<class_bool>` push_opposite_anchor=true **)**
  1435. Sets the anchor identified by ``margin`` constant from :ref:`Margin<enum_@GlobalScope_Margin>` enum to value ``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>`.
  1436. If ``keep_margin`` is ``true``, margins aren't updated after this operation.
  1437. 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.
  1438. .. rst-class:: classref-item-separator
  1439. ----
  1440. .. _class_Control_method_set_anchor_and_margin:
  1441. .. rst-class:: classref-method
  1442. void **set_anchor_and_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` anchor, :ref:`float<class_float>` offset, :ref:`bool<class_bool>` push_opposite_anchor=false **)**
  1443. Works the same as :ref:`set_anchor<class_Control_method_set_anchor>`, but instead of ``keep_margin`` argument and automatic update of margin, it allows to set the margin offset yourself (see :ref:`set_margin<class_Control_method_set_margin>`).
  1444. .. rst-class:: classref-item-separator
  1445. ----
  1446. .. _class_Control_method_set_anchors_and_margins_preset:
  1447. .. rst-class:: classref-method
  1448. void **set_anchors_and_margins_preset** **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)**
  1449. Sets both anchor preset and margin preset. See :ref:`set_anchors_preset<class_Control_method_set_anchors_preset>` and :ref:`set_margins_preset<class_Control_method_set_margins_preset>`.
  1450. .. rst-class:: classref-item-separator
  1451. ----
  1452. .. _class_Control_method_set_anchors_preset:
  1453. .. rst-class:: classref-method
  1454. void **set_anchors_preset** **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`bool<class_bool>` keep_margins=false **)**
  1455. 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.
  1456. If ``keep_margins`` is ``true``, control's position will also be updated.
  1457. .. rst-class:: classref-item-separator
  1458. ----
  1459. .. _class_Control_method_set_begin:
  1460. .. rst-class:: classref-method
  1461. void **set_begin** **(** :ref:`Vector2<class_Vector2>` position **)**
  1462. Sets :ref:`margin_left<class_Control_property_margin_left>` and :ref:`margin_top<class_Control_property_margin_top>` at the same time. Equivalent of changing :ref:`rect_position<class_Control_property_rect_position>`.
  1463. .. rst-class:: classref-item-separator
  1464. ----
  1465. .. _class_Control_method_set_drag_forwarding:
  1466. .. rst-class:: classref-method
  1467. void **set_drag_forwarding** **(** :ref:`Control<class_Control>` target **)**
  1468. Forwards the handling of this control's drag and drop to ``target`` control.
  1469. Forwarding can be implemented in the target control similar to the methods :ref:`get_drag_data<class_Control_method_get_drag_data>`, :ref:`can_drop_data<class_Control_method_can_drop_data>`, and :ref:`drop_data<class_Control_method_drop_data>` but with two differences:
  1470. 1. The function name must be suffixed with **_fw**\
  1471. 2. The function must take an extra argument that is the control doing the forwarding
  1472. ::
  1473. # ThisControl.gd
  1474. extends Control
  1475. func _ready():
  1476. set_drag_forwarding(target_control)
  1477. # TargetControl.gd
  1478. extends Control
  1479. func can_drop_data_fw(position, data, from_control):
  1480. return true
  1481. func drop_data_fw(position, data, from_control):
  1482. my_handle_data(data)
  1483. func get_drag_data_fw(position, from_control):
  1484. set_drag_preview(my_preview)
  1485. return my_data()
  1486. .. rst-class:: classref-item-separator
  1487. ----
  1488. .. _class_Control_method_set_drag_preview:
  1489. .. rst-class:: classref-method
  1490. void **set_drag_preview** **(** :ref:`Control<class_Control>` control **)**
  1491. Shows the given control at the mouse pointer. A good time to call this method is in :ref:`get_drag_data<class_Control_method_get_drag_data>`. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended.
  1492. ::
  1493. export (Color, RGBA) var color = Color(1, 0, 0, 1)
  1494. func get_drag_data(position):
  1495. # Use a control that is not in the tree
  1496. var cpb = ColorPickerButton.new()
  1497. cpb.color = color
  1498. cpb.rect_size = Vector2(50, 50)
  1499. set_drag_preview(cpb)
  1500. return color
  1501. .. rst-class:: classref-item-separator
  1502. ----
  1503. .. _class_Control_method_set_end:
  1504. .. rst-class:: classref-method
  1505. void **set_end** **(** :ref:`Vector2<class_Vector2>` position **)**
  1506. Sets :ref:`margin_right<class_Control_property_margin_right>` and :ref:`margin_bottom<class_Control_property_margin_bottom>` at the same time.
  1507. .. rst-class:: classref-item-separator
  1508. ----
  1509. .. _class_Control_method_set_focus_neighbour:
  1510. .. rst-class:: classref-method
  1511. void **set_focus_neighbour** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`NodePath<class_NodePath>` neighbour **)**
  1512. Sets the anchor identified by ``margin`` constant from :ref:`Margin<enum_@GlobalScope_Margin>` enum to **Control** at ``neighbor`` node path. A setter method for :ref:`focus_neighbour_bottom<class_Control_property_focus_neighbour_bottom>`, :ref:`focus_neighbour_left<class_Control_property_focus_neighbour_left>`, :ref:`focus_neighbour_right<class_Control_property_focus_neighbour_right>` and :ref:`focus_neighbour_top<class_Control_property_focus_neighbour_top>`.
  1513. .. rst-class:: classref-item-separator
  1514. ----
  1515. .. _class_Control_method_set_global_position:
  1516. .. rst-class:: classref-method
  1517. void **set_global_position** **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_margins=false **)**
  1518. Sets the :ref:`rect_global_position<class_Control_property_rect_global_position>` to given ``position``.
  1519. If ``keep_margins`` is ``true``, control's anchors will be updated instead of margins.
  1520. .. rst-class:: classref-item-separator
  1521. ----
  1522. .. _class_Control_method_set_margin:
  1523. .. rst-class:: classref-method
  1524. void **set_margin** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` offset **)**
  1525. Sets the margin identified by ``margin`` constant from :ref:`Margin<enum_@GlobalScope_Margin>` enum to given ``offset``. A setter method for :ref:`margin_bottom<class_Control_property_margin_bottom>`, :ref:`margin_left<class_Control_property_margin_left>`, :ref:`margin_right<class_Control_property_margin_right>` and :ref:`margin_top<class_Control_property_margin_top>`.
  1526. .. rst-class:: classref-item-separator
  1527. ----
  1528. .. _class_Control_method_set_margins_preset:
  1529. .. rst-class:: classref-method
  1530. void **set_margins_preset** **(** :ref:`LayoutPreset<enum_Control_LayoutPreset>` preset, :ref:`LayoutPresetMode<enum_Control_LayoutPresetMode>` resize_mode=0, :ref:`int<class_int>` margin=0 **)**
  1531. Sets the margins to a ``preset`` from :ref:`LayoutPreset<enum_Control_LayoutPreset>` enum. This is the code equivalent to using the Layout menu in the 2D editor.
  1532. 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. ``PRESET_LEFT_WIDE``.
  1533. Use parameter ``margin`` to determine the gap between the **Control** and the edges.
  1534. .. rst-class:: classref-item-separator
  1535. ----
  1536. .. _class_Control_method_set_position:
  1537. .. rst-class:: classref-method
  1538. void **set_position** **(** :ref:`Vector2<class_Vector2>` position, :ref:`bool<class_bool>` keep_margins=false **)**
  1539. Sets the :ref:`rect_position<class_Control_property_rect_position>` to given ``position``.
  1540. If ``keep_margins`` is ``true``, control's anchors will be updated instead of margins.
  1541. .. rst-class:: classref-item-separator
  1542. ----
  1543. .. _class_Control_method_set_rotation:
  1544. .. rst-class:: classref-method
  1545. void **set_rotation** **(** :ref:`float<class_float>` radians **)**
  1546. Sets the rotation (in radians).
  1547. .. rst-class:: classref-item-separator
  1548. ----
  1549. .. _class_Control_method_set_size:
  1550. .. rst-class:: classref-method
  1551. void **set_size** **(** :ref:`Vector2<class_Vector2>` size, :ref:`bool<class_bool>` keep_margins=false **)**
  1552. Sets the size (see :ref:`rect_size<class_Control_property_rect_size>`).
  1553. If ``keep_margins`` is ``true``, control's anchors will be updated instead of margins.
  1554. .. rst-class:: classref-item-separator
  1555. ----
  1556. .. _class_Control_method_show_modal:
  1557. .. rst-class:: classref-method
  1558. void **show_modal** **(** :ref:`bool<class_bool>` exclusive=false **)**
  1559. Displays a control as modal. Control must be a subwindow. Modal controls capture the input signals until closed or the area outside them is accessed. When a modal control loses focus, or the ESC key is pressed, they automatically hide. Modal controls are used extensively for popup dialogs and menus.
  1560. If ``exclusive`` is ``true``, other controls will not receive input and clicking outside this control will not close it.
  1561. .. rst-class:: classref-item-separator
  1562. ----
  1563. .. _class_Control_method_warp_mouse:
  1564. .. rst-class:: classref-method
  1565. void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` to_position **)**
  1566. Moves the mouse cursor to ``to_position``, relative to :ref:`rect_position<class_Control_property_rect_position>` of this **Control**.
  1567. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1568. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1569. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1570. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`