HdyViewSwitcherBar: Handy Reference Manual

## HdyViewSwitcherBar HdyViewSwitcherBar — A view switcher action bar. |

## Functions

GtkWidget * | hdy_view_switcher_bar_new ()
HdyViewSwitcherPolicy | hdy_view_switcher_bar_get_policy ()
void | hdy_view_switcher_bar_set_policy ()
GtkStack * | hdy_view_switcher_bar_get_stack ()
void | hdy_view_switcher_bar_set_stack ()
gboolean | hdy_view_switcher_bar_get_reveal ()
void | hdy_view_switcher_bar_set_reveal ()

## Properties

HdyViewSwitcherPolicy | policy | Read / Write
gboolean | reveal | Read / Write
GtkStack * | stack | Read / Write

## Types and Values

#define | HDY_TYPE_VIEW_SWITCHER_BAR
| HdyViewSwitcherBar

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBin
                        ╰── HdyViewSwitcherBar

## Implemented Interfaces

HdyViewSwitcherBar implements AtkImplementorIface and GtkBuildable.

## Description

An action bar letting you switch between multiple views offered by a GtkStack, via an HdyViewSwitcher. 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.

You can conveniently bind the “reveal” property to “title-visible” to automatically reveal the view switcher bar when the title label is displayed in place of the view switcher.

An example of the UI definition for a common use case:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    <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.

## Functions

### hdy_view_switcher_bar_new ()

    GtkWidget *
    hdy_view_switcher_bar_new (void);

Creates a new HdyViewSwitcherBar widget.

#### Returns

a new HdyViewSwitcherBar

Since: 0.0.10

### hdy_view_switcher_bar_get_policy ()

    HdyViewSwitcherPolicy
    hdy_view_switcher_bar_get_policy (HdyViewSwitcherBar *self);

Gets the policy of `self` .

#### Parameters

self | a HdyViewSwitcherBar |

#### Returns

the policy of `self`

Since: 0.0.10

### hdy_view_switcher_bar_set_policy ()

    void
    hdy_view_switcher_bar_set_policy (HdyViewSwitcherBar *self,
                                      HdyViewSwitcherPolicy policy);

Sets the policy of `self` .

#### Parameters

self | a HdyViewSwitcherBar |
policy | the new policy |

Since: 0.0.10

### hdy_view_switcher_bar_get_stack ()

    GtkStack *
    hdy_view_switcher_bar_get_stack (HdyViewSwitcherBar *self);

Get the GtkStack being controlled by the HdyViewSwitcher.

#### Parameters

self | a HdyViewSwitcherBar |

#### Returns

the GtkStack, or `NULL` if none has been set.

[nullable][transfer none]

Since: 0.0.10

### hdy_view_switcher_bar_set_stack ()

    void
    hdy_view_switcher_bar_set_stack (HdyViewSwitcherBar *self,
                                     GtkStack *stack);

Sets the GtkStack to control.

#### Parameters

self | a HdyViewSwitcherBar |
stack | a GtkStack. | [nullable]

Since: 0.0.10

### hdy_view_switcher_bar_get_reveal ()

    gboolean
    hdy_view_switcher_bar_get_reveal (HdyViewSwitcherBar *self);

Gets whether `self` should be revealed or not.

#### Parameters

self | a HdyViewSwitcherBar |

#### Returns

`TRUE` if `self` is revealed, `FALSE` if not.

Since: 0.0.10

### hdy_view_switcher_bar_set_reveal ()

    void
    hdy_view_switcher_bar_set_reveal (HdyViewSwitcherBar *self,
                                      gboolean reveal);

Sets whether `self` should be revealed or not.

#### Parameters

self | a HdyViewSwitcherBar |
reveal | `TRUE` to reveal `self` |

Since: 0.0.10

## Types and Values

### HDY_TYPE_VIEW_SWITCHER_BAR

    #define HDY_TYPE_VIEW_SWITCHER_BAR (hdy_view_switcher_bar_get_type())

### HdyViewSwitcherBar

    typedef struct _HdyViewSwitcherBar HdyViewSwitcherBar;

## Property Details

### The `“policy”` property

      “policy”                   HdyViewSwitcherPolicy

The HdyViewSwitcherPolicy the HdyViewSwitcher should use to determine which mode to use.

Owner: HdyViewSwitcherBar

Flags: Read / Write

Default value: HDY_VIEW_SWITCHER_POLICY_NARROW

Since: 0.0.10

### The `“reveal”` property

      “reveal”                   gboolean

Whether the bar should be revealed or hidden.

Owner: HdyViewSwitcherBar

Flags: Read / Write

Default value: FALSE

Since: 0.0.10

### The `“stack”` property

      “stack”                    GtkStack *

The GtkStack the HdyViewSwitcher controls.

Owner: HdyViewSwitcherBar

Flags: Read / Write

Since: 0.0.10

## See Also

HdyViewSwitcher, HdyViewSwitcherTitle