A GtkWindow is a toplevel window which can contain other widgets.
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 Buildable interface supports setting a child as
the titlebar by specifying “titlebar” as the “type” attribute of a <child> element.
CSS nodes
window.background
├── <child>
╰── <titlebar child>.titlebar [.default-decoration]
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: .tiled, .maximized, .fullscreen. Specialized types of window often add their own
discriminating style classes, such as .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.
- public void close ()
Requests that the window is closed, similar to what happens when a window
manager close button is clicked.
- 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 Application
associated with the window (if any).
- 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 such as a title
bar via set_decorated.
- 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 via
set_deletable.
- 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 ()
- public unowned WindowGroup get_group ()
Returns the group for this or the default
group, if this is null or if this does
not have an explicit window group.
- 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, see
set_icon_name.
- public bool get_mnemonics_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
Application associated with the window.
- public void set_child (Widget? child)
Sets the child widget of this.
- public void set_decorated (bool setting)
By default, windows are decorated with a title bar, resize controls, etc.
- public void set_default_size (int width, int height)
Sets the default size of a window.
- public void set_default_widget (Widget? default_widget)
The default widget is the widget that’s activated when the user presses
Enter in a dialog (for example).
- public void set_deletable (bool setting)
By default, windows have a close button in the window frame.
- 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 Display where
the this is displayed; if the window is already mapped, it will be unmapped, and then remapped on the new
display.
- public void set_focus (Widget? focus)
If focus
is not the current focus widget, and is focusable,
sets it as the focus widget for the window.
- public void set_focus_visible (bool setting)
- 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)
- 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)
Startup notification identifiers are used by desktop environment to track
application startup, to provide user feedback and other features.
- public void set_title (string? title)
Sets the title of the Window.
- 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 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.