class_window.rst 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Window.xml.
  6. .. _class_Window:
  7. Window
  8. ======
  9. **Inherits:** :ref:`Viewport<class_Viewport>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`AcceptDialog<class_AcceptDialog>`, :ref:`Popup<class_Popup>`
  11. Base class for all windows.
  12. Description
  13. -----------
  14. A node that creates a window. The window can either be a native system window or embedded inside another ``Window`` (see :ref:`Viewport.gui_embed_subwindows<class_Viewport_property_gui_embed_subwindows>`).
  15. At runtime, ``Window``\ s will not close automatically when requested. You need to handle it manually using :ref:`close_requested<class_Window_signal_close_requested>` (this applies both to clicking close button and clicking outside popup).
  16. Properties
  17. ----------
  18. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`always_on_top<class_Window_property_always_on_top>` | ``false`` |
  20. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`auto_translate<class_Window_property_auto_translate>` | ``true`` |
  22. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`borderless<class_Window_property_borderless>` | ``false`` |
  24. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  25. | :ref:`ContentScaleAspect<enum_Window_ContentScaleAspect>` | :ref:`content_scale_aspect<class_Window_property_content_scale_aspect>` | ``0`` |
  26. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  27. | :ref:`float<class_float>` | :ref:`content_scale_factor<class_Window_property_content_scale_factor>` | ``1.0`` |
  28. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  29. | :ref:`ContentScaleMode<enum_Window_ContentScaleMode>` | :ref:`content_scale_mode<class_Window_property_content_scale_mode>` | ``0`` |
  30. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  31. | :ref:`Vector2i<class_Vector2i>` | :ref:`content_scale_size<class_Window_property_content_scale_size>` | ``Vector2i(0, 0)`` |
  32. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  33. | :ref:`int<class_int>` | :ref:`current_screen<class_Window_property_current_screen>` | ``0`` |
  34. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`exclusive<class_Window_property_exclusive>` | ``false`` |
  36. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  37. | :ref:`Vector2i<class_Vector2i>` | :ref:`max_size<class_Window_property_max_size>` | ``Vector2i(0, 0)`` |
  38. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  39. | :ref:`Vector2i<class_Vector2i>` | :ref:`min_size<class_Window_property_min_size>` | ``Vector2i(0, 0)`` |
  40. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  41. | :ref:`Mode<enum_Window_Mode>` | :ref:`mode<class_Window_property_mode>` | ``0`` |
  42. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  43. | :ref:`bool<class_bool>` | :ref:`popup_window<class_Window_property_popup_window>` | ``false`` |
  44. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  45. | :ref:`Vector2i<class_Vector2i>` | :ref:`position<class_Window_property_position>` | ``Vector2i(0, 0)`` |
  46. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  47. | :ref:`Vector2i<class_Vector2i>` | :ref:`size<class_Window_property_size>` | ``Vector2i(100, 100)`` |
  48. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  49. | :ref:`Theme<class_Theme>` | :ref:`theme<class_Window_property_theme>` | |
  50. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  51. | :ref:`StringName<class_StringName>` | :ref:`theme_type_variation<class_Window_property_theme_type_variation>` | ``&""`` |
  52. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  53. | :ref:`String<class_String>` | :ref:`title<class_Window_property_title>` | ``""`` |
  54. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  55. | :ref:`bool<class_bool>` | :ref:`transient<class_Window_property_transient>` | ``false`` |
  56. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  57. | :ref:`bool<class_bool>` | :ref:`transparent<class_Window_property_transparent>` | ``false`` |
  58. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`unfocusable<class_Window_property_unfocusable>` | ``false`` |
  60. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`unresizable<class_Window_property_unresizable>` | ``false`` |
  62. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`visible<class_Window_property_visible>` | ``true`` |
  64. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`wrap_controls<class_Window_property_wrap_controls>` | ``false`` |
  66. +-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
  67. Methods
  68. -------
  69. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`bool<class_bool>` | :ref:`can_draw<class_Window_method_can_draw>` **(** **)** |const| |
  71. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | void | :ref:`child_controls_changed<class_Window_method_child_controls_changed>` **(** **)** |
  73. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Vector2<class_Vector2>` | :ref:`get_contents_minimum_size<class_Window_method_get_contents_minimum_size>` **(** **)** |const| |
  75. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`bool<class_bool>` | :ref:`get_flag<class_Window_method_get_flag>` **(** :ref:`Flags<enum_Window_Flags>` flag **)** |const| |
  77. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`LayoutDirection<enum_Window_LayoutDirection>` | :ref:`get_layout_direction<class_Window_method_get_layout_direction>` **(** **)** |const| |
  79. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_real_size<class_Window_method_get_real_size>` **(** **)** |const| |
  81. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`Color<class_Color>` | :ref:`get_theme_color<class_Window_method_get_theme_color>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  83. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`int<class_int>` | :ref:`get_theme_constant<class_Window_method_get_theme_constant>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  85. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`float<class_float>` | :ref:`get_theme_default_base_scale<class_Window_method_get_theme_default_base_scale>` **(** **)** |const| |
  87. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`Font<class_Font>` | :ref:`get_theme_default_font<class_Window_method_get_theme_default_font>` **(** **)** |const| |
  89. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`int<class_int>` | :ref:`get_theme_default_font_size<class_Window_method_get_theme_default_font_size>` **(** **)** |const| |
  91. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`Font<class_Font>` | :ref:`get_theme_font<class_Window_method_get_theme_font>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  93. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`int<class_int>` | :ref:`get_theme_font_size<class_Window_method_get_theme_font_size>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  95. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_theme_icon<class_Window_method_get_theme_icon>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  97. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`StyleBox<class_StyleBox>` | :ref:`get_theme_stylebox<class_Window_method_get_theme_stylebox>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  99. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`grab_focus<class_Window_method_grab_focus>` **(** **)** |
  101. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`bool<class_bool>` | :ref:`has_focus<class_Window_method_has_focus>` **(** **)** |const| |
  103. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`bool<class_bool>` | :ref:`has_theme_color<class_Window_method_has_theme_color>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  105. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`bool<class_bool>` | :ref:`has_theme_constant<class_Window_method_has_theme_constant>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  107. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :ref:`bool<class_bool>` | :ref:`has_theme_font<class_Window_method_has_theme_font>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  109. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`bool<class_bool>` | :ref:`has_theme_font_size<class_Window_method_has_theme_font_size>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  111. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`bool<class_bool>` | :ref:`has_theme_icon<class_Window_method_has_theme_icon>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  113. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`bool<class_bool>` | :ref:`has_theme_stylebox<class_Window_method_has_theme_stylebox>` **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const| |
  115. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`hide<class_Window_method_hide>` **(** **)** |
  117. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`bool<class_bool>` | :ref:`is_embedded<class_Window_method_is_embedded>` **(** **)** |const| |
  119. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`bool<class_bool>` | :ref:`is_layout_rtl<class_Window_method_is_layout_rtl>` **(** **)** |const| |
  121. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`bool<class_bool>` | :ref:`is_maximize_allowed<class_Window_method_is_maximize_allowed>` **(** **)** |const| |
  123. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | :ref:`bool<class_bool>` | :ref:`is_using_font_oversampling<class_Window_method_is_using_font_oversampling>` **(** **)** |const| |
  125. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`move_to_foreground<class_Window_method_move_to_foreground>` **(** **)** |
  127. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`popup<class_Window_method_popup>` **(** :ref:`Rect2i<class_Rect2i>` rect=Rect2i(0, 0, 0, 0) **)** |
  129. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | void | :ref:`popup_centered<class_Window_method_popup_centered>` **(** :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0) **)** |
  131. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | void | :ref:`popup_centered_clamped<class_Window_method_popup_centered_clamped>` **(** :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0), :ref:`float<class_float>` fallback_ratio=0.75 **)** |
  133. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | void | :ref:`popup_centered_ratio<class_Window_method_popup_centered_ratio>` **(** :ref:`float<class_float>` ratio=0.8 **)** |
  135. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | void | :ref:`popup_on_parent<class_Window_method_popup_on_parent>` **(** :ref:`Rect2i<class_Rect2i>` parent_rect **)** |
  137. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | void | :ref:`request_attention<class_Window_method_request_attention>` **(** **)** |
  139. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | void | :ref:`reset_size<class_Window_method_reset_size>` **(** **)** |
  141. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | void | :ref:`set_flag<class_Window_method_set_flag>` **(** :ref:`Flags<enum_Window_Flags>` flag, :ref:`bool<class_bool>` enabled **)** |
  143. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | void | :ref:`set_ime_active<class_Window_method_set_ime_active>` **(** :ref:`bool<class_bool>` active **)** |
  145. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | void | :ref:`set_ime_position<class_Window_method_set_ime_position>` **(** :ref:`Vector2i<class_Vector2i>` position **)** |
  147. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | void | :ref:`set_layout_direction<class_Window_method_set_layout_direction>` **(** :ref:`LayoutDirection<enum_Window_LayoutDirection>` direction **)** |
  149. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | void | :ref:`set_use_font_oversampling<class_Window_method_set_use_font_oversampling>` **(** :ref:`bool<class_bool>` enable **)** |
  151. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | void | :ref:`show<class_Window_method_show>` **(** **)** |
  153. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. Theme Properties
  155. ----------------
  156. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  157. | :ref:`Color<class_Color>` | :ref:`title_color<class_Window_theme_color_title_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  158. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  159. | :ref:`Color<class_Color>` | :ref:`title_outline_modulate<class_Window_theme_color_title_outline_modulate>` | ``Color(1, 1, 1, 1)`` |
  160. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  161. | :ref:`int<class_int>` | :ref:`close_h_offset<class_Window_theme_constant_close_h_offset>` | ``18`` |
  162. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  163. | :ref:`int<class_int>` | :ref:`close_v_offset<class_Window_theme_constant_close_v_offset>` | ``24`` |
  164. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  165. | :ref:`int<class_int>` | :ref:`resize_margin<class_Window_theme_constant_resize_margin>` | ``4`` |
  166. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  167. | :ref:`int<class_int>` | :ref:`title_height<class_Window_theme_constant_title_height>` | ``36`` |
  168. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  169. | :ref:`int<class_int>` | :ref:`title_outline_size<class_Window_theme_constant_title_outline_size>` | ``0`` |
  170. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  171. | :ref:`Font<class_Font>` | :ref:`title_font<class_Window_theme_font_title_font>` | |
  172. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  173. | :ref:`int<class_int>` | :ref:`title_font_size<class_Window_theme_font_size_title_font_size>` | |
  174. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  175. | :ref:`Texture2D<class_Texture2D>` | :ref:`close<class_Window_theme_icon_close>` | |
  176. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  177. | :ref:`Texture2D<class_Texture2D>` | :ref:`close_pressed<class_Window_theme_icon_close_pressed>` | |
  178. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  179. | :ref:`StyleBox<class_StyleBox>` | :ref:`embedded_border<class_Window_theme_style_embedded_border>` | |
  180. +-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
  181. Signals
  182. -------
  183. .. _class_Window_signal_about_to_popup:
  184. - **about_to_popup** **(** **)**
  185. Emitted right after :ref:`popup<class_Window_method_popup>` call, before the ``Window`` appears or does anything.
  186. ----
  187. .. _class_Window_signal_close_requested:
  188. - **close_requested** **(** **)**
  189. Emitted when the ``Window``'s close button is pressed or when :ref:`popup_window<class_Window_property_popup_window>` is enabled and user clicks outside the window.
  190. This signal can be used to handle window closing, e.g. by connecting it to :ref:`hide<class_Window_method_hide>`.
  191. ----
  192. .. _class_Window_signal_files_dropped:
  193. - **files_dropped** **(** :ref:`PackedStringArray<class_PackedStringArray>` files **)**
  194. Emitted when files are dragged from the OS file manager and dropped in the game window. The argument is a list of file paths.
  195. Note that this method only works with non-embedded windows, i.e. the main window and ``Window``-derived nodes when :ref:`Viewport.gui_embed_subwindows<class_Viewport_property_gui_embed_subwindows>` is disabled in the main viewport.
  196. Example usage:
  197. ::
  198. func _ready():
  199. get_viewport().files_dropped.connect(on_files_dropped)
  200. func on_files_dropped(files):
  201. print(files)
  202. ----
  203. .. _class_Window_signal_focus_entered:
  204. - **focus_entered** **(** **)**
  205. Emitted when the ``Window`` gains focus.
  206. ----
  207. .. _class_Window_signal_focus_exited:
  208. - **focus_exited** **(** **)**
  209. Emitted when the ``Window`` loses its focus.
  210. ----
  211. .. _class_Window_signal_go_back_requested:
  212. - **go_back_requested** **(** **)**
  213. Emitted when a go back request is sent (e.g. pressing the "Back" button on Android), right after :ref:`Node.NOTIFICATION_WM_GO_BACK_REQUEST<class_Node_constant_NOTIFICATION_WM_GO_BACK_REQUEST>`.
  214. ----
  215. .. _class_Window_signal_mouse_entered:
  216. - **mouse_entered** **(** **)**
  217. Emitted when the mouse cursor enters the ``Window``'s area, regardless if it's currently focused or not.
  218. ----
  219. .. _class_Window_signal_mouse_exited:
  220. - **mouse_exited** **(** **)**
  221. Emitted when the mouse cursor exits the ``Window``'s area (including when it's hovered over another window on top of this one).
  222. ----
  223. .. _class_Window_signal_theme_changed:
  224. - **theme_changed** **(** **)**
  225. Emitted when the :ref:`theme<class_Window_property_theme>` is modified or changed to another :ref:`Theme<class_Theme>`.
  226. ----
  227. .. _class_Window_signal_visibility_changed:
  228. - **visibility_changed** **(** **)**
  229. Emitted when ``Window`` is made visible or disappears.
  230. ----
  231. .. _class_Window_signal_window_input:
  232. - **window_input** **(** :ref:`InputEvent<class_InputEvent>` event **)**
  233. Emitted when the ``Window`` is currently focused and receives any input, passing the received event as an argument.
  234. Enumerations
  235. ------------
  236. .. _enum_Window_Mode:
  237. .. _class_Window_constant_MODE_WINDOWED:
  238. .. _class_Window_constant_MODE_MINIMIZED:
  239. .. _class_Window_constant_MODE_MAXIMIZED:
  240. .. _class_Window_constant_MODE_FULLSCREEN:
  241. .. _class_Window_constant_MODE_EXCLUSIVE_FULLSCREEN:
  242. enum **Mode**:
  243. - **MODE_WINDOWED** = **0** --- Windowed mode, i.e. ``Window`` doesn't occupy whole screen (unless set to the size of the screen).
  244. - **MODE_MINIMIZED** = **1** --- Minimized window mode, i.e. ``Window`` is not visible and available on window manager's window list. Normally happens when the minimize button is presesd.
  245. - **MODE_MAXIMIZED** = **2** --- Maximized window mode, i.e. ``Window`` will occupy whole screen area except task bar and still display its borders. Normally happens when the minimize button is presesd.
  246. - **MODE_FULLSCREEN** = **3** --- Fullscreen window mode. Note that this is not *exclusive* fullscreen. On Windows and Linux, a borderless window is used to emulate fullscreen. On macOS, a new desktop is used to display the running project.
  247. Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports :doc:`multiple resolutions <../tutorials/rendering/multiple_resolutions>` when enabling fullscreen mode.
  248. - **MODE_EXCLUSIVE_FULLSCREEN** = **4** --- Exclusive fullscreen window mode. This mode is implemented on Windows only. On other platforms, it is equivalent to :ref:`MODE_FULLSCREEN<class_Window_constant_MODE_FULLSCREEN>`.
  249. Only one window in exclusive fullscreen mode can be visible on a given screen at a time. If multiple windows are in exclusive fullscreen mode for the same screen, the last one being set to this mode takes precedence.
  250. Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports :doc:`multiple resolutions <../tutorials/rendering/multiple_resolutions>` when enabling fullscreen mode.
  251. ----
  252. .. _enum_Window_Flags:
  253. .. _class_Window_constant_FLAG_RESIZE_DISABLED:
  254. .. _class_Window_constant_FLAG_BORDERLESS:
  255. .. _class_Window_constant_FLAG_ALWAYS_ON_TOP:
  256. .. _class_Window_constant_FLAG_TRANSPARENT:
  257. .. _class_Window_constant_FLAG_NO_FOCUS:
  258. .. _class_Window_constant_FLAG_POPUP:
  259. .. _class_Window_constant_FLAG_MAX:
  260. enum **Flags**:
  261. - **FLAG_RESIZE_DISABLED** = **0** --- The window's ability to be resized. Set with :ref:`unresizable<class_Window_property_unresizable>`.
  262. - **FLAG_BORDERLESS** = **1** --- Borderless window. Set with :ref:`borderless<class_Window_property_borderless>`.
  263. - **FLAG_ALWAYS_ON_TOP** = **2** --- Flag for making the window always on top of all other windows. Set with :ref:`always_on_top<class_Window_property_always_on_top>`.
  264. - **FLAG_TRANSPARENT** = **3** --- Flag for per-pixel transparency. Set with :ref:`transparent<class_Window_property_transparent>`.
  265. - **FLAG_NO_FOCUS** = **4** --- The window's ability to gain focus. Set with :ref:`unfocusable<class_Window_property_unfocusable>`.
  266. - **FLAG_POPUP** = **5** --- Whether the window is popup or a regular window. Set with :ref:`popup_window<class_Window_property_popup_window>`.
  267. - **FLAG_MAX** = **6** --- Max value of the :ref:`Flags<enum_Window_Flags>`.
  268. ----
  269. .. _enum_Window_ContentScaleMode:
  270. .. _class_Window_constant_CONTENT_SCALE_MODE_DISABLED:
  271. .. _class_Window_constant_CONTENT_SCALE_MODE_CANVAS_ITEMS:
  272. .. _class_Window_constant_CONTENT_SCALE_MODE_VIEWPORT:
  273. enum **ContentScaleMode**:
  274. - **CONTENT_SCALE_MODE_DISABLED** = **0** --- The content will not be scaled to match the ``Window``'s size.
  275. - **CONTENT_SCALE_MODE_CANVAS_ITEMS** = **1** --- The content will be rendered at the target size. This is more performance-expensive than :ref:`CONTENT_SCALE_MODE_VIEWPORT<class_Window_constant_CONTENT_SCALE_MODE_VIEWPORT>`, but provides better results.
  276. - **CONTENT_SCALE_MODE_VIEWPORT** = **2** --- The content will be rendered at the base size and then scaled to the target size. More performant than :ref:`CONTENT_SCALE_MODE_CANVAS_ITEMS<class_Window_constant_CONTENT_SCALE_MODE_CANVAS_ITEMS>`, but results in pixelated image.
  277. ----
  278. .. _enum_Window_ContentScaleAspect:
  279. .. _class_Window_constant_CONTENT_SCALE_ASPECT_IGNORE:
  280. .. _class_Window_constant_CONTENT_SCALE_ASPECT_KEEP:
  281. .. _class_Window_constant_CONTENT_SCALE_ASPECT_KEEP_WIDTH:
  282. .. _class_Window_constant_CONTENT_SCALE_ASPECT_KEEP_HEIGHT:
  283. .. _class_Window_constant_CONTENT_SCALE_ASPECT_EXPAND:
  284. enum **ContentScaleAspect**:
  285. - **CONTENT_SCALE_ASPECT_IGNORE** = **0** --- The aspect will be ignored. Scaling will simply stretch the content to fit the target size.
  286. - **CONTENT_SCALE_ASPECT_KEEP** = **1** --- The content's aspect will be preserved. If the target size has different aspect from the base one, the image will be centered and black bars will appear on left and right sides.
  287. - **CONTENT_SCALE_ASPECT_KEEP_WIDTH** = **2** --- The content can be expanded vertically. Scaling horizontally will result in keeping the width ratio and then black bars on left and right sides.
  288. - **CONTENT_SCALE_ASPECT_KEEP_HEIGHT** = **3** --- The content can be expanded horizontally. Scaling vertically will result in keeping the height ratio and then black bars on top and bottom sides.
  289. - **CONTENT_SCALE_ASPECT_EXPAND** = **4** --- The content's aspect will be preserved. If the target size has different aspect from the base one, the content will stay in the to-left corner and add an extra visible area in the stretched space.
  290. ----
  291. .. _enum_Window_LayoutDirection:
  292. .. _class_Window_constant_LAYOUT_DIRECTION_INHERITED:
  293. .. _class_Window_constant_LAYOUT_DIRECTION_LOCALE:
  294. .. _class_Window_constant_LAYOUT_DIRECTION_LTR:
  295. .. _class_Window_constant_LAYOUT_DIRECTION_RTL:
  296. enum **LayoutDirection**:
  297. - **LAYOUT_DIRECTION_INHERITED** = **0** --- Automatic layout direction, determined from the parent window layout direction.
  298. - **LAYOUT_DIRECTION_LOCALE** = **1** --- Automatic layout direction, determined from the current locale.
  299. - **LAYOUT_DIRECTION_LTR** = **2** --- Left-to-right layout direction.
  300. - **LAYOUT_DIRECTION_RTL** = **3** --- Right-to-left layout direction.
  301. Constants
  302. ---------
  303. .. _class_Window_constant_NOTIFICATION_VISIBILITY_CHANGED:
  304. - **NOTIFICATION_VISIBILITY_CHANGED** = **30** --- Emitted when ``Window``'s visibility changes, right before :ref:`visibility_changed<class_Window_signal_visibility_changed>`.
  305. Property Descriptions
  306. ---------------------
  307. .. _class_Window_property_always_on_top:
  308. - :ref:`bool<class_bool>` **always_on_top**
  309. +-----------+-----------------+
  310. | *Default* | ``false`` |
  311. +-----------+-----------------+
  312. | *Setter* | set_flag(value) |
  313. +-----------+-----------------+
  314. | *Getter* | get_flag() |
  315. +-----------+-----------------+
  316. If ``true``, the window will be on top of all other windows. Does not work if :ref:`transient<class_Window_property_transient>` is enabled.
  317. ----
  318. .. _class_Window_property_auto_translate:
  319. - :ref:`bool<class_bool>` **auto_translate**
  320. +-----------+---------------------------+
  321. | *Default* | ``true`` |
  322. +-----------+---------------------------+
  323. | *Setter* | set_auto_translate(value) |
  324. +-----------+---------------------------+
  325. | *Getter* | is_auto_translating() |
  326. +-----------+---------------------------+
  327. Toggles if any text should automatically change to its translated version depending on the current locale.
  328. ----
  329. .. _class_Window_property_borderless:
  330. - :ref:`bool<class_bool>` **borderless**
  331. +-----------+-----------------+
  332. | *Default* | ``false`` |
  333. +-----------+-----------------+
  334. | *Setter* | set_flag(value) |
  335. +-----------+-----------------+
  336. | *Getter* | get_flag() |
  337. +-----------+-----------------+
  338. If ``true``, the window will have no borders.
  339. ----
  340. .. _class_Window_property_content_scale_aspect:
  341. - :ref:`ContentScaleAspect<enum_Window_ContentScaleAspect>` **content_scale_aspect**
  342. +-----------+---------------------------------+
  343. | *Default* | ``0`` |
  344. +-----------+---------------------------------+
  345. | *Setter* | set_content_scale_aspect(value) |
  346. +-----------+---------------------------------+
  347. | *Getter* | get_content_scale_aspect() |
  348. +-----------+---------------------------------+
  349. Specifies how the content's aspect behaves when the ``Window`` is resized. The base aspect is determined by :ref:`content_scale_size<class_Window_property_content_scale_size>`.
  350. ----
  351. .. _class_Window_property_content_scale_factor:
  352. - :ref:`float<class_float>` **content_scale_factor**
  353. +-----------+---------------------------------+
  354. | *Default* | ``1.0`` |
  355. +-----------+---------------------------------+
  356. | *Setter* | set_content_scale_factor(value) |
  357. +-----------+---------------------------------+
  358. | *Getter* | get_content_scale_factor() |
  359. +-----------+---------------------------------+
  360. Specifies the base scale of ``Window``'s content when its :ref:`size<class_Window_property_size>` is equal to :ref:`content_scale_size<class_Window_property_content_scale_size>`.
  361. ----
  362. .. _class_Window_property_content_scale_mode:
  363. - :ref:`ContentScaleMode<enum_Window_ContentScaleMode>` **content_scale_mode**
  364. +-----------+-------------------------------+
  365. | *Default* | ``0`` |
  366. +-----------+-------------------------------+
  367. | *Setter* | set_content_scale_mode(value) |
  368. +-----------+-------------------------------+
  369. | *Getter* | get_content_scale_mode() |
  370. +-----------+-------------------------------+
  371. Specifies how the content is scaled when the ``Window`` is resized.
  372. ----
  373. .. _class_Window_property_content_scale_size:
  374. - :ref:`Vector2i<class_Vector2i>` **content_scale_size**
  375. +-----------+-------------------------------+
  376. | *Default* | ``Vector2i(0, 0)`` |
  377. +-----------+-------------------------------+
  378. | *Setter* | set_content_scale_size(value) |
  379. +-----------+-------------------------------+
  380. | *Getter* | get_content_scale_size() |
  381. +-----------+-------------------------------+
  382. Base size of the content (i.e. nodes that are drawn inside the window). If non-zero, ``Window``'s content will be scaled when the window is resized to a different size.
  383. ----
  384. .. _class_Window_property_current_screen:
  385. - :ref:`int<class_int>` **current_screen**
  386. +-----------+---------------------------+
  387. | *Default* | ``0`` |
  388. +-----------+---------------------------+
  389. | *Setter* | set_current_screen(value) |
  390. +-----------+---------------------------+
  391. | *Getter* | get_current_screen() |
  392. +-----------+---------------------------+
  393. The screen the window is currently on.
  394. ----
  395. .. _class_Window_property_exclusive:
  396. - :ref:`bool<class_bool>` **exclusive**
  397. +-----------+----------------------+
  398. | *Default* | ``false`` |
  399. +-----------+----------------------+
  400. | *Setter* | set_exclusive(value) |
  401. +-----------+----------------------+
  402. | *Getter* | is_exclusive() |
  403. +-----------+----------------------+
  404. If ``true``, the ``Window`` will be in exclusive mode. Exclusive windows are always on top of their parent and will block all input going to the parent ``Window``.
  405. Needs :ref:`transient<class_Window_property_transient>` enabled to work.
  406. ----
  407. .. _class_Window_property_max_size:
  408. - :ref:`Vector2i<class_Vector2i>` **max_size**
  409. +-----------+---------------------+
  410. | *Default* | ``Vector2i(0, 0)`` |
  411. +-----------+---------------------+
  412. | *Setter* | set_max_size(value) |
  413. +-----------+---------------------+
  414. | *Getter* | get_max_size() |
  415. +-----------+---------------------+
  416. If non-zero, the ``Window`` can't be resized to be bigger than this size.
  417. ----
  418. .. _class_Window_property_min_size:
  419. - :ref:`Vector2i<class_Vector2i>` **min_size**
  420. +-----------+---------------------+
  421. | *Default* | ``Vector2i(0, 0)`` |
  422. +-----------+---------------------+
  423. | *Setter* | set_min_size(value) |
  424. +-----------+---------------------+
  425. | *Getter* | get_min_size() |
  426. +-----------+---------------------+
  427. If non-zero, the ``Window`` can't be resized to be smaller than this size.
  428. ----
  429. .. _class_Window_property_mode:
  430. - :ref:`Mode<enum_Window_Mode>` **mode**
  431. +-----------+-----------------+
  432. | *Default* | ``0`` |
  433. +-----------+-----------------+
  434. | *Setter* | set_mode(value) |
  435. +-----------+-----------------+
  436. | *Getter* | get_mode() |
  437. +-----------+-----------------+
  438. Set's the window's current mode.
  439. \ **Note:** Fullscreen mode is not exclusive fullscreen on Windows and Linux.
  440. ----
  441. .. _class_Window_property_popup_window:
  442. - :ref:`bool<class_bool>` **popup_window**
  443. +-----------+-----------------+
  444. | *Default* | ``false`` |
  445. +-----------+-----------------+
  446. | *Setter* | set_flag(value) |
  447. +-----------+-----------------+
  448. | *Getter* | get_flag() |
  449. +-----------+-----------------+
  450. If ``true``, the ``Window`` will be considered a popup. Popups are sub-windows that don't show as separate windows in system's window manager's window list and will send close request when anything is clicked outside of them (unless :ref:`exclusive<class_Window_property_exclusive>` is enabled).
  451. ----
  452. .. _class_Window_property_position:
  453. - :ref:`Vector2i<class_Vector2i>` **position**
  454. +-----------+---------------------+
  455. | *Default* | ``Vector2i(0, 0)`` |
  456. +-----------+---------------------+
  457. | *Setter* | set_position(value) |
  458. +-----------+---------------------+
  459. | *Getter* | get_position() |
  460. +-----------+---------------------+
  461. The window's position in pixels.
  462. ----
  463. .. _class_Window_property_size:
  464. - :ref:`Vector2i<class_Vector2i>` **size**
  465. +-----------+------------------------+
  466. | *Default* | ``Vector2i(100, 100)`` |
  467. +-----------+------------------------+
  468. | *Setter* | set_size(value) |
  469. +-----------+------------------------+
  470. | *Getter* | get_size() |
  471. +-----------+------------------------+
  472. The window's size in pixels.
  473. ----
  474. .. _class_Window_property_theme:
  475. - :ref:`Theme<class_Theme>` **theme**
  476. +----------+------------------+
  477. | *Setter* | set_theme(value) |
  478. +----------+------------------+
  479. | *Getter* | get_theme() |
  480. +----------+------------------+
  481. The :ref:`Theme<class_Theme>` resource that determines the style of the underlying :ref:`Control<class_Control>` nodes.
  482. \ ``Window`` styles will have no effect unless the window is embedded.
  483. ----
  484. .. _class_Window_property_theme_type_variation:
  485. - :ref:`StringName<class_StringName>` **theme_type_variation**
  486. +-----------+---------------------------------+
  487. | *Default* | ``&""`` |
  488. +-----------+---------------------------------+
  489. | *Setter* | set_theme_type_variation(value) |
  490. +-----------+---------------------------------+
  491. | *Getter* | get_theme_type_variation() |
  492. +-----------+---------------------------------+
  493. The name of a theme type variation used by this ``Window`` to look up its own theme items. See :ref:`Control.theme_type_variation<class_Control_property_theme_type_variation>` for more details.
  494. ----
  495. .. _class_Window_property_title:
  496. - :ref:`String<class_String>` **title**
  497. +-----------+------------------+
  498. | *Default* | ``""`` |
  499. +-----------+------------------+
  500. | *Setter* | set_title(value) |
  501. +-----------+------------------+
  502. | *Getter* | get_title() |
  503. +-----------+------------------+
  504. The window's title. If the ``Window`` is non-embedded, title styles set in :ref:`Theme<class_Theme>` will have no effect.
  505. ----
  506. .. _class_Window_property_transient:
  507. - :ref:`bool<class_bool>` **transient**
  508. +-----------+----------------------+
  509. | *Default* | ``false`` |
  510. +-----------+----------------------+
  511. | *Setter* | set_transient(value) |
  512. +-----------+----------------------+
  513. | *Getter* | is_transient() |
  514. +-----------+----------------------+
  515. If ``true``, the ``Window`` is transient, i.e. it's considered a child of another ``Window``. Transient windows can't be in fullscreen mode and will return focus to their parent when closed.
  516. Note that behavior might be different depending on the platform.
  517. ----
  518. .. _class_Window_property_transparent:
  519. - :ref:`bool<class_bool>` **transparent**
  520. +-----------+-----------------+
  521. | *Default* | ``false`` |
  522. +-----------+-----------------+
  523. | *Setter* | set_flag(value) |
  524. +-----------+-----------------+
  525. | *Getter* | get_flag() |
  526. +-----------+-----------------+
  527. If ``true``, the ``Window``'s background can be transparent. This is best used with embedded windows. Currently non-embedded ``Window`` transparency is implemented only for MacOS.
  528. ----
  529. .. _class_Window_property_unfocusable:
  530. - :ref:`bool<class_bool>` **unfocusable**
  531. +-----------+-----------------+
  532. | *Default* | ``false`` |
  533. +-----------+-----------------+
  534. | *Setter* | set_flag(value) |
  535. +-----------+-----------------+
  536. | *Getter* | get_flag() |
  537. +-----------+-----------------+
  538. If ``true``, the ``Window`` can't be focused nor interacted with. It can still be visible.
  539. ----
  540. .. _class_Window_property_unresizable:
  541. - :ref:`bool<class_bool>` **unresizable**
  542. +-----------+-----------------+
  543. | *Default* | ``false`` |
  544. +-----------+-----------------+
  545. | *Setter* | set_flag(value) |
  546. +-----------+-----------------+
  547. | *Getter* | get_flag() |
  548. +-----------+-----------------+
  549. If ``true``, the window can't be resized. Minimize and maximize buttons are disabled.
  550. ----
  551. .. _class_Window_property_visible:
  552. - :ref:`bool<class_bool>` **visible**
  553. +-----------+--------------------+
  554. | *Default* | ``true`` |
  555. +-----------+--------------------+
  556. | *Setter* | set_visible(value) |
  557. +-----------+--------------------+
  558. | *Getter* | is_visible() |
  559. +-----------+--------------------+
  560. If ``true``, the window is visible.
  561. ----
  562. .. _class_Window_property_wrap_controls:
  563. - :ref:`bool<class_bool>` **wrap_controls**
  564. +-----------+--------------------------+
  565. | *Default* | ``false`` |
  566. +-----------+--------------------------+
  567. | *Setter* | set_wrap_controls(value) |
  568. +-----------+--------------------------+
  569. | *Getter* | is_wrapping_controls() |
  570. +-----------+--------------------------+
  571. If ``true``, the window's size will automatically update when a child node is added or removed.
  572. If ``false``, you need to call :ref:`child_controls_changed<class_Window_method_child_controls_changed>` manually.
  573. Method Descriptions
  574. -------------------
  575. .. _class_Window_method_can_draw:
  576. - :ref:`bool<class_bool>` **can_draw** **(** **)** |const|
  577. Returns whether the window is being drawn to the screen.
  578. ----
  579. .. _class_Window_method_child_controls_changed:
  580. - void **child_controls_changed** **(** **)**
  581. Requests an update of the ``Window`` size to fit underlying :ref:`Control<class_Control>` nodes.
  582. ----
  583. .. _class_Window_method_get_contents_minimum_size:
  584. - :ref:`Vector2<class_Vector2>` **get_contents_minimum_size** **(** **)** |const|
  585. Returns the combined minimum size from the child :ref:`Control<class_Control>` nodes of the window. Use :ref:`child_controls_changed<class_Window_method_child_controls_changed>` to update it when children nodes have changed.
  586. ----
  587. .. _class_Window_method_get_flag:
  588. - :ref:`bool<class_bool>` **get_flag** **(** :ref:`Flags<enum_Window_Flags>` flag **)** |const|
  589. Returns ``true`` if the flag is set.
  590. ----
  591. .. _class_Window_method_get_layout_direction:
  592. - :ref:`LayoutDirection<enum_Window_LayoutDirection>` **get_layout_direction** **(** **)** |const|
  593. Returns layout direction and text writing direction.
  594. ----
  595. .. _class_Window_method_get_real_size:
  596. - :ref:`Vector2i<class_Vector2i>` **get_real_size** **(** **)** |const|
  597. Returns the window's size including its border.
  598. ----
  599. .. _class_Window_method_get_theme_color:
  600. - :ref:`Color<class_Color>` **get_theme_color** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  601. Returns the :ref:`Color<class_Color>` at ``name`` if the theme has ``theme_type``.
  602. See :ref:`Control.get_theme_color<class_Control_method_get_theme_color>` for more details.
  603. ----
  604. .. _class_Window_method_get_theme_constant:
  605. - :ref:`int<class_int>` **get_theme_constant** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  606. Returns the constant at ``name`` if the theme has ``theme_type``.
  607. See :ref:`Control.get_theme_color<class_Control_method_get_theme_color>` for more details.
  608. ----
  609. .. _class_Window_method_get_theme_default_base_scale:
  610. - :ref:`float<class_float>` **get_theme_default_base_scale** **(** **)** |const|
  611. Returns the default base scale defined in the attached :ref:`Theme<class_Theme>`.
  612. See :ref:`Theme.default_base_scale<class_Theme_property_default_base_scale>` for more details.
  613. ----
  614. .. _class_Window_method_get_theme_default_font:
  615. - :ref:`Font<class_Font>` **get_theme_default_font** **(** **)** |const|
  616. Returns the default :ref:`Font<class_Font>` defined in the attached :ref:`Theme<class_Theme>`.
  617. See :ref:`Theme.default_font<class_Theme_property_default_font>` for more details.
  618. ----
  619. .. _class_Window_method_get_theme_default_font_size:
  620. - :ref:`int<class_int>` **get_theme_default_font_size** **(** **)** |const|
  621. Returns the default font size defined in the attached :ref:`Theme<class_Theme>`.
  622. See :ref:`Theme.default_font_size<class_Theme_property_default_font_size>` for more details.
  623. ----
  624. .. _class_Window_method_get_theme_font:
  625. - :ref:`Font<class_Font>` **get_theme_font** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  626. Returns the :ref:`Font<class_Font>` at ``name`` if the theme has ``theme_type``.
  627. See :ref:`Control.get_theme_color<class_Control_method_get_theme_color>` for more details.
  628. ----
  629. .. _class_Window_method_get_theme_font_size:
  630. - :ref:`int<class_int>` **get_theme_font_size** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  631. Returns the font size at ``name`` if the theme has ``theme_type``.
  632. See :ref:`Control.get_theme_color<class_Control_method_get_theme_color>` for more details.
  633. ----
  634. .. _class_Window_method_get_theme_icon:
  635. - :ref:`Texture2D<class_Texture2D>` **get_theme_icon** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  636. Returns the icon at ``name`` if the theme has ``theme_type``.
  637. See :ref:`Control.get_theme_color<class_Control_method_get_theme_color>` for more details.
  638. ----
  639. .. _class_Window_method_get_theme_stylebox:
  640. - :ref:`StyleBox<class_StyleBox>` **get_theme_stylebox** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  641. Returns the :ref:`StyleBox<class_StyleBox>` at ``name`` if the theme has ``theme_type``.
  642. See :ref:`Control.get_theme_color<class_Control_method_get_theme_color>` for more details.
  643. ----
  644. .. _class_Window_method_grab_focus:
  645. - void **grab_focus** **(** **)**
  646. Causes the window to grab focus, allowing it to receive user input.
  647. ----
  648. .. _class_Window_method_has_focus:
  649. - :ref:`bool<class_bool>` **has_focus** **(** **)** |const|
  650. Returns ``true`` if the window is focused.
  651. ----
  652. .. _class_Window_method_has_theme_color:
  653. - :ref:`bool<class_bool>` **has_theme_color** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  654. Returns ``true`` if :ref:`Color<class_Color>` with ``name`` is in ``theme_type``.
  655. ----
  656. .. _class_Window_method_has_theme_constant:
  657. - :ref:`bool<class_bool>` **has_theme_constant** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  658. Returns ``true`` if constant with ``name`` is in ``theme_type``.
  659. ----
  660. .. _class_Window_method_has_theme_font:
  661. - :ref:`bool<class_bool>` **has_theme_font** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  662. Returns ``true`` if :ref:`Font<class_Font>` with ``name`` is in ``theme_type``.
  663. ----
  664. .. _class_Window_method_has_theme_font_size:
  665. - :ref:`bool<class_bool>` **has_theme_font_size** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  666. Returns ``true`` if font size with ``name`` is in ``theme_type``.
  667. ----
  668. .. _class_Window_method_has_theme_icon:
  669. - :ref:`bool<class_bool>` **has_theme_icon** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  670. Returns ``true`` if icon with ``name`` is in ``theme_type``.
  671. ----
  672. .. _class_Window_method_has_theme_stylebox:
  673. - :ref:`bool<class_bool>` **has_theme_stylebox** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
  674. Returns ``true`` if :ref:`StyleBox<class_StyleBox>` with ``name`` is in ``theme_type``.
  675. ----
  676. .. _class_Window_method_hide:
  677. - void **hide** **(** **)**
  678. Hides the window. This is not the same as minimized state. Hidden window can't be interacted with and needs to be made visible with :ref:`show<class_Window_method_show>`.
  679. ----
  680. .. _class_Window_method_is_embedded:
  681. - :ref:`bool<class_bool>` **is_embedded** **(** **)** |const|
  682. Returns ``true`` if the window is currently embedded in another window.
  683. ----
  684. .. _class_Window_method_is_layout_rtl:
  685. - :ref:`bool<class_bool>` **is_layout_rtl** **(** **)** |const|
  686. Returns ``true`` if layout is right-to-left.
  687. ----
  688. .. _class_Window_method_is_maximize_allowed:
  689. - :ref:`bool<class_bool>` **is_maximize_allowed** **(** **)** |const|
  690. Returns ``true`` if the window can be maximized (the maximize button is enabled).
  691. ----
  692. .. _class_Window_method_is_using_font_oversampling:
  693. - :ref:`bool<class_bool>` **is_using_font_oversampling** **(** **)** |const|
  694. Returns ``true`` if font oversampling is enabled. See :ref:`set_use_font_oversampling<class_Window_method_set_use_font_oversampling>`.
  695. ----
  696. .. _class_Window_method_move_to_foreground:
  697. - void **move_to_foreground** **(** **)**
  698. Moves the ``Window`` on top of other windows and focuses it.
  699. ----
  700. .. _class_Window_method_popup:
  701. - void **popup** **(** :ref:`Rect2i<class_Rect2i>` rect=Rect2i(0, 0, 0, 0) **)**
  702. Shows the ``Window`` and makes it transient (see :ref:`transient<class_Window_property_transient>`). If ``rect`` is provided, it will be set as the ``Window``'s size.
  703. Fails if called on the main window.
  704. ----
  705. .. _class_Window_method_popup_centered:
  706. - void **popup_centered** **(** :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0) **)**
  707. Popups the ``Window`` at the center of the current screen, with optionally given minimum size.
  708. If the ``Window`` is embedded, it will be centered in the parent :ref:`Viewport<class_Viewport>` instead.
  709. ----
  710. .. _class_Window_method_popup_centered_clamped:
  711. - void **popup_centered_clamped** **(** :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0), :ref:`float<class_float>` fallback_ratio=0.75 **)**
  712. Popups the ``Window`` centered inside its parent ``Window``.
  713. \ ``fallback_ratio`` determines the maximum size of the ``Window``, in relation to its parent.
  714. ----
  715. .. _class_Window_method_popup_centered_ratio:
  716. - void **popup_centered_ratio** **(** :ref:`float<class_float>` ratio=0.8 **)**
  717. Popups the ``Window`` centered inside its parent ``Window`` and sets its size as a ``ratio`` of parent's size.
  718. ----
  719. .. _class_Window_method_popup_on_parent:
  720. - void **popup_on_parent** **(** :ref:`Rect2i<class_Rect2i>` parent_rect **)**
  721. Popups the ``Window`` with a position shifted by parent ``Window``'s position.
  722. If the ``Window`` is embedded, has the same effect as :ref:`popup<class_Window_method_popup>`.
  723. ----
  724. .. _class_Window_method_request_attention:
  725. - void **request_attention** **(** **)**
  726. Tells the OS that the ``Window`` needs an attention. This makes the window stand out in some way depending on the system, e.g. it might blink on the task bar.
  727. ----
  728. .. _class_Window_method_reset_size:
  729. - void **reset_size** **(** **)**
  730. Resets the size to the minimum size, which is the max of :ref:`min_size<class_Window_property_min_size>` and (if :ref:`wrap_controls<class_Window_property_wrap_controls>` is enabled) :ref:`get_contents_minimum_size<class_Window_method_get_contents_minimum_size>`. This is equivalent to calling ``set_size(Vector2i())`` (or any size below the minimum).
  731. ----
  732. .. _class_Window_method_set_flag:
  733. - void **set_flag** **(** :ref:`Flags<enum_Window_Flags>` flag, :ref:`bool<class_bool>` enabled **)**
  734. Sets a specified window flag.
  735. ----
  736. .. _class_Window_method_set_ime_active:
  737. - void **set_ime_active** **(** :ref:`bool<class_bool>` active **)**
  738. If ``active`` is ``true``, enables system's native IME (Input Method Editor).
  739. ----
  740. .. _class_Window_method_set_ime_position:
  741. - void **set_ime_position** **(** :ref:`Vector2i<class_Vector2i>` position **)**
  742. Moves IME to the given position.
  743. ----
  744. .. _class_Window_method_set_layout_direction:
  745. - void **set_layout_direction** **(** :ref:`LayoutDirection<enum_Window_LayoutDirection>` direction **)**
  746. Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
  747. ----
  748. .. _class_Window_method_set_use_font_oversampling:
  749. - void **set_use_font_oversampling** **(** :ref:`bool<class_bool>` enable **)**
  750. Enables font oversampling. This makes fonts look better when they are scaled up.
  751. ----
  752. .. _class_Window_method_show:
  753. - void **show** **(** **)**
  754. Makes the ``Window`` appear. This enables interactions with the ``Window`` and doesn't change any of its property other than visibility (unlike e.g. :ref:`popup<class_Window_method_popup>`).
  755. Theme Property Descriptions
  756. ---------------------------
  757. .. _class_Window_theme_color_title_color:
  758. - :ref:`Color<class_Color>` **title_color**
  759. +-----------+-----------------------------------+
  760. | *Default* | ``Color(0.875, 0.875, 0.875, 1)`` |
  761. +-----------+-----------------------------------+
  762. The color of the title's text.
  763. ----
  764. .. _class_Window_theme_color_title_outline_modulate:
  765. - :ref:`Color<class_Color>` **title_outline_modulate**
  766. +-----------+-----------------------+
  767. | *Default* | ``Color(1, 1, 1, 1)`` |
  768. +-----------+-----------------------+
  769. The color of the title's text outline.
  770. ----
  771. .. _class_Window_theme_constant_close_h_offset:
  772. - :ref:`int<class_int>` **close_h_offset**
  773. +-----------+--------+
  774. | *Default* | ``18`` |
  775. +-----------+--------+
  776. Horizontal position offset of the close button.
  777. ----
  778. .. _class_Window_theme_constant_close_v_offset:
  779. - :ref:`int<class_int>` **close_v_offset**
  780. +-----------+--------+
  781. | *Default* | ``24`` |
  782. +-----------+--------+
  783. Vertical position offset of the close button.
  784. ----
  785. .. _class_Window_theme_constant_resize_margin:
  786. - :ref:`int<class_int>` **resize_margin**
  787. +-----------+-------+
  788. | *Default* | ``4`` |
  789. +-----------+-------+
  790. Defines the outside margin at which the window border can be grabbed with mouse and resized.
  791. ----
  792. .. _class_Window_theme_constant_title_height:
  793. - :ref:`int<class_int>` **title_height**
  794. +-----------+--------+
  795. | *Default* | ``36`` |
  796. +-----------+--------+
  797. Height of the title bar.
  798. ----
  799. .. _class_Window_theme_constant_title_outline_size:
  800. - :ref:`int<class_int>` **title_outline_size**
  801. +-----------+-------+
  802. | *Default* | ``0`` |
  803. +-----------+-------+
  804. The size of the title outline.
  805. ----
  806. .. _class_Window_theme_font_title_font:
  807. - :ref:`Font<class_Font>` **title_font**
  808. The font used to draw the title.
  809. ----
  810. .. _class_Window_theme_font_size_title_font_size:
  811. - :ref:`int<class_int>` **title_font_size**
  812. The size of the title font.
  813. ----
  814. .. _class_Window_theme_icon_close:
  815. - :ref:`Texture2D<class_Texture2D>` **close**
  816. The icon for the close button.
  817. ----
  818. .. _class_Window_theme_icon_close_pressed:
  819. - :ref:`Texture2D<class_Texture2D>` **close_pressed**
  820. The icon for the close button when it's being pressed.
  821. ----
  822. .. _class_Window_theme_style_embedded_border:
  823. - :ref:`StyleBox<class_StyleBox>` **embedded_border**
  824. The background style used when the ``Window`` is embedded. Note that this is drawn only under the window's content, excluding the title. For proper borders and title bar style, you can use ``expand_margin_*`` properties of :ref:`StyleBoxFlat<class_StyleBoxFlat>`.
  825. \ **Note:** The content background will not be visible unless :ref:`transparent<class_Window_property_transparent>` is enabled.
  826. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  827. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  828. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  829. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  830. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  831. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`