Class

AdwButtonContent

[]

Description [src]

final class Adw.ButtonContent : Gtk.Widget
  implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
  /* No available fields */
}

A helper widget for creating buttons.

button-content

AdwButtonContent is a box-like widget with an icon and a label.

It’s intended to be used as a direct child of GtkButton, GtkMenuButton or AdwSplitButton, when they need to have both an icon and a label, as follows:

<object class="GtkButton">
  <property name="child">
    <object class="AdwButtonContent">
      <property name="icon-name">document-open-symbolic</property>
      <property name="label" translatable="yes">_Open</property>
      <property name="use-underline">True</property>
    </object>
  </property>
</object>

AdwButtonContent handles style classes and connecting the mnemonic to the button automatically.

CSS nodes

buttoncontent
╰── box
    ├── image
    ╰── label

AdwButtonContents CSS node is called buttoncontent. It contains a box subnode that serves as a container for the image and label nodes.

When inside a GtkButton or AdwSplitButton, the button will receive the .image-text-button style class. When inside a GtkMenuButton, the internal GtkButton will receive it instead.

Accessibility

AdwButtonContent uses the GTK_ACCESSIBLE_ROLE_GROUP role.

[]

Hierarchy

hierarchy this AdwButtonContent implements_0 GtkAccessible this--implements_0 implements_1 GtkBuildable this--implements_1 implements_2 GtkConstraintTarget this--implements_2 ancestor_0 GtkWidget ancestor_0--this ancestor_1 GInitiallyUnowned ancestor_1--ancestor_0 ancestor_2 GObject ancestor_2--ancestor_1
[]

Constructors

adw_button_content_new

Creates a new AdwButtonContent.

[]

Instance methods

adw_button_content_get_can_shrink

Gets whether the button can be smaller than the natural size of its contents.

since: 1.4

adw_button_content_get_icon_name

Gets the name of the displayed icon.

adw_button_content_get_label

Gets the displayed label.

adw_button_content_get_use_underline

Gets whether an underline in the text indicates a mnemonic.

adw_button_content_set_can_shrink

Sets whether the button can be smaller than the natural size of its contents.

since: 1.4

adw_button_content_set_icon_name

Sets the name of the displayed icon.

adw_button_content_set_label

Sets the displayed label.

adw_button_content_set_use_underline

Sets whether an underline in the text indicates a mnemonic.

Methods inherited from GtkWidget (164)
Methods inherited from GObject (43)
Methods inherited from GtkAccessible (20)
Methods inherited from GtkBuildable (1)
[]

Properties

Adw.ButtonContent:can-shrink

Whether the button can be smaller than the natural size of its contents.

since: 1.4

Adw.ButtonContent:icon-name

The name of the displayed icon.

Adw.ButtonContent:label

The displayed label.

Adw.ButtonContent:use-underline

Whether an underline in the text indicates a mnemonic.

Properties inherited from GtkWidget (35)
Properties inherited from GtkAccessible (1)
[]

Signals

Signals inherited from GtkWidget (13)
Signals inherited from GObject (1)

Class structure