ToolbarView

class ToolbarView(pointer: <Error class: unknown class><<Error class: unknown class>>)

A widget containing a page, as well as top and/or bottom bars.

toolbar-view

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:

<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 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 style-classes.html#undershoot-indicators and 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, where some elements are adjacent to the top/bottom bars, or class@TabView, where each page can have a different background.

toolbar-view-flat-1 toolbar-view-flat-2 toolbar-view-raised

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

toolbar-view-spacing toolbar-view-spacing-box

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.

Since

1.4

Constructors

Link copied to clipboard
constructor()

Creates a new AdwToolbarView.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val adwToolbarViewPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

The current bottom bar height.

Link copied to clipboard

Appearance of the bottom bars.

Link copied to clipboard
var content: <Error class: unknown class>?

The content widget.

Link copied to clipboard

Whether the content widget can extend behind bottom bars.

Link copied to clipboard

Whether the content widget can extend behind top bars.

Link copied to clipboard
open val gtkAccessiblePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkBuildablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkConstraintTargetPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

Whether bottom bars are visible.

Link copied to clipboard

Whether top bars are revealed.

Link copied to clipboard

The current top bar height.

Link copied to clipboard

Appearance of the top bars.

Functions

Link copied to clipboard
fun addBottomBar(widget: <Error class: unknown class>)

Adds a bottom bar to @self.

Link copied to clipboard
fun addTopBar(widget: <Error class: unknown class>)

Adds a top bar to @self.

Link copied to clipboard

Gets the current bottom bar height for @self.

Link copied to clipboard

Gets appearance of the bottom bars for @self.

Link copied to clipboard
fun getContent(): <Error class: unknown class>?

Gets the content widget for @self.

Link copied to clipboard

Gets whether the content widget can extend behind bottom bars.

Link copied to clipboard

Gets whether the content widget can extend behind top bars.

Link copied to clipboard

Gets whether bottom bars are revealed for @self.

Link copied to clipboard

Gets whether top bars are revealed for @self.

Link copied to clipboard

Gets the current top bar height for @self.

Link copied to clipboard

Gets appearance of the top bars for @self.

Link copied to clipboard
fun remove(widget: <Error class: unknown class>)

Removes a child from @self.

Link copied to clipboard

Sets appearance of the bottom bars for @self.

Link copied to clipboard
fun setContent(content: <Error class: unknown class>? = null)

Sets the content widget for @self.

Link copied to clipboard

Sets whether the content widget can extend behind bottom bars.

Link copied to clipboard

Sets whether the content widget can extend behind top bars.

Link copied to clipboard

Sets whether bottom bars are revealed for @self.

Link copied to clipboard

Sets whether top bars are revealed for @self.

Link copied to clipboard

Sets appearance of the top bars for @self.