Handy.ViewSwitcherBar

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.ViewSwitcherBar Handy.ViewSwitcherBar Gtk.Bin->Handy.ViewSwitcherBar 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_reveal ()

get_stack ()

set_policy (policy)

set_reveal (reveal)

set_stack (stack)

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

reveal

bool

r/w/en

Whether the view switcher is revealed

stack

Gtk.Stack

r/w/en

Stack

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.ViewSwitcherBar(**kwargs)
Bases:

Gtk.Bin

Abstract:

No

Structure:

Handy.ViewSwitcherBarClass

A view switcher action bar.

An action bar letting you switch between multiple views offered by a [class`Gtk`.Stack], via an [class`ViewSwitcher`]. It is designed to be put at the bottom of a window and to be revealed only on really narrow windows e.g. on mobile phones. It can’t be revealed if there are less than two pages.

HdyViewSwitcherBar is intended to be used together with [class`ViewSwitcherTitle`].

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

HdyViewSwitcherBar has a single CSS node with name viewswitcherbar.

New in version 1.0.

classmethod new()
Returns:

the newly created HdyViewSwitcherBar

Return type:

Gtk.Widget

Creates a new HdyViewSwitcherBar.

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_reveal()
Returns:

whether self is revealed

Return type:

bool

Gets whether self should be revealed or hidden.

New in version 1.0.

get_stack()
Returns:

the stack

Return type:

Gtk.Stack or None

Get the [class`Gtk`.Stack] being controlled by the [class`ViewSwitcher`].

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_reveal(reveal)
Parameters:

reveal (bool) – TRUE to reveal self

Sets whether self should be revealed or not.

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.

Property Details

Handy.ViewSwitcherBar.props.policy
Name:

policy

Type:

Handy.ViewSwitcherPolicy

Default Value:

Handy.ViewSwitcherPolicy.NARROW

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The policy used to determine which mode to use.

New in version 1.0.

Handy.ViewSwitcherBar.props.reveal
Name:

reveal

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the bar should be revealed or hidden.

New in version 1.0.

Handy.ViewSwitcherBar.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.