Adw.ViewSwitcherTitle

g Adw.ViewSwitcherTitle Adw.ViewSwitcherTitle GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->Adw.ViewSwitcherTitle

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

get_stack ()

get_subtitle ()

get_title ()

get_title_visible ()

get_view_switcher_enabled ()

set_stack (stack)

set_subtitle (subtitle)

set_title (title)

set_view_switcher_enabled (enabled)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

stack

Adw.ViewStack

d/r/w/en

deprecated

subtitle

str

d/r/w/en

deprecated

title

str

d/r/w/en

deprecated

title-visible

bool

d/r

deprecated

view-switcher-enabled

bool

d/r/w/en

deprecated

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Adw.ViewSwitcherTitle(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Adw.ViewSwitcherTitleClass

A view switcher title.

<picture> <source srcset=”view-switcher-title-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”view-switcher-title.png” alt=”view-switcher-title”> </picture>

A widget letting you switch between multiple views contained by a [class`ViewStack`] via an [class`ViewSwitcher`].

It is designed to be used as the title widget of a [class`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 [property`HeaderBar`:py:data::centering-policy<Adw.ViewSwitcherTitle.props.centering_policy>] set to ADW_CENTERING_POLICY_STRICT.

AdwViewSwitcherTitle is intended to be used together with [class`ViewSwitcherBar`].

A common use case is to bind the [property`ViewSwitcherBar`:py:data::reveal<Adw.ViewSwitcherTitle.props.reveal>] property to [property`ViewSwitcherTitle`:py:data::title-visible<Adw.ViewSwitcherTitle.props.title_visible>] to automatically reveal the view switcher bar when the title label is displayed in place of the view switcher, as follows:

``xml <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.

Deprecated since version 1.4: See the migration guide

classmethod new()
Returns:

the newly created AdwViewSwitcherTitle

Return type:

Gtk.Widget

Creates a new AdwViewSwitcherTitle.

Deprecated since version 1.4: See the migration guide

get_stack()
Returns:

the stack

Return type:

Adw.ViewStack or None

Gets the stack controlled by self.

Deprecated since version 1.4: See the migration guide

get_subtitle()
Returns:

the subtitle

Return type:

str

Gets the subtitle of self.

Deprecated since version 1.4: See the migration guide

get_title()
Returns:

the title

Return type:

str

Gets the title of self.

Deprecated since version 1.4: See the migration guide

get_title_visible()
Returns:

whether the title of self is currently visible

Return type:

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 [class`ViewSwitcherBar`].

Deprecated since version 1.4: See the migration guide

get_view_switcher_enabled()
Returns:

whether the view switcher is enabled

Return type:

bool

Gets whether self's view switcher is enabled.

Deprecated since version 1.4: See the migration guide

set_stack(stack)
Parameters:

stack (Adw.ViewStack or None) – a stack

Sets the stack controlled by self.

Deprecated since version 1.4: See the migration guide

set_subtitle(subtitle)
Parameters:

subtitle (str) – a subtitle

Sets the subtitle of self.

The subtitle should give the user additional details.

Deprecated since version 1.4: See the migration guide

set_title(title)
Parameters:

title (str) – a title

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

set_view_switcher_enabled(enabled)
Parameters:

enabled (bool) – whether the view switcher is enabled

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

Property Details

Adw.ViewSwitcherTitle.props.stack
Name:

stack

Type:

Adw.ViewStack

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The stack the view switcher controls.

Deprecated since version 1.4: See the migration guide

Adw.ViewSwitcherTitle.props.subtitle
Name:

subtitle

Type:

str

Default Value:

''

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The subtitle to display.

The subtitle should give the user additional details.

Deprecated since version 1.4: See the migration guide

Adw.ViewSwitcherTitle.props.title
Name:

title

Type:

str

Default Value:

''

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

The title to display.

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

Adw.ViewSwitcherTitle.props.title_visible
Name:

title-visible

Type:

bool

Default Value:

True

Flags:

DEPRECATED, READABLE

Whether the title 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 [class`ViewSwitcherBar`].

Deprecated since version 1.4: See the migration guide

Adw.ViewSwitcherTitle.props.view_switcher_enabled
Name:

view-switcher-enabled

Type:

bool

Default Value:

True

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the 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