Window¶
Inherits: Viewport < Node < Object
Inherited By: AcceptDialog, Popup
Base class for all windows.
Description¶
A node that creates a window.
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
Theme Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Signals¶
about_to_popup ( )
close_requested ( )
files_dropped ( PackedStringArray files )
Emitted when files are dragged from the OS file manager and dropped in the game window. The argument is a list of file paths.
focus_entered ( )
focus_exited ( )
go_back_requested ( )
mouse_entered ( )
mouse_exited ( )
theme_changed ( )
visibility_changed ( )
window_input ( InputEvent event )
Enumerations¶
enum Mode:
MODE_WINDOWED = 0 --- Windowed mode.
MODE_MINIMIZED = 1 --- Minimized window mode.
MODE_MAXIMIZED = 2 --- Maximized window mode.
MODE_FULLSCREEN = 3 --- Fullscreen window mode. Note that this is not exclusive fullscreen. On Windows and Linux, a borderless window is used to emulate fullscreen. On macOS, a new desktop is used to display the running project.
Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports multiple resolutions when enabling fullscreen mode.
MODE_EXCLUSIVE_FULLSCREEN = 4 --- Exclusive fullscreen window mode. This mode is implemented on Windows only. On other platforms, it is equivalent to MODE_FULLSCREEN.
Only one window in exclusive fullscreen mode can be visible on a given screen at a time. If multiple windows are in exclusive fullscreen mode for the same screen, the last one being set to this mode takes precedence.
Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports multiple resolutions when enabling fullscreen mode.
enum Flags:
FLAG_RESIZE_DISABLED = 0 --- The window's ability to be resized.
FLAG_BORDERLESS = 1 --- Borderless window.
FLAG_ALWAYS_ON_TOP = 2 --- Flag for making the window always on top of all other windows.
FLAG_TRANSPARENT = 3
FLAG_NO_FOCUS = 4
FLAG_POPUP = 5
FLAG_MAX = 6
enum ContentScaleMode:
CONTENT_SCALE_MODE_DISABLED = 0
CONTENT_SCALE_MODE_CANVAS_ITEMS = 1
CONTENT_SCALE_MODE_VIEWPORT = 2
enum ContentScaleAspect:
CONTENT_SCALE_ASPECT_IGNORE = 0
CONTENT_SCALE_ASPECT_KEEP = 1
CONTENT_SCALE_ASPECT_KEEP_WIDTH = 2
CONTENT_SCALE_ASPECT_KEEP_HEIGHT = 3
CONTENT_SCALE_ASPECT_EXPAND = 4
enum LayoutDirection:
LAYOUT_DIRECTION_INHERITED = 0 --- Automatic layout direction, determined from the parent window layout direction.
LAYOUT_DIRECTION_LOCALE = 1 --- Automatic layout direction, determined from the current locale.
LAYOUT_DIRECTION_LTR = 2 --- Left-to-right layout direction.
LAYOUT_DIRECTION_RTL = 3 --- Right-to-left layout direction.
Constants¶
NOTIFICATION_VISIBILITY_CHANGED = 30
Property Descriptions¶
bool always_on_top
Default |
|
Setter |
set_flag(value) |
Getter |
get_flag() |
If true
, the window will be on top of all other windows.
bool auto_translate
Default |
|
Setter |
set_auto_translate(value) |
Getter |
is_auto_translating() |
Toggles if any text should automatically change to its translated version depending on the current locale.
bool borderless
Default |
|
Setter |
set_flag(value) |
Getter |
get_flag() |
If true
, the window will have no borders.
ContentScaleAspect content_scale_aspect
Default |
|
Setter |
set_content_scale_aspect(value) |
Getter |
get_content_scale_aspect() |
float content_scale_factor
Default |
|
Setter |
set_content_scale_factor(value) |
Getter |
get_content_scale_factor() |
ContentScaleMode content_scale_mode
Default |
|
Setter |
set_content_scale_mode(value) |
Getter |
get_content_scale_mode() |
Vector2i content_scale_size
Default |
|
Setter |
set_content_scale_size(value) |
Getter |
get_content_scale_size() |
int current_screen
Default |
|
Setter |
set_current_screen(value) |
Getter |
get_current_screen() |
The screen the window is currently on.
bool exclusive
Default |
|
Setter |
set_exclusive(value) |
Getter |
is_exclusive() |
Vector2i max_size
Default |
|
Setter |
set_max_size(value) |
Getter |
get_max_size() |
Vector2i min_size
Default |
|
Setter |
set_min_size(value) |
Getter |
get_min_size() |
Mode mode
Default |
|
Setter |
set_mode(value) |
Getter |
get_mode() |
Set's the window's current mode.
Note: Fullscreen mode is not exclusive fullscreen on Windows and Linux.
bool popup_window
Default |
|
Setter |
set_flag(value) |
Getter |
get_flag() |
Vector2i position
Default |
|
Setter |
set_position(value) |
Getter |
get_position() |
The window's position in pixels.
Vector2i size
Default |
|
Setter |
set_size(value) |
Getter |
get_size() |
The window's size in pixels.
Theme theme
Setter |
set_theme(value) |
Getter |
get_theme() |
StringName theme_type_variation
Default |
|
Setter |
set_theme_type_variation(value) |
Getter |
get_theme_type_variation() |
String title
Default |
|
Setter |
set_title(value) |
Getter |
get_title() |
The window's title.
bool transient
Default |
|
Setter |
set_transient(value) |
Getter |
is_transient() |
bool transparent
Default |
|
Setter |
set_flag(value) |
Getter |
get_flag() |
bool unfocusable
Default |
|
Setter |
set_flag(value) |
Getter |
get_flag() |
bool unresizable
Default |
|
Setter |
set_flag(value) |
Getter |
get_flag() |
If true
, the window can't be resized.
bool visible
Default |
|
Setter |
set_visible(value) |
Getter |
is_visible() |
If true
, the window is visible.
bool wrap_controls
Default |
|
Setter |
set_wrap_controls(value) |
Getter |
is_wrapping_controls() |
Method Descriptions¶
bool can_draw ( ) const
Returns whether the window is being drawn to the screen.
void child_controls_changed ( )
Vector2 get_contents_minimum_size ( ) const
Returns the combined minimum size from the child Control nodes of the window.
Returns true
if the flag is set.
LayoutDirection get_layout_direction ( ) const
Returns layout direction and text writing direction.
Vector2i get_real_size ( ) const
Returns the window's size including its border.
Color get_theme_color ( StringName name, StringName theme_type="" ) const
int get_theme_constant ( StringName name, StringName theme_type="" ) const
float get_theme_default_base_scale ( ) const
Font get_theme_default_font ( ) const
int get_theme_default_font_size ( ) const
Font get_theme_font ( StringName name, StringName theme_type="" ) const
Returns the Font at name
if the theme has theme_type
.
int get_theme_font_size ( StringName name, StringName theme_type="" ) const
Returns the font size at name
if the theme has theme_type
.
Texture2D get_theme_icon ( StringName name, StringName theme_type="" ) const
StyleBox get_theme_stylebox ( StringName name, StringName theme_type="" ) const
void grab_focus ( )
Causes the window to grab focus, allowing it to receive user input.
bool has_focus ( ) const
Returns true
if the window is focused.
bool has_theme_color ( StringName name, StringName theme_type="" ) const
bool has_theme_constant ( StringName name, StringName theme_type="" ) const
bool has_theme_font ( StringName name, StringName theme_type="" ) const
Returns true
if Font with name
is in theme_type
.
Returns false
if the theme does not have theme_type
.
bool has_theme_font_size ( StringName name, StringName theme_type="" ) const
Returns true
if font size with name
is in theme_type
.
Returns false
if the theme does not have theme_type
.
bool has_theme_icon ( StringName name, StringName theme_type="" ) const
bool has_theme_stylebox ( StringName name, StringName theme_type="" ) const
void hide ( )
bool is_embedded ( ) const
Returns true
if the window is currently embedded in another window.
bool is_layout_rtl ( ) const
Returns true
if layout is right-to-left.
bool is_maximize_allowed ( ) const
bool is_using_font_oversampling ( ) const
void move_to_foreground ( )
void popup ( Rect2i rect=Rect2i(0, 0, 0, 0) )
void popup_centered ( Vector2i minsize=Vector2i(0, 0) )
void popup_centered_ratio ( float ratio=0.8 )
void popup_on_parent ( Rect2i parent_rect )
void request_attention ( )
void reset_size ( )
Resets the size to the minimum size, which is the max of min_size and (if wrap_controls is enabled) get_contents_minimum_size. This is equivalent to calling set_size(Vector2i())
(or any size below the minimum).
Sets a specified window flag.
void set_ime_active ( bool active )
void set_ime_position ( Vector2i position )
void set_layout_direction ( LayoutDirection direction )
Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
void set_use_font_oversampling ( bool enable )
void show ( )
Theme Property Descriptions¶
Color title_color
Default |
|
Color title_outline_modulate
Default |
|
The color of the title outline.
int close_h_ofs
Default |
|
int close_v_ofs
Default |
|
int resize_margin
Default |
|
int scaleborder_size
Default |
|
int title_height
Default |
|
int title_outline_size
Default |
|
The size of the title outline.
Font title_font
int title_font_size
The size of the title font.
Texture2D close
Texture2D close_pressed
StyleBox embedded_border