A `GtkWindow` is a toplevel window which can contain other widgets.
![An example GtkWindow](window.png)
Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window (resize
it, move it, close it,...).
GtkWindow as GtkBuildable
The `GtkWindow` implementation of the [[email protected]] interface supports setting a child as the titlebar by specifying
“titlebar” as the “type” attribute of a <child> element.
CSS nodes
``` window.background [.csd / .solid-csd / .ssd] [.maximized / .fullscreen / .tiled] ├── <child> ╰── <titlebar child
>.titlebar [.default-decoration] ```
`GtkWindow` has a main CSS node with name window and style class .background.
Style classes that are typically used with the main CSS node are .csd (when client-side decorations are in use), .solid-csd (for
client-side decorations without invisible borders), .ssd (used by mutter when rendering server-side decorations). GtkWindow also
represents window states with the following style classes on the main node: .maximized, .fullscreen, .tiled (when supported, also
.tiled-top, .tiled-left, .tiled-right, .tiled-bottom).
`GtkWindow` subclasses often add their own discriminating style classes, such as .dialog, .popup or .tooltip.
Generally, some CSS properties don't make sense on the toplevel window node, such as margins or padding. When client-side decorations
without invisible borders are in use (i.e. the .solid-csd style class is added to the main window node), the CSS border of the toplevel
window is used for resize drags. In the .csd case, the shadow area outside of the window can be used to resize it.
`GtkWindow` adds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child.
Accessibility
`GtkWindow` uses the gtk_accessible_role_window role.
Actions
`GtkWindow` defines a set of built-in actions: - `default.activate`: Activate the default widget. - `window.minimize`: Minimize the
window. - `window.toggle-maximized`: Maximize or restore the window. - `window.close`: Close the window.
- public Application application { get; set; }
The `GtkApplication` associated with the window.
- public Widget child { get; set; }
The child widget.
- public bool decorated { get; set; }
Whether the window should have a frame (also known as *decorations*).
- public int default_height { get; set; }
The default height of the window.
- public Widget default_widget { get; set; }
The default widget.
- public int default_width { get; set; }
The default width of the window.
- public bool deletable { get; set; }
Whether the window frame should have a close button.
- public bool destroy_with_parent { get; set; }
If this window should be destroyed when the parent is destroyed.
- public Display display { owned get; set; }
The display that will display this window.
- public bool focus_visible { get; set; }
Whether 'focus rectangles' are currently visible in this window.
- public Widget focus_widget { owned get; set; }
The focus widget.
- public bool fullscreened { get; set construct; }
Whether the window is fullscreen.
- public bool handle_menubar_accel { get; set; }
Whether the window frame should handle F10 for activating menubars.
- public bool hide_on_close { get; set; }
If this window should be hidden when the users clicks the close
button.
- public string icon_name { get; set; }
Specifies the name of the themed icon to use as the window icon.
- public bool is_active { get; }
Whether the toplevel is the currently active window.
- public bool maximized { get; set construct; }
Whether the window is maximized.
- public bool mnemonics_visible { get; set; }
Whether mnemonics are currently visible in this window.
- public bool modal { get; set; }
If true, the window is modal.
- public bool resizable { get; set; }
If true, users can resize the
window.
- public string startup_id { set; }
A write-only property for setting window's startup notification
identifier.
- public string title { get; set; }
The title of the window.
- public Widget titlebar { get; set; }
The titlebar widget.
- public Window transient_for { get; set construct; }
The transient parent of the window.
- public void close ()
Requests that the window is closed.
- public void destroy ()
Drop the internal reference GTK holds on toplevel windows.
- public void fullscreen ()
Asks to place this in the fullscreen
state.
- public void fullscreen_on_monitor (Monitor monitor)
Asks to place this in the fullscreen
state on the given monitor
.
- public unowned Application? get_application ()
Gets the `GtkApplication` associated with the window.
- public unowned Widget? get_child ()
Gets the child widget of this.
- public bool get_decorated ()
Returns whether the window has been set to have decorations.
- public void get_default_size (out int width, out int height)
Gets the default size of the window.
- public unowned Widget? get_default_widget ()
Returns the default widget for this.
- public bool get_deletable ()
Returns whether the window has been set to have a close button.
- public bool get_destroy_with_parent ()
Returns whether the window will be destroyed with its transient
parent.
- public unowned Widget? get_focus ()
Retrieves the current focused widget within the window.
- public bool get_focus_visible ()
Gets whether “focus rectangles” are supposed to be visible.
- public unowned WindowGroup get_group ()
Returns the group for this.
- public bool get_handle_menubar_accel ()
Returns whether this window reacts to F10 key presses by activating a
menubar it contains.
- public bool get_hide_on_close ()
Returns whether the window will be hidden when the close button is
clicked.
- public unowned string? get_icon_name ()
Returns the name of the themed icon for the window.
- public bool get_mnemonics_visible ()
Gets whether mnemonics are supposed to be visible.
- public bool get_modal ()
Returns whether the window is modal.
- public bool get_resizable ()
- public unowned string? get_title ()
Retrieves the title of the window.
- public unowned Widget? get_titlebar ()
Returns the custom titlebar that has been set with
set_titlebar.
- public unowned Window? get_transient_for ()
Fetches the transient parent for this window.
- public bool has_group ()
Returns whether this has an explicit
window group.
- public bool is_fullscreen ()
Retrieves the current fullscreen state of
this.
- public bool is_maximized ()
Retrieves the current maximized state of
this.
- public void maximize ()
Asks to maximize this, so that it
fills the screen.
- public void minimize ()
Asks to minimize the specified this.
- public void present ()
Presents a window to the user.
- public void present_with_time (uint32 timestamp)
Presents a window to the user.
- public void set_application (Application? application)
Sets or unsets the `GtkApplication` associated with the window.
- public void set_child (Widget? child)
Sets the child widget of this.
- public void set_decorated (bool setting)
Sets whether the window should be decorated.
- public void set_default_size (int width, int height)
Sets the default size of a window.
- public void set_default_widget (Widget? default_widget)
Sets the default widget.
- public void set_deletable (bool setting)
Sets whether the window should be deletable.
- public void set_destroy_with_parent (bool setting)
If setting
is true,
then destroying the transient parent of this will also destroy this
itself.
- public void set_display (Display display)
Sets the `GdkDisplay` where the this
is displayed.
- public void set_focus (Widget? focus)
Sets the focus widget.
- public void set_focus_visible (bool setting)
Sets whether “focus rectangles” are supposed to be visible.
- public void set_handle_menubar_accel (bool handle_menubar_accel)
Sets whether this window should react to F10 key presses by activating
a menubar it contains.
- public void set_hide_on_close (bool setting)
If setting
is true,
then clicking the close button on the window will not destroy it, but only hide it.
- public void set_icon_name (string? name)
Sets the icon for the window from a named themed icon.
- public void set_mnemonics_visible (bool setting)
Sets whether mnemonics are supposed to be visible.
- public void set_modal (bool modal)
Sets a window modal or non-modal.
- public void set_resizable (bool resizable)
Sets whether the user can resize a window.
- public void set_startup_id (string startup_id)
Sets the startup notification ID.
- public void set_title (string? title)
Sets the title of the `GtkWindow`.
- public void set_titlebar (Widget? titlebar)
Sets a custom titlebar for this.
- public void set_transient_for (Window? parent)
Dialog windows should be set transient for the main application window
they were spawned from.
- public async bool show_uri_full (string uri, uint32 timestamp, Cancellable? cancellable) throws Error
This function launches the default application for showing a given
uri.
- public void unfullscreen ()
Asks to remove the fullscreen state for
this, and return to its previous state.
- public void unmaximize ()
Asks to unmaximize this.
- public void unminimize ()
Asks to unminimize the specified this
.