Klasse Window

Alle implementierten Schnittstellen:
PointerInterface
Bekannte direkte Unterklassen:
AboutWindow, PreferencesWindow

public class Window extends Window
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: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:adaptive-preview] property.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Window.html

  • Konstruktordetails

    • Window

      public Window(PointerContainer pointer)
    • Window

      public Window()
      Creates a new `AdwWindow`.
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • addBreakpoint

      public void addBreakpoint(@Nonnull Breakpoint breakpoint)
      Adds @breakpoint to @self.
      Parameter:
      breakpoint - the breakpoint to add
    • getAdaptivePreview

      public boolean getAdaptivePreview()
      Gets whether adaptive preview for @self is currently open.
      Gibt zurück:
      whether adaptive preview is open.
    • getContent

      public Widget getContent()
      Gets the content widget of @self.

      This method should always be used instead of [method@Gtk.Window.get_child].
      Gibt zurück:
      the content widget of @self
    • getCurrentBreakpoint

      public Breakpoint getCurrentBreakpoint()
      Gets the current breakpoint.
      Gibt zurück:
      the current breakpoint
    • getDialogs

      public ListModel getDialogs()
      Returns a [iface@Gio.ListModel] that contains the open dialogs of @self.

      This can be used to keep an up-to-date view.
      Gibt zurück:
      a list model for the dialogs of @self
    • getVisibleDialog

      public Dialog getVisibleDialog()
      Returns the currently visible dialog in @self, if there's one.
      Gibt zurück:
      the visible dialog
    • setAdaptivePreview

      public void setAdaptivePreview(boolean 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.
      Parameter:
      adaptive_preview - whether to open adaptive preview
    • setContent

      public void setContent(@Nullable Widget content)
      Sets the content widget of @self.

      This method should always be used instead of [method@Gtk.Window.set_child].
      Parameter:
      content - the content widget
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Setzt außer Kraft:
      asAccessible in Klasse Window
      Gibt zurück:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Setzt außer Kraft:
      asBuildable in Klasse Window
      Gibt zurück:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Setzt außer Kraft:
      asConstraintTarget in Klasse Window
      Gibt zurück:
      ConstraintTarget
    • asNative

      public Native asNative()
      Implements interface Native. Call this to get access to interface functions.
      Setzt außer Kraft:
      asNative in Klasse Window
      Gibt zurück:
      Native
    • asRoot

      public Root asRoot()
      Implements interface Root. Call this to get access to interface functions.
      Setzt außer Kraft:
      asRoot in Klasse Window
      Gibt zurück:
      Root
    • asShortcutManager

      public ShortcutManager asShortcutManager()
      Implements interface ShortcutManager. Call this to get access to interface functions.
      Setzt außer Kraft:
      asShortcutManager in Klasse Window
      Gibt zurück:
      ShortcutManager
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()