Handy.ViewSwitcher

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.ViewSwitcher Handy.ViewSwitcher Gtk.Bin->Handy.ViewSwitcher 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_narrow_ellipsize ()

get_policy ()

get_stack ()

set_narrow_ellipsize (mode)

set_policy (policy)

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

narrow-ellipsize

Pango.EllipsizeMode

r/w/en

The preferred place to ellipsize the string, if the narrow mode label does not have enough room to display the entire string

policy

Handy.ViewSwitcherPolicy

r/w/en

The policy to determine the mode to use

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

Gtk.Bin

Abstract:

No

Structure:

Handy.ViewSwitcherClass

An adaptive view switcher.

An adaptive view switcher, designed to switch between multiple views in a similar fashion than a [class`Gtk`.StackSwitcher].

Depending on the available width, the view switcher can adapt from a wide mode showing the view’s icon and title side by side, to a narrow mode showing the view’s icon and title one on top of the other, in a more compact way. This can be controlled via the policy property.

To look good in a header bar, an HdyViewSwitcher requires to fill its full height. Contrary to [class`Gtk`.HeaderBar], [class`HeaderBar`] doesn’t force a vertical alignment on its title widget, so we recommend it over [class`Gtk`.HeaderBar].

CSS nodes

HdyViewSwitcher has a single CSS node with name viewswitcher.

New in version 1.0.

classmethod new()
Returns:

the newly created HdyViewSwitcher

Return type:

Gtk.Widget

Creates a new HdyViewSwitcher.

New in version 1.0.

get_narrow_ellipsize()
Returns:

a [enum`Pango`.EllipsizeMode]

Return type:

Pango.EllipsizeMode

Get the ellipsizing position of the narrow mode label.

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.

set_narrow_ellipsize(mode)
Parameters:

mode (Pango.EllipsizeMode) – a [enum`Pango`.EllipsizeMode]

Sets the mode used to ellipsize the text in narrow mode.

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.

Property Details

Handy.ViewSwitcher.props.narrow_ellipsize
Name:

narrow-ellipsize

Type:

Pango.EllipsizeMode

Default Value:

Pango.EllipsizeMode.NONE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The preferred place to ellipsize the string.

If the narrow mode label does not have enough room to display the entire string, specified as a [enum`Pango`.EllipsizeMode].

Note that setting this property to a value other than PANGO_ELLIPSIZE_NONE has the side-effect that the label requests only enough space to display the ellipsis.

New in version 1.0.

Handy.ViewSwitcher.props.policy
Name:

policy

Type:

Handy.ViewSwitcherPolicy

Default Value:

Handy.ViewSwitcherPolicy.AUTO

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The policy to determine which mode to use.

New in version 1.0.

Handy.ViewSwitcher.props.stack
Name:

stack

Type:

Gtk.Stack

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The [class`Gtk`.Stack] the view switcher controls.

New in version 1.0.