GtkHeaderBar

GtkHeaderBar — A box with a centered child

Functions

Properties

GtkWidget * custom-title Read / Write / Construct
gboolean show-close-button Read / Write
gint spacing Read / Write
gchar * subtitle Read / Write
gchar * title Read / Write

Child Properties

GtkPackType pack-type Read / Write
gint position Read

Types and Values

struct GtkHeaderBar

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkHeaderBar

Implemented Interfaces

GtkHeaderBar implements AtkImplementorIface and GtkBuildable.

Includes

#include <gtk/gtk.h>

Description

GtkHeaderBar is similar to a horizontal GtkBox, it allows to place children at the start or the end. In addition, it allows a title to be displayed. The title will be centered with respect to the width of the box, even if the children at either side take up different amounts of space.

Functions

gtk_header_bar_new ()

GtkWidget *
gtk_header_bar_new (void);

Creates a new GtkHeaderBar widget.

Returns

a new GtkHeaderBar

Since 3.10


gtk_header_bar_set_title ()

void
gtk_header_bar_set_title (GtkHeaderBar *bar,
                          const gchar *title);

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

Parameters

bar

a GtkHeaderBar

 

title

a title.

[allow-none]

Since 3.10


gtk_header_bar_get_title ()

const gchar *
gtk_header_bar_get_title (GtkHeaderBar *bar);

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

Parameters

bar

a GtkHeaderBar

 

Returns

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

Since 3.10


gtk_header_bar_set_subtitle ()

void
gtk_header_bar_set_subtitle (GtkHeaderBar *bar,
                             const gchar *subtitle);

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

Note that GtkHeaderBar always reserves room for the subtitle, even if none is currently set. If this is not desired, use gtk_header_bar_set_custom_title() to place your own label in the title position. To achieve the same style, use the "title" style class.

Parameters

bar

a GtkHeaderBar

 

subtitle

a subtitle.

[allow-none]

Since 3.10


gtk_header_bar_get_subtitle ()

const gchar *
gtk_header_bar_get_subtitle (GtkHeaderBar *bar);

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

Parameters

bar

a GtkHeaderBar

 

Returns

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

Since 3.10


gtk_header_bar_set_custom_title ()

void
gtk_header_bar_set_custom_title (GtkHeaderBar *bar,
                                 GtkWidget *title_widget);

Sets a custom title for the GtkHeaderBar. The title should help a user identify the current view. This supercedes any title set by gtk_header_bar_set_title() or gtk_header_bar_set_subtitle(). You should set the custom title to NULL, for the header title label to be visible again.

Parameters

bar

a GtkHeaderBar

 

title_widget

a custom widget to use for a title.

[allow-none]

Since 3.10


gtk_header_bar_get_custom_title ()

GtkWidget *
gtk_header_bar_get_custom_title (GtkHeaderBar *bar);

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

Parameters

bar

a GtkHeaderBar

 

Returns

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

[transfer none]

Since 3.10


gtk_header_bar_pack_start ()

void
gtk_header_bar_pack_start (GtkHeaderBar *bar,
                           GtkWidget *child);

Adds child to bar , packed with reference to the start of the bar .

Parameters

bar

A GtkHeaderBar

 

child

the GtkWidget to be added to bar

 

Since 3.10


gtk_header_bar_pack_end ()

void
gtk_header_bar_pack_end (GtkHeaderBar *bar,
                         GtkWidget *child);

Adds child to bar , packed with reference to the end of the bar .

Parameters

bar

A GtkHeaderBar

 

child

the GtkWidget to be added to bar

 

Since 3.10


gtk_header_bar_set_show_close_button ()

void
gtk_header_bar_set_show_close_button (GtkHeaderBar *bar,
                                      gboolean setting);

Sets whether this header bar shows a window close button.

Parameters

bar

a GtkHeaderBar

 

setting

TRUE to show a window close button

 

Since 3.10


gtk_header_bar_get_show_close_button ()

gboolean
gtk_header_bar_get_show_close_button (GtkHeaderBar *bar);

Returns whether this header bar shows a window close button.

Parameters

bar

a GtkHeaderBar

 

Returns

TRUE if a window close button is shown

Since 3.10

Types and Values

struct GtkHeaderBar

struct GtkHeaderBar;

Property Details

The “custom-title” property

  “custom-title”             GtkWidget *

Custom title widget to display.

Flags: Read / Write / Construct


The “show-close-button” property

  “show-close-button”        gboolean

Whether to show a window close button.

Flags: Read / Write

Default value: FALSE


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

Child Property Details

The “pack-type” child property

  “pack-type”                GtkPackType

A GtkPackType indicating whether the child is packed with reference to the start or end of the parent.

Flags: Read / Write

Default value: GTK_PACK_START


The “position” child property

  “position”                 gint

The index of the child in the parent.

Flags: Read

Allowed values: >= -1

Default value: 0

See Also

GtkBox