Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
ContentScaleStretch
Window.swift:173enum ContentScaleStretch
Cases
case fractional
The content will be stretched according to a fractional factor. This fills all the space available in the window, but allows “pixel wobble” to occur due to uneven pixel scaling.
case integer
The content will be stretched only according to an integer factor, preserving sharp pixels. This may leave a black background visible on the window’s edges depending on the window size.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (124) members.
Types
enum ContentScaleAspect
enum ContentScaleMode
enum Flags
enum LayoutDirection
enum Mode
class Signal1
Signal support.
class Signal2
Signal support.
enum WindowInitialPosition
Type members
static let notificationThemeChanged: Int
Sent when the node needs to refresh its theme items. This happens in one of the following cases:
static let notificationVisibilityChanged: Int
Emitted when
Window
’s visibility changes, right before [signal visibility_changed].class var godotClassName: StringName
Instance members
var aboutToPopup: SimpleSignal
Emitted right after
popup(rect:)
call, before theWindow
appears or does anything.var alwaysOnTop: Bool
If
true
, the window will be on top of all other windows. Does not work iftransient
is enabled.var autoTranslate: Bool
Toggles if any text should automatically change to its translated version depending on the current locale.
var borderless: Bool
If
true
, the window will have no borders.var closeRequested: SimpleSignal
Emitted when the
Window
’s close button is pressed or whenpopupWindow
is enabled and user clicks outside the window.var contentScaleAspect: Window.ContentScaleAspect
Specifies how the content’s aspect behaves when the
Window
is resized. The base aspect is determined bycontentScaleSize
.var contentScaleFactor: Double
Specifies the base scale of
Window
’s content when itssize
is equal tocontentScaleSize
.var contentScaleMode: Window.ContentScaleMode
Specifies how the content is scaled when the
Window
is resized.var contentScaleSize: Vector2i
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.var contentScaleStretch: Window.ContentScaleStretch
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 bycontentScaleSize
.var currentScreen: Int32
The screen the window is currently on.
var dpiChanged: SimpleSignal
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).var exclusive: Bool
If
true
, theWindow
will be in exclusive mode. Exclusive windows are always on top of their parent and will block all input going to the parentWindow
.var extendToTitle: Bool
If
true
, theWindow
contents is expanded to the full size of the window, window title bar is transparent.var filesDropped: Signal2
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
Emitted when the
Window
gains focus.var focusExited: SimpleSignal
Emitted when the
Window
loses its focus.var goBackRequested: SimpleSignal
Emitted when a go back request is sent (e.g. pressing the “Back” button on Android), right after
Node
notificationWmGoBackRequest````.var initialPosition: Window.WindowInitialPosition
Specifies the initial type of position for the
Window
. SeeWindowInitialPosition
constants.var keepTitleVisible: Bool
If
true
, theWindow
width is expanded to keep the title bar text fully visible.var maxSize: Vector2i
If non-zero, the
Window
can’t be resized to be bigger than this size.var minSize: Vector2i
If non-zero, the
Window
can’t be resized to be smaller than this size.var mode: Window.Mode
Set’s the window’s current mode.
var mouseEntered: SimpleSignal
Emitted when the mouse cursor enters the
Window
‘s visible area, that is not occluded behind otherControl
s or windows, provided itsguiDisableInput
isfalse
and regardless if it’s currently focused or not.var mouseExited: SimpleSignal
Emitted when the mouse cursor leaves the
Window
‘s visible area, that is not occluded behind otherControl
s or windows, provided itsguiDisableInput
isfalse
and regardless if it’s currently focused or not.var mousePassthrough: Bool
If
true
, all mouse events will be passed to the underlying window of the same application. See alsomousePassthroughPolygon
.var mousePassthroughPolygon: PackedVector2Array
Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through.
var popupWindow: Bool
If
true
, theWindow
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 (unlessexclusive
is enabled).var position: Vector2i
The window’s position in pixels.
var size: Vector2i
The window’s size in pixels.
var theme: Theme?
The
Theme
resource this node and all itsControl
andWindow
children use. If a child node has its ownTheme
resource set, theme items are merged with child’s definitions having higher priority.var themeChanged: SimpleSignal
Emitted when the
notificationThemeChanged
notification is sent.var themeTypeVariation: StringName
The name of a theme type variation used by this
Window
to look up its own theme items. SeethemeTypeVariation
for more details.var title: String
The window’s title. If the
Window
is native, title styles set inTheme
will have no effect.var titlebarChanged: SimpleSignal
Emitted when window title bar decorations are changed, e.g. macOS window enter/exit full screen mode, or extend-to-title flag is changed.
var transient: Bool
If
true
, theWindow
is transient, i.e. it’s considered a child of anotherWindow
. 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.var transparent: Bool
If
true
, theWindow
’s background can be transparent. This is best used with embedded windows.var unfocusable: Bool
If
true
, theWindow
can’t be focused nor interacted with. It can still be visible.var unresizable: Bool
If
true
, the window can’t be resized. Minimize and maximize buttons are disabled.var visibilityChanged: SimpleSignal
Emitted when
Window
is made visible or disappears.var visible: Bool
If
true
, the window is visible.var windowInput: Signal1
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.var wrapControls: Bool
If
true
, the window’s size will automatically update when a child node is added or removed, ignoringminSize
if the new size is bigger.func addThemeColorOverride(name: StringName, color: Color
) Creates a local override for a theme
Color
with the specifiedname
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeColorOverride(name:)
.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 withremoveThemeConstantOverride(name:)
.func addThemeFontOverride(name: StringName, font: Font?
) Creates a local override for a theme
Font
with the specifiedname
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeFontOverride(name:)
.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 withremoveThemeFontSizeOverride(name:)
.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 withremoveThemeIconOverride(name:)
.func addThemeStyleboxOverride(name: StringName, stylebox: StyleBox?
) Creates a local override for a theme
StyleBox
with the specifiedname
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeStyleboxOverride(name:)
.func beginBulkThemeOverride(
) Prevents
*_theme_*_override
methods from emittingnotificationThemeChanged
untilendBulkThemeOverride
is called.func canDraw(
) -> Bool Returns whether the window is being drawn to the screen.
func childControlsChanged(
) Requests an update of the
Window
size to fit underlyingControl
nodes.func endBulkThemeOverride(
) Ends a bulk theme override update. See
beginBulkThemeOverride
.func getContentsMinimumSize(
) -> Vector2 Returns the combined minimum size from the child
Control
nodes of the window. UsechildControlsChanged
to update it when children nodes have changed.func getLayoutDirection(
) -> Window.LayoutDirection Returns layout direction and text writing direction.
func getPositionWithDecorations(
) -> Vector2i Returns the window’s position including its border.
func getSizeWithDecorations(
) -> Vector2i Returns the window’s size including its border.
func getThemeColor(name: StringName, themeType: StringName
) -> Color Returns a
Color
from the first matchingTheme
in the tree if thatTheme
has a color item with the specifiedname
andthemeType
.func getThemeConstant(name: StringName, themeType: StringName
) -> Int32 Returns a constant from the first matching
Theme
in the tree if thatTheme
has a constant item with the specifiedname
andthemeType
.func getThemeDefaultBaseScale(
) -> Double Returns the default base scale value from the first matching
Theme
in the tree if thatTheme
has a validdefaultBaseScale
value.func getThemeDefaultFont(
) -> Font? Returns the default font from the first matching
Theme
in the tree if thatTheme
has a validdefaultFont
value.func getThemeDefaultFontSize(
) -> Int32 Returns the default font size value from the first matching
Theme
in the tree if thatTheme
has a validdefaultFontSize
value.func getThemeFont(name: StringName, themeType: StringName
) -> Font? Returns a
Font
from the first matchingTheme
in the tree if thatTheme
has a font item with the specifiedname
andthemeType
.func getThemeFontSize(name: StringName, themeType: StringName
) -> Int32 Returns a font size from the first matching
Theme
in the tree if thatTheme
has a font size item with the specifiedname
andthemeType
.func getThemeIcon(name: StringName, themeType: StringName
) -> Texture2D? Returns an icon from the first matching
Theme
in the tree if thatTheme
has an icon item with the specifiedname
andthemeType
.func getThemeStylebox(name: StringName, themeType: StringName
) -> StyleBox? Returns a
StyleBox
from the first matchingTheme
in the tree if thatTheme
has a stylebox item with the specifiedname
andthemeType
.func getWindowId(
) -> Int32 Returns the ID of the window.
func grabFocus(
) Causes the window to grab focus, allowing it to receive user input.
func hasFocus(
) -> Bool Returns
true
if the window is focused.func hasThemeColor(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a color item with the specifiedname
andthemeType
.func hasThemeColorOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a themeColor
with the specifiedname
in thisControl
node.func hasThemeConstant(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a constant item with the specifiedname
andthemeType
.func hasThemeConstantOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a theme constant with the specifiedname
in thisControl
node.func hasThemeFont(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a font item with the specifiedname
andthemeType
.func hasThemeFontOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a themeFont
with the specifiedname
in thisControl
node.func hasThemeFontSize(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a font size item with the specifiedname
andthemeType
.func hasThemeFontSizeOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a theme font size with the specifiedname
in thisControl
node.func hasThemeIcon(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has an icon item with the specifiedname
andthemeType
.func hasThemeIconOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a theme icon with the specifiedname
in thisControl
node.func hasThemeStylebox(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a stylebox item with the specifiedname
andthemeType
.func hasThemeStyleboxOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a themeStyleBox
with the specifiedname
in thisControl
node.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
.func isEmbedded(
) -> Bool Returns
true
if the window is currently embedded in another window.func isLayoutRtl(
) -> Bool Returns
true
if layout is right-to-left.func isMaximizeAllowed(
) -> Bool Returns
true
if the window can be maximized (the maximize button is enabled).func isUsingFontOversampling(
) -> Bool Returns
true
if font oversampling is enabled. SeesetUseFontOversampling(enable:)
.func moveToCenter(
) Centers a native window on the current screen and an embedded window on its embedder
Viewport
.func moveToForeground(
) Moves the
Window
on top of other windows and focuses it.func popup(rect: Rect2i
) Shows the
Window
and makes it transient (seetransient
). Ifrect
is provided, it will be set as theWindow
’s size. Fails if called on the main window.func popupCentered(minsize: Vector2i
) Popups the
Window
at the center of the current screen, with optionally given minimum size. If theWindow
is embedded, it will be centered in the parentViewport
instead.func popupCenteredClamped(minsize: Vector2i, fallbackRatio: Double
) Popups the
Window
centered inside its parentWindow
.fallbackRatio
determines the maximum size of theWindow
, in relation to its parent.func popupCenteredRatio(Double
) If
Window
is embedded, popups theWindow
centered inside its embedder and sets its size as aratio
of embedder’s size.func popupExclusive(fromNode: Node?, rect: Rect2i
) Attempts to parent this dialog to the last exclusive window relative to
fromNode
, and then callspopup(rect:)
on it. The dialog must have no current parent, otherwise the method fails.func popupExclusiveCentered(fromNode: Node?, minsize: Vector2i
) Attempts to parent this dialog to the last exclusive window relative to
fromNode
, and then callspopupCentered(minsize:)
on it. The dialog must have no current parent, otherwise the method fails.func popupExclusiveCenteredClamped(fromNode: Node?, minsize: Vector2i, fallbackRatio: Double
) Attempts to parent this dialog to the last exclusive window relative to
fromNode
, and then callspopupCenteredClamped(minsize:fallbackRatio:)
on it. The dialog must have no current parent, otherwise the method fails.func popupExclusiveCenteredRatio(fromNode: Node?, ratio: Double
) Attempts to parent this dialog to the last exclusive window relative to
fromNode
, and then callspopupCenteredRatio(_:)
on it. The dialog must have no current parent, otherwise the method fails.func popupExclusiveOnParent(fromNode: Node?, parentRect: Rect2i
) Attempts to parent this dialog to the last exclusive window relative to
fromNode
, and then callspopupOnParent(parentRect:)
on it. The dialog must have no current parent, otherwise the method fails.func popupOnParent(parentRect: Rect2i
) Popups the
Window
with a position shifted by parentWindow
’s position. If theWindow
is embedded, has the same effect aspopup(rect:)
.func removeThemeColorOverride(name: StringName
) Removes a local override for a theme
Color
with the specifiedname
previously added byaddThemeColorOverride(name:color:)
or via the Inspector dock.func removeThemeConstantOverride(name: StringName
) Removes a local override for a theme constant with the specified
name
previously added byaddThemeConstantOverride(name:constant:)
or via the Inspector dock.func removeThemeFontOverride(name: StringName
) Removes a local override for a theme
Font
with the specifiedname
previously added byaddThemeFontOverride(name:font:)
or via the Inspector dock.func removeThemeFontSizeOverride(name: StringName
) Removes a local override for a theme font size with the specified
name
previously added byaddThemeFontSizeOverride(name:fontSize:)
or via the Inspector dock.func removeThemeIconOverride(name: StringName
) Removes a local override for a theme icon with the specified
name
previously added byaddThemeIconOverride(name:texture:)
or via the Inspector dock.func removeThemeStyleboxOverride(name: StringName
) Removes a local override for a theme
StyleBox
with the specifiedname
previously added byaddThemeStyleboxOverride(name:stylebox:)
or via the Inspector dock.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.func resetSize(
) Resets the size to the minimum size, which is the max of
minSize
and (ifwrapControls
is enabled)getContentsMinimumSize
. This is equivalent to callingset_size(Vector2i())
(or any size below the minimum).func setImeActive(Bool
) If
active
istrue
, enables system’s native IME (Input Method Editor).func setImePosition(Vector2i
) Moves IME to the given position.
func setLayoutDirection(Window.LayoutDirection
) Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
func setUnparentWhenInvisible(unparent: Bool
) If
unparent
istrue
, the window is automatically unparented when going invisible.func setUseFontOversampling(enable: Bool
) Enables font oversampling. This makes fonts look better when they are scaled up.
func show(
) Makes the
Window
appear. This enables interactions with theWindow
and doesn’t change any of its property other than visibility (unlike e.g.popup(rect:)
).
Show implementation details (1)
Hide implementation details
func _getContentsMinimumSize(
) -> Vector2 Virtual method to be implemented by the user. Overrides the value returned by
getContentsMinimumSize
.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A 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.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.