Base class for all windows.
A node that creates a window. The window can either be a native system window or embedded inside another [Window] (see [member Viewport.gui_embed_subwindows]).
At runtime, [Window]s will not close automatically when requested. You need to handle it manually using [signal close_requested] (this applies both to clicking close button and clicking outside popup).
Returns whether the window is being drawn to the screen.
Requests an update of the [Window] size to fit underlying [Control] nodes.
Returns the combined minimum size from the child [Control] nodes of the window. Use [method child_controls_changed] to update it when children nodes have changed.
Returns [code]true[/code] if the [param flag] is set.
Returns layout direction and text writing direction.
Returns the window's position including its border.
Returns the window's size including its border.
Returns the [Color] at [param name] if the theme has [param theme_type].
See [method Control.get_theme_color] for more details.
Returns the constant at [param name] if the theme has [param theme_type].
See [method Control.get_theme_color] for more details.
Returns the default base scale defined in the attached [Theme].
See [member Theme.default_base_scale] for more details.
Returns the default [Font] defined in the attached [Theme].
See [member Theme.default_font] for more details.
Returns the default font size defined in the attached [Theme].
See [member Theme.default_font_size] for more details.
Returns the [Font] at [param name] if the theme has [param theme_type].
See [method Control.get_theme_color] for more details.
Returns the font size at [param name] if the theme has [param theme_type].
See [method Control.get_theme_color] for more details.
Returns the icon at [param name] if the theme has [param theme_type].
See [method Control.get_theme_color] for more details.
Returns the [StyleBox] at [param name] if the theme has [param theme_type].
See [method Control.get_theme_color] for more details.
Causes the window to grab focus, allowing it to receive user input.
Returns [code]true[/code] if the window is focused.
Returns [code]true[/code] if [Color] with [param name] is in [param theme_type].
Returns [code]true[/code] if constant with [param name] is in [param theme_type].
Returns [code]true[/code] if [Font] with [param name] is in [param theme_type].
Returns [code]true[/code] if font size with [param name] is in [param theme_type].
Returns [code]true[/code] if icon with [param name] is in [param theme_type].
Returns [code]true[/code] if [StyleBox] with [param name] is in [param theme_type].
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 [method show].
Returns [code]true[/code] if the window is currently embedded in another window.
Returns [code]true[/code] if layout is right-to-left.
Returns [code]true[/code] if the window can be maximized (the maximize button is enabled).
Returns [code]true[/code] if font oversampling is enabled. See [method set_use_font_oversampling].
Moves the [Window] on top of other windows and focuses it.
Shows the [Window] and makes it transient (see [member transient]). If [param rect] is provided, it will be set as the [Window]'s size.
Fails if called on the main window.
Popups the [Window] at the center of the current screen, with optionally given minimum size.
If the [Window] is embedded, it will be centered in the parent [Viewport] instead.
Popups the [Window] centered inside its parent [Window].
[code]fallback_ratio[/code] determines the maximum size of the [Window], in relation to its parent.
Popups the [Window] centered inside its parent [Window] and sets its size as a [param ratio] of parent's size.
Popups the [Window] with a position shifted by parent [Window]'s position.
If the [Window] is embedded, has the same effect as [method popup].
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.
Resets the size to the minimum size, which is the max of [member min_size] and (if [member wrap_controls] is enabled) [method get_contents_minimum_size]. This is equivalent to calling [code]set_size(Vector2i())[/code] (or any size below the minimum).
Sets a specified window flag.
If [param active] is [code]true[/code], enables system's native IME (Input Method Editor).
Moves IME to the given position.
Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
Enables font oversampling. This makes fonts look better when they are scaled up.
Makes the [Window] appear. This enables interactions with the [Window] and doesn't change any of its property other than visibility (unlike e.g. [method popup]).
If [code]true[/code], the window will be on top of all other windows. Does not work if [member transient] is enabled.
Toggles if any text should automatically change to its translated version depending on the current locale.
If [code]true[/code], the window will have no borders.
Specifies how the content's aspect behaves when the [Window] is resized. The base aspect is determined by [member content_scale_size].
Specifies the base scale of [Window]'s content when its [member size] is equal to [member content_scale_size].
Specifies how the content is scaled when the [Window] is resized.
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.
The screen the window is currently on.
If [code]true[/code], 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].
Needs [member transient] enabled to work.
If [code]true[/code], the [Window] contents is expanded to the full size of the window, window title bar is transparent.
If non-zero, the [Window] can't be resized to be bigger than this size.
[b]Note:[/b] This property will be ignored if the value is lower than [member min_size].
If non-zero, the [Window] can't be resized to be smaller than this size.
[b]Note:[/b] This property will be ignored in favor of [method get_contents_minimum_size] if [member wrap_controls] is enabled and if its size is bigger.
Set's the window's current mode.
[b]Note:[/b] Fullscreen mode is not exclusive full screen on Windows and Linux.
If [code]true[/code], 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 [member exclusive] is enabled).
The window's position in pixels.
The window's size in pixels.
The [Theme] resource that determines the style of the underlying [Control] nodes.
[Window] styles will have no effect unless the window is embedded.
The name of a theme type variation used by this [Window] to look up its own theme items. See [member Control.theme_type_variation] for more details.
The window's title. If the [Window] is non-embedded, title styles set in [Theme] will have no effect.
If [code]true[/code], the [Window] is transient, i.e. it's considered a child of another [Window]. Transient window is will be destroyed with its transient parent and will return focus to their parent when closed. The transient window is displayed on top of a non-exclusive full-screen parent window. Transient windows can't enter full-screen mode.
Note that behavior might be different depending on the platform.
If [code]true[/code], the [Window]'s background can be transparent. This is best used with embedded windows.
[b]Note:[/b] For native windows, this flag has no effect if [member ProjectSettings.display/window/per_pixel_transparency/allowed] is set to [code]false[/code].
[b]Note:[/b] Transparency support is implemented on Linux, macOS and Windows, but availability might vary depending on GPU driver, display manager, and compositor capabilities.
If [code]true[/code], the [Window] can't be focused nor interacted with. It can still be visible.
If [code]true[/code], the window can't be resized. Minimize and maximize buttons are disabled.
If [code]true[/code], the window is visible.
If [code]true[/code], the window's size will automatically update when a child node is added or removed, ignoring [member min_size] if the new size is bigger.
If [code]false[/code], you need to call [method child_controls_changed] manually.
Emitted right after [method popup] call, before the [Window] appears or does anything.
Emitted when the [Window]'s close button is pressed or when [member popup_window] is enabled and user clicks outside the window.
This signal can be used to handle window closing, e.g. by connecting it to [method hide].
Emitted when files are dragged from the OS file manager and dropped in the game window. The argument is a list of file paths.
Note that this method only works with non-embedded windows, i.e. the main window and [Window]-derived nodes when [member Viewport.gui_embed_subwindows] is disabled in the main viewport.
Example usage:
[codeblock]
func _ready():
get_viewport().files_dropped.connect(on_files_dropped)
func on_files_dropped(files):
print(files)
[/codeblock]
Emitted when the [Window] gains focus.
Emitted when the [Window] loses its focus.
Emitted when a go back request is sent (e.g. pressing the "Back" button on Android), right after [constant Node.NOTIFICATION_WM_GO_BACK_REQUEST].
Emitted when the mouse cursor enters the [Window]'s area, regardless if it's currently focused or not.
Emitted when the mouse cursor exits the [Window]'s area (including when it's hovered over another window on top of this one).
Emitted when the [constant NOTIFICATION_THEME_CHANGED] notification is sent.
Emitted when window title bar decorations are changed, e.g. macOS window enter/exit full screen mode, or extend-to-title flag is changed.
Emitted when [Window] is made visible or disappears.
Emitted when the [Window] is currently focused and receives any input, passing the received event as an argument. The event's position, if present, is in the embedder's coordinate system.
Emitted when [Window]'s visibility changes, right before [signal visibility_changed].
Sent when the node needs to refresh its theme items. This happens in one of the following cases:
- The [member theme] property is changed on this node or any of its ancestors.
- The [member theme_type_variation] property is changed on this node.
- The node enters the scene tree.
[b]Note:[/b] As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree.
Windowed mode, i.e. [Window] doesn't occupy the whole screen (unless set to the size of the screen).
Minimized window mode, i.e. [Window] is not visible and available on window manager's window list. Normally happens when the minimize button is pressed.
Maximized window mode, i.e. [Window] will occupy whole screen area except task bar and still display its borders. Normally happens when the maximize button is pressed.
Full screen window mode. Note that this is not [i]exclusive[/i] full screen. On Windows and Linux, a borderless window is used to emulate full screen. On macOS, a new desktop is used to display the running project.
Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling full screen mode.
Exclusive full screen window mode. This mode is implemented on Windows only. On other platforms, it is equivalent to [constant MODE_FULLSCREEN].
Only one window in exclusive full screen mode can be visible on a given screen at a time. If multiple windows are in exclusive full screen mode for the same screen, the last one being set to this mode takes precedence.
Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling full screen mode.
The window can't be resizing by dragging its resize grip. It's still possible to resize the window using [member size]. This flag is ignored for full screen windows. Set with [member unresizable].
The window do not have native title bar and other decorations. This flag is ignored for full-screen windows. Set with [member borderless].
The window is floating on top of all other windows. This flag is ignored for full-screen windows. Set with [member always_on_top].
The window background can be transparent.
[b]Note:[/b] This flag has no effect if [member ProjectSettings.display/window/per_pixel_transparency/allowed] is set to [code]false[/code]. Set with [member transparent].
The window can't be focused. No-focus window will ignore all input, except mouse clicks. Set with [member unfocusable].
Window is part of menu or [OptionButton] dropdown. This flag can't be changed when the window is visible. An active popup window will exclusively receive all input, without stealing focus from its parent. Popup windows are automatically closed when uses click outside it, or when an application is switched. Popup window must have [code]transient parent[/code] set (see [member transient]).
Window content is expanded to the full size of the window. Unlike borderless window, the frame is left intact and can be used to resize the window, title bar is transparent, but have minimize/maximize/close buttons. Set with [member extend_to_title].
[b]Note:[/b] This flag is implemented on macOS.
Max value of the [enum Flags].
The content will not be scaled to match the [Window]'s size.
The content will be rendered at the target size. This is more performance-expensive than [constant CONTENT_SCALE_MODE_VIEWPORT], but provides better results.
The content will be rendered at the base size and then scaled to the target size. More performant than [constant CONTENT_SCALE_MODE_CANVAS_ITEMS], but results in pixelated image.
The aspect will be ignored. Scaling will simply stretch the content to fit the target size.
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.
The content can be expanded vertically. Scaling horizontally will result in keeping the width ratio and then black bars on left and right sides.
The content can be expanded horizontally. Scaling vertically will result in keeping the height ratio and then black bars on top and bottom sides.
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.
Automatic layout direction, determined from the parent window layout direction.
Automatic layout direction, determined from the current locale.
Left-to-right layout direction.
Right-to-left layout direction.
The color of the title's text.
The color of the title's text outline.
Horizontal position offset of the close button.
Vertical position offset of the close button.
Defines the outside margin at which the window border can be grabbed with mouse and resized.
Height of the title bar.
The size of the title outline.
The font used to draw the title.
The size of the title font.
The icon for the close button.
The icon for the close button when it's being pressed.
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 [code]expand_margin_*[/code] properties of [StyleBoxFlat].
[b]Note:[/b] The content background will not be visible unless [member transparent] is enabled.