adw.toolbar_view

Module for ToolbarView class

Types 3

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

toolbar-view

adw.toolbar_view.ToolbarView has a single content widget and one or multiple top and bottom bars, shown at the top and bottom sides respectively.

Example of an adw.toolbar_view.ToolbarView 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:

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

adw.toolbar_view.ToolbarView.topBarStyle and adw.toolbar_view.ToolbarView.bottomBarStyle 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 adw.tab_view.TabView, where each page can have a different background.

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

adw.toolbar_view.ToolbarView 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 gtk.window_handle.WindowHandle.

Content is typically place between top and bottom bars, but can also extend behind them. This is controlled with the adw.toolbar_view.ToolbarView.extendContentToTopEdge and adw.toolbar_view.ToolbarView.extendContentToBottomEdge properties.

Top and bottom bars can be hidden and revealed with an animation using the adw.toolbar_view.ToolbarView.revealTopBars and adw.toolbar_view.ToolbarView.revealBottomBars properties.

adw.toolbar_view.ToolbarView as gtk.buildable.Buildable

The adw.toolbar_view.ToolbarView implementation of the gtk.buildable.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

adw.toolbar_view.ToolbarView uses the gtk.types.AccessibleRole.Group role.

Methods
GType _gType() @property
ToolbarView self()Returns `this`, for use in `with` statements.
ToolbarViewGidBuilder builder()Get builder for [adw.toolbar_view.ToolbarView] Returns: New builder object
int bottomBarHeight() @propertyGet `bottomBarHeight` property. Returns: The current bottom bar height.
adw.types.ToolbarStyle bottomBarStyle() @propertyGet `bottomBarStyle` property. Returns: Appearance of the bottom bars.
void bottomBarStyle(adw.types.ToolbarStyle propval) @propertySet `bottomBarStyle` property. Params: propval = Appearance of the bottom bars.
gtk.widget.Widget content() @propertyGet `content` property. Returns: The content widget.
void content(gtk.widget.Widget propval) @propertySet `content` property. Params: propval = The content widget.
bool extendContentToBottomEdge() @propertyGet `extendContentToBottomEdge` property. Returns: Whether the content widget can extend behind bottom bars.
void extendContentToBottomEdge(bool propval) @propertySet `extendContentToBottomEdge` property. Params: propval = Whether the content widget can extend behind bottom bars.
bool extendContentToTopEdge() @propertyGet `extendContentToTopEdge` property. Returns: Whether the content widget can extend behind top bars.
void extendContentToTopEdge(bool propval) @propertySet `extendContentToTopEdge` property. Params: propval = Whether the content widget can extend behind top bars.
bool revealBottomBars() @propertyGet `revealBottomBars` property. Returns: Whether bottom bars are visible.
void revealBottomBars(bool propval) @propertySet `revealBottomBars` property. Params: propval = Whether bottom bars are visible.
bool revealTopBars() @propertyGet `revealTopBars` property. Returns: Whether top bars are revealed.
void revealTopBars(bool propval) @propertySet `revealTopBars` property. Params: propval = Whether top bars are revealed.
int topBarHeight() @propertyGet `topBarHeight` property. Returns: The current top bar height.
adw.types.ToolbarStyle topBarStyle() @propertyGet `topBarStyle` property. Returns: Appearance of the top bars.
void topBarStyle(adw.types.ToolbarStyle propval) @propertySet `topBarStyle` property. Params: propval = Appearance of the top bars.
void addBottomBar(gtk.widget.Widget widget)Adds a bottom bar to self.
void addTopBar(gtk.widget.Widget widget)Adds a top bar to self.
int getBottomBarHeight()Gets the current bottom bar height for self.
adw.types.ToolbarStyle getBottomBarStyle()Gets appearance of the botom bars for self. Returns: bottom bar style
gtk.widget.Widget getContent()Gets the content widget for self. Returns: the content widget
bool getExtendContentToBottomEdge()Gets whether the content widget can extend behind bottom bars. Returns: whether content extends behind bottom bars
bool getExtendContentToTopEdge()Gets whether the content widget can extend behind top bars. Returns: whether content extends behind top bars
bool getRevealBottomBars()Gets whether bottom bars are revealed for self. Returns: whether bottom bars are revealed
bool getRevealTopBars()Gets whether top bars are revealed for self. Returns: whether top bars are revealed
int getTopBarHeight()Gets the current top bar height for self.
adw.types.ToolbarStyle getTopBarStyle()Gets appearance of the top bars for self. Returns: top bar style
void remove(gtk.widget.Widget widget)Removes a child from self.
void setBottomBarStyle(adw.types.ToolbarStyle style)Sets appearance of the bottom bars for self.
void setContent(gtk.widget.Widget content = null)Sets the content widget for self.
void setExtendContentToBottomEdge(bool extend)Sets whether the content widget can extend behind bottom bars.
void setExtendContentToTopEdge(bool extend)Sets whether the content widget can extend behind top bars.
void setRevealBottomBars(bool reveal)Sets whether bottom bars are revealed for self.
void setRevealTopBars(bool reveal)Sets whether top bars are revealed for self.
void setTopBarStyle(adw.types.ToolbarStyle style)Sets appearance of the top bars for self.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [adw.toolbar_view.ToolbarView]. Returns: the newly created [adw.toolbar_view.ToolbarView]

Fluent builder implementation template for adw.toolbar_view.ToolbarView

Methods
T bottomBarStyle(adw.types.ToolbarStyle propval)Set `bottomBarStyle` property. Params: propval = Appearance of the bottom bars.
T content(gtk.widget.Widget propval)Set `content` property. Params: propval = The content widget. Returns: Builder instance for fluent chaining
T extendContentToBottomEdge(bool propval)Set `extendContentToBottomEdge` property. Params: propval = Whether the content widget can extend behind bottom bars.
T extendContentToTopEdge(bool propval)Set `extendContentToTopEdge` property. Params: propval = Whether the content widget can extend behind top bars.
T revealBottomBars(bool propval)Set `revealBottomBars` property. Params: propval = Whether bottom bars are visible.
T revealTopBars(bool propval)Set `revealTopBars` property. Params: propval = Whether top bars are revealed.
T topBarStyle(adw.types.ToolbarStyle propval)Set `topBarStyle` property. Params: propval = Appearance of the top bars.

Fluent builder for adw.toolbar_view.ToolbarView

Methods
ToolbarView build()Create object from builder. Returns: New object