adw.toolbar_view
Module for [ToolbarView] class
Types 3
A widget containing a page, as well as top and/or bottom bars.
[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:
class@HeaderBarclass@TabBarclass@ViewSwitcherBar- [gtk.action_bar.ActionBar]
- [gtk.header_bar.HeaderBar]
- [gtk.popover_menu_bar.PopoverMenuBar]
- [gtk.search_bar.SearchBar]
- Any [gtk.box.Box] or a similar widget with the
.toolbar 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 and
.undershoot-bottom 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.
[adw.toolbar_view.ToolbarView] ensures the top and bottom bars have consistent backdrop styles and vertical spacing. For comparison:
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 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.
[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.
ToolbarView self()Returns `this`, for use in `with` statements.ToolbarViewGidBuilder builder()Get builder for [adw.toolbar_view.ToolbarView] Returns: New builder objectint 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.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.void revealTopBars(bool propval) @propertySet `revealTopBars` property. Params: propval = Whether top bars are revealed.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 stylegtk.widget.Widget getContent()Gets the content widget for self. Returns: the content widgetbool getExtendContentToBottomEdge()Gets whether the content widget can extend behind bottom bars. Returns: whether content extends behind bottom barsbool getExtendContentToTopEdge()Gets whether the content widget can extend behind top bars. Returns: whether content extends behind top barsbool getRevealBottomBars()Gets whether bottom bars are revealed for self. Returns: whether bottom bars are revealedbool getRevealTopBars()Gets whether top bars are revealed for self. Returns: whether top bars are revealedint getTopBarHeight()Gets the current top bar height for self.adw.types.ToolbarStyle getTopBarStyle()Gets appearance of the top bars for self. Returns: top bar stylevoid 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.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 chainingT 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]