Package: gtk

Class gtk:window

Superclasses

Documented Subclasses

Direct Slots

application
The application property of type gtk:application (Read / Write)
The application associated with the window. The application will be kept alive for at least as long as it has any windows associated with it. See the g:application-hold function for a way to keep it alive without windows. Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it by setting this property to nil.
child
The child property of type gtk:widget (Read / Write)
The child widget.
decorated
The decorated property of type :boolean (Read / Write)
Whether the window should be decorated by the window manager.
Default value: true
default-height
The default-height property of type :int (Read / Write)
The default height of the window.
Allowed values: >= -1
Default value: 0
default-widget
The default-widget property of type gtk:widget (Read / Write)
The default widget of the window. The default widget is the widget that is activated when the user presses the Enter key.
default-width
The default-width property of type :int (Read / Write)
The default width of the window.
Allowed values: >= -1
Default value: 0
deletable
The deletable property of type :boolean (Read / Write)
Whether the window frame should have a Close button.
Default value: true
destroy-with-parent
The destroy-with-parent property of type :boolean (Read / Write)
Whether this window should be destroyed when the parent is destroyed.
Default value: false
display
The display property of type gdk:display (Read / Write)
The display that will display the window.
focus-visible
The focus-visible property of type :boolean (Read / Write)
Whether "focus rectangles" are currently visible in the window. This property is maintained by GTK based on user input and should not be set by applications.
Default value: true
focus-widget
The focus-widget property of type gtk:widget (Read / Write)
The focus widget. That is the widget that would have the focus if the toplevel window focused.
fullscreened
The fullscreened property of type :boolean (Read / Write)
Whether the window is fullscreen.
Default value: false
handle-menubar-accel
The handle-menubar-accel property of type :boolean (Read / Write)
Whether the window frame should handle the F10 key for activating menubars. Since 4.2
Default value: true
hide-on-close
The hide-on-close property of type :boolean (Read / Write)
Whether the window should be hidden when the users clicks the Close button.
Default value: false
icon-name
The icon-name property of type :string (Read / Write)
Specifies the name of the themed icon to use as the window icon. See the gtk:icon-theme documentation for more details.
Default value: nil
is-active
The is-active property of type :boolean (Read)
Whether the toplevel is the currently active window.
Default value: false
maximized
The maximized property of type :boolean (Read / Write / Construct)
Whether the window is maximized.
Default value: false
mnemonics-visible
The mnemonics-visible property of type :boolean (Read / Write)
Whether mnemonics are currently visible in the window. This property is maintained by GTK based on user input, and should not be set by applications.
Default value: false
modal
The modal property of type :boolean (Read / Write)
If true other windows are not usable while this one is up.
Default value: false
resizable
The resizable property of type :boolean (Read / Write)
If true users can resize the window.
Default value: true
startup-id
The startup-id property of type :string (Write)
The write-only property for setting the startup notification identifier of the window.
Default value: nil
suspended
The suspended property of type :boolean (Read)
Whether the window is suspended.
Default value: false
title
The title property of type :string (Read / Write)
The title of the window.
Default value: nil
titlebar
The titlebar property of type gtk:widget (Read / Write)
The titlebar widget. Since 4.6
transient-for
The transient-for property of type gtk:window (Read / Write / Construct)
The transient parent of the window.

Details

The gtk:window widget is a toplevel window which can contain other widgets.

Figure: GtkWindow

Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window, for example, to resize it, move it, or close it.

GtkWindow as GtkBuildable

The gtk:window implementation of the gtk:buildable interface supports setting a child widget 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]    
The gtk:window implementation has a main CSS node with name window and .background style class.

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. The gtk:window implementation 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 do not make sense on the toplevel window node, such as margins or padding. When client-side decorations without invisible borders are in use, that is, 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.

The gtk:window implementation adds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child.

Accessibility

The gtk:window implementation uses the :window role of the gtk:accessible-role enumeration.

Signal Details

The "activate-default" signal
lambda (window)    :action      
window
The gtk:window widget which received the signal.
The signal is a keybinding signal which gets emitted when the user activates the default widget of the window.
The "activate-focus" signal
lambda (window)    :action      
window
The gtk:window widget which received the signal.
The signal is a keybinding signal which gets emitted when the user activates the currently focused widget of the window.
The "close-request" signal
lambda (window)    :run-last      
window
The gtk:window widget on which the signal is emitted.
Returns
True to stop other handlers from being invoked for the signal.
The signal is emitted when the user clicks on the close button of the window.
The "enable-debugging" signal
lambda (window toggle)    :action      
window
The gtk:window widget on which the signal is emitted.
toggle
The boolean which toggles the debugger.
Returns
The boolean which is true if the key binding was handled.
The signal is a keybinding signal which gets emitted when the user enables or disables interactive debugging. When the toggle argument is true, interactive debugging is toggled on or off, when it is false, the debugger will be pointed at the widget under the pointer. The default bindings for this signal are the Ctrl-Shift-I and Ctrl-Shift-D keys.
The "keys-changed" signal
lambda (window)    :run-first      
window
The gtk:window widget which received the signal.
The signal gets emitted when the set of accelerators or mnemonics that are associated with the window changes.
Warning: Deprecated since 4.10. Use gtk:shortcut and gtk:event-controller objects to implement keyboard shortcuts.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

2024-10-2