ButtonContent


Object Hierarchy:

Adw.ButtonContent Adw.ButtonContent Adw.ButtonContent Gtk.Widget Gtk.Widget Gtk.Widget->Adw.ButtonContent GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Adw.ButtonContent Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Adw.ButtonContent Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Adw.ButtonContent Gtk.ConstraintTarget->Gtk.Widget

Description:

[ CCode ( type_id = "adw_button_content_get_type ()" ) ]
public sealed class ButtonContent : Widget, Accessible, Buildable, ConstraintTarget

A helper widget for creating buttons.

<picture> <source srcset="button-content-dark.png" media="(prefers-color-scheme: dark)"> <img src="button-content.png" alt="button-content"> </picture>

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

It's intended to be used as a direct child of [class@Gtk.Button], [class@Gtk.MenuButton] or [class@SplitButton], when they need to have both an icon and a label, as follows:

```xml <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 ├── image ╰── label ```

`AdwButtonContent`'s CSS node is called `buttoncontent`. It contains the subnodes `image` and `label`.

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.


Namespace: Adw
Package: libadwaita-1

Content:

Properties:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class Gtk.Widget