## EHeaderBarButton

EHeaderBarButton

## Functions

GtkWidget * | e_header_bar_button_new ()
void | e_header_bar_button_add_action ()
void | e_header_bar_button_take_menu ()
void | e_header_bar_button_css_add_class ()
void | e_header_bar_button_add_accelerator ()
void | e_header_bar_button_get_widths ()
gboolean | e_header_bar_button_get_show_icon_only ()
void | e_header_bar_button_set_show_icon_only ()

## Properties

EUIAction * | action | Read / Write
char * | label | Read / Write / Construct Only
char * | prefer-item | Read / Write
EUIManager * | ui-manager | Read / Write / Construct Only

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBox
                        ╰── EHeaderBarButton

## Description

## Functions

### e_header_bar_button_new ()

    GtkWidget *
    e_header_bar_button_new (const gchar *label,
                             EUIAction *action,
                             EUIManager *ui_manager);

Creates a new EHeaderBarButton labeled with `label` . If action is `NULL`, button will use default preferred menu action if available, see `e_header_bar_button_take_menu()`.

#### Parameters

label | a button label |
action | an EUIAction overriding menu default action |
ui_manager | an EUIManager to get an icon for the `action` |

#### Returns

a new EHeaderBarButton.

[transfer full]

Since: 3.56

### e_header_bar_button_add_action ()

    void
    e_header_bar_button_add_action (EHeaderBarButton *header_bar_button,
                                    const gchar *label,
                                    EUIAction *action);

Adds a new button with a related action.

#### Parameters

header_bar_button | EHeaderBarButton |
label | The text you want the GtkButton to hold. |
action | GtkButton related action |

Since: 3.56

### e_header_bar_button_take_menu ()

    void
    e_header_bar_button_take_menu (EHeaderBarButton *header_bar_button,
                                   GtkWidget *menu);

Sets the GtkMenu that will be popped up when the `menu_button` is clicked, or `NULL` to dissociate any existing menu and disable the dropdown button.

If current EHeaderBarButton action is `NULL`, clicking the button will fire the preferred item, if set, or the first menu item otherwise.

#### Parameters

header_bar_button | EHeaderBarButton |
menu | A GtkMenu, or `NULL` to unset and disable the dropdown button. | [transfer full][nullable]

Since: 3.46

### e_header_bar_button_css_add_class ()

    void
    e_header_bar_button_css_add_class (EHeaderBarButton *header_bar_button,
                                       const gchar *class);

Adds a CSS class to EHeaderBarButton main button

#### Parameters

header_bar_button | EHeaderBarButton |
class_name | a CSS class name |

Since: 3.46

### e_header_bar_button_add_accelerator ()

    void
    e_header_bar_button_add_accelerator (EHeaderBarButton *header_bar_button,
                                         GtkAccelGroup *accel_group,
                                         guint accel_key,
                                         GdkModifierType accel_mods,
                                         GtkAccelFlags accel_flags);

Installs an accelerator for main action

#### Parameters

header_bar_button | EHeaderBarButton to activate |
accel_group | Accel group for this widget, added to its toplevel. |
accel_key | GDK keyval of the accelerator |
accel_mods | Modifier key combination of the accelerator. |
accel_flags | Flag accelerators, e.g. GTK_ACCEL_VISIBLE |

Since: 3.46

### e_header_bar_button_get_widths ()

    void
    e_header_bar_button_get_widths (EHeaderBarButton *self,
                                    gint *out_labeled_width,
                                    gint *out_icon_only_width);

Returns expected width of the button when it has set a label and when only icon is shown. When either of the two is -1, the width could not be calculated, like when the button cannot have (un)set the label, then the out_icon_only_width is set to -1.

#### Parameters

self | an EHeaderBarButton |
out_labeled_width | return location for width of the button with the label. | [out]
out_icon_only_width | return location for width of the button with the icon only. | [out]

Since: 3.48

### e_header_bar_button_get_show_icon_only ()

    gboolean
    e_header_bar_button_get_show_icon_only
                                   (EHeaderBarButton *self);

Returns whether the button shows only icon, without label. Returns `FALSE`, when the label cannot be (un)set.

#### Parameters

self | an EHeaderBarButton |

#### Returns

whether the button shows only icon, without label

Since: 3.48

### e_header_bar_button_set_show_icon_only ()

    void
    e_header_bar_button_set_show_icon_only
                                   (EHeaderBarButton *self,
                                    gboolean show_icon_only);

Changes button's appearance between showing only icon and showing label with an icon. The function does nothing, when the label cannot be (un)set.

#### Parameters

self | an EHeaderBarButton |
show_icon_only | value to set |

Since: 3.48

## Property Details

### The `“action”` property

      “action”                   EUIAction *

Button action.

Owner: EHeaderBarButton

Flags: Read / Write

### The `“label”` property

      “label”                    char *

Button label.

Owner: EHeaderBarButton

Flags: Read / Write / Construct Only

Default value: NULL

### The `“prefer-item”` property

      “prefer-item”              char *

Name of an item to show instead of the first.

Owner: EHeaderBarButton

Flags: Read / Write

Default value: NULL

### The `“ui-manager”` property

      “ui-manager”               EUIManager *

Owner: EHeaderBarButton

Flags: Read / Write / Construct Only