Object Hierarchy:

Gtk.Window Gtk.Window Gtk.Window Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Window GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Gtk.Window Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.Window Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Gtk.Window Gtk.ConstraintTarget->Gtk.Widget Gtk.Native Gtk.Native Gtk.Native->Gtk.Window Gtk.Root Gtk.Root Gtk.Root->Gtk.Window Gtk.ShortcutManager Gtk.ShortcutManager Gtk.ShortcutManager->Gtk.Window


[ CCode ( type_id = "gtk_window_get_type ()" ) ]
public class Window : Widget, Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager

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 [iface@Gtk.Buildable] 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.


Until GTK 4.10, `GtkWindow` used the `GTK_ACCESSIBLE_ROLE_WINDOW` role.

Since GTK 4.12, `GtkWindow` uses the `GTK_ACCESSIBLE_ROLE_APPLICATION` role.


`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.

Namespace: Gtk
Package: gtk4



Static methods:

Creation methods:



Inherited Members:

All known members inherited from class Gtk.Widget
All known members inherited from interface Gtk.Native
All known members inherited from interface Gtk.Root
All known members inherited from interface Gtk.ShortcutManager