Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Child Properties | ![]() |
![]() |
![]() |
![]() |
#include <gtk/gtk.h> struct GtkHeaderBar; GtkWidget * gtk_header_bar_new (void
); void gtk_header_bar_set_title (GtkHeaderBar *bar
,const gchar *title
); const gchar * gtk_header_bar_get_title (GtkHeaderBar *bar
); void gtk_header_bar_set_subtitle (GtkHeaderBar *bar
,const gchar *subtitle
); const gchar * gtk_header_bar_get_subtitle (GtkHeaderBar *bar
); void gtk_header_bar_set_custom_title (GtkHeaderBar *bar
,GtkWidget *title_widget
); GtkWidget * gtk_header_bar_get_custom_title (GtkHeaderBar *bar
); void gtk_header_bar_pack_start (GtkHeaderBar *bar
,GtkWidget *child
); void gtk_header_bar_pack_end (GtkHeaderBar *bar
,GtkWidget *child
); void gtk_header_bar_set_show_close_button (GtkHeaderBar *bar
,gboolean setting
); gboolean gtk_header_bar_get_show_close_button (GtkHeaderBar *bar
); void gtk_header_bar_set_show_fallback_app_menu (GtkHeaderBar *bar
,gboolean setting
); gboolean gtk_header_bar_get_show_fallback_app_menu (GtkHeaderBar *bar
);
"custom-title" GtkWidget* : Read / Write / Construct "show-close-button" gboolean : Read / Write "show-fallback-app-menu" gboolean : Read / Write "spacing" gint : Read / Write "subtitle" gchar* : Read / Write "title" gchar* : Read / Write
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.
GtkWidget * gtk_header_bar_new (void
);
Creates a new GtkHeaderBar widget.
Returns : |
a new GtkHeaderBar |
Since 3.10
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.
|
a GtkHeaderBar |
|
a title. [allow-none] |
Since 3.10
const gchar * gtk_header_bar_get_title (GtkHeaderBar *bar
);
Retrieves the title of the header. See gtk_header_bar_set_title()
.
|
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
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.
|
a GtkHeaderBar |
|
a subtitle. [allow-none] |
Since 3.10
const gchar * gtk_header_bar_get_subtitle (GtkHeaderBar *bar
);
Retrieves the subtitle of the header. See gtk_header_bar_set_subtitle()
.
|
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
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.
|
a GtkHeaderBar |
|
a custom widget to use for a title. [allow-none] |
Since 3.10
GtkWidget * gtk_header_bar_get_custom_title (GtkHeaderBar *bar
);
Retrieves the custom title widget of the header. See
gtk_header_bar_set_custom_title()
.
|
a GtkHeaderBar |
Returns : |
the custom title widget
of the header, or NULL if none has been set explicitely. [transfer none]
|
Since 3.10
void gtk_header_bar_pack_start (GtkHeaderBar *bar
,GtkWidget *child
);
Adds child
to box
, packed with reference to the
start of the box
.
|
A GtkHeaderBar |
|
the GtkWidget to be added to bar
|
Since 3.10
void gtk_header_bar_pack_end (GtkHeaderBar *bar
,GtkWidget *child
);
Adds child
to box
, packed with reference to the
end of the box
.
|
A GtkHeaderBar |
|
the GtkWidget to be added to bar
|
Since 3.10
void gtk_header_bar_set_show_close_button (GtkHeaderBar *bar
,gboolean setting
);
Sets whether this header bar shows a window close button.
|
a GtkHeaderBar |
|
TRUE to show a window close button |
Since 3.10
gboolean gtk_header_bar_get_show_close_button
(GtkHeaderBar *bar
);
Returns whether this header bar shows a window close button.
|
a GtkHeaderBar |
Returns : |
TRUE if a window close button is shown |
Since 3.10
void gtk_header_bar_set_show_fallback_app_menu (GtkHeaderBar *bar
,gboolean setting
);
Sets whether this header bar may show a menu button for the application menu when it is not shown by the desktop environment.
|
a GtkHeaderBar |
|
TRUE to enable the fallback application menu |
Since 3.12
gboolean gtk_header_bar_get_show_fallback_app_menu
(GtkHeaderBar *bar
);
Returns whether this header bar shows a menu button for the application menu when needed.
|
a GtkHeaderBar |
Returns : |
TRUE if an application menu button may be shown |
Since 3.12
"custom-title"
property"custom-title" GtkWidget* : Read / Write / Construct
Custom title widget to display.
"show-close-button"
property"show-close-button" gboolean : Read / Write
Whether to show a window close button.
Default value: FALSE
"show-fallback-app-menu"
property"show-fallback-app-menu" gboolean : Read / Write
If TRUE
, the header bar will show a menu button for the
application menu when needed, ie when the application menu
is not shown by the desktop shell.
If FALSE
, the header bar will not whow a menu button,
regardless whether the desktop shell shows the application
menu or not.
GtkApplicationWindow will not add a the application menu
to the fallback menubar that it creates if the window
has a header bar with ::show-fallback-app-menu set to TRUE
as its titlebar widget.
Default value: FALSE
Since 3.12
"spacing"
property"spacing" gint : Read / Write
The amount of space between children.
Allowed values: >= 0
Default value: 6
"subtitle"
property"subtitle" gchar* : Read / Write
The subtitle to display.
Default value: NULL
"pack-type"
child property"pack-type" GtkPackType : Read / Write
A GtkPackType indicating whether the child is packed with reference to the start or end of the parent.
Default value: GTK_PACK_START
"position"
child property"position" gint : Read
The index of the child in the parent.
Allowed values: >= -1
Default value: 0