adw-header-bar

adw-header-bar

Functions

Properties

AdwCenteringPolicy centering-policy Read / Write
char * decoration-layout Read / Write
gboolean show-end-title-buttons Read / Write
gboolean show-start-title-buttons Read / Write
GtkWidget * title-widget Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── AdwHeaderBar

Implemented Interfaces

AdwHeaderBar implements GtkAccessible, GtkBuildable and GtkConstraintTarget.

Description

Functions

adw_header_bar_new ()

GtkWidget *
adw_header_bar_new (void);

Creates a new AdwHeaderBar widget.

Returns

a new AdwHeaderBar

Since: 1.0


adw_header_bar_get_title_widget ()

GtkWidget *
adw_header_bar_get_title_widget (AdwHeaderBar *self);

Retrieves the title widget widget of the header. See adw_header_bar_set_title_widget().

Parameters

self

a AdwHeaderBar

 

Returns

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

[nullable][transfer none]

Since: 1.0


adw_header_bar_set_title_widget ()

void
adw_header_bar_set_title_widget (AdwHeaderBar *self,
                                 GtkWidget *title_widget);

Sets the title for the AdwHeaderBar.

When set to NULL, the headerbar will display the title of the window it is contained in.

The title should help a user identify the current view. To achieve the same style as the builtin title, use the “title” style class.

You should set the title widget to NULL, for the window title label to be visible again.

Parameters

self

a AdwHeaderBar

 

title_widget

a widget to use for a title.

[allow-none]

Since: 1.0


adw_header_bar_pack_start ()

void
adw_header_bar_pack_start (AdwHeaderBar *self,
                           GtkWidget *child);

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

Parameters

self

A AdwHeaderBar

 

child

the GtkWidget to be added to self

 

Since: 1.0


adw_header_bar_pack_end ()

void
adw_header_bar_pack_end (AdwHeaderBar *self,
                         GtkWidget *child);

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

Parameters

self

A AdwHeaderBar

 

child

the GtkWidget to be added to self

 

Since: 1.0


adw_header_bar_remove ()

void
adw_header_bar_remove (AdwHeaderBar *self,
                       GtkWidget *child);

Removes a child from self , after it has been added with adw_header_bar_pack_start(), adw_header_bar_pack_end() or adw_header_bar_set_title_widget().

Parameters

self

a AdwHeaderBar

 

child

the child to remove

 

Since: 1.0


adw_header_bar_get_show_start_title_buttons ()

gboolean
adw_header_bar_get_show_start_title_buttons
                               (AdwHeaderBar *self);

Returns whether this header bar shows the standard window title buttons.

Parameters

self

a AdwHeaderBar

 

Returns

TRUE if title buttons are shown

Since: 1.0


adw_header_bar_set_show_start_title_buttons ()

void
adw_header_bar_set_show_start_title_buttons
                               (AdwHeaderBar *self,
                                gboolean setting);

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

Parameters

self

a AdwHeaderBar

 

setting

TRUE to show standard title buttons

 

Since: 1.0


adw_header_bar_get_show_end_title_buttons ()

gboolean
adw_header_bar_get_show_end_title_buttons
                               (AdwHeaderBar *self);

Returns whether this header bar shows the standard window title buttons.

Parameters

self

a AdwHeaderBar

 

Returns

TRUE if title buttons are shown

Since: 1.0


adw_header_bar_set_show_end_title_buttons ()

void
adw_header_bar_set_show_end_title_buttons
                               (AdwHeaderBar *self,
                                gboolean setting);

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

Parameters

self

a AdwHeaderBar

 

setting

TRUE to show standard title buttons

 

Since: 1.0


adw_header_bar_get_decoration_layout ()

const char *
adw_header_bar_get_decoration_layout (AdwHeaderBar *self);

Gets the decoration layout set with adw_header_bar_set_decoration_layout().

Parameters

self

a AdwHeaderBar

 

Returns

the decoration layout.

[nullable]

Since: 1.0


adw_header_bar_set_decoration_layout ()

void
adw_header_bar_set_decoration_layout (AdwHeaderBar *self,
                                      const char *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 and icon (the window icon).

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

Parameters

self

a AdwHeaderBar

 

layout

a decoration layout, or NULL to unset the layout.

[nullable]

Since: 1.0


adw_header_bar_get_centering_policy ()

AdwCenteringPolicy
adw_header_bar_get_centering_policy (AdwHeaderBar *self);

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

Parameters

self

a AdwHeaderBar

 

Returns

the centering policy

Since: 1.0


adw_header_bar_set_centering_policy ()

void
adw_header_bar_set_centering_policy (AdwHeaderBar *self,
                                     AdwCenteringPolicy centering_policy);

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

Parameters

self

a AdwHeaderBar

 

centering_policy

the centering policy

 

Since: 1.0

Types and Values

ADW_TYPE_HEADER_BAR

#define ADW_TYPE_HEADER_BAR (adw_header_bar_get_type())

enum AdwCenteringPolicy

Members

ADW_CENTERING_POLICY_LOOSE

Keep the title centered when possible

 

ADW_CENTERING_POLICY_STRICT

Keep the title centered at all cost

 

Since: 1.0


AdwHeaderBar

typedef struct _AdwHeaderBar AdwHeaderBar;

Property Details

The “centering-policy” property

  “centering-policy”         AdwCenteringPolicy

The policy to horizontally align the center widget.

Owner: AdwHeaderBar

Flags: Read / Write

Default value: ADW_CENTERING_POLICY_LOOSE


The “decoration-layout” property

  “decoration-layout”        char *

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

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

Owner: AdwHeaderBar

Flags: Read / Write

Default value: NULL

Since: 1.0


The “show-end-title-buttons” property

  “show-end-title-buttons”   gboolean

Whether to show title buttons like close, minimize, maximize.

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

Owner: AdwHeaderBar

Flags: Read / Write

Default value: TRUE

Since: 1.0


The “show-start-title-buttons” property

  “show-start-title-buttons” gboolean

Whether to show title buttons like close, minimize, maximize.

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

Owner: AdwHeaderBar

Flags: Read / Write

Default value: TRUE

Since: 1.0


The “title-widget” property

  “title-widget”             GtkWidget *

Title widget to display.

Owner: AdwHeaderBar

Flags: Read / Write