diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index 5ce870a8996a..f4eaaac2e1e4 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -4,7 +4,8 @@ Base class for all windows. - A node that creates a window. + A node that creates a window. The window can either be a native system window or embedded inside another [Window] (see [member Viewport.gui_embed_subwindows]). + At runtime, [Window]s will not close automatically when requested. You need to handle it manually using [signal close_requested] (this applies both to clicking close button and clicking outside popup). @@ -18,12 +19,13 @@ + Requests an update of the [Window] size to fit underlying [Control] nodes. - Returns the combined minimum size from the child [Control] nodes of the window. + Returns the combined minimum size from the child [Control] nodes of the window. Use [method child_controls_changed] to update it when children nodes have changed. @@ -50,6 +52,8 @@ + Returns the [Color] at [code]name[/code] if the theme has [code]theme_type[/code]. + See [method Control.get_theme_color] for more details. @@ -57,21 +61,29 @@ + Returns the constant at [code]name[/code] if the theme has [code]theme_type[/code]. + See [method Control.get_theme_color] for more details. + Returns the default base scale defined in the attached [Theme]. + See [member Theme.default_base_scale] for more details. + Returns the default [Font] defined in the attached [Theme]. + See [member Theme.default_font] for more details. + Returns the default font size defined in the attached [Theme]. + See [member Theme.default_font_size] for more details. @@ -80,6 +92,7 @@ Returns the [Font] at [code]name[/code] if the theme has [code]theme_type[/code]. + See [method Control.get_theme_color] for more details. @@ -88,6 +101,7 @@ Returns the font size at [code]name[/code] if the theme has [code]theme_type[/code]. + See [method Control.get_theme_color] for more details. @@ -95,6 +109,8 @@ + Returns the icon at [code]name[/code] if the theme has [code]theme_type[/code]. + See [method Control.get_theme_color] for more details. @@ -102,6 +118,8 @@ + Returns the [StyleBox] at [code]name[/code] if the theme has [code]theme_type[/code]. + See [method Control.get_theme_color] for more details. @@ -121,6 +139,7 @@ + Returns [code]true[/code] if [Color] with [code]name[/code] is in [code]theme_type[/code]. @@ -128,6 +147,7 @@ + Returns [code]true[/code] if constant with [code]name[/code] is in [code]theme_type[/code]. @@ -136,7 +156,6 @@ Returns [code]true[/code] if [Font] with [code]name[/code] is in [code]theme_type[/code]. - Returns [code]false[/code] if the theme does not have [code]theme_type[/code]. @@ -145,7 +164,6 @@ Returns [code]true[/code] if font size with [code]name[/code] is in [code]theme_type[/code]. - Returns [code]false[/code] if the theme does not have [code]theme_type[/code]. @@ -153,6 +171,7 @@ + Returns [code]true[/code] if icon with [code]name[/code] is in [code]theme_type[/code]. @@ -160,11 +179,13 @@ + Returns [code]true[/code] if [StyleBox] with [code]name[/code] is in [code]theme_type[/code]. + Hides the window. This is not the same as minimized state. Hidden window can't be interacted with and needs to be made visible with [method show]. @@ -182,28 +203,35 @@ + Returns [code]true[/code] if the window can be maximized (the maximize button is enabled). + Returns [code]true[/code] if font oversampling is enabled. See [method set_use_font_oversampling]. + Moves the [Window] on top of other windows and focuses it. + Shows the [Window] and makes it transient (see [member transient]). If [code]rect[/code] is provided, it will be set as the [Window]'s size. + Fails if called on the main window. + Popups the [Window] at the center of the current screen, with optionally given minimum size. + If the [Window] is embedded, it will be centered in the parent [Viewport] instead. @@ -211,23 +239,29 @@ + Popups the [Window] centered inside its parent [Window]. + [code]fallback_ratio[/code] determines the maximum size of the [Window], in relation to its parent. + Popups the [Window] centered inside its parent [Window] and sets its size as a [code]ratio[/code] of parent's size. + Popups the [Window] with a position shifted by parent [Window]'s position. + If the [Window] is embedded, has the same effect as [method popup]. + Tells the OS that the [Window] needs an attention. This makes the window stand out in some way depending on the system, e.g. it might blink on the task bar. @@ -248,12 +282,14 @@ + If [code]active[/code] is [code]true[/code], enables system's native IME (Input Method Editor). + Moves IME to the given position. @@ -267,17 +303,19 @@ + Enables font oversampling. This makes fonts look better when they are scaled up. + Makes the [Window] appear. This enables interactions with the [Window] and doesn't change any of its property other than visibility (unlike e.g. [method popup]). - If [code]true[/code], the window will be on top of all other windows. + If [code]true[/code], the window will be on top of all other windows. Does not work if [member transient] is enabled. Toggles if any text should automatically change to its translated version depending on the current locale. @@ -286,27 +324,36 @@ If [code]true[/code], the window will have no borders. + Specifies how the content's aspect behaves when the [Window] is resized. The base aspect is determined by [member content_scale_size]. + Specifies the base scale of [Window]'s content when its [member size] is equal to [member content_scale_size]. + Specifies how the content is scaled when the [Window] is resized. + Base size of the content (i.e. nodes that are drawn inside the window). If non-zero, [Window]'s content will be scaled when the window is resized to a different size. The screen the window is currently on. + If [code]true[/code], the [Window] will be in exclusive mode. Exclusive windows are always on top of their parent and will block all input going to the parent [Window]. + Needs [member transient] enabled to work. + If non-zero, the [Window] can't be resized to be bigger than this size. + If non-zero, the [Window] can't be resized to be smaller than this size. Set's the window's current mode. [b]Note:[/b] Fullscreen mode is not exclusive fullscreen on Windows and Linux. + If [code]true[/code], the [Window] will be considered a popup. Popups are sub-windows that don't show as separate windows in system's window manager's window list and will send close request when anything is clicked outside of them (unless [member exclusive] is enabled). The window's position in pixels. @@ -315,34 +362,46 @@ The window's size in pixels. + The [Theme] resource that determines the style of the underlying [Control] nodes. + [Window] styles will have no effect unless the window is embedded. + The name of a theme type variation used by this [Window] to look up its own theme items. See [member Control.theme_type_variation] for more details. - The window's title. + The window's title. If the [Window] is non-embedded, title styles set in [Theme] will have no effect. + If [code]true[/code], the [Window] is transient, i.e. it's considered a child of another [Window]. Transient windows can't be in fullscreen mode and will return focus to their parent when closed. + Note that behavior might be different depending on the platform. + If [code]true[/code], the [Window]'s background can be transparent. This is best used with embedded windows. Currently non-embedded [Window] transparency is implemented only for MacOS. + If [code]true[/code], the [Window] can't be focused nor interacted with. It can still be visible. - If [code]true[/code], the window can't be resized. + If [code]true[/code], the window can't be resized. Minimize and maximize buttons are disabled. If [code]true[/code], the window is visible. + If [code]true[/code], the window's size will automatically update when a child node is added or removed. + If [code]false[/code], you need to call [method child_controls_changed] manually. + Emitted right after [method popup] call, before the [Window] appears or does anything. + Emitted when the [Window]'s close button is pressed or when [member popup_window] is enabled and user clicks outside the window. + This signal can be used to handle window closing, e.g. by connecting it to [method hide]. @@ -362,49 +421,58 @@ + Emitted when the [Window] gains focus. + Emitted when the [Window] loses its focus. + Emitted when a go back request is sent (e.g. pressing the "Back" button on Android), right after [constant Node.NOTIFICATION_WM_GO_BACK_REQUEST]. + Emitted when the mouse cursor enters the [Window]'s area, regardless if it's currently focused or not. + Emitted when the mouse cursor exits the [Window]'s area (including when it's hovered over another window on top of this one). + Emitted when the [member theme] is modified or changed to another [Theme]. + Emitted when [Window] is made visible or disappears. + Emitted when the [Window] is currently focused and receives any input, passing the received event as an argument. + Emitted when [Window]'s visibility changes, right before [signal visibility_changed]. - Windowed mode. + Windowed mode, i.e. [Window] doesn't occupy whole screen (unless set to the size of the screen). - Minimized window mode. + Minimized window mode, i.e. [Window] is not visible and available on window manager's window list. Normally happens when the minimize button is presesd. - Maximized window mode. + Maximized window mode, i.e. [Window] will occupy whole screen area except task bar and still display its borders. Normally happens when the minimize button is presesd. Fullscreen window mode. Note that this is not [i]exclusive[/i] 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. @@ -416,37 +484,49 @@ Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling fullscreen mode. - The window's ability to be resized. + The window's ability to be resized. Set with [member unresizable]. - Borderless window. + Borderless window. Set with [member borderless]. - Flag for making the window always on top of all other windows. + Flag for making the window always on top of all other windows. Set with [member always_on_top]. + Flag for per-pixel transparency. Set with [member transparent]. + The window's ability to gain focus. Set with [member unfocusable]. + Whether the window is popup or a regular window. Set with [member popup_window]. + Max value of the [enum Flags]. + The content will not be scaled to match the [Window]'s size. + The content will be rendered at the target size. This is more performance-expensive than [constant CONTENT_SCALE_MODE_VIEWPORT], but provides better results. + The content will be rendered at the base size and then scaled to the target size. More performant than [constant CONTENT_SCALE_MODE_CANVAS_ITEMS], but results in pixelated image. + The aspect will be ignored. Scaling will simply stretch the content to fit the target size. + The content's aspect will be preserved. If the target size has different aspect from the base one, the image will be centered and black bars will appear on left and right sides. + The content can be expanded vertically. Scaling horizontally will result in keeping the width ratio and then black bars on left and right sides. + The content can be expanded horizontally. Scaling vertically will result in keeping the height ratio and then black bars on top and bottom sides. + The content's aspect will be preserved. If the target size has different aspect from the base one, the content will stay in the to-left corner and add an extra visible area in the stretched space. Automatic layout direction, determined from the parent window layout direction. @@ -463,33 +543,41 @@ + The color of the title's text. - The color of the title outline. + The color of the title's text outline. + Horizontal position offset of the close button. + Vertical position offset of the close button. - - + Defines the outside margin at which the window border can be grabbed with mouse and resized. + Height of the title bar. The size of the title outline. + The font used to draw the title. The size of the title font. + The icon for the close button. + The icon for the close button when it's being pressed. + The background style used when the [Window] is embedded. Note that this is drawn only under the window's content, excluding the title. For proper borders and title bar style, you can use [code]expand_margin_*[/code] properties of [StyleBoxFlat]. + [b]Note:[/b] The content background will not be visible unless [member transparent] is enabled. diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 5fcaf8f2c4df..401aeb4889fd 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -570,7 +570,6 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const // Window theme->set_stylebox("embedded_border", "Window", sb_expand(make_flat_stylebox(style_popup_color, 10, 28, 10, 8), 8, 32, 8, 6)); - theme->set_constant("scaleborder_size", "Window", 4 * scale); theme->set_font("title_font", "Window", Ref()); theme->set_font_size("title_font_size", "Window", -1);