ContentScaleMode
Window.swift:135enum ContentScaleModeenum ContentScaleModeimport SwiftGodotFramework to write Godot Game Extensions using the Swift Programming Language.
class WindowBase class for all windows, dialogs, and popups.
case disabledThe content will not be scaled to match the Window’s size.
case canvasItemsThe content will be rendered at the target size. This is more performance-expensive than .viewport, but provides better results.
case viewportThe content will be rendered at the base size and then scaled to the target size. More performant than .canvasItems, but results in pixelated image.
static let notificationThemeChanged: IntSent when the node needs to refresh its theme items. This happens in one of the following cases:
static let notificationVisibilityChanged: IntEmitted when Window’s visibility changes, right before [signal visibility_changed].
override class var godotClassName: StringName { get }var aboutToPopup: SimpleSignal { get }Emitted right after popup(rect:) call, before the Window appears or does anything.
final var alwaysOnTop: Bool { get set }If true, the window will be on top of all other windows. Does not work if transient is enabled.
final var autoTranslate: Bool { get set }Toggles if any text should automatically change to its translated version depending on the current locale.
final var borderless: Bool { get set }If true, the window will have no borders.
var closeRequested: SimpleSignal { get }Emitted when the Window’s close button is pressed or when popupWindow is enabled and user clicks outside the window.
final var contentScaleAspect: Window.ContentScaleAspect { get set }Specifies how the content’s aspect behaves when the Window is resized. The base aspect is determined by contentScaleSize.
final var contentScaleFactor: Double { get set }Specifies the base scale of Window’s content when its size is equal to contentScaleSize.
final var contentScaleMode: Window.ContentScaleMode { get set }Specifies how the content is scaled when the Window is resized.
final var contentScaleSize: Vector2i { get set }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.
final var contentScaleStretch: Window.ContentScaleStretch { get set }The policy to use to determine the final scale factor for 2D elements. This affects how contentScaleFactor is applied, in addition to the automatic scale factor determined by contentScaleSize.
final var currentScreen: Int32 { get set }The screen the window is currently on.
var dpiChanged: SimpleSignal { get }Emitted when the Window’s DPI changes as a result of OS-level changes (e.g. moving the window from a Retina display to a lower resolution one).
final var exclusive: Bool { get set }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.
final var extendToTitle: Bool { get set }If true, the Window contents is expanded to the full size of the window, window title bar is transparent.
var filesDropped: Signal2 { get }Emitted when files are dragged from the OS file manager and dropped in the game window. The argument is a list of file paths.
var focusEntered: SimpleSignal { get }Emitted when the Window gains focus.
var focusExited: SimpleSignal { get }Emitted when the Window loses its focus.
final var forceNative: Bool { get set }If true, native window will be used regardless of parent viewport and project settings.
var goBackRequested: SimpleSignal { get }Emitted when a go back request is sent (e.g. pressing the “Back” button on Android), right after NodenotificationWmGoBackRequest````.
final var initialPosition: Window.WindowInitialPosition { get set }Specifies the initial type of position for the Window. See WindowInitialPosition constants.
final var keepTitleVisible: Bool { get set }If true, the Window width is expanded to keep the title bar text fully visible.
final var maxSize: Vector2i { get set }If non-zero, the Window can’t be resized to be bigger than this size.
final var minSize: Vector2i { get set }If non-zero, the Window can’t be resized to be smaller than this size.
final var mode: Window.Mode { get set }Set’s the window’s current mode.
var mouseEntered: SimpleSignal { get }Emitted when the mouse cursor enters the Window‘s visible area, that is not occluded behind other Controls or windows, provided its guiDisableInput is false and regardless if it’s currently focused or not.
var mouseExited: SimpleSignal { get }Emitted when the mouse cursor leaves the Window‘s visible area, that is not occluded behind other Controls or windows, provided its guiDisableInput is false and regardless if it’s currently focused or not.
final var mousePassthrough: Bool { get set }If true, all mouse events will be passed to the underlying window of the same application. See also mousePassthroughPolygon.
final var mousePassthroughPolygon: PackedVector2Array { get set }Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through.
final var popupWindow: Bool { get set }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 exclusive is enabled).
final var position: Vector2i { get set }The window’s position in pixels.
final var size: Vector2i { get set }The window’s size in pixels.
final var theme: Theme? { get set }The Theme resource this node and all its Control and Window children use. If a child node has its own Theme resource set, theme items are merged with child’s definitions having higher priority.
var themeChanged: SimpleSignal { get }Emitted when the notificationThemeChanged notification is sent.
final var themeTypeVariation: StringName { get set }The name of a theme type variation used by this Window to look up its own theme items. See themeTypeVariation for more details.
final var title: String { get set }The window’s title. If the Window is native, title styles set in Theme will have no effect.
var titlebarChanged: SimpleSignal { get }Emitted when window title bar decorations are changed, e.g. macOS window enter/exit full screen mode, or extend-to-title flag is changed.
final var transient: Bool { get set }If true, the Window is transient, i.e. it’s considered a child of another Window. The transient window 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.
final var transientToFocused: Bool { get set }If true, and the Window is transient, this window will (at the time of becoming visible) become transient to the currently focused window instead of the immediate parent window in the hierarchy. Note that the transient parent is assigned at the time this window becomes visible, so changing it afterwards has no effect until re-shown.
final var transparent: Bool { get set }If true, the Window’s background can be transparent. This is best used with embedded windows.
final var unfocusable: Bool { get set }If true, the Window can’t be focused nor interacted with. It can still be visible.
final var unresizable: Bool { get set }If true, the window can’t be resized. Minimize and maximize buttons are disabled.
var visibilityChanged: SimpleSignal { get }Emitted when Window is made visible or disappears.
final var visible: Bool { get set }If true, the window is visible.
var windowInput: Signal1 { get }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.
final var wrapControls: Bool { get set }If true, the window’s size will automatically update when a child node is added or removed, ignoring minSize if the new size is bigger.
func _getContentsMinimumSize() -> Vector2 Virtual method to be implemented by the user. Overrides the value returned by getContentsMinimumSize.
final func addThemeColorOverride(name: StringName, color: Color) Creates a local override for a theme Color with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with removeThemeColorOverride(name:).
final func addThemeConstantOverride(name: StringName, constant: Int32) Creates a local override for a theme constant with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with removeThemeConstantOverride(name:).
final func addThemeFontOverride(name: StringName, font: Font?) Creates a local override for a theme Font with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with removeThemeFontOverride(name:).
final func addThemeFontSizeOverride(name: StringName, fontSize: Int32) Creates a local override for a theme font size with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with removeThemeFontSizeOverride(name:).
final func addThemeIconOverride(name: StringName, texture: Texture2D?) Creates a local override for a theme icon with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with removeThemeIconOverride(name:).
final func addThemeStyleboxOverride(name: StringName, stylebox: StyleBox?) Creates a local override for a theme StyleBox with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with removeThemeStyleboxOverride(name:).
final func beginBulkThemeOverride() Prevents *_theme_*_override methods from emitting notificationThemeChanged until endBulkThemeOverride is called.
final func canDraw() -> Bool Returns whether the window is being drawn to the screen.
final func childControlsChanged() Requests an update of the Window size to fit underlying Control nodes.
final func endBulkThemeOverride() Ends a bulk theme override update. See beginBulkThemeOverride.
final func getContentsMinimumSize() -> Vector2 Returns the combined minimum size from the child Control nodes of the window. Use childControlsChanged to update it when child nodes have changed.
final func getLayoutDirection() -> Window.LayoutDirection Returns layout direction and text writing direction.
final func getPositionWithDecorations() -> Vector2i Returns the window’s position including its border.
final func getSizeWithDecorations() -> Vector2i Returns the window’s size including its border.
final func getThemeColor(name: StringName, themeType: StringName = StringName ("")) -> Color Returns a Color from the first matching Theme in the tree if that Theme has a color item with the specified name and themeType.
final func getThemeConstant(name: StringName, themeType: StringName = StringName ("")) -> Int32 Returns a constant from the first matching Theme in the tree if that Theme has a constant item with the specified name and themeType.
final func getThemeDefaultBaseScale() -> Double Returns the default base scale value from the first matching Theme in the tree if that Theme has a valid defaultBaseScale value.
final func getThemeDefaultFont() -> Font? Returns the default font from the first matching Theme in the tree if that Theme has a valid defaultFont value.
final func getThemeDefaultFontSize() -> Int32 Returns the default font size value from the first matching Theme in the tree if that Theme has a valid defaultFontSize value.
final func getThemeFont(name: StringName, themeType: StringName = StringName ("")) -> Font? Returns a Font from the first matching Theme in the tree if that Theme has a font item with the specified name and themeType.
final func getThemeFontSize(name: StringName, themeType: StringName = StringName ("")) -> Int32 Returns a font size from the first matching Theme in the tree if that Theme has a font size item with the specified name and themeType.
final func getThemeIcon(name: StringName, themeType: StringName = StringName ("")) -> Texture2D? Returns an icon from the first matching Theme in the tree if that Theme has an icon item with the specified name and themeType.
final func getThemeStylebox(name: StringName, themeType: StringName = StringName ("")) -> StyleBox? Returns a StyleBox from the first matching Theme in the tree if that Theme has a stylebox item with the specified name and themeType.
final func getWindowId() -> Int32 Returns the ID of the window.
final func grabFocus() Causes the window to grab focus, allowing it to receive user input.
final func hasFocus() -> Bool Returns true if the window is focused.
final func hasThemeColor(name: StringName, themeType: StringName = StringName ("")) -> Bool Returns true if there is a matching Theme in the tree that has a color item with the specified name and themeType.
final func hasThemeColorOverride(name: StringName) -> Bool Returns true if there is a local override for a theme Color with the specified name in this Control node.
final func hasThemeConstant(name: StringName, themeType: StringName = StringName ("")) -> Bool Returns true if there is a matching Theme in the tree that has a constant item with the specified name and themeType.
final func hasThemeConstantOverride(name: StringName) -> Bool Returns true if there is a local override for a theme constant with the specified name in this Control node.
final func hasThemeFont(name: StringName, themeType: StringName = StringName ("")) -> Bool Returns true if there is a matching Theme in the tree that has a font item with the specified name and themeType.
final func hasThemeFontOverride(name: StringName) -> Bool Returns true if there is a local override for a theme Font with the specified name in this Control node.
final func hasThemeFontSize(name: StringName, themeType: StringName = StringName ("")) -> Bool Returns true if there is a matching Theme in the tree that has a font size item with the specified name and themeType.
final func hasThemeFontSizeOverride(name: StringName) -> Bool Returns true if there is a local override for a theme font size with the specified name in this Control node.
final func hasThemeIcon(name: StringName, themeType: StringName = StringName ("")) -> Bool Returns true if there is a matching Theme in the tree that has an icon item with the specified name and themeType.
final func hasThemeIconOverride(name: StringName) -> Bool Returns true if there is a local override for a theme icon with the specified name in this Control node.
final func hasThemeStylebox(name: StringName, themeType: StringName = StringName ("")) -> Bool Returns true if there is a matching Theme in the tree that has a stylebox item with the specified name and themeType.
final func hasThemeStyleboxOverride(name: StringName) -> Bool Returns true if there is a local override for a theme StyleBox with the specified name in this Control node.
final func hide() 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 show.
final func isEmbedded() -> Bool Returns true if the window is currently embedded in another window.
final func isLayoutRtl() -> Bool Returns true if layout is right-to-left.
final func isMaximizeAllowed() -> Bool Returns true if the window can be maximized (the maximize button is enabled).
final func isUsingFontOversampling() -> Bool Returns true if font oversampling is enabled. See setUseFontOversampling(enable:).
final func moveToCenter() Centers a native window on the current screen and an embedded window on its embedder Viewport.
final func moveToForeground() Causes the window to grab focus, allowing it to receive user input.
final func popup(rect: Rect2i = Rect2i (x: 0, y: 0, width: 0, height: 0)) Shows the Window and makes it transient (see transient). If rect is provided, it will be set as the Window’s size. Fails if called on the main window.
final func popupCentered(minsize: Vector2i = Vector2i (x: 0, y: 0)) 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.
final func popupCenteredClamped(minsize: Vector2i = Vector2i (x: 0, y: 0), fallbackRatio: Double = 0.75) Popups the Window centered inside its parent Window. fallbackRatio determines the maximum size of the Window, in relation to its parent.
final func popupCenteredRatio(_ ratio: Double = 0.8) If Window is embedded, popups the Window centered inside its embedder and sets its size as a ratio of embedder’s size.
final func popupExclusive(fromNode: Node?, rect: Rect2i = Rect2i (x: 0, y: 0, width: 0, height: 0)) Attempts to parent this dialog to the last exclusive window relative to fromNode, and then calls popup(rect:) on it. The dialog must have no current parent, otherwise the method fails.
final func popupExclusiveCentered(fromNode: Node?, minsize: Vector2i = Vector2i (x: 0, y: 0)) Attempts to parent this dialog to the last exclusive window relative to fromNode, and then calls popupCentered(minsize:) on it. The dialog must have no current parent, otherwise the method fails.
final func popupExclusiveCenteredClamped(fromNode: Node?, minsize: Vector2i = Vector2i (x: 0, y: 0), fallbackRatio: Double = 0.75) Attempts to parent this dialog to the last exclusive window relative to fromNode, and then calls popupCenteredClamped(minsize:fallbackRatio:) on it. The dialog must have no current parent, otherwise the method fails.
final func popupExclusiveCenteredRatio(fromNode: Node?, ratio: Double = 0.8) Attempts to parent this dialog to the last exclusive window relative to fromNode, and then calls popupCenteredRatio(_:) on it. The dialog must have no current parent, otherwise the method fails.
final func popupExclusiveOnParent(fromNode: Node?, parentRect: Rect2i) Attempts to parent this dialog to the last exclusive window relative to fromNode, and then calls popupOnParent(parentRect:) on it. The dialog must have no current parent, otherwise the method fails.
final func popupOnParent(parentRect: Rect2i) Popups the Window with a position shifted by parent Window’s position. If the Window is embedded, has the same effect as popup(rect:).
final func removeThemeColorOverride(name: StringName) Removes a local override for a theme Color with the specified name previously added by addThemeColorOverride(name:color:) or via the Inspector dock.
final func removeThemeConstantOverride(name: StringName) Removes a local override for a theme constant with the specified name previously added by addThemeConstantOverride(name:constant:) or via the Inspector dock.
final func removeThemeFontOverride(name: StringName) Removes a local override for a theme Font with the specified name previously added by addThemeFontOverride(name:font:) or via the Inspector dock.
final func removeThemeFontSizeOverride(name: StringName) Removes a local override for a theme font size with the specified name previously added by addThemeFontSizeOverride(name:fontSize:) or via the Inspector dock.
final func removeThemeIconOverride(name: StringName) Removes a local override for a theme icon with the specified name previously added by addThemeIconOverride(name:texture:) or via the Inspector dock.
final func removeThemeStyleboxOverride(name: StringName) Removes a local override for a theme StyleBox with the specified name previously added by addThemeStyleboxOverride(name:stylebox:) or via the Inspector dock.
final func requestAttention() 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.
final func resetSize() Resets the size to the minimum size, which is the max of minSize and (if wrapControls is enabled) getContentsMinimumSize. This is equivalent to calling set_size(Vector2i()) (or any size below the minimum).
final func setImeActive(_ active: Bool) If active is true, enables system’s native IME (Input Method Editor).
final func setImePosition(_ position: Vector2i) Moves IME to the given position.
final func setLayoutDirection(_ direction: Window.LayoutDirection) Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
final func setUnparentWhenInvisible(unparent: Bool) If unparent is true, the window is automatically unparented when going invisible.
final func setUseFontOversampling(enable: Bool) Enables font oversampling. This makes fonts look better when they are scaled up.
final func show() Makes the Window appear. This enables interactions with the Window and doesn’t change any of its property other than visibility (unlike e.g. popup(rect:)).
enum ContentScaleAspectenum ContentScaleStretchenum Flagsenum LayoutDirectionenum Modeclass Signal1Signal support.
class Signal2Signal support.
enum WindowInitialPositionprotocol CaseIterableA type that provides a collection of all of its values.
protocol CustomDebugStringConvertibleA type with a customized textual representation suitable for debugging purposes.
protocol EquatableA type that can be compared for value equality.
protocol Hashable : EquatableA type that can be hashed into a Hasher to produce an integer hash value.
protocol RawRepresentable<RawValue>A type that can be converted to and from an associated raw value.
init?(rawValue: Int64) var debugDescription: String { get }A textual representation of this instance, suitable for debugging
var hashValue: Int { get }static func != (lhs: Self, rhs: Self) -> Bool Returns a Boolean value indicating whether two values are not equal.
func hash(into hasher: inout Hasher)