1.78 <AdwWindow>

Class: <AdwWindow>

It derives from <GtkWindow>.

A freeform window.

The <AdwWindow> widget is a subclass of <GtkWindow> which has no titlebar area. Instead, ToolbarView can be used together with HeaderBar or <GtkHeaderBar> as follows:

<object class="AdwWindow">
  <property name="content">
    <object class="AdwToolbarView">
      <child type="top">
        <object class="AdwHeaderBar"/>
      </child>
      <property name="content">
        <!-- ... -->
      </property>
    </object>
  </property>
</object>

Using window:titlebar or window:child is not supported and will result in a crash. Use Window:content instead.

Dialogs

<AdwWindow> can contain Dialog. Use Dialog.present with the window or a widget within a window to show a dialog.

Breakpoints

<AdwWindow> can be used with Breakpoint the same way as BreakpointBin. Refer to that widget’s documentation for details.

Example:

<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 widget:width-request and 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 Ctrl+Shift+M, and controlled via the Window:adaptive-preview property.

Fields

parent-instance

Properties

Property: window:adaptive-preview self

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.

Its value is a boolean.

Set it with (set! (window:adaptive-preview self) value).

Property: window:content self

The content widget.

This property should always be used instead of window:child.

Its value is a <GtkWidget>, or #f.

Set it with (set! (window:content self) value).

Property: window:current-breakpoint self

The current breakpoint.

Its value is a <AdwBreakpoint>, or #f.

It is read only.

Property: window:dialogs self

The open dialogs.

Its value is a <GListModel>, or #f.

It is read only.

Property: window:visible-dialog self

The currently visible dialog

Its value is a <AdwDialog>, or #f.

It is read only.

Procedures

Method: window:add-breakpoint self breakpoint
Method: add-breakpoint self breakpoint

Adds breakpoint to self.

self

Passed: a <AdwWindow>.

a window

breakpoint

Passed: a <AdwBreakpoint>.

the breakpoint to add

Method: window:get-adaptive-preview? self ⇒ %return
Method: get-adaptive-preview? self ⇒ %return

Gets whether adaptive preview for self is currently open.

self

Passed: a <AdwWindow>.

a window

%return

Returned: a boolean.

whether adaptive preview is open.

Method: window:get-content self ⇒ %return
Method: get-content self ⇒ %return

Gets the content widget of self.

This method should always be used instead of window:get-child.

self

Passed: a <AdwWindow>.

a window

%return

Returned: a <GtkWidget>, or #f.

the content widget of self

Method: window:get-current-breakpoint self ⇒ %return
Method: get-current-breakpoint self ⇒ %return

Gets the current breakpoint.

self

Passed: a <AdwWindow>.

a window

%return

Returned: a <AdwBreakpoint>, or #f.

the current breakpoint

Method: window:get-dialogs self ⇒ %return
Method: get-dialogs self ⇒ %return

Returns a <GListModel> that contains the open dialogs of self.

This can be used to keep an up-to-date view.

self

Passed: a <AdwWindow>.

a window

%return

Returned: a <GListModel>.

a list model for the dialogs of self

Method: window:get-visible-dialog self ⇒ %return
Method: get-visible-dialog self ⇒ %return

Returns the currently visible dialog in self, if there’s one.

self

Passed: a <AdwWindow>.

a window

%return

Returned: a <AdwDialog>, or #f.

the visible dialog

Procedure: window:new ⇒ %return

Creates a new <AdwWindow>.

%return

Returned: a <GtkWidget>.

the newly created <AdwWindow>

Method: window:set-adaptive-preview self adaptive-preview
Method: set-adaptive-preview self 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.

self

Passed: a <AdwWindow>.

a window

adaptive-preview

Passed: a boolean.

whether to open adaptive preview

Method: window:set-content self [content]
Method: set-content self [content]

Sets the content widget of self.

This method should always be used instead of window:set-child.

self

Passed: a <AdwWindow>.

a window

content

Passed, or left out: a <GtkWidget>, or #f.

the content widget