Files
godot-docs/classes/class_window.rst
2022-02-22 10:06:27 +01:00

1152 lines
56 KiB
ReStructuredText

:github_url: hide
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the Window.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_Window:
Window
======
**Inherits:** :ref:`Viewport<class_Viewport>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Inherited By:** :ref:`AcceptDialog<class_AcceptDialog>`, :ref:`Popup<class_Popup>`
Base class for all windows.
Description
-----------
A node that creates a window.
Properties
----------
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`always_on_top<class_Window_property_always_on_top>` | ``false`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`auto_translate<class_Window_property_auto_translate>` | ``true`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`borderless<class_Window_property_borderless>` | ``false`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`ContentScaleAspect<enum_Window_ContentScaleAspect>` | :ref:`content_scale_aspect<class_Window_property_content_scale_aspect>` | ``0`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`float<class_float>` | :ref:`content_scale_factor<class_Window_property_content_scale_factor>` | ``1.0`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`ContentScaleMode<enum_Window_ContentScaleMode>` | :ref:`content_scale_mode<class_Window_property_content_scale_mode>` | ``0`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`Vector2i<class_Vector2i>` | :ref:`content_scale_size<class_Window_property_content_scale_size>` | ``Vector2i(0, 0)`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`int<class_int>` | :ref:`current_screen<class_Window_property_current_screen>` | ``0`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`exclusive<class_Window_property_exclusive>` | ``false`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`Vector2i<class_Vector2i>` | :ref:`max_size<class_Window_property_max_size>` | ``Vector2i(0, 0)`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`Vector2i<class_Vector2i>` | :ref:`min_size<class_Window_property_min_size>` | ``Vector2i(0, 0)`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`Mode<enum_Window_Mode>` | :ref:`mode<class_Window_property_mode>` | ``0`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`Vector2i<class_Vector2i>` | :ref:`position<class_Window_property_position>` | ``Vector2i(0, 0)`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`Vector2i<class_Vector2i>` | :ref:`size<class_Window_property_size>` | ``Vector2i(100, 100)`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`Theme<class_Theme>` | :ref:`theme<class_Window_property_theme>` | |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`StringName<class_StringName>` | :ref:`theme_type_variation<class_Window_property_theme_type_variation>` | ``&""`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`String<class_String>` | :ref:`title<class_Window_property_title>` | ``""`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`transient<class_Window_property_transient>` | ``false`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`transparent<class_Window_property_transparent>` | ``false`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`unfocusable<class_Window_property_unfocusable>` | ``false`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`unresizable<class_Window_property_unresizable>` | ``false`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`visible<class_Window_property_visible>` | ``true`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`wrap_controls<class_Window_property_wrap_controls>` | ``false`` |
+-----------------------------------------------------------+-------------------------------------------------------------------------+------------------------+
Methods
-------
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`can_draw<class_Window_method_can_draw>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`child_controls_changed<class_Window_method_child_controls_changed>` **(** **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_contents_minimum_size<class_Window_method_get_contents_minimum_size>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_flag<class_Window_method_get_flag>` **(** :ref:`Flags<enum_Window_Flags>` flag **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`LayoutDirection<enum_Window_LayoutDirection>` | :ref:`get_layout_direction<class_Window_method_get_layout_direction>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2i<class_Vector2i>` | :ref:`get_real_size<class_Window_method_get_real_size>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_theme_default_base_scale<class_Window_method_get_theme_default_base_scale>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Font<class_Font>` | :ref:`get_theme_default_font<class_Window_method_get_theme_default_font>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_theme_default_font_size<class_Window_method_get_theme_default_font_size>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`grab_focus<class_Window_method_grab_focus>` **(** **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_focus<class_Window_method_has_focus>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`hide<class_Window_method_hide>` **(** **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_embedded<class_Window_method_is_embedded>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_layout_rtl<class_Window_method_is_layout_rtl>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_maximize_allowed<class_Window_method_is_maximize_allowed>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_using_font_oversampling<class_Window_method_is_using_font_oversampling>` **(** **)** |const| |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`move_to_foreground<class_Window_method_move_to_foreground>` **(** **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`popup<class_Window_method_popup>` **(** :ref:`Rect2i<class_Rect2i>` rect=Rect2i(0, 0, 0, 0) **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`popup_centered<class_Window_method_popup_centered>` **(** :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0) **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 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 **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`popup_centered_ratio<class_Window_method_popup_centered_ratio>` **(** :ref:`float<class_float>` ratio=0.8 **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`popup_on_parent<class_Window_method_popup_on_parent>` **(** :ref:`Rect2i<class_Rect2i>` parent_rect **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`request_attention<class_Window_method_request_attention>` **(** **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`reset_size<class_Window_method_reset_size>` **(** **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_flag<class_Window_method_set_flag>` **(** :ref:`Flags<enum_Window_Flags>` flag, :ref:`bool<class_bool>` enabled **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ime_active<class_Window_method_set_ime_active>` **(** :ref:`bool<class_bool>` active **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ime_position<class_Window_method_set_ime_position>` **(** :ref:`Vector2i<class_Vector2i>` position **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_layout_direction<class_Window_method_set_layout_direction>` **(** :ref:`LayoutDirection<enum_Window_LayoutDirection>` direction **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_use_font_oversampling<class_Window_method_set_use_font_oversampling>` **(** :ref:`bool<class_bool>` enable **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`show<class_Window_method_show>` **(** **)** |
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Theme Properties
----------------
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`Color<class_Color>` | :ref:`title_color<class_Window_theme_color_title_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`Color<class_Color>` | :ref:`title_outline_modulate<class_Window_theme_color_title_outline_modulate>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`int<class_int>` | :ref:`close_h_ofs<class_Window_theme_constant_close_h_ofs>` | ``18`` |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`int<class_int>` | :ref:`close_v_ofs<class_Window_theme_constant_close_v_ofs>` | ``24`` |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`int<class_int>` | :ref:`resize_margin<class_Window_theme_constant_resize_margin>` | ``4`` |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`int<class_int>` | :ref:`scaleborder_size<class_Window_theme_constant_scaleborder_size>` | ``4`` |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`int<class_int>` | :ref:`title_height<class_Window_theme_constant_title_height>` | ``36`` |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`int<class_int>` | :ref:`title_outline_size<class_Window_theme_constant_title_outline_size>` | ``0`` |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`Font<class_Font>` | :ref:`title_font<class_Window_theme_font_title_font>` | |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`int<class_int>` | :ref:`title_font_size<class_Window_theme_font_size_title_font_size>` | |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`close<class_Window_theme_icon_close>` | |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`close_pressed<class_Window_theme_icon_close_pressed>` | |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`embedded_border<class_Window_theme_style_embedded_border>` | |
+-----------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
Signals
-------
.. _class_Window_signal_about_to_popup:
- **about_to_popup** **(** **)**
----
.. _class_Window_signal_close_requested:
- **close_requested** **(** **)**
----
.. _class_Window_signal_files_dropped:
- **files_dropped** **(** :ref:`PackedStringArray<class_PackedStringArray>` files **)**
----
.. _class_Window_signal_focus_entered:
- **focus_entered** **(** **)**
----
.. _class_Window_signal_focus_exited:
- **focus_exited** **(** **)**
----
.. _class_Window_signal_go_back_requested:
- **go_back_requested** **(** **)**
----
.. _class_Window_signal_mouse_entered:
- **mouse_entered** **(** **)**
----
.. _class_Window_signal_mouse_exited:
- **mouse_exited** **(** **)**
----
.. _class_Window_signal_theme_changed:
- **theme_changed** **(** **)**
----
.. _class_Window_signal_visibility_changed:
- **visibility_changed** **(** **)**
----
.. _class_Window_signal_window_input:
- **window_input** **(** :ref:`InputEvent<class_InputEvent>` event **)**
Enumerations
------------
.. _enum_Window_Mode:
.. _class_Window_constant_MODE_WINDOWED:
.. _class_Window_constant_MODE_MINIMIZED:
.. _class_Window_constant_MODE_MAXIMIZED:
.. _class_Window_constant_MODE_FULLSCREEN:
.. _class_Window_constant_MODE_EXCLUSIVE_FULLSCREEN:
enum **Mode**:
- **MODE_WINDOWED** = **0** --- Windowed mode.
- **MODE_MINIMIZED** = **1** --- Minimized window mode.
- **MODE_MAXIMIZED** = **2** --- Maximized window mode.
- **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.
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.
- **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>`.
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.
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.
----
.. _enum_Window_Flags:
.. _class_Window_constant_FLAG_RESIZE_DISABLED:
.. _class_Window_constant_FLAG_BORDERLESS:
.. _class_Window_constant_FLAG_ALWAYS_ON_TOP:
.. _class_Window_constant_FLAG_TRANSPARENT:
.. _class_Window_constant_FLAG_NO_FOCUS:
.. _class_Window_constant_FLAG_MAX:
enum **Flags**:
- **FLAG_RESIZE_DISABLED** = **0** --- The window's ability to be resized.
- **FLAG_BORDERLESS** = **1** --- Borderless window.
- **FLAG_ALWAYS_ON_TOP** = **2** --- Flag for making the window always on top of all other windows.
- **FLAG_TRANSPARENT** = **3**
- **FLAG_NO_FOCUS** = **4**
- **FLAG_MAX** = **5**
----
.. _enum_Window_ContentScaleMode:
.. _class_Window_constant_CONTENT_SCALE_MODE_DISABLED:
.. _class_Window_constant_CONTENT_SCALE_MODE_CANVAS_ITEMS:
.. _class_Window_constant_CONTENT_SCALE_MODE_VIEWPORT:
enum **ContentScaleMode**:
- **CONTENT_SCALE_MODE_DISABLED** = **0**
- **CONTENT_SCALE_MODE_CANVAS_ITEMS** = **1**
- **CONTENT_SCALE_MODE_VIEWPORT** = **2**
----
.. _enum_Window_ContentScaleAspect:
.. _class_Window_constant_CONTENT_SCALE_ASPECT_IGNORE:
.. _class_Window_constant_CONTENT_SCALE_ASPECT_KEEP:
.. _class_Window_constant_CONTENT_SCALE_ASPECT_KEEP_WIDTH:
.. _class_Window_constant_CONTENT_SCALE_ASPECT_KEEP_HEIGHT:
.. _class_Window_constant_CONTENT_SCALE_ASPECT_EXPAND:
enum **ContentScaleAspect**:
- **CONTENT_SCALE_ASPECT_IGNORE** = **0**
- **CONTENT_SCALE_ASPECT_KEEP** = **1**
- **CONTENT_SCALE_ASPECT_KEEP_WIDTH** = **2**
- **CONTENT_SCALE_ASPECT_KEEP_HEIGHT** = **3**
- **CONTENT_SCALE_ASPECT_EXPAND** = **4**
----
.. _enum_Window_LayoutDirection:
.. _class_Window_constant_LAYOUT_DIRECTION_INHERITED:
.. _class_Window_constant_LAYOUT_DIRECTION_LOCALE:
.. _class_Window_constant_LAYOUT_DIRECTION_LTR:
.. _class_Window_constant_LAYOUT_DIRECTION_RTL:
enum **LayoutDirection**:
- **LAYOUT_DIRECTION_INHERITED** = **0** --- Automatic layout direction, determined from the parent window layout direction.
- **LAYOUT_DIRECTION_LOCALE** = **1** --- Automatic layout direction, determined from the current locale.
- **LAYOUT_DIRECTION_LTR** = **2** --- Left-to-right layout direction.
- **LAYOUT_DIRECTION_RTL** = **3** --- Right-to-left layout direction.
Constants
---------
.. _class_Window_constant_NOTIFICATION_VISIBILITY_CHANGED:
- **NOTIFICATION_VISIBILITY_CHANGED** = **30**
Property Descriptions
---------------------
.. _class_Window_property_always_on_top:
- :ref:`bool<class_bool>` **always_on_top**
+-----------+-----------------+
| *Default* | ``false`` |
+-----------+-----------------+
| *Setter* | set_flag(value) |
+-----------+-----------------+
| *Getter* | get_flag() |
+-----------+-----------------+
If ``true``, the window will be on top of all other windows.
----
.. _class_Window_property_auto_translate:
- :ref:`bool<class_bool>` **auto_translate**
+-----------+---------------------------+
| *Default* | ``true`` |
+-----------+---------------------------+
| *Setter* | set_auto_translate(value) |
+-----------+---------------------------+
| *Getter* | is_auto_translating() |
+-----------+---------------------------+
Toggles if any text should automatically change to its translated version depending on the current locale.
----
.. _class_Window_property_borderless:
- :ref:`bool<class_bool>` **borderless**
+-----------+-----------------+
| *Default* | ``false`` |
+-----------+-----------------+
| *Setter* | set_flag(value) |
+-----------+-----------------+
| *Getter* | get_flag() |
+-----------+-----------------+
If ``true``, the window will have no borders.
----
.. _class_Window_property_content_scale_aspect:
- :ref:`ContentScaleAspect<enum_Window_ContentScaleAspect>` **content_scale_aspect**
+-----------+---------------------------------+
| *Default* | ``0`` |
+-----------+---------------------------------+
| *Setter* | set_content_scale_aspect(value) |
+-----------+---------------------------------+
| *Getter* | get_content_scale_aspect() |
+-----------+---------------------------------+
----
.. _class_Window_property_content_scale_factor:
- :ref:`float<class_float>` **content_scale_factor**
+-----------+---------------------------------+
| *Default* | ``1.0`` |
+-----------+---------------------------------+
| *Setter* | set_content_scale_factor(value) |
+-----------+---------------------------------+
| *Getter* | get_content_scale_factor() |
+-----------+---------------------------------+
----
.. _class_Window_property_content_scale_mode:
- :ref:`ContentScaleMode<enum_Window_ContentScaleMode>` **content_scale_mode**
+-----------+-------------------------------+
| *Default* | ``0`` |
+-----------+-------------------------------+
| *Setter* | set_content_scale_mode(value) |
+-----------+-------------------------------+
| *Getter* | get_content_scale_mode() |
+-----------+-------------------------------+
----
.. _class_Window_property_content_scale_size:
- :ref:`Vector2i<class_Vector2i>` **content_scale_size**
+-----------+-------------------------------+
| *Default* | ``Vector2i(0, 0)`` |
+-----------+-------------------------------+
| *Setter* | set_content_scale_size(value) |
+-----------+-------------------------------+
| *Getter* | get_content_scale_size() |
+-----------+-------------------------------+
----
.. _class_Window_property_current_screen:
- :ref:`int<class_int>` **current_screen**
+-----------+---------------------------+
| *Default* | ``0`` |
+-----------+---------------------------+
| *Setter* | set_current_screen(value) |
+-----------+---------------------------+
| *Getter* | get_current_screen() |
+-----------+---------------------------+
The screen the window is currently on.
----
.. _class_Window_property_exclusive:
- :ref:`bool<class_bool>` **exclusive**
+-----------+----------------------+
| *Default* | ``false`` |
+-----------+----------------------+
| *Setter* | set_exclusive(value) |
+-----------+----------------------+
| *Getter* | is_exclusive() |
+-----------+----------------------+
----
.. _class_Window_property_max_size:
- :ref:`Vector2i<class_Vector2i>` **max_size**
+-----------+---------------------+
| *Default* | ``Vector2i(0, 0)`` |
+-----------+---------------------+
| *Setter* | set_max_size(value) |
+-----------+---------------------+
| *Getter* | get_max_size() |
+-----------+---------------------+
----
.. _class_Window_property_min_size:
- :ref:`Vector2i<class_Vector2i>` **min_size**
+-----------+---------------------+
| *Default* | ``Vector2i(0, 0)`` |
+-----------+---------------------+
| *Setter* | set_min_size(value) |
+-----------+---------------------+
| *Getter* | get_min_size() |
+-----------+---------------------+
----
.. _class_Window_property_mode:
- :ref:`Mode<enum_Window_Mode>` **mode**
+-----------+-----------------+
| *Default* | ``0`` |
+-----------+-----------------+
| *Setter* | set_mode(value) |
+-----------+-----------------+
| *Getter* | get_mode() |
+-----------+-----------------+
Set's the window's current mode.
\ **Note:** Fullscreen mode is not exclusive fullscreen on Windows and Linux.
----
.. _class_Window_property_position:
- :ref:`Vector2i<class_Vector2i>` **position**
+-----------+---------------------+
| *Default* | ``Vector2i(0, 0)`` |
+-----------+---------------------+
| *Setter* | set_position(value) |
+-----------+---------------------+
| *Getter* | get_position() |
+-----------+---------------------+
The window's position in pixels.
----
.. _class_Window_property_size:
- :ref:`Vector2i<class_Vector2i>` **size**
+-----------+------------------------+
| *Default* | ``Vector2i(100, 100)`` |
+-----------+------------------------+
| *Setter* | set_size(value) |
+-----------+------------------------+
| *Getter* | get_size() |
+-----------+------------------------+
The window's size in pixels.
----
.. _class_Window_property_theme:
- :ref:`Theme<class_Theme>` **theme**
+----------+------------------+
| *Setter* | set_theme(value) |
+----------+------------------+
| *Getter* | get_theme() |
+----------+------------------+
----
.. _class_Window_property_theme_type_variation:
- :ref:`StringName<class_StringName>` **theme_type_variation**
+-----------+---------------------------------+
| *Default* | ``&""`` |
+-----------+---------------------------------+
| *Setter* | set_theme_type_variation(value) |
+-----------+---------------------------------+
| *Getter* | get_theme_type_variation() |
+-----------+---------------------------------+
----
.. _class_Window_property_title:
- :ref:`String<class_String>` **title**
+-----------+------------------+
| *Default* | ``""`` |
+-----------+------------------+
| *Setter* | set_title(value) |
+-----------+------------------+
| *Getter* | get_title() |
+-----------+------------------+
The window's title.
----
.. _class_Window_property_transient:
- :ref:`bool<class_bool>` **transient**
+-----------+----------------------+
| *Default* | ``false`` |
+-----------+----------------------+
| *Setter* | set_transient(value) |
+-----------+----------------------+
| *Getter* | is_transient() |
+-----------+----------------------+
----
.. _class_Window_property_transparent:
- :ref:`bool<class_bool>` **transparent**
+-----------+-----------------+
| *Default* | ``false`` |
+-----------+-----------------+
| *Setter* | set_flag(value) |
+-----------+-----------------+
| *Getter* | get_flag() |
+-----------+-----------------+
----
.. _class_Window_property_unfocusable:
- :ref:`bool<class_bool>` **unfocusable**
+-----------+-----------------+
| *Default* | ``false`` |
+-----------+-----------------+
| *Setter* | set_flag(value) |
+-----------+-----------------+
| *Getter* | get_flag() |
+-----------+-----------------+
----
.. _class_Window_property_unresizable:
- :ref:`bool<class_bool>` **unresizable**
+-----------+-----------------+
| *Default* | ``false`` |
+-----------+-----------------+
| *Setter* | set_flag(value) |
+-----------+-----------------+
| *Getter* | get_flag() |
+-----------+-----------------+
If ``true``, the window can't be resized.
----
.. _class_Window_property_visible:
- :ref:`bool<class_bool>` **visible**
+-----------+--------------------+
| *Default* | ``true`` |
+-----------+--------------------+
| *Setter* | set_visible(value) |
+-----------+--------------------+
| *Getter* | is_visible() |
+-----------+--------------------+
If ``true``, the window is visible.
----
.. _class_Window_property_wrap_controls:
- :ref:`bool<class_bool>` **wrap_controls**
+-----------+--------------------------+
| *Default* | ``false`` |
+-----------+--------------------------+
| *Setter* | set_wrap_controls(value) |
+-----------+--------------------------+
| *Getter* | is_wrapping_controls() |
+-----------+--------------------------+
Method Descriptions
-------------------
.. _class_Window_method_can_draw:
- :ref:`bool<class_bool>` **can_draw** **(** **)** |const|
Returns whether the window is being drawn to the screen.
----
.. _class_Window_method_child_controls_changed:
- void **child_controls_changed** **(** **)**
----
.. _class_Window_method_get_contents_minimum_size:
- :ref:`Vector2<class_Vector2>` **get_contents_minimum_size** **(** **)** |const|
Returns the combined minimum size from the child :ref:`Control<class_Control>` nodes of the window.
----
.. _class_Window_method_get_flag:
- :ref:`bool<class_bool>` **get_flag** **(** :ref:`Flags<enum_Window_Flags>` flag **)** |const|
Returns ``true`` if the flag is set.
----
.. _class_Window_method_get_layout_direction:
- :ref:`LayoutDirection<enum_Window_LayoutDirection>` **get_layout_direction** **(** **)** |const|
Returns layout direction and text writing direction.
----
.. _class_Window_method_get_real_size:
- :ref:`Vector2i<class_Vector2i>` **get_real_size** **(** **)** |const|
Returns the window's size including its border.
----
.. _class_Window_method_get_theme_color:
- :ref:`Color<class_Color>` **get_theme_color** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
----
.. _class_Window_method_get_theme_constant:
- :ref:`int<class_int>` **get_theme_constant** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
----
.. _class_Window_method_get_theme_default_base_scale:
- :ref:`float<class_float>` **get_theme_default_base_scale** **(** **)** |const|
----
.. _class_Window_method_get_theme_default_font:
- :ref:`Font<class_Font>` **get_theme_default_font** **(** **)** |const|
----
.. _class_Window_method_get_theme_default_font_size:
- :ref:`int<class_int>` **get_theme_default_font_size** **(** **)** |const|
----
.. _class_Window_method_get_theme_font:
- :ref:`Font<class_Font>` **get_theme_font** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
Returns the :ref:`Font<class_Font>` at ``name`` if the theme has ``theme_type``.
----
.. _class_Window_method_get_theme_font_size:
- :ref:`int<class_int>` **get_theme_font_size** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
Returns the font size at ``name`` if the theme has ``theme_type``.
----
.. _class_Window_method_get_theme_icon:
- :ref:`Texture2D<class_Texture2D>` **get_theme_icon** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
----
.. _class_Window_method_get_theme_stylebox:
- :ref:`StyleBox<class_StyleBox>` **get_theme_stylebox** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
----
.. _class_Window_method_grab_focus:
- void **grab_focus** **(** **)**
Causes the window to grab focus, allowing it to receive user input.
----
.. _class_Window_method_has_focus:
- :ref:`bool<class_bool>` **has_focus** **(** **)** |const|
Returns ``true`` if the window is focused.
----
.. _class_Window_method_has_theme_color:
- :ref:`bool<class_bool>` **has_theme_color** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
----
.. _class_Window_method_has_theme_constant:
- :ref:`bool<class_bool>` **has_theme_constant** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
----
.. _class_Window_method_has_theme_font:
- :ref:`bool<class_bool>` **has_theme_font** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
Returns ``true`` if :ref:`Font<class_Font>` with ``name`` is in ``theme_type``.
Returns ``false`` if the theme does not have ``theme_type``.
----
.. _class_Window_method_has_theme_font_size:
- :ref:`bool<class_bool>` **has_theme_font_size** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
Returns ``true`` if font size with ``name`` is in ``theme_type``.
Returns ``false`` if the theme does not have ``theme_type``.
----
.. _class_Window_method_has_theme_icon:
- :ref:`bool<class_bool>` **has_theme_icon** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
----
.. _class_Window_method_has_theme_stylebox:
- :ref:`bool<class_bool>` **has_theme_stylebox** **(** :ref:`StringName<class_StringName>` name, :ref:`StringName<class_StringName>` theme_type="" **)** |const|
----
.. _class_Window_method_hide:
- void **hide** **(** **)**
----
.. _class_Window_method_is_embedded:
- :ref:`bool<class_bool>` **is_embedded** **(** **)** |const|
Returns ``true`` if the window is currently embedded in another window.
----
.. _class_Window_method_is_layout_rtl:
- :ref:`bool<class_bool>` **is_layout_rtl** **(** **)** |const|
Returns ``true`` if layout is right-to-left.
----
.. _class_Window_method_is_maximize_allowed:
- :ref:`bool<class_bool>` **is_maximize_allowed** **(** **)** |const|
----
.. _class_Window_method_is_using_font_oversampling:
- :ref:`bool<class_bool>` **is_using_font_oversampling** **(** **)** |const|
----
.. _class_Window_method_move_to_foreground:
- void **move_to_foreground** **(** **)**
----
.. _class_Window_method_popup:
- void **popup** **(** :ref:`Rect2i<class_Rect2i>` rect=Rect2i(0, 0, 0, 0) **)**
----
.. _class_Window_method_popup_centered:
- void **popup_centered** **(** :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0) **)**
----
.. _class_Window_method_popup_centered_clamped:
- void **popup_centered_clamped** **(** :ref:`Vector2i<class_Vector2i>` minsize=Vector2i(0, 0), :ref:`float<class_float>` fallback_ratio=0.75 **)**
----
.. _class_Window_method_popup_centered_ratio:
- void **popup_centered_ratio** **(** :ref:`float<class_float>` ratio=0.8 **)**
----
.. _class_Window_method_popup_on_parent:
- void **popup_on_parent** **(** :ref:`Rect2i<class_Rect2i>` parent_rect **)**
----
.. _class_Window_method_request_attention:
- void **request_attention** **(** **)**
----
.. _class_Window_method_reset_size:
- void **reset_size** **(** **)**
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).
----
.. _class_Window_method_set_flag:
- void **set_flag** **(** :ref:`Flags<enum_Window_Flags>` flag, :ref:`bool<class_bool>` enabled **)**
Sets a specified window flag.
----
.. _class_Window_method_set_ime_active:
- void **set_ime_active** **(** :ref:`bool<class_bool>` active **)**
----
.. _class_Window_method_set_ime_position:
- void **set_ime_position** **(** :ref:`Vector2i<class_Vector2i>` position **)**
----
.. _class_Window_method_set_layout_direction:
- void **set_layout_direction** **(** :ref:`LayoutDirection<enum_Window_LayoutDirection>` direction **)**
Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
----
.. _class_Window_method_set_use_font_oversampling:
- void **set_use_font_oversampling** **(** :ref:`bool<class_bool>` enable **)**
----
.. _class_Window_method_show:
- void **show** **(** **)**
Theme Property Descriptions
---------------------------
.. _class_Window_theme_color_title_color:
- :ref:`Color<class_Color>` **title_color**
+-----------+-----------------------------------+
| *Default* | ``Color(0.875, 0.875, 0.875, 1)`` |
+-----------+-----------------------------------+
----
.. _class_Window_theme_color_title_outline_modulate:
- :ref:`Color<class_Color>` **title_outline_modulate**
+-----------+-----------------------+
| *Default* | ``Color(1, 1, 1, 1)`` |
+-----------+-----------------------+
The color of the title outline.
----
.. _class_Window_theme_constant_close_h_ofs:
- :ref:`int<class_int>` **close_h_ofs**
+-----------+--------+
| *Default* | ``18`` |
+-----------+--------+
----
.. _class_Window_theme_constant_close_v_ofs:
- :ref:`int<class_int>` **close_v_ofs**
+-----------+--------+
| *Default* | ``24`` |
+-----------+--------+
----
.. _class_Window_theme_constant_resize_margin:
- :ref:`int<class_int>` **resize_margin**
+-----------+-------+
| *Default* | ``4`` |
+-----------+-------+
----
.. _class_Window_theme_constant_scaleborder_size:
- :ref:`int<class_int>` **scaleborder_size**
+-----------+-------+
| *Default* | ``4`` |
+-----------+-------+
----
.. _class_Window_theme_constant_title_height:
- :ref:`int<class_int>` **title_height**
+-----------+--------+
| *Default* | ``36`` |
+-----------+--------+
----
.. _class_Window_theme_constant_title_outline_size:
- :ref:`int<class_int>` **title_outline_size**
+-----------+-------+
| *Default* | ``0`` |
+-----------+-------+
The size of the title outline.
----
.. _class_Window_theme_font_title_font:
- :ref:`Font<class_Font>` **title_font**
----
.. _class_Window_theme_font_size_title_font_size:
- :ref:`int<class_int>` **title_font_size**
The size of the title font.
----
.. _class_Window_theme_icon_close:
- :ref:`Texture2D<class_Texture2D>` **close**
----
.. _class_Window_theme_icon_close_pressed:
- :ref:`Texture2D<class_Texture2D>` **close_pressed**
----
.. _class_Window_theme_style_embedded_border:
- :ref:`StyleBox<class_StyleBox>` **embedded_border**
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`