Adw.Window¶
- Subclasses:
Methods¶
- Inherited:
Gtk.Window (62), Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1), Gtk.Native (6), Gtk.Root (3)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r |
|||
r |
|||
r |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Adw.Window(*args, **kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A freeform window.
<picture> <source srcset=”window-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”window.png” alt=”window”> </picture>
The
AdwWindow
widget is a subclass of [class`Gtk`.Window] which has no titlebar area. Instead, [class`ToolbarView`] can be used together with [class`HeaderBar`] or [class`Gtk`.HeaderBar] as follows:``xml <object class=”AdwWindow”>
- <property name=”content”>
- <object class=”AdwToolbarView”>
- <child type=”top”>
<object class=”AdwHeaderBar”/>
</child> <property name=”content”>
<!– … –>
</property>
</object>
</property>
</object> ``
Using [property`Gtk`.Window:titlebar] or [property`Gtk`.Window:child] is not supported and will result in a crash. Use [property`Window`:py:data::content<Adw.Window.props.content>] instead.
- Dialogs
AdwWindow
can contain [class`Dialog`]. Use [method`Dialog`.present] with the window or a widget within a window to show a dialog.- Breakpoints
AdwWindow
can be used with [class`Breakpoint`] the same way as [class`BreakpointBin`]. Refer to that widget’s documentation for details.Example:
``xml <object class=”AdwWindow”>
- <property name=”content”>
- <object class=”AdwToolbarView”>
- <child type=”top”>
<object class=”AdwHeaderBar”/>
</child> <property name=”content”>
<!– … –>
</property> <child type=”bottom”>
- <object class=”GtkActionBar” id=”bottom_bar”>
<property name=”revealed”>True</property> <property name=”visible”>False</property>
</object>
</child>
</object>
</property> <child>
- <object class=”AdwBreakpoint”>
<condition>max-width: 500px</condition> <setter object=”bottom_bar” property=”visible”>True</setter>
</object>
</child>
</object> ``
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 [property`Gtk`.Widget:width-request] and [property`Gtk`.Widget:height-request] properties manually.- Adaptive Preview
AdwWindow
has a debug tool called adaptive preview. It can be opened from GTK Inspector or by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd>, and controlled via the [property`Window`:py:data::adaptive-preview<Adw.Window.props.adaptive_preview>] property.- classmethod new()¶
- Returns:
the newly created
AdwWindow
- Return type:
Creates a new
AdwWindow
.
- add_breakpoint(breakpoint)¶
- Parameters:
breakpoint (
Adw.Breakpoint
) – the breakpoint to add
Adds breakpoint to self.
New in version 1.4.
- get_adaptive_preview()¶
- Returns:
whether adaptive preview is open.
- Return type:
Gets whether adaptive preview for self is currently open.
New in version 1.7.
- get_content()¶
- Returns:
the content widget of self
- Return type:
Gtk.Widget
orNone
Gets the content widget of self.
This method should always be used instead of [method`Gtk`.Window.get_child].
- get_current_breakpoint()¶
- Returns:
the current breakpoint
- Return type:
Gets the current breakpoint.
New in version 1.4.
- get_dialogs()¶
- Returns:
a list model for the dialogs of self
- Return type:
Returns a [iface`Gio`.ListModel] that contains the open dialogs of self.
This can be used to keep an up-to-date view.
New in version 1.5.
- get_visible_dialog()¶
- Returns:
the visible dialog
- Return type:
Adw.Dialog
orNone
Returns the currently visible dialog in self, if there’s one.
New in version 1.5.
- set_adaptive_preview(adaptive_preview)¶
- Parameters:
adaptive_preview (
bool
) – whether to open adaptive preview
Sets whether adaptive preview for self is currently open.
Adaptive preview is a debugging tool used for testing the window contents at specific screen sizes, simulating mobile environment.
Adaptive preview can always be accessed from inspector. This function allows applications to open it manually.
Most applications should not use this function.
New in version 1.7.
- set_content(content)¶
- Parameters:
content (
Gtk.Widget
orNone
) – the content widget
Sets the content widget of self.
This method should always be used instead of [method`Gtk`.Window.set_child].
Property Details¶
- Adw.Window.props.adaptive_preview¶
- Name:
adaptive-preview
- Type:
- Default Value:
- Flags:
Whether adaptive preview is currently open.
Adaptive preview is a debugging tool used for testing the window contents at specific screen sizes, simulating mobile environment.
Adaptive preview can always be accessed from inspector. This function allows applications to open it manually.
Most applications should not use this property.
New in version 1.7.
- Adw.Window.props.content¶
- Name:
content
- Type:
- Default Value:
- Flags:
The content widget.
This property should always be used instead of [property`Gtk`.Window:child].
- Adw.Window.props.current_breakpoint¶
- Name:
current-breakpoint
- Type:
- Default Value:
- Flags:
The current breakpoint.
New in version 1.4.
- Adw.Window.props.dialogs¶
- Name:
dialogs
- Type:
- Default Value:
- Flags:
The open dialogs.
New in version 1.5.
- Adw.Window.props.visible_dialog¶
- Name:
visible-dialog
- Type:
- Default Value:
- Flags:
The currently visible dialog
New in version 1.5.