:right-sidebar: True
Window
===================================================================
.. currentmodule:: gi.repository.Adw
.. class:: Window(*args, **kwargs)
:no-contents-entry:
Superclasses: :class:`~gi.repository.Gtk.Window`, :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object`
Subclasses: :class:`~gi.repository.Adw.AboutWindow`, :class:`~gi.repository.Adw.PreferencesWindow`
Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Native`, :class:`~gi.repository.Gtk.Root`, :class:`~gi.repository.Gtk.ShortcutManager`
A freeform window.
.. image:: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/window.png
The ``AdwWindow`` widget is a subclass of :obj:`~gi.repository.Gtk.Window` which has no
titlebar area. Instead, :obj:`~gi.repository.Adw.ToolbarView` can be used together with
:obj:`~gi.repository.Adw.HeaderBar` or :obj:`~gi.repository.Gtk.HeaderBar` as follows:
.. code-block:: xml
:dedent:
Using :obj:`~gi.repository.Gtk.Window.props.titlebar` or :obj:`~gi.repository.Gtk.Window.props.child`
is not supported and will result in a crash. Use :obj:`~gi.repository.Adw.Window.props.content`
instead.
Dialogs
--------------------------------------------------------------------------------
``AdwWindow`` can contain :obj:`~gi.repository.Adw.Dialog`\. Use :obj:`~gi.repository.Dialog.present` with the
window or a widget within a window to show a dialog.
Breakpoints
--------------------------------------------------------------------------------
``AdwWindow`` can be used with :obj:`~gi.repository.Adw.Breakpoint` the same way as
:obj:`~gi.repository.Adw.BreakpointBin`\. Refer to that widget's documentation for details.
Example:
.. code-block:: xml
:dedent:
TrueFalsemax-width: 500pxTrue
When breakpoints are used, the minimum size must be larger than the smallest
UI state. ``AdwWindow`` defaults to the minimum size of 360×200 px. If that's
too small, set the :obj:`~gi.repository.Gtk.Widget.props.width_request` and
:obj:`~gi.repository.Gtk.Widget.props.height_request` properties manually.
Constructors
------------
.. rst-class:: interim-class
.. class:: Window
:no-index:
.. classmethod:: new() -> ~gi.repository.Gtk.Widget
Creates a new ``AdwWindow``\.
Methods
-------
.. rst-class:: interim-class
.. class:: Window
:no-index:
.. method:: add_breakpoint(breakpoint: ~gi.repository.Adw.Breakpoint) -> None
Adds ``breakpoint`` to ``self``\.
.. versionadded:: 1.4
:param breakpoint: the breakpoint to add
.. method:: get_content() -> ~gi.repository.Gtk.Widget | None
Gets the content widget of ``self``\.
This method should always be used instead of :obj:`~gi.repository.Gtk.Window.get_child`\.
.. method:: get_current_breakpoint() -> ~gi.repository.Adw.Breakpoint | None
Gets the current breakpoint.
.. versionadded:: 1.4
.. method:: get_dialogs() -> ~gi.repository.Gio.ListModel
Returns a :obj:`~gi.repository.Gio.ListModel` that contains the open dialogs of ``self``\.
This can be used to keep an up-to-date view.
.. versionadded:: 1.5
.. method:: get_visible_dialog() -> ~gi.repository.Adw.Dialog | None
Returns the currently visible dialog in ``self``\, if there's one.
.. versionadded:: 1.5
.. method:: set_content(content: ~gi.repository.Gtk.Widget | None = None) -> None
Sets the content widget of ``self``\.
This method should always be used instead of :obj:`~gi.repository.Gtk.Window.set_child`\.
:param content: the content widget
Properties
----------
.. rst-class:: interim-class
.. class:: Window
:no-index:
.. attribute:: props.content
:type: ~gi.repository.Gtk.Widget
The type of the None singleton.
.. attribute:: props.current_breakpoint
:type: ~gi.repository.Adw.Breakpoint
The type of the None singleton.
.. versionadded:: 1.4
.. attribute:: props.dialogs
:type: ~gi.repository.Gio.ListModel
The type of the None singleton.
.. versionadded:: 1.5
.. attribute:: props.visible_dialog
:type: ~gi.repository.Adw.Dialog
The type of the None singleton.
.. versionadded:: 1.5
Fields
------
.. rst-class:: interim-class
.. class:: Window
:no-index:
.. attribute:: parent_instance