Klasse ToolbarView

Alle implementierten Schnittstellen:
PointerInterface

public class ToolbarView extends Widget
A widget containing a page, as well as top and/or bottom bars.

<picture>
<source srcset="toolbar-view-dark.png" media="(prefers-color-scheme: dark)">
<img src="toolbar-view.png" alt="toolbar-view">
</picture>

`AdwToolbarView` has a single content widget and one or multiple top and
bottom bars, shown at the top and bottom sides respectively.

Example of an `AdwToolbarView` UI definition:
```xml
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<property name="content">
<object class="AdwPreferencesPage">
<!-- ... -->
</object>
</property>
</object>
```

The following kinds of top and bottom bars are supported:

- [class@HeaderBar]
- [class@TabBar]
- [class@ViewSwitcherBar]
- [class@Gtk.ActionBar]
- [class@Gtk.HeaderBar]
- [class@Gtk.PopoverMenuBar]
- [class@Gtk.SearchBar]
- Any [class@Gtk.Box] or a similar widget with the
[`.toolbar`](style-classes.html#toolbars) style class

By default, top and bottom bars are flat and scrolling content has a subtle
undershoot shadow, same as when using the
[`.undershoot-top`](style-classes.html#undershoot-indicators) and
[`.undershoot-bottom`](style-classes.html#undershoot-indicators) style
classes. This works well in most cases, e.g. with [class@StatusPage] or
[class@PreferencesPage], where the background at the top and bottom parts of
the page is uniform. Additionally, windows with sidebars should always use
this style.

[property@ToolbarView:top-bar-style] and
[property@ToolbarView:bottom-bar-style] properties can be used add an opaque
background and a persistent shadow to top and bottom bars, this can be useful
for content such as [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
where some elements are adjacent to the top/bottom bars, or [class@TabView],
where each page can have a different background.

<picture style="min-width: 33%; display: inline-block;">
<source srcset="toolbar-view-flat-1-dark.png" media="(prefers-color-scheme: dark)">
<img src="toolbar-view-flat-1.png" alt="toolbar-view-flat-1">
</picture>
<picture style="min-width: 33%; display: inline-block;">
<source srcset="toolbar-view-flat-2-dark.png" media="(prefers-color-scheme: dark)">
<img src="toolbar-view-flat-2.png" alt="toolbar-view-flat-2">
</picture>
<picture style="min-width: 33%; display: inline-block;">
<source srcset="toolbar-view-raised-dark.png" media="(prefers-color-scheme: dark)">
<img src="toolbar-view-raised.png" alt="toolbar-view-raised">
</picture>

`AdwToolbarView` ensures the top and bottom bars have consistent backdrop
styles and vertical spacing. For comparison:

<picture style="min-width: 40%; display: inline-block;">
<source srcset="toolbar-view-spacing-dark.png" media="(prefers-color-scheme: dark)">
<img src="toolbar-view-spacing.png" alt="toolbar-view-spacing">
</picture>
<picture style="min-width: 40%; display: inline-block;">
<source srcset="toolbar-view-spacing-box-dark.png" media="(prefers-color-scheme: dark)">
<img src="toolbar-view-spacing-box.png" alt="toolbar-view-spacing-box">
</picture>

Any top and bottom bars can also be dragged to move the window, equivalent
to putting them into a [class@Gtk.WindowHandle].

Content is typically place between top and bottom bars, but can also extend
behind them. This is controlled with the
[property@ToolbarView:extend-content-to-top-edge] and
[property@ToolbarView:extend-content-to-bottom-edge] properties.

Top and bottom bars can be hidden and revealed with an animation using the
[property@ToolbarView:reveal-top-bars] and
[property@ToolbarView:reveal-bottom-bars] properties.

## `AdwToolbarView` as `GtkBuildable`

The `AdwToolbarView` implementation of the [iface@Gtk.Buildable] interface
supports adding a top bar by specifying “top” as the “type” attribute of a
`<child>` element, or adding a bottom bar by specifying “bottom”.

## Accessibility

`AdwToolbarView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.

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

  • Konstruktordetails

    • ToolbarView

      public ToolbarView(PointerContainer pointer)
    • ToolbarView

      public ToolbarView()
      Creates a new `AdwToolbarView`.
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • addBottomBar

      public void addBottomBar(@Nonnull Widget widget)
      Adds a bottom bar to @self.
      Parameter:
      widget - a widget
    • addTopBar

      public void addTopBar(@Nonnull Widget widget)
      Adds a top bar to @self.
      Parameter:
      widget - a widget
    • getBottomBarHeight

      public int getBottomBarHeight()
      Gets the current bottom bar height for @self.

      Bottom bar height does change depending on
      [property@ToolbarView:reveal-bottom-bars], including during the transition.

      See [method@ToolbarView.get_top_bar_height].
      Gibt zurück:
      the current bottom bar height
    • getBottomBarStyle

      public int getBottomBarStyle()
      Gets appearance of the bottom bars for @self.
      Gibt zurück:
      bottom bar style
    • getContent

      public Widget getContent()
      Gets the content widget for @self.
      Gibt zurück:
      the content widget
    • getExtendContentToBottomEdge

      public boolean getExtendContentToBottomEdge()
      Gets whether the content widget can extend behind bottom bars.
      Gibt zurück:
      whether content extends behind bottom bars
    • getExtendContentToTopEdge

      public boolean getExtendContentToTopEdge()
      Gets whether the content widget can extend behind top bars.
      Gibt zurück:
      whether content extends behind top bars
    • getRevealBottomBars

      public boolean getRevealBottomBars()
      Gets whether bottom bars are revealed for @self.
      Gibt zurück:
      whether bottom bars are revealed
    • getRevealTopBars

      public boolean getRevealTopBars()
      Gets whether top bars are revealed for @self.
      Gibt zurück:
      whether top bars are revealed
    • getTopBarHeight

      public int getTopBarHeight()
      Gets the current top bar height for @self.

      Top bar height does change depending on
      [property@ToolbarView:reveal-top-bars], including during the transition.

      See [method@ToolbarView.get_bottom_bar_height].
      Gibt zurück:
      the current top bar height
    • getTopBarStyle

      public int getTopBarStyle()
      Gets appearance of the top bars for @self.
      Gibt zurück:
      top bar style
    • remove

      public void remove(@Nonnull Widget widget)
      Removes a child from @self.
      Parameter:
      widget - the child to be removed
    • setBottomBarStyle

      public void setBottomBarStyle(int style)
      Sets appearance of the bottom bars for @self.

      If set to `ADW_TOOLBAR_FLAT`, bottom bars are flat and scrolling content has
      a subtle undershoot shadow when touching them, same as the
      [`.undershoot-bottom`](style-classes.html#undershoot-indicators)
      style class. This works well for simple content, e.g. [class@StatusPage] or
      [class@PreferencesPage], where the background at the bottom of the page is
      uniform. Additionally, windows with sidebars should always use this style.

      Undershoot shadow is only present if a bottom bar is actually present and
      visible. It is also never present if
      [property@ToolbarView:extend-content-to-bottom-edge] is set to `TRUE`.

      If set to `ADW_TOOLBAR_RAISED`, bottom bars have an opaque background and a
      persistent shadow, this is suitable for content such as
      [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
      where some elements are directly adjacent to the bottom bars, or
      [class@TabView], where each page can have a different background.

      `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the
      shadow is replaced with a more subtle border. This can be useful for
      applications like image viewers.

      See also [method@ToolbarView.set_top_bar_style].
      Parameter:
      style - bottom bar style
    • setContent

      public void setContent(@Nullable Widget content)
      Sets the content widget for @self.
      Parameter:
      content - the content widget
    • setExtendContentToBottomEdge

      public void setExtendContentToBottomEdge(boolean extend)
      Sets whether the content widget can extend behind bottom bars.

      This can be used in combination with [property@ToolbarView:reveal-bottom-bars]
      to show and hide toolbars in fullscreen.

      See [method@ToolbarView.set_extend_content_to_top_edge].
      Parameter:
      extend - whether content extends behind bottom bars
    • setExtendContentToTopEdge

      public void setExtendContentToTopEdge(boolean extend)
      Sets whether the content widget can extend behind top bars.

      This can be used in combination with [property@ToolbarView:reveal-top-bars]
      to show and hide toolbars in fullscreen.

      See [method@ToolbarView.set_extend_content_to_bottom_edge].
      Parameter:
      extend - whether content extends behind top bars
    • setRevealBottomBars

      public void setRevealBottomBars(boolean reveal)
      Sets whether bottom bars are revealed for @self.

      The transition will be animated.

      This can be used in combination with
      [property@ToolbarView:extend-content-to-bottom-edge] to show and hide
      toolbars in fullscreen.

      See [method@ToolbarView.set_reveal_top_bars].
      Parameter:
      reveal - whether to reveal bottom bars
    • setRevealTopBars

      public void setRevealTopBars(boolean reveal)
      Sets whether top bars are revealed for @self.

      The transition will be animated.

      This can be used in combination with
      [property@ToolbarView:extend-content-to-top-edge] to show and hide toolbars
      in fullscreen.

      See [method@ToolbarView.set_reveal_bottom_bars].
      Parameter:
      reveal - whether to reveal top bars
    • setTopBarStyle

      public void setTopBarStyle(int style)
      Sets appearance of the top bars for @self.

      If set to `ADW_TOOLBAR_FLAT`, top bars are flat and scrolling content has a
      subtle undershoot shadow when touching them, same as the
      [`.undershoot-top`](style-classes.html#undershoot-indicators)
      style class. This works well for simple content, e.g. [class@StatusPage] or
      [class@PreferencesPage], where the background at the top of the page is
      uniform. Additionally, windows with sidebars should always use this style.

      Undershoot shadow is only present if a top bar is actually present and
      visible. It is also never present if
      [property@ToolbarView:extend-content-to-top-edge] is set to `TRUE`.

      If set to `ADW_TOOLBAR_RAISED`, top bars have an opaque background and a
      persistent shadow, this is suitable for content such as
      [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
      where some elements are directly adjacent to the top bars, or
      [class@TabView], where each page can have a different background.

      `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the
      shadow is replaced with a more subtle border. This can be useful for
      applications like image viewers.

      See also [method@ToolbarView.set_bottom_bar_style].
      Parameter:
      style - top bar style
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Setzt außer Kraft:
      asAccessible in Klasse Widget
      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 Widget
      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 Widget
      Gibt zurück:
      ConstraintTarget
    • 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()