ViewSwitcherTitle#
Deprecated since version 1.4: See the migration guide
Superclasses: Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Buildable
, ConstraintTarget
A view switcher title.

A widget letting you switch between multiple views contained by a
ViewStack
via an ViewSwitcher
.
It is designed to be used as the title widget of a HeaderBar
, and
will display the window’s title when the window is too narrow to fit the view
switcher e.g. on mobile phones, or if there are less than two views.
In order to center the title in narrow windows, the header bar should have
centering_policy
set to
ADW_CENTERING_POLICY_STRICT
.
AdwViewSwitcherTitle
is intended to be used together with
ViewSwitcherBar
.
A common use case is to bind the reveal
property
to title_visible
to automatically reveal the
view switcher bar when the title label is displayed in place of the view
switcher, as follows:
<object class="AdwWindow">
<property name="content">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="centering-policy">strict</property>
<property name="title-widget">
<object class="AdwViewSwitcherTitle" id="title">
<property name="stack">stack</property>
</object>
</property>
</object>
</child>
<property name="content">
<object class="AdwViewStack" id="stack"/>
</property>
<child type="bottom">
<object class="AdwViewSwitcherBar">
<property name="stack">stack</property>
<binding name="reveal">
<lookup name="title-visible">title</lookup>
</binding>
</object>
</child>
</object>
</property>
</object>
CSS nodes#
AdwViewSwitcherTitle
has a single CSS node with name viewswitchertitle
.
Constructors#
- class ViewSwitcherTitle
- classmethod new() Widget #
Creates a new
AdwViewSwitcherTitle
.Deprecated since version 1.4: See the migration guide
Methods#
- class ViewSwitcherTitle
- get_stack() ViewStack | None #
Gets the stack controlled by
self
.Deprecated since version 1.4: See the migration guide
- get_subtitle() str #
Gets the subtitle of
self
.Deprecated since version 1.4: See the migration guide
- get_title() str #
Gets the title of
self
.Deprecated since version 1.4: See the migration guide
- get_title_visible() bool #
Gets whether the title of
self
is currently visible.If the title is visible, it means the view switcher is hidden an it may be wanted to show an alternative switcher, e.g. a
ViewSwitcherBar
.Deprecated since version 1.4: See the migration guide
- get_view_switcher_enabled() bool #
Gets whether
self
's view switcher is enabled.Deprecated since version 1.4: See the migration guide
- set_stack(stack: ViewStack | None = None) None #
Sets the stack controlled by
self
.Deprecated since version 1.4: See the migration guide
- Parameters:
stack – a stack
- set_subtitle(subtitle: str) None #
Sets the subtitle of
self
.The subtitle should give the user additional details.
Deprecated since version 1.4: See the migration guide
- Parameters:
subtitle – a subtitle
- set_title(title: str) None #
Sets the title of
self
.The title typically identifies the current view or content item, and generally does not use the application name.
Deprecated since version 1.4: See the migration guide
- Parameters:
title – a title
- set_view_switcher_enabled(enabled: bool) None #
Sets whether
self
's view switcher is enabled.If it is disabled, the title will be displayed instead. This allows to programmatically hide the view switcher even if it fits in the available space.
This can be used e.g. to ensure the view switcher is hidden below a certain window width, or any other constraint you find suitable.
Deprecated since version 1.4: See the migration guide
- Parameters:
enabled – whether the view switcher is enabled
Properties#
- class ViewSwitcherTitle
- props.stack: ViewStack#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.subtitle: str#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.title: str#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.title_visible: bool#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide
- props.view_switcher_enabled: bool#
The type of the None singleton.
Deprecated since version 1.4: See the migration guide