Handy.ViewSwitcherTitle

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Bin Gtk.Bin Handy.ViewSwitcherTitle Handy.ViewSwitcherTitle Gtk.Bin->Handy.ViewSwitcherTitle Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

get_policy ()

get_stack ()

get_subtitle ()

get_title ()

get_title_visible ()

get_view_switcher_enabled ()

set_policy (policy)

set_stack (stack)

set_subtitle (subtitle)

set_title (title)

set_view_switcher_enabled (enabled)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39)

Name

Type

Flags

Short Description

policy

Handy.ViewSwitcherPolicy

r/w/en

The policy to determine the mode to use

stack

Gtk.Stack

r/w/en

Stack

subtitle

str

r/w/en

The subtitle to display

title

str

r/w/en

The title to display

title-visible

bool

r/en

Whether the title label is visible

view-switcher-enabled

bool

r/w/en

Whether the view switcher is enabled

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Class Details

class Handy.ViewSwitcherTitle(**kwargs)
Bases:

Gtk.Bin

Abstract:

No

Structure:

Handy.ViewSwitcherTitleClass

A view switcher title.

A widget letting you switch between multiple views contained by a [class`Gtk`.Stack], 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.

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

A common use case is to bind the [property`ViewSwitcherBar`:py:data::reveal<Handy.ViewSwitcherTitle.props.reveal>] property to [property`ViewSwitcherTitle`:py:data::title-visible<Handy.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=”GtkWindow”/>

<child type=”titlebar”>
<object class=”HdyHeaderBar”>

<property name=”centering-policy”>strict</property> <child type=”title”>

<object class=”HdyViewSwitcherTitle”

id=”view_switcher_title”>

<property name=”stack”>stack</property>

</object>

</child>

</object>

</child> <child>

<object class=”GtkBox”>
<child>

<object class=”GtkStack” id=”stack”/>

</child> <child>

<object class=”HdyViewSwitcherBar”>

<property name=”stack”>stack</property> <property name=”reveal”

bind-source=”view_switcher_title” bind-property=”title-visible” bind-flags=”sync-create”/>

</object>

</child>

</object>

</child>

</object> ``

CSS nodes

HdyViewSwitcherTitle has a single CSS node with name viewswitchertitle.

New in version 1.0.

classmethod new()
Returns:

the newly created HdyViewSwitcherTitle

Return type:

Handy.ViewSwitcherTitle

Creates a new HdyViewSwitcherTitle.

New in version 1.0.

get_policy()
Returns:

the policy of self

Return type:

Handy.ViewSwitcherPolicy

Gets the policy of self.

New in version 1.0.

get_stack()
Returns:

the stack

Return type:

Gtk.Stack or None

Gets the stack controlled by self.

New in version 1.0.

get_subtitle()
Returns:

the subtitle of self

Return type:

str or None

Gets the subtitle of self.

New in version 1.0.

get_title()
Returns:

the title of self

Return type:

str or None

Gets the title of self.

New in version 1.0.

get_title_visible()
Returns:

whether the title of self is currently visible

Return type:

bool

Gets whether the title of self is currently visible.

New in version 1.0.

get_view_switcher_enabled()
Returns:

whether the view switcher is enabled

Return type:

bool

Gets whether self's view switcher is enabled.

New in version 1.0.

set_policy(policy)
Parameters:

policy (Handy.ViewSwitcherPolicy) – the new policy

Sets the policy of self.

New in version 1.0.

set_stack(stack)
Parameters:

stack (Gtk.Stack or None) – a stack

Sets the [class`Gtk`.Stack] to control.

New in version 1.0.

set_subtitle(subtitle)
Parameters:

subtitle (str or None) – a subtitle

Sets the subtitle of self.

New in version 1.0.

set_title(title)
Parameters:

title (str or None) – a title

Sets the title of self.

New in version 1.0.

set_view_switcher_enabled(enabled)
Parameters:

enabled (bool) – TRUE to enable the view switcher, FALSE to disable it

Sets whether self's view switcher is enabled.

New in version 1.0.

Property Details

Handy.ViewSwitcherTitle.props.policy
Name:

policy

Type:

Handy.ViewSwitcherPolicy

Default Value:

Handy.ViewSwitcherPolicy.AUTO

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The policy used to determine which mode to use.

New in version 1.0.

Handy.ViewSwitcherTitle.props.stack
Name:

stack

Type:

Gtk.Stack

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The [class`Gtk`.Stack] the [class`ViewSwitcher`] controls.

New in version 1.0.

Handy.ViewSwitcherTitle.props.subtitle
Name:

subtitle

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The subtitle of the [class`ViewSwitcher`].

The subtitle should give a user additional details.

New in version 1.0.

Handy.ViewSwitcherTitle.props.title
Name:

title

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The title of the [class`ViewSwitcher`].

The title should give a user additional details. A good title should not include the application name.

New in version 1.0.

Handy.ViewSwitcherTitle.props.title_visible
Name:

title-visible

Type:

bool

Default Value:

True

Flags:

READABLE, EXPLICIT_NOTIFY

Whether the bar should be revealed or hidden.

New in version 1.0.

Handy.ViewSwitcherTitle.props.view_switcher_enabled
Name:

view-switcher-enabled

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the bar should be revealed or hidden.

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.

New in version 1.0.