Documentation
¶
Overview ¶
A node that creates a window. The window can either be a native system window or embedded inside another graphics.gd/classdb/Window (see graphics.gd/classdb/Viewport.Instance.GuiEmbedSubwindows).
At runtime, [graphics.gd/classdb/Window]s will not close automatically when requested. You need to handle it manually using the Instance.OnCloseRequested signal (this applies both to pressing the close button and clicking outside of a popup).
Index ¶
- Constants
- type Advanced
- type Any
- type ContentScaleAspect
- type ContentScaleMode
- type ContentScaleStretch
- type Expanded
- func (self Expanded) GetThemeColor(name string, theme_type string) Color.RGBA
- func (self Expanded) GetThemeConstant(name string, theme_type string) int
- func (self Expanded) GetThemeFont(name string, theme_type string) Font.Instance
- func (self Expanded) GetThemeFontSize(name string, theme_type string) int
- func (self Expanded) GetThemeIcon(name string, theme_type string) Texture2D.Instance
- func (self Expanded) GetThemeStylebox(name string, theme_type string) StyleBox.Instance
- func (self Expanded) HasThemeColor(name string, theme_type string) bool
- func (self Expanded) HasThemeConstant(name string, theme_type string) bool
- func (self Expanded) HasThemeFont(name string, theme_type string) bool
- func (self Expanded) HasThemeFontSize(name string, theme_type string) bool
- func (self Expanded) HasThemeIcon(name string, theme_type string) bool
- func (self Expanded) HasThemeStylebox(name string, theme_type string) bool
- func (self Expanded) Popup(rect Rect2i.PositionSize)
- func (self Expanded) PopupCentered(minsize Vector2i.XY)
- func (self Expanded) PopupCenteredClamped(minsize Vector2i.XY, fallback_ratio Float.X)
- func (self Expanded) PopupCenteredRatio(ratio Float.X)
- func (self Expanded) PopupExclusive(from_node Node.Instance, rect Rect2i.PositionSize)
- func (self Expanded) PopupExclusiveCentered(from_node Node.Instance, minsize Vector2i.XY)
- func (self Expanded) PopupExclusiveCenteredClamped(from_node Node.Instance, minsize Vector2i.XY, fallback_ratio Float.X)
- func (self Expanded) PopupExclusiveCenteredRatio(from_node Node.Instance, ratio Float.X)
- type Extension
- type Flags
- type ID
- type Implementation
- type Instance
- func (self Instance) AddThemeColorOverride(name string, color Color.RGBA)
- func (self Instance) AddThemeConstantOverride(name string, constant int)
- func (self Instance) AddThemeFontOverride(name string, font Font.Instance)
- func (self Instance) AddThemeFontSizeOverride(name string, font_size int)
- func (self Instance) AddThemeIconOverride(name string, texture Texture2D.Instance)
- func (self Instance) AddThemeStyleboxOverride(name string, stylebox StyleBox.Instance)
- func (self Instance) AlwaysOnTop() bool
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsViewport() Viewport.Instance
- func (self Instance) AsWindow() Instance
- func (self Instance) AutoTranslate() bool
- func (self Instance) BeginBulkThemeOverride()
- func (self Instance) Borderless() bool
- func (self Instance) CanDraw() bool
- func (self Instance) ChildControlsChanged()
- func (self Instance) ContentScaleAspect() ContentScaleAspect
- func (self Instance) ContentScaleFactor() Float.X
- func (self Instance) ContentScaleMode() ContentScaleMode
- func (self Instance) ContentScaleSize() Vector2i.XY
- func (self Instance) ContentScaleStretch() ContentScaleStretch
- func (self Instance) CurrentScreen() int
- func (self Instance) EndBulkThemeOverride()
- func (self Instance) ExcludeFromCapture() bool
- func (self Instance) Exclusive() bool
- func (self Instance) ExtendToTitle() bool
- func (self Instance) ForceNative() bool
- func (self Instance) GetContentsMinimumSize() Vector2.XY
- func (self Instance) GetEmbeddedInView(peer Viewport.Instance) []Instance
- func (self Instance) GetLayoutDirection() LayoutDirection
- func (self Instance) GetPositionWithDecorations() Vector2i.XY
- func (self Instance) GetSizeWithDecorations() Vector2i.XY
- func (self Instance) GetThemeColor(name string) Color.RGBA
- func (self Instance) GetThemeConstant(name string) int
- func (self Instance) GetThemeDefaultBaseScale() Float.X
- func (self Instance) GetThemeDefaultFont() Font.Instance
- func (self Instance) GetThemeDefaultFontSize() int
- func (self Instance) GetThemeFont(name string) Font.Instance
- func (self Instance) GetThemeFontSize(name string) int
- func (self Instance) GetThemeIcon(name string) Texture2D.Instance
- func (self Instance) GetThemeStylebox(name string) StyleBox.Instance
- func (self Instance) GetWindowId() int
- func (self Instance) GrabFocus()
- func (self Instance) HasFocus() bool
- func (self Instance) HasThemeColor(name string) bool
- func (self Instance) HasThemeColorOverride(name string) bool
- func (self Instance) HasThemeConstant(name string) bool
- func (self Instance) HasThemeConstantOverride(name string) bool
- func (self Instance) HasThemeFont(name string) bool
- func (self Instance) HasThemeFontOverride(name string) bool
- func (self Instance) HasThemeFontSize(name string) bool
- func (self Instance) HasThemeFontSizeOverride(name string) bool
- func (self Instance) HasThemeIcon(name string) bool
- func (self Instance) HasThemeIconOverride(name string) bool
- func (self Instance) HasThemeStylebox(name string) bool
- func (self Instance) HasThemeStyleboxOverride(name string) bool
- func (self Instance) Hide()
- func (self Instance) ID() ID
- func (self Instance) InitialPosition() WindowInitialPosition
- func (self Instance) IsEmbedded() bool
- func (self Instance) IsLayoutRtl() bool
- func (self Instance) IsMaximizeAllowed() bool
- func (self Instance) IsUsingFontOversampling() bool
- func (self Instance) KeepTitleVisible() bool
- func (self Instance) MaxSize() Vector2i.XY
- func (self Instance) MinSize() Vector2i.XY
- func (self Instance) Mode() Mode
- func (self Instance) MousePassthrough() bool
- func (self Instance) MousePassthroughPolygon() []Vector2.XY
- func (self Instance) MoveToCenter()
- func (self Instance) MoveToForeground()
- func (self Instance) OnAboutToPopup(cb func(), flags ...Signal.Flags)
- func (self Instance) OnCloseRequested(cb func(), flags ...Signal.Flags)
- func (self Instance) OnDpiChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnFilesDropped(cb func(files []string), flags ...Signal.Flags)
- func (self Instance) OnFocusEntered(cb func(), flags ...Signal.Flags)
- func (self Instance) OnFocusExited(cb func(), flags ...Signal.Flags)
- func (self Instance) OnGoBackRequested(cb func(), flags ...Signal.Flags)
- func (self Instance) OnMouseEntered(cb func(), flags ...Signal.Flags)
- func (self Instance) OnMouseExited(cb func(), flags ...Signal.Flags)
- func (self Instance) OnThemeChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnTitleChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnTitlebarChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnVisibilityChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnWindowInput(cb func(event InputEvent.Instance), flags ...Signal.Flags)
- func (self Instance) Popup()
- func (self Instance) PopupCentered()
- func (self Instance) PopupCenteredClamped()
- func (self Instance) PopupCenteredRatio()
- func (self Instance) PopupExclusive(from_node Node.Instance)
- func (self Instance) PopupExclusiveCentered(from_node Node.Instance)
- func (self Instance) PopupExclusiveCenteredClamped(from_node Node.Instance)
- func (self Instance) PopupExclusiveCenteredRatio(from_node Node.Instance)
- func (self Instance) PopupExclusiveOnParent(from_node Node.Instance, parent_rect Rect2i.PositionSize)
- func (self Instance) PopupOnParent(parent_rect Rect2i.PositionSize)
- func (self Instance) PopupWindow() bool
- func (self Instance) Position() Vector2i.XY
- func (self Instance) RemoveThemeColorOverride(name string)
- func (self Instance) RemoveThemeConstantOverride(name string)
- func (self Instance) RemoveThemeFontOverride(name string)
- func (self Instance) RemoveThemeFontSizeOverride(name string)
- func (self Instance) RemoveThemeIconOverride(name string)
- func (self Instance) RemoveThemeStyleboxOverride(name string)
- func (self Instance) RequestAttention()
- func (self Instance) ResetSize()
- func (self Instance) SetAlwaysOnTop(value bool)
- func (self Instance) SetAutoTranslate(value bool)
- func (self Instance) SetBorderless(value bool)
- func (self Instance) SetContentScaleAspect(value ContentScaleAspect)
- func (self Instance) SetContentScaleFactor(value Float.X)
- func (self Instance) SetContentScaleMode(value ContentScaleMode)
- func (self Instance) SetContentScaleSize(value Vector2i.XY)
- func (self Instance) SetContentScaleStretch(value ContentScaleStretch)
- func (self Instance) SetCurrentScreen(value int)
- func (self Instance) SetExcludeFromCapture(value bool)
- func (self Instance) SetExclusive(value bool)
- func (self Instance) SetExtendToTitle(value bool)
- func (self Instance) SetForceNative(value bool)
- func (self Instance) SetImeActive(active bool)
- func (self Instance) SetImePosition(position Vector2i.XY)
- func (self Instance) SetInitialPosition(value WindowInitialPosition)
- func (self Instance) SetKeepTitleVisible(value bool)
- func (self Instance) SetLayoutDirection(direction LayoutDirection)
- func (self Instance) SetMaxSize(value Vector2i.XY)
- func (self Instance) SetMinSize(value Vector2i.XY)
- func (self Instance) SetMode(value Mode)
- func (self Instance) SetMousePassthrough(value bool)
- func (self Instance) SetMousePassthroughPolygon(value []Vector2.XY)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPopupWindow(value bool)
- func (self Instance) SetPosition(value Vector2i.XY)
- func (self Instance) SetSharpCorners(value bool)
- func (self Instance) SetSize(value Vector2i.XY)
- func (self Instance) SetTheme(value Theme.Instance)
- func (self Instance) SetThemeTypeVariation(value string)
- func (self Instance) SetTitle(value string)
- func (self Instance) SetTransient(value bool)
- func (self Instance) SetTransientToFocused(value bool)
- func (self Instance) SetTransparent(value bool)
- func (self Instance) SetUnfocusable(value bool)
- func (self Instance) SetUnparentWhenInvisible(unparent bool)
- func (self Instance) SetUnresizable(value bool)
- func (self Instance) SetUseFontOversampling(enable bool)
- func (self Instance) SetVisible(value bool)
- func (self Instance) SetWrapControls(value bool)
- func (self Instance) SharpCorners() bool
- func (self Instance) Show()
- func (self Instance) Size() Vector2i.XY
- func (self Instance) StartDrag()
- func (self Instance) StartResize(edge DisplayServer.WindowResizeEdge)
- func (self Instance) Theme() Theme.Instance
- func (self Instance) ThemeTypeVariation() string
- func (self Instance) Title() string
- func (self Instance) Transient() bool
- func (self Instance) TransientToFocused() bool
- func (self Instance) Transparent() bool
- func (self Instance) Unfocusable() bool
- func (self Instance) Unresizable() bool
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) Visible() bool
- func (self Instance) WrapControls() bool
- type Interface
- type LayoutDirection
- type Mode
- type WindowInitialPosition
Constants ¶
const NotificationThemeChanged Object.Notification = 32 //gd:Window.NOTIFICATION_THEME_CHANGED
const NotificationVisibilityChanged Object.Notification = 30 //gd:Window.NOTIFICATION_VISIBILITY_CHANGED
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type ContentScaleAspect ¶
type ContentScaleAspect int //gd:Window.ContentScaleAspect
const ( // The aspect will be ignored. Scaling will simply stretch the content to fit the target size. ContentScaleAspectIgnore ContentScaleAspect = 0 // 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. ContentScaleAspectKeep ContentScaleAspect = 1 // The content can be expanded vertically. Scaling horizontally will result in keeping the width ratio and then black bars on left and right sides. ContentScaleAspectKeepWidth ContentScaleAspect = 2 // The content can be expanded horizontally. Scaling vertically will result in keeping the height ratio and then black bars on top and bottom sides. ContentScaleAspectKeepHeight ContentScaleAspect = 3 // The content's aspect will be preserved. If the target size has different aspect from the base one, the content will stay in the top-left corner and add an extra visible area in the stretched space. ContentScaleAspectExpand ContentScaleAspect = 4 )
type ContentScaleMode ¶
type ContentScaleMode int //gd:Window.ContentScaleMode
const ( // The content will not be scaled to match the [graphics.gd/classdb/Window]'s size. ContentScaleModeDisabled ContentScaleMode = 0 // The content will be rendered at the target size. This is more performance-expensive than [ContentScaleModeViewport], but provides better results. ContentScaleModeCanvasItems ContentScaleMode = 1 // The content will be rendered at the base size and then scaled to the target size. More performant than [ContentScaleModeCanvasItems], but results in pixelated image. ContentScaleModeViewport ContentScaleMode = 2 )
type ContentScaleStretch ¶
type ContentScaleStretch int //gd:Window.ContentScaleStretch
const ( // 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. ContentScaleStretchFractional ContentScaleStretch = 0 // 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. ContentScaleStretchInteger ContentScaleStretch = 1 )
type Expanded ¶
func (Expanded) GetThemeColor ¶
Returns a [Color.RGBA] from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a color item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for more details.
func (Expanded) GetThemeConstant ¶
Returns a constant from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a constant item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for more details.
func (Expanded) GetThemeFont ¶
Returns a graphics.gd/classdb/Font from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a font item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) GetThemeFontSize ¶
Returns a font size from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a font size item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) GetThemeIcon ¶
Returns an icon from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has an icon item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) GetThemeStylebox ¶
Returns a graphics.gd/classdb/StyleBox from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a stylebox item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) HasThemeColor ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a color item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) HasThemeConstant ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a constant item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) HasThemeFont ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a font item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) HasThemeFontSize ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a font size item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) HasThemeIcon ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has an icon item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) HasThemeStylebox ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a stylebox item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Expanded) Popup ¶
func (self Expanded) Popup(rect Rect2i.PositionSize)
Shows the graphics.gd/classdb/Window and makes it transient (see Instance.Transient). If 'rect' is provided, it will be set as the graphics.gd/classdb/Window's size. Fails if called on the main window.
If graphics.gd/classdb/ProjectSettings "display/window/subwindows/embed_subwindows" is true (single-window mode), 'rect”s coordinates are global and relative to the main window's top-left corner (excluding window decorations). If 'rect”s position coordinates are negative, the window will be located outside the main window and may not be visible as a result.
If graphics.gd/classdb/ProjectSettings "display/window/subwindows/embed_subwindows" is false (multi-window mode), 'rect”s coordinates are global and relative to the top-left corner of the leftmost screen. If 'rect”s position coordinates are negative, the window will be placed at the top-left corner of the screen.
Note: 'rect' must be in global coordinates if specified.
func (Expanded) PopupCentered ¶
Popups the graphics.gd/classdb/Window at the center of the current screen, with optionally given minimum size. If the graphics.gd/classdb/Window is embedded, it will be centered in the parent graphics.gd/classdb/Viewport instead.
Note: Calling it with the default value of 'minsize' is equivalent to calling it with Instance.Size.
func (Expanded) PopupCenteredClamped ¶
Popups the graphics.gd/classdb/Window centered inside its parent graphics.gd/classdb/Window. 'fallback_ratio' determines the maximum size of the graphics.gd/classdb/Window, in relation to its parent.
Note: Calling it with the default value of 'minsize' is equivalent to calling it with Instance.Size.
func (Expanded) PopupCenteredRatio ¶
If graphics.gd/classdb/Window is embedded, popups the graphics.gd/classdb/Window centered inside its embedder and sets its size as a 'ratio' of embedder's size.
If graphics.gd/classdb/Window is a native window, popups the graphics.gd/classdb/Window centered inside the screen of its parent graphics.gd/classdb/Window and sets its size as a 'ratio' of the screen size.
func (Expanded) PopupExclusive ¶
func (self Expanded) PopupExclusive(from_node Node.Instance, rect Rect2i.PositionSize)
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.Popup on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
func (Expanded) PopupExclusiveCentered ¶
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.PopupCentered on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
func (Expanded) PopupExclusiveCenteredClamped ¶
func (self Expanded) PopupExclusiveCenteredClamped(from_node Node.Instance, minsize Vector2i.XY, fallback_ratio Float.X)
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.PopupCenteredClamped on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
func (Expanded) PopupExclusiveCenteredRatio ¶
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.PopupCenteredRatio on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.
func (*Extension[T]) AsViewport ¶
type Flags ¶
type Flags int //gd:Window.Flags
const ( // The window can't be resized by dragging its resize grip. It's still possible to resize the window using [Instance.Size]. This flag is ignored for full screen windows. Set with [Instance.Unresizable]. FlagResizeDisabled Flags = 0 // The window do not have native title bar and other decorations. This flag is ignored for full-screen windows. Set with [Instance.Borderless]. FlagBorderless Flags = 1 // The window is floating on top of all other windows. This flag is ignored for full-screen windows. Set with [Instance.AlwaysOnTop]. FlagAlwaysOnTop Flags = 2 // The window background can be transparent. Set with [Instance.Transparent]. // // Note: This flag has no effect if either [graphics.gd/classdb/ProjectSettings] "display/window/per_pixel_transparency/allowed", or the window's [graphics.gd/classdb/Viewport.Instance.TransparentBg] is set to false. FlagTransparent Flags = 3 // The window can't be focused. No-focus window will ignore all input, except mouse clicks. Set with [Instance.Unfocusable]. FlagNoFocus Flags = 4 // Window is part of menu or [graphics.gd/classdb/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 transient parent set (see [Instance.Transient]). // // Note: This flag has no effect in embedded windows (unless said window is a [graphics.gd/classdb/Popup]). FlagPopup Flags = 5 // 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 [Instance.ExtendToTitle]. // // Note: This flag is implemented only on macOS. // // Note: This flag has no effect in embedded windows. FlagExtendToTitle Flags = 6 // All mouse events are passed to the underlying window of the same application. // // Note: This flag has no effect in embedded windows. FlagMousePassthrough Flags = 7 // Window style is overridden, forcing sharp corners. // // Note: This flag has no effect in embedded windows. // // Note: This flag is implemented only on Windows (11). FlagSharpCorners Flags = 8 // Windows is excluded from screenshots taken by [graphics.gd/classdb/DisplayServer.ScreenGetImage], [graphics.gd/classdb/DisplayServer.ScreenGetImageRect], and [graphics.gd/classdb/DisplayServer.ScreenGetPixel]. // // Note: This flag is implemented on macOS and Windows. // // Note: Setting this flag will NOT prevent other apps from capturing an image, it should not be used as a security measure. FlagExcludeFromCapture Flags = 9 // Max value of the [Flags]. FlagMax Flags = 10 )
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func Get ¶
Returns the [Window] that contains this node. If the node is in the main window, this is equivalent to getting the root node ([code]get_tree().get_root()[/code]).
func GetLastExclusive ¶
Returns the [Window] that contains this node, or the last exclusive child in a chain of windows starting with the one that contains this node.
func (Instance) AddThemeColorOverride ¶
Creates a local override for a theme [Color.RGBA] with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Instance.RemoveThemeColorOverride.
See also Instance.GetThemeColor and graphics.gd/classdb/Control.Instance.AddThemeColorOverride for more details.
func (Instance) AddThemeConstantOverride ¶
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 Instance.RemoveThemeConstantOverride.
See also Instance.GetThemeConstant.
func (Instance) AddThemeFontOverride ¶
Creates a local override for a theme graphics.gd/classdb/Font with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Instance.RemoveThemeFontOverride.
See also Instance.GetThemeFont.
func (Instance) AddThemeFontSizeOverride ¶
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 Instance.RemoveThemeFontSizeOverride.
See also Instance.GetThemeFontSize.
func (Instance) AddThemeIconOverride ¶
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 Instance.RemoveThemeIconOverride.
See also Instance.GetThemeIcon.
func (Instance) AddThemeStyleboxOverride ¶
Creates a local override for a theme graphics.gd/classdb/StyleBox with the specified 'name'. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Instance.RemoveThemeStyleboxOverride.
See also Instance.GetThemeStylebox and graphics.gd/classdb/Control.Instance.AddThemeStyleboxOverride for more details.
func (Instance) AlwaysOnTop ¶
func (Instance) AsViewport ¶
func (Instance) AutoTranslate ¶
func (Instance) BeginBulkThemeOverride ¶
func (self Instance) BeginBulkThemeOverride()
Prevents *_theme_*_override methods from emitting NotificationThemeChanged until Instance.EndBulkThemeOverride is called.
func (Instance) Borderless ¶
func (Instance) ChildControlsChanged ¶
func (self Instance) ChildControlsChanged()
Requests an update of the graphics.gd/classdb/Window size to fit underlying graphics.gd/classdb/Control nodes.
func (Instance) ContentScaleAspect ¶
func (self Instance) ContentScaleAspect() ContentScaleAspect
func (Instance) ContentScaleFactor ¶
func (Instance) ContentScaleMode ¶
func (self Instance) ContentScaleMode() ContentScaleMode
func (Instance) ContentScaleSize ¶
func (Instance) ContentScaleStretch ¶
func (self Instance) ContentScaleStretch() ContentScaleStretch
func (Instance) CurrentScreen ¶
func (Instance) EndBulkThemeOverride ¶
func (self Instance) EndBulkThemeOverride()
Ends a bulk theme override update. See Instance.BeginBulkThemeOverride.
func (Instance) ExcludeFromCapture ¶
func (Instance) ExtendToTitle ¶
func (Instance) ForceNative ¶
func (Instance) GetContentsMinimumSize ¶
Returns the combined minimum size from the child graphics.gd/classdb/Control nodes of the window. Use Instance.ChildControlsChanged to update it when child nodes have changed.
The value returned by this method can be overridden with [Interface.GetContentsMinimumSize].
func (Instance) GetEmbeddedInView ¶
Returns a list of the visible embedded [Window]s inside the viewport. [b]Note:[/b] [Window]s inside other viewports will not be listed.
func (Instance) GetLayoutDirection ¶
func (self Instance) GetLayoutDirection() LayoutDirection
Returns layout direction and text writing direction.
func (Instance) GetPositionWithDecorations ¶
Returns the window's position including its border.
Note: If Instance.Visible is false, this method returns the same value as Instance.Position.
func (Instance) GetSizeWithDecorations ¶
Returns the window's size including its border.
Note: If Instance.Visible is false, this method returns the same value as Instance.Size.
func (Instance) GetThemeColor ¶
Returns a [Color.RGBA] from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a color item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for more details.
func (Instance) GetThemeConstant ¶
Returns a constant from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a constant item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for more details.
func (Instance) GetThemeDefaultBaseScale ¶
Returns the default base scale value from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a valid graphics.gd/classdb/Theme.Instance.DefaultBaseScale value.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) GetThemeDefaultFont ¶
Returns the default font from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a valid graphics.gd/classdb/Theme.Instance.DefaultFont value.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) GetThemeDefaultFontSize ¶
Returns the default font size value from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a valid graphics.gd/classdb/Theme.Instance.DefaultFontSize value.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) GetThemeFont ¶
Returns a graphics.gd/classdb/Font from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a font item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) GetThemeFontSize ¶
Returns a font size from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a font size item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) GetThemeIcon ¶
Returns an icon from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has an icon item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) GetThemeStylebox ¶
Returns a graphics.gd/classdb/StyleBox from the first matching graphics.gd/classdb/Theme in the tree if that graphics.gd/classdb/Theme has a stylebox item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) GrabFocus ¶
func (self Instance) GrabFocus()
Causes the window to grab focus, allowing it to receive user input.
func (Instance) HasThemeColor ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a color item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) HasThemeColorOverride ¶
Returns true if there is a local override for a theme [Color.RGBA] with the specified 'name' in this graphics.gd/classdb/Control node.
func (Instance) HasThemeConstant ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a constant item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) HasThemeConstantOverride ¶
Returns true if there is a local override for a theme constant with the specified 'name' in this graphics.gd/classdb/Control node.
func (Instance) HasThemeFont ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a font item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) HasThemeFontOverride ¶
Returns true if there is a local override for a theme graphics.gd/classdb/Font with the specified 'name' in this graphics.gd/classdb/Control node.
func (Instance) HasThemeFontSize ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a font size item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) HasThemeFontSizeOverride ¶
Returns true if there is a local override for a theme font size with the specified 'name' in this graphics.gd/classdb/Control node.
func (Instance) HasThemeIcon ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has an icon item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) HasThemeIconOverride ¶
Returns true if there is a local override for a theme icon with the specified 'name' in this graphics.gd/classdb/Control node.
func (Instance) HasThemeStylebox ¶
Returns true if there is a matching graphics.gd/classdb/Theme in the tree that has a stylebox item with the specified 'name' and 'theme_type'.
See graphics.gd/classdb/Control.Instance.GetThemeColor for details.
func (Instance) HasThemeStyleboxOverride ¶
Returns true if there is a local override for a theme graphics.gd/classdb/StyleBox with the specified 'name' in this graphics.gd/classdb/Control node.
func (Instance) Hide ¶
func (self Instance) 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 Instance.Show.
func (Instance) InitialPosition ¶
func (self Instance) InitialPosition() WindowInitialPosition
func (Instance) IsEmbedded ¶
Returns true if the window is currently embedded in another window.
func (Instance) IsLayoutRtl ¶
Returns true if layout is right-to-left.
func (Instance) IsMaximizeAllowed ¶
Returns true if the window can be maximized (the maximize button is enabled).
func (Instance) IsUsingFontOversampling ¶
Returns true if font oversampling is enabled. See Instance.SetUseFontOversampling.
func (Instance) KeepTitleVisible ¶
func (Instance) MousePassthrough ¶
func (Instance) MousePassthroughPolygon ¶
func (Instance) MoveToCenter ¶
func (self Instance) MoveToCenter()
Centers a native window on the current screen and an embedded window on its embedder graphics.gd/classdb/Viewport.
func (Instance) MoveToForeground ¶
func (self Instance) MoveToForeground()
Causes the window to grab focus, allowing it to receive user input.
func (Instance) OnAboutToPopup ¶
func (Instance) OnCloseRequested ¶
func (Instance) OnDpiChanged ¶
func (Instance) OnFilesDropped ¶
func (Instance) OnFocusEntered ¶
func (Instance) OnFocusExited ¶
func (Instance) OnGoBackRequested ¶
func (Instance) OnMouseEntered ¶
func (Instance) OnMouseExited ¶
func (Instance) OnThemeChanged ¶
func (Instance) OnTitleChanged ¶
func (Instance) OnTitlebarChanged ¶
func (Instance) OnVisibilityChanged ¶
func (Instance) OnWindowInput ¶
func (self Instance) OnWindowInput(cb func(event InputEvent.Instance), flags ...Signal.Flags)
func (Instance) Popup ¶
func (self Instance) Popup()
Shows the graphics.gd/classdb/Window and makes it transient (see Instance.Transient). If 'rect' is provided, it will be set as the graphics.gd/classdb/Window's size. Fails if called on the main window.
If graphics.gd/classdb/ProjectSettings "display/window/subwindows/embed_subwindows" is true (single-window mode), 'rect”s coordinates are global and relative to the main window's top-left corner (excluding window decorations). If 'rect”s position coordinates are negative, the window will be located outside the main window and may not be visible as a result.
If graphics.gd/classdb/ProjectSettings "display/window/subwindows/embed_subwindows" is false (multi-window mode), 'rect”s coordinates are global and relative to the top-left corner of the leftmost screen. If 'rect”s position coordinates are negative, the window will be placed at the top-left corner of the screen.
Note: 'rect' must be in global coordinates if specified.
func (Instance) PopupCentered ¶
func (self Instance) PopupCentered()
Popups the graphics.gd/classdb/Window at the center of the current screen, with optionally given minimum size. If the graphics.gd/classdb/Window is embedded, it will be centered in the parent graphics.gd/classdb/Viewport instead.
Note: Calling it with the default value of 'minsize' is equivalent to calling it with Instance.Size.
func (Instance) PopupCenteredClamped ¶
func (self Instance) PopupCenteredClamped()
Popups the graphics.gd/classdb/Window centered inside its parent graphics.gd/classdb/Window. 'fallback_ratio' determines the maximum size of the graphics.gd/classdb/Window, in relation to its parent.
Note: Calling it with the default value of 'minsize' is equivalent to calling it with Instance.Size.
func (Instance) PopupCenteredRatio ¶
func (self Instance) PopupCenteredRatio()
If graphics.gd/classdb/Window is embedded, popups the graphics.gd/classdb/Window centered inside its embedder and sets its size as a 'ratio' of embedder's size.
If graphics.gd/classdb/Window is a native window, popups the graphics.gd/classdb/Window centered inside the screen of its parent graphics.gd/classdb/Window and sets its size as a 'ratio' of the screen size.
func (Instance) PopupExclusive ¶
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.Popup on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
func (Instance) PopupExclusiveCentered ¶
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.PopupCentered on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
func (Instance) PopupExclusiveCenteredClamped ¶
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.PopupCenteredClamped on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
func (Instance) PopupExclusiveCenteredRatio ¶
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.PopupCenteredRatio on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
func (Instance) PopupExclusiveOnParent ¶
func (self Instance) PopupExclusiveOnParent(from_node Node.Instance, parent_rect Rect2i.PositionSize)
Attempts to parent this dialog to the last exclusive window relative to 'from_node', and then calls graphics.gd/classdb/Window.Instance.PopupOnParent on it. The dialog must have no current parent, otherwise the method fails.
See also Instance.SetUnparentWhenInvisible and graphics.gd/classdb/Node.Instance.GetLastExclusiveWindow.
func (Instance) PopupOnParent ¶
func (self Instance) PopupOnParent(parent_rect Rect2i.PositionSize)
Popups the graphics.gd/classdb/Window with a position shifted by parent graphics.gd/classdb/Window's position. If the graphics.gd/classdb/Window is embedded, has the same effect as Instance.Popup.
func (Instance) PopupWindow ¶
func (Instance) RemoveThemeColorOverride ¶
Removes a local override for a theme [Color.RGBA] with the specified 'name' previously added by Instance.AddThemeColorOverride or via the Inspector dock.
func (Instance) RemoveThemeConstantOverride ¶
Removes a local override for a theme constant with the specified 'name' previously added by Instance.AddThemeConstantOverride or via the Inspector dock.
func (Instance) RemoveThemeFontOverride ¶
Removes a local override for a theme graphics.gd/classdb/Font with the specified 'name' previously added by Instance.AddThemeFontOverride or via the Inspector dock.
func (Instance) RemoveThemeFontSizeOverride ¶
Removes a local override for a theme font size with the specified 'name' previously added by Instance.AddThemeFontSizeOverride or via the Inspector dock.
func (Instance) RemoveThemeIconOverride ¶
Removes a local override for a theme icon with the specified 'name' previously added by Instance.AddThemeIconOverride or via the Inspector dock.
func (Instance) RemoveThemeStyleboxOverride ¶
Removes a local override for a theme graphics.gd/classdb/StyleBox with the specified 'name' previously added by Instance.AddThemeStyleboxOverride or via the Inspector dock.
func (Instance) RequestAttention ¶
func (self Instance) RequestAttention()
Tells the OS that the graphics.gd/classdb/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 (Instance) ResetSize ¶
func (self Instance) ResetSize()
Resets the size to the minimum size, which is the max of Instance.MinSize and (if Instance.WrapControls is enabled) Instance.GetContentsMinimumSize. This is equivalent to calling set_size(Vector2i()) (or any size below the minimum).
func (Instance) SetAlwaysOnTop ¶
func (Instance) SetAutoTranslate ¶
func (Instance) SetBorderless ¶
func (Instance) SetContentScaleAspect ¶
func (self Instance) SetContentScaleAspect(value ContentScaleAspect)
func (Instance) SetContentScaleFactor ¶
func (Instance) SetContentScaleMode ¶
func (self Instance) SetContentScaleMode(value ContentScaleMode)
func (Instance) SetContentScaleSize ¶
func (Instance) SetContentScaleStretch ¶
func (self Instance) SetContentScaleStretch(value ContentScaleStretch)
func (Instance) SetCurrentScreen ¶
func (Instance) SetExcludeFromCapture ¶
func (Instance) SetExclusive ¶
func (Instance) SetExtendToTitle ¶
func (Instance) SetForceNative ¶
func (Instance) SetImeActive ¶
If 'active' is true, enables system's native IME (Input Method Editor).
func (Instance) SetImePosition ¶
Moves IME to the given position.
func (Instance) SetInitialPosition ¶
func (self Instance) SetInitialPosition(value WindowInitialPosition)
func (Instance) SetKeepTitleVisible ¶
func (Instance) SetLayoutDirection ¶
func (self Instance) SetLayoutDirection(direction LayoutDirection)
Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
func (Instance) SetMaxSize ¶
func (Instance) SetMinSize ¶
func (Instance) SetMousePassthrough ¶
func (Instance) SetMousePassthroughPolygon ¶
func (Instance) SetPopupWindow ¶
func (Instance) SetPosition ¶
func (Instance) SetSharpCorners ¶
func (Instance) SetThemeTypeVariation ¶
func (Instance) SetTransient ¶
func (Instance) SetTransientToFocused ¶
func (Instance) SetTransparent ¶
func (Instance) SetUnfocusable ¶
func (Instance) SetUnparentWhenInvisible ¶
If 'unparent' is true, the window is automatically unparented when going invisible.
Note: Make sure to keep a reference to the node, otherwise it will be orphaned. You also need to manually call graphics.gd/classdb/Node.Instance.QueueFree to free the window if it's not parented.
func (Instance) SetUnresizable ¶
func (Instance) SetUseFontOversampling ¶
Enables font oversampling. This makes fonts look better when they are scaled up.
func (Instance) SetVisible ¶
func (Instance) SetWrapControls ¶
func (Instance) SharpCorners ¶
func (Instance) Show ¶
func (self Instance) Show()
Makes the graphics.gd/classdb/Window appear. This enables interactions with the graphics.gd/classdb/Window and doesn't change any of its property other than visibility (unlike e.g. Instance.Popup).
func (Instance) StartDrag ¶
func (self Instance) StartDrag()
Starts an interactive drag operation on the window, using the current mouse position. Call this method when handling a mouse button being pressed to simulate a pressed event on the window's title bar. Using this method allows the window to participate in space switching, tiling, and other system features.
func (Instance) StartResize ¶
func (self Instance) StartResize(edge DisplayServer.WindowResizeEdge)
Starts an interactive resize operation on the window, using the current mouse position. Call this method when handling a mouse button being pressed to simulate a pressed event on the window's edge.
func (Instance) ThemeTypeVariation ¶
func (Instance) TransientToFocused ¶
func (Instance) Transparent ¶
func (Instance) Unfocusable ¶
func (Instance) Unresizable ¶
func (Instance) WrapControls ¶
type LayoutDirection ¶
type LayoutDirection int //gd:Window.LayoutDirection
const ( // Automatic layout direction, determined from the parent window layout direction. LayoutDirectionInherited LayoutDirection = 0 // Automatic layout direction, determined from the current locale. LayoutDirectionApplicationLocale LayoutDirection = 1 // Left-to-right layout direction. LayoutDirectionLtr LayoutDirection = 2 // Right-to-left layout direction. LayoutDirectionRtl LayoutDirection = 3 // Automatic layout direction, determined from the system locale. LayoutDirectionSystemLocale LayoutDirection = 4 // Represents the size of the [LayoutDirection] enum. LayoutDirectionMax LayoutDirection = 5 LayoutDirectionLocale LayoutDirection = 1 )
type Mode ¶
type Mode int //gd:Window.Mode
const ( // Windowed mode, i.e. [graphics.gd/classdb/Window] doesn't occupy the whole screen (unless set to the size of the screen). ModeWindowed Mode = 0 // Minimized window mode, i.e. [graphics.gd/classdb/Window] is not visible and available on window manager's window list. Normally happens when the minimize button is pressed. ModeMinimized Mode = 1 // Maximized window mode, i.e. [graphics.gd/classdb/Window] will occupy whole screen area except task bar and still display its borders. Normally happens when the maximize button is pressed. ModeMaximized Mode = 2 // Full screen mode with full multi-window support. // // Full screen window covers the entire display area of a screen and has no decorations. The display's video mode is not changed. // // On Android: This enables immersive mode. // // On Windows: Multi-window full-screen mode has a 1px border of the [graphics.gd/classdb/ProjectSettings] "rendering/environment/defaults/default_clear_color" color. // // On macOS: A new desktop is used to display the running project. // // Note: Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports [multiple resolutions] when enabling full screen mode. // // [multiple resolutions]: https://docs.godotengine.org/tutorials/rendering/multiple_resolutions.html ModeFullscreen Mode = 3 // A single window full screen mode. This mode has less overhead, but only one window can be open on a given screen at a time (opening a child window or application switching will trigger a full screen transition). // // Full screen window covers the entire display area of a screen and has no border or decorations. The display's video mode is not changed. // // On Android: This enables immersive mode. // // On Windows: Depending on video driver, full screen transition might cause screens to go black for a moment. // // On macOS: A new desktop is used to display the running project. Exclusive full screen mode prevents Dock and Menu from showing up when the mouse pointer is hovering the edge of the screen. // // On Linux (X11): Exclusive full screen mode bypasses compositor. // // Note: Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports [multiple resolutions] when enabling full screen mode. // // [multiple resolutions]: https://docs.godotengine.org/tutorials/rendering/multiple_resolutions.html ModeExclusiveFullscreen Mode = 4 )
type WindowInitialPosition ¶
type WindowInitialPosition int //gd:Window.WindowInitialPosition
const ( // Initial window position is determined by [Instance.Position]. WindowInitialPositionAbsolute WindowInitialPosition = 0 // Initial window position is the center of the primary screen. WindowInitialPositionCenterPrimaryScreen WindowInitialPosition = 1 // Initial window position is the center of the main window screen. WindowInitialPositionCenterMainWindowScreen WindowInitialPosition = 2 // Initial window position is the center of [Instance.CurrentScreen] screen. WindowInitialPositionCenterOtherScreen WindowInitialPosition = 3 // Initial window position is the center of the screen containing the mouse pointer. WindowInitialPositionCenterScreenWithMouseFocus WindowInitialPosition = 4 // Initial window position is the center of the screen containing the window with the keyboard focus. WindowInitialPositionCenterScreenWithKeyboardFocus WindowInitialPosition = 5 )