Adw.ToolbarView¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Adw.ToolbarView(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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 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`:py:data::top-bar-style<Adw.ToolbarView.props.top_bar_style>] and [property`ToolbarView`:py:data::bottom-bar-style<Adw.ToolbarView.props.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.
<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`:py:data::extend-content-to-top-edge<Adw.ToolbarView.props.extend_content_to_top_edge>] and [property`ToolbarView`:py:data::extend-content-to-bottom-edge<Adw.ToolbarView.props.extend_content_to_bottom_edge>] properties.
Top and bottom bars can be hidden and revealed with an animation using the [property`ToolbarView`:py:data::reveal-top-bars<Adw.ToolbarView.props.reveal_top_bars>] and [property`ToolbarView`:py:data::reveal-bottom-bars<Adw.ToolbarView.props.reveal_bottom_bars>] properties.
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 theGTK_ACCESSIBLE_ROLE_GROUP
role.New in version 1.4.
- classmethod new()¶
- Returns:
the newly created
AdwToolbarView
- Return type:
Creates a new
AdwToolbarView
.New in version 1.4.
- add_bottom_bar(widget)¶
- Parameters:
widget (
Gtk.Widget
) – a widget
Adds a bottom bar to self.
New in version 1.4.
- add_top_bar(widget)¶
- Parameters:
widget (
Gtk.Widget
) – a widget
Adds a top bar to self.
New in version 1.4.
- get_bottom_bar_height()¶
- Returns:
the current bottom bar height
- Return type:
Gets the current bottom bar height for self.
Bottom bar height does change depending on [property`ToolbarView`:py:data::reveal-bottom-bars<Adw.ToolbarView.props.reveal_bottom_bars>], including during the transition.
See [method`ToolbarView`.get_top_bar_height].
New in version 1.4.
- get_bottom_bar_style()¶
- Returns:
bottom bar style
- Return type:
Gets appearance of the botom bars for self.
New in version 1.4.
- get_content()¶
- Returns:
the content widget
- Return type:
Gtk.Widget
orNone
Gets the content widget for self.
New in version 1.4.
- get_extend_content_to_bottom_edge()¶
- Returns:
whether content extends behind bottom bars
- Return type:
Gets whether the content widget can extend behind bottom bars.
New in version 1.4.
- get_extend_content_to_top_edge()¶
- Returns:
whether content extends behind top bars
- Return type:
Gets whether the content widget can extend behind top bars.
New in version 1.4.
- get_reveal_bottom_bars()¶
- Returns:
whether bottom bars are revealed
- Return type:
Gets whether bottom bars are revealed for self.
New in version 1.4.
- get_reveal_top_bars()¶
- Returns:
whether top bars are revealed
- Return type:
Gets whether top bars are revealed for self.
New in version 1.4.
- get_top_bar_height()¶
- Returns:
the current top bar height
- Return type:
Gets the current top bar height for self.
Top bar height does change depending on [property`ToolbarView`:py:data::reveal-top-bars<Adw.ToolbarView.props.reveal_top_bars>], including during the transition.
See [method`ToolbarView`.get_bottom_bar_height].
New in version 1.4.
- get_top_bar_style()¶
- Returns:
top bar style
- Return type:
Gets appearance of the top bars for self.
New in version 1.4.
- remove(widget)¶
- Parameters:
widget (
Gtk.Widget
) – the child to be removed
Removes a child from self.
New in version 1.4.
- set_bottom_bar_style(style)¶
- Parameters:
style (
Adw.ToolbarStyle
) – bottom bar 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 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`:py:data::extend-content-to-bottom-edge<Adw.ToolbarView.props.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, 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 toADW_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].
New in version 1.4.
- set_content(content)¶
- Parameters:
content (
Gtk.Widget
orNone
) – the content widget
Sets the content widget for self.
New in version 1.4.
- set_extend_content_to_bottom_edge(extend)¶
- Parameters:
extend (
bool
) – whether content extends behind bottom bars
Sets whether the content widget can extend behind bottom bars.
This can be used in combination with [property`ToolbarView`:py:data::reveal-bottom-bars<Adw.ToolbarView.props.reveal_bottom_bars>] to show and hide toolbars in fullscreen.
See [method`ToolbarView`.set_extend_content_to_top_edge].
New in version 1.4.
- set_extend_content_to_top_edge(extend)¶
- Parameters:
extend (
bool
) – whether content extends behind top bars
Sets whether the content widget can extend behind top bars.
This can be used in combination with [property`ToolbarView`:py:data::reveal-top-bars<Adw.ToolbarView.props.reveal_top_bars>] to show and hide toolbars in fullscreen.
See [method`ToolbarView`.set_extend_content_to_bottom_edge].
New in version 1.4.
- set_reveal_bottom_bars(reveal)¶
- Parameters:
reveal (
bool
) – whether to reveal bottom bars
Sets whether bottom bars are revealed for self.
The transition will be animated.
This can be used in combination with [property`ToolbarView`:py:data::extend-content-to-bottom-edge<Adw.ToolbarView.props.extend_content_to_bottom_edge>] to show and hide toolbars in fullscreen.
See [method`ToolbarView`.set_reveal_top_bars].
New in version 1.4.
- set_reveal_top_bars(reveal)¶
- Parameters:
reveal (
bool
) – whether to reveal top bars
Sets whether top bars are revealed for self.
The transition will be animated.
This can be used in combination with [property`ToolbarView`:py:data::extend-content-to-top-edge<Adw.ToolbarView.props.extend_content_to_top_edge>] to show and hide toolbars in fullscreen.
See [method`ToolbarView`.set_reveal_bottom_bars].
New in version 1.4.
- set_top_bar_style(style)¶
- Parameters:
style (
Adw.ToolbarStyle
) – top bar 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 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`:py:data::extend-content-to-top-edge<Adw.ToolbarView.props.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, 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 toADW_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].
New in version 1.4.
Property Details¶
- Adw.ToolbarView.props.bottom_bar_height¶
-
The current bottom bar height.
Bottom bar height does change depending on [property`ToolbarView`:py:data::reveal-bottom-bars<Adw.ToolbarView.props.reveal_bottom_bars>], including during the transition.
See [property`ToolbarView`:py:data::top-bar-height<Adw.ToolbarView.props.top_bar_height>].
New in version 1.4.
- Adw.ToolbarView.props.bottom_bar_style¶
- Name:
bottom-bar-style
- Type:
- Default Value:
- Flags:
Appearance of the bottom bars.
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 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`:py:data::extend-content-to-bottom-edge<Adw.ToolbarView.props.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, 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 toADW_TOOLBAR_RAISED
, but the shadow is replaced with a more subtle border. This can be useful for applications like image viewers.See also [property`ToolbarView`:py:data::top-bar-style<Adw.ToolbarView.props.top_bar_style>].
New in version 1.4.
- Adw.ToolbarView.props.content¶
- Name:
content
- Type:
- Default Value:
- Flags:
The content widget.
New in version 1.4.
- Adw.ToolbarView.props.extend_content_to_bottom_edge¶
- Name:
extend-content-to-bottom-edge
- Type:
- Default Value:
- Flags:
Whether the content widget can extend behind bottom bars.
This can be used in combination with [property`ToolbarView`:py:data::reveal-bottom-bars<Adw.ToolbarView.props.reveal_bottom_bars>] to show and hide toolbars in fullscreen.
See [property`ToolbarView`:py:data::extend-content-to-top-edge<Adw.ToolbarView.props.extend_content_to_top_edge>].
New in version 1.4.
- Adw.ToolbarView.props.extend_content_to_top_edge¶
- Name:
extend-content-to-top-edge
- Type:
- Default Value:
- Flags:
Whether the content widget can extend behind top bars.
This can be used in combination with [property`ToolbarView`:py:data::reveal-top-bars<Adw.ToolbarView.props.reveal_top_bars>] to show and hide toolbars in fullscreen.
See [property`ToolbarView`:py:data::extend-content-to-bottom-edge<Adw.ToolbarView.props.extend_content_to_bottom_edge>].
New in version 1.4.
- Adw.ToolbarView.props.reveal_bottom_bars¶
- Name:
reveal-bottom-bars
- Type:
- Default Value:
- Flags:
Whether bottom bars are visible.
The transition will be animated.
This can be used in combination with [property`ToolbarView`:py:data::extend-content-to-bottom-edge<Adw.ToolbarView.props.extend_content_to_bottom_edge>] to show and hide toolbars in fullscreen.
See [property`ToolbarView`:py:data::reveal-top-bars<Adw.ToolbarView.props.reveal_top_bars>].
New in version 1.4.
- Adw.ToolbarView.props.reveal_top_bars¶
- Name:
reveal-top-bars
- Type:
- Default Value:
- Flags:
Whether top bars are revealed.
The transition will be animated.
This can be used in combination with [property`ToolbarView`:py:data::extend-content-to-top-edge<Adw.ToolbarView.props.extend_content_to_top_edge>] to show and hide toolbars in fullscreen.
See [property`ToolbarView`:py:data::reveal-bottom-bars<Adw.ToolbarView.props.reveal_bottom_bars>].
New in version 1.4.
- Adw.ToolbarView.props.top_bar_height¶
-
The current top bar height.
Top bar height does change depending [property`ToolbarView`:py:data::reveal-top-bars<Adw.ToolbarView.props.reveal_top_bars>], including during the transition.
See [property`ToolbarView`:py:data::bottom-bar-height<Adw.ToolbarView.props.bottom_bar_height>].
New in version 1.4.
- Adw.ToolbarView.props.top_bar_style¶
- Name:
top-bar-style
- Type:
- Default Value:
- Flags:
Appearance of the top bars.
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 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`:py:data::extend-content-to-top-edge<Adw.ToolbarView.props.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, 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 toADW_TOOLBAR_RAISED
, but the shadow is replaced with a more subtle border. This can be useful for applications like image viewers.See also [property`ToolbarView`:py:data::bottom-bar-style<Adw.ToolbarView.props.bottom_bar_style>].
New in version 1.4.