HdyViewSwitcher

HdyViewSwitcher — An adaptive view switcher.

Functions

Properties

gint icon-size Read / Write
PangoEllipsizeMode narrow-ellipsize Read / Write
HdyViewSwitcherPolicy policy Read / Write
GtkStack * stack Read / Write

Types and Values

Object Hierarchy

    GEnum
    ╰── HdyViewSwitcherPolicy
    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBox
                    ╰── HdyViewSwitcher

Implemented Interfaces

HdyViewSwitcher implements AtkImplementorIface, GtkBuildable and GtkOrientable.

Description

An adaptive view switcher, designed to switch between multiple views in a similar fashion than a GtkStackSwitcher.

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 GtkHeaderBar, HdyHeaderBar doesn't force a vertical alignment on its title widget, so we recommend it over GtkHeaderBar.

Functions

hdy_view_switcher_new ()

HdyViewSwitcher *
hdy_view_switcher_new (void);

Creates a new HdyViewSwitcher widget.

Returns

a new HdyViewSwitcher

Since: 0.0.10


hdy_view_switcher_get_policy ()

HdyViewSwitcherPolicy
hdy_view_switcher_get_policy (HdyViewSwitcher *self);

Gets the policy of self .

Parameters

self

a HdyViewSwitcher

 

Returns

the policy of self

Since: 0.0.10


hdy_view_switcher_set_policy ()

void
hdy_view_switcher_set_policy (HdyViewSwitcher *self,
                              HdyViewSwitcherPolicy policy);

Sets the policy of self .

Parameters

self

a HdyViewSwitcher

 

policy

the new policy

 

Since: 0.0.10


hdy_view_switcher_get_icon_size ()

GtkIconSize
hdy_view_switcher_get_icon_size (HdyViewSwitcher *self);

Get the icon size of the images used in the HdyViewSwitcher.

See: hdy_view_switcher_set_icon_size()

Parameters

self

a HdyViewSwitcher

 

Returns

the icon size of the images

Since: 0.0.10


hdy_view_switcher_set_icon_size ()

void
hdy_view_switcher_set_icon_size (HdyViewSwitcher *self,
                                 GtkIconSize icon_size);

Change the icon size hint for the icons in a HdyViewSwitcher.

Parameters

self

a HdyViewSwitcher

 

icon_size

the new icon size

 

Since: 0.0.10


hdy_view_switcher_get_narrow_ellipsize ()

PangoEllipsizeMode
hdy_view_switcher_get_narrow_ellipsize
                               (HdyViewSwitcher *self);

Get the ellipsizing position of the narrow mode label. See hdy_view_switcher_set_narrow_ellipsize().

Parameters

self

a HdyViewSwitcher

 

Since: 0.0.10


hdy_view_switcher_set_narrow_ellipsize ()

void
hdy_view_switcher_set_narrow_ellipsize
                               (HdyViewSwitcher *self,
                                PangoEllipsizeMode mode);

Set the mode used to ellipsize the text in narrow mode if there is not enough space to render the entire string.

Parameters

self

a HdyViewSwitcher

 

mode

a PangoEllipsizeMode

 

Since: 0.0.10


hdy_view_switcher_get_stack ()

GtkStack *
hdy_view_switcher_get_stack (HdyViewSwitcher *self);

Get the GtkStack being controlled by the HdyViewSwitcher.

See: hdy_view_switcher_set_stack()

Parameters

self

a HdyViewSwitcher

 

Returns

the GtkStack, or NULL if none has been set.

[nullable][transfer none]

Since: 0.0.10


hdy_view_switcher_set_stack ()

void
hdy_view_switcher_set_stack (HdyViewSwitcher *self,
                             GtkStack *stack);

Sets the GtkStack to control.

Parameters

self

a HdyViewSwitcher

 

stack

a GtkStack.

[nullable]

Since: 0.0.10

Types and Values

HDY_TYPE_VIEW_SWITCHER

#define HDY_TYPE_VIEW_SWITCHER (hdy_view_switcher_get_type())

HdyViewSwitcherClass

typedef struct {
  GtkBoxClass parent_class;
} HdyViewSwitcherClass;

enum HdyViewSwitcherPolicy

Members

HDY_VIEW_SWITCHER_POLICY_AUTO

Automatically adapt to the best fitting mode

 

HDY_VIEW_SWITCHER_POLICY_NARROW

Force the narrow mode

 

HDY_VIEW_SWITCHER_POLICY_WIDE

Force the wide mode

 

HdyViewSwitcher

typedef struct _HdyViewSwitcher HdyViewSwitcher;

Property Details

The “icon-size” property

  “icon-size”                gint

Use the "icon-size" property to hint the icons to use, you almost certainly want to leave this as GTK_ICON_SIZE_BUTTON.

Flags: Read / Write

Allowed values: >= 0

Default value: 4

Since: 0.0.10


The “narrow-ellipsize” property

  “narrow-ellipsize”         PangoEllipsizeMode

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 PangoEllipsizeMode.

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.

Flags: Read / Write

Default value: PANGO_ELLIPSIZE_NONE

Since: 0.0.10


The “policy” property

  “policy”                   HdyViewSwitcherPolicy

The HdyViewSwitcherPolicy the view switcher should use to determine which mode to use.

Flags: Read / Write

Default value: HDY_VIEW_SWITCHER_POLICY_AUTO

Since: 0.0.10


The “stack” property

  “stack”                    GtkStack *

The GtkStack the view switcher controls.

Flags: Read / Write

Since: 0.0.10