HdyHeaderBar

HdyHeaderBar — A box with a centered child.

Functions

Properties

HdyCenteringPolicy centering-policy Read / Write
GtkWidget * custom-title Read / Write
gchar * decoration-layout Read / Write
gboolean decoration-layout-set Read / Write
gboolean has-subtitle Read / Write
gboolean interpolate-size Read / Write
gboolean show-close-button Read / Write
gint spacing Read / Write
gchar * subtitle Read / Write
gchar * title Read / Write
guint transition-duration Read / Write
gboolean transition-running Read

Types and Values

Object Hierarchy

    GEnum
    ╰── HdyCenteringPolicy
    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── HdyHeaderBar

Implemented Interfaces

HdyHeaderBar implements AtkImplementorIface and GtkBuildable.

Description

HdyHeaderBar is similar to GtkHeaderBar but is designed to fix some of its shortcomings for adaptive applications.

HdyHeaderBar doesn't force the custom title widget to be vertically centered, hence allowing it to fill up the whole height, which is e.g. needed for HdyViewSwitcher.

When used in a HdyDialog, HdyHeaderBar will replace its window decorations by a back button allowing to close it. It doesn't have to be its direct child and you can use any complex contraption you like as the dialog's titlebar.

Functions

hdy_header_bar_new ()

GtkWidget *
hdy_header_bar_new (void);

Creates a new HdyHeaderBar widget.

Returns

a new HdyHeaderBar

Since: 0.0.10


hdy_header_bar_get_title ()

const gchar *
hdy_header_bar_get_title (HdyHeaderBar *self);

Retrieves the title of the header. See hdy_header_bar_set_title().

Parameters

self

a HdyHeaderBar

 

Returns

the title of the header, or NULL if none has been set explicitly. The returned string is owned by the widget and must not be modified or freed.

[nullable]

Since: 0.0.10


hdy_header_bar_set_title ()

void
hdy_header_bar_set_title (HdyHeaderBar *self,
                          const gchar *title);

Sets the title of the HdyHeaderBar. The title should help a user identify the current view. A good title should not include the application name.

Parameters

self

a HdyHeaderBar

 

title

a title, or NULL.

[allow-none]

Since: 0.0.10


hdy_header_bar_get_subtitle ()

const gchar *
hdy_header_bar_get_subtitle (HdyHeaderBar *self);

Retrieves the subtitle of the header. See hdy_header_bar_set_subtitle().

Parameters

self

a HdyHeaderBar

 

Returns

the subtitle of the header, or NULL if none has been set explicitly. The returned string is owned by the widget and must not be modified or freed.

[nullable]

Since: 0.0.10


hdy_header_bar_set_subtitle ()

void
hdy_header_bar_set_subtitle (HdyHeaderBar *self,
                             const gchar *subtitle);

Sets the subtitle of the HdyHeaderBar. The title should give a user an additional detail to help him identify the current view.

Note that HdyHeaderBar by default reserves room for the subtitle, even if none is currently set. If this is not desired, set the “has-subtitle” property to FALSE.

Parameters

self

a HdyHeaderBar

 

subtitle

a subtitle, or NULL.

[allow-none]

Since: 0.0.10


hdy_header_bar_get_custom_title ()

GtkWidget *
hdy_header_bar_get_custom_title (HdyHeaderBar *self);

Retrieves the custom title widget of the header. See hdy_header_bar_set_custom_title().

Parameters

self

a HdyHeaderBar

 

Returns

the custom title widget of the header, or NULL if none has been set explicitly.

[nullable][transfer none]

Since: 0.0.10


hdy_header_bar_set_custom_title ()

void
hdy_header_bar_set_custom_title (HdyHeaderBar *self,
                                 GtkWidget *title_widget);

Sets a custom title for the HdyHeaderBar.

The title should help a user identify the current view. This supersedes any title set by hdy_header_bar_set_title() or hdy_header_bar_set_subtitle(). To achieve the same style as the builtin title and subtitle, use the “title” and “subtitle” style classes.

You should set the custom title to NULL, for the header title label to be visible again.

Parameters

self

a HdyHeaderBar

 

title_widget

a custom widget to use for a title.

[allow-none]

Since: 0.0.10


hdy_header_bar_pack_start ()

void
hdy_header_bar_pack_start (HdyHeaderBar *self,
                           GtkWidget *child);

Adds child to self :, packed with reference to the start of the self :.

Parameters

self

A HdyHeaderBar

 

child

the GtkWidget to be added to self :

 

Since: 0.0.10


hdy_header_bar_pack_end ()

void
hdy_header_bar_pack_end (HdyHeaderBar *self,
                         GtkWidget *child);

Adds child to self :, packed with reference to the end of the self :.

Parameters

self

A HdyHeaderBar

 

child

the GtkWidget to be added to self :

 

Since: 0.0.10


hdy_header_bar_get_show_close_button ()

gboolean
hdy_header_bar_get_show_close_button (HdyHeaderBar *self);

Returns whether this header bar shows the standard window decorations.

Parameters

self

a HdyHeaderBar

 

Returns

TRUE if the decorations are shown

Since: 0.0.10


hdy_header_bar_set_show_close_button ()

void
hdy_header_bar_set_show_close_button (HdyHeaderBar *self,
                                      gboolean setting);

Sets whether this header bar shows the standard window decorations, including close, maximize, and minimize.

Parameters

self

a HdyHeaderBar

 

setting

TRUE to show standard window decorations

 

Since: 0.0.10


hdy_header_bar_get_has_subtitle ()

gboolean
hdy_header_bar_get_has_subtitle (HdyHeaderBar *self);

Retrieves whether the header bar reserves space for a subtitle, regardless if one is currently set or not.

Parameters

self

a HdyHeaderBar

 

Returns

TRUE if the header bar reserves space for a subtitle

Since: 0.0.10


hdy_header_bar_set_has_subtitle ()

void
hdy_header_bar_set_has_subtitle (HdyHeaderBar *self,
                                 gboolean setting);

Sets whether the header bar should reserve space for a subtitle, even if none is currently set.

Parameters

self

a HdyHeaderBar

 

setting

TRUE to reserve space for a subtitle

 

Since: 0.0.10


hdy_header_bar_get_decoration_layout ()

const gchar *
hdy_header_bar_get_decoration_layout (HdyHeaderBar *self);

Gets the decoration layout set with hdy_header_bar_set_decoration_layout().

Parameters

self

a HdyHeaderBar

 

Returns

the decoration layout

Since: 0.0.10


hdy_header_bar_set_decoration_layout ()

void
hdy_header_bar_set_decoration_layout (HdyHeaderBar *self,
                                      const gchar *layout);

Sets the decoration layout for this header bar, overriding the “gtk-decoration-layout” setting.

There can be valid reasons for overriding the setting, such as a header bar design that does not allow for buttons to take room on the right, or only offers room for a single close button. Split header bars are another example for overriding the setting.

The format of the string is button names, separated by commas. A colon separates the buttons that should appear on the left from those on the right. Recognized button names are minimize, maximize, close, icon (the window icon) and menu (a menu button for the fallback app menu).

For example, “menu:minimize,maximize,close” specifies a menu on the left, and minimize, maximize and close buttons on the right.

Parameters

self

a HdyHeaderBar

 

layout

a decoration layout, or NULL to unset the layout.

[allow-none]

Since: 0.0.10


hdy_header_bar_get_centering_policy ()

HdyCenteringPolicy
hdy_header_bar_get_centering_policy (HdyHeaderBar *self);

Gets the policy self follows to horizontally align its center widget.

Parameters

self

a HdyHeaderBar

 

Returns

the centering policy

Since: 0.0.10


hdy_header_bar_set_centering_policy ()

void
hdy_header_bar_set_centering_policy (HdyHeaderBar *self,
                                     HdyCenteringPolicy centering_policy);

Sets the policy self must follow to horizontally align its center widget.

Parameters

self

a HdyHeaderBar

 

centering_policy

the centering policy

 

Since: 0.0.10


hdy_header_bar_get_transition_duration ()

guint
hdy_header_bar_get_transition_duration
                               (HdyHeaderBar *self);

Returns the amount of time (in milliseconds) that transitions between pages in self will take.

Parameters

self

a HdyHeaderBar

 

Returns

the transition duration

Since: 0.0.10


hdy_header_bar_set_transition_duration ()

void
hdy_header_bar_set_transition_duration
                               (HdyHeaderBar *self,
                                guint duration);

Sets the duration that transitions between pages in self will take.

Parameters

self

a HdyHeaderBar

 

duration

the new duration, in milliseconds

 

Since: 0.0.10


hdy_header_bar_get_transition_running ()

gboolean
hdy_header_bar_get_transition_running (HdyHeaderBar *self);

Returns whether the self is currently in a transition from one page to another.

Parameters

self

a HdyHeaderBar

 

Returns

TRUE if the transition is currently running, FALSE otherwise.

Since: 0.0.10


hdy_header_bar_get_interpolate_size ()

gboolean
hdy_header_bar_get_interpolate_size (HdyHeaderBar *self);

Gets wether self should interpolate its size on visible child change.

See hdy_header_bar_set_interpolate_size().

Parameters

self

A HdyHeaderBar

 

Returns

TRUE if self interpolates its size on visible child change, FALSE if not

Since: 0.0.10


hdy_header_bar_set_interpolate_size ()

void
hdy_header_bar_set_interpolate_size (HdyHeaderBar *self,
                                     gboolean interpolate_size);

Sets whether or not self will interpolate the size of its opposing orientation when changing the visible child. If TRUE, self will interpolate its size between the one of the previous visible child and the one of the new visible child, according to the set transition duration and the orientation, e.g. if self is horizontal, it will interpolate the its height.

Parameters

self

A HdyHeaderBar

 

interpolate_size

TRUE to interpolate the size

 

Since: 0.0.10

Types and Values

HDY_TYPE_HEADER_BAR

#define HDY_TYPE_HEADER_BAR (hdy_header_bar_get_type())

enum HdyCenteringPolicy

Members

HDY_CENTERING_POLICY_LOOSE

Keep the title centered when possible

 

HDY_CENTERING_POLICY_STRICT

Keep the title centered at all cost

 

struct HdyHeaderBarClass

struct HdyHeaderBarClass {
  GtkContainerClass parent_class;
};

Members


HdyHeaderBar

typedef struct _HdyHeaderBar HdyHeaderBar;

Property Details

The “centering-policy” property

  “centering-policy”         HdyCenteringPolicy

The policy to horizontally align the center widget.

Flags: Read / Write

Default value: HDY_CENTERING_POLICY_LOOSE


The “custom-title” property

  “custom-title”             GtkWidget *

Custom title widget to display.

Flags: Read / Write


The “decoration-layout” property

  “decoration-layout”        gchar *

The decoration layout for buttons. If this property is not set, the “gtk-decoration-layout” setting is used.

See hdy_header_bar_set_decoration_layout() for information about the format of this string.

Flags: Read / Write

Default value: NULL

Since: 0.0.10


The “decoration-layout-set” property

  “decoration-layout-set”    gboolean

Set to TRUE if “decoration-layout” is set.

Flags: Read / Write

Default value: FALSE

Since: 0.0.10


The “has-subtitle” property

  “has-subtitle”             gboolean

If TRUE, reserve space for a subtitle, even if none is currently set.

Flags: Read / Write

Default value: TRUE

Since: 0.0.10


The “interpolate-size” property

  “interpolate-size”         gboolean

Whether or not the size should smoothly change when changing between differently sized children.

Flags: Read / Write

Default value: FALSE


The “show-close-button” property

  “show-close-button”        gboolean

Whether to show window decorations.

Which buttons are actually shown and where is determined by the “decoration-layout” property, and by the state of the window (e.g. a close button will not be shown if the window can't be closed).

Flags: Read / Write

Default value: FALSE

Since: 0.0.10


The “spacing” property

  “spacing”                  gint

The amount of space between children.

Flags: Read / Write

Allowed values: >= 0

Default value: 6


The “subtitle” property

  “subtitle”                 gchar *

The subtitle to display.

Flags: Read / Write

Default value: NULL


The “title” property

  “title”                    gchar *

The title to display.

Flags: Read / Write

Default value: NULL


The “transition-duration” property

  “transition-duration”      guint

The animation duration, in milliseconds.

Flags: Read / Write

Default value: 200


The “transition-running” property

  “transition-running”       gboolean

Whether or not the transition is currently running.

Flags: Read

Default value: FALSE

See Also

GtkHeaderBar, HdyTitleBar, HdyViewSwitcher, HdyDialog