1.55 <AdwSplitButton>

Class: <AdwSplitButton>

It derives from <GtkWidget>.

A combined button and dropdown widget.

<AdwSplitButton> is typically used to present a set of actions in a menu, but allow access to one of them with a single click.

The API is very similar to <GtkButton> and <GtkMenuButton>, see their documentation for details.

CSS nodes

splitbutton[.image-button][.text-button]
├── button
│   ╰── <content>
├── separator
╰── menubutton
    ╰── button.toggle
        ╰── arrow

<AdwSplitButton>’s CSS node is called splitbutton. It contains the css nodes: button, separator, menubutton. See <GtkMenuButton> documentation for the menubutton contents.

The main CSS node will contain the .image-button or .text-button style classes matching the button contents. The nested button nodes will never contain them.

Style classes

<AdwSplitButton> can use some of the same style classes as <GtkButton>:

  • ‘.suggested-action‘
  • ‘.destructive-action‘
  • ‘.flat‘
  • ‘.raised‘

Other style classes, like .pill, cannot be used.

Accessibility

<AdwSplitButton> uses the Gtk.AccessibleRole.group role.

Properties

Property: split-button:can-shrink self

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

If set to TRUE, the label will ellipsize.

See button:can-shrink and menu-button:can-shrink.

Its value is a boolean.

Set it with (set! (split-button:can-shrink self) value).

Property: split-button:child self

The child widget.

Setting the child widget will set SplitButton:label and SplitButton:icon-name to NULL.

Its value is a <GtkWidget>, or #f.

Set it with (set! (split-button:child self) value).

Property: split-button:direction self

The direction in which the popup will be popped up.

The dropdown arrow icon will point at the same direction.

If the does not fit in the available space in the given direction, GTK will try its best to keep it inside the screen and fully visible.

Gtk.ArrowType.none behaves same as Gtk.ArrowType.down.

Its value is a <GtkArrowType> (or, to set it, one of its symbols).

Set it with (set! (split-button:direction self) value).

Property: split-button:dropdown-tooltip self

The tooltip of the dropdown button.

The tooltip can be marked up with the Pango text markup language.

Its value is a string, or #f.

Set it with (set! (split-button:dropdown-tooltip self) value).

Property: split-button:icon-name self

The name of the icon used to automatically populate the button.

Setting the icon name will set SplitButton:label and SplitButton:child to NULL.

Its value is a string, or #f.

Set it with (set! (split-button:icon-name self) value).

Property: split-button:label self

The label for the button.

Setting the label will set SplitButton:icon-name and SplitButton:child to NULL.

Its value is a string, or #f.

Set it with (set! (split-button:label self) value).

Property: split-button:menu-model self

The <GMenuModel> from which the popup will be created.

If the menu model is NULL, the dropdown is disabled.

A <GtkPopover> will be created from the menu model with popover-menu:new-from-model. Actions will be connected as documented for this function.

If SplitButton:popover is already set, it will be dissociated from the button, and the property is set to NULL.

Its value is a <GMenuModel>, or #f.

Set it with (set! (split-button:menu-model self) value).

Property: split-button:popover self

The <GtkPopover> that will be popped up when the dropdown is clicked.

If the popover is NULL, the dropdown is disabled.

If SplitButton:menu-model is set, the menu model is dissociated from the button, and the property is set to NULL.

Its value is a <GtkPopover>, or #f.

Set it with (set! (split-button:popover self) value).

Property: split-button:use-underline self

Whether an underline in the text indicates a mnemonic.

See SplitButton:label.

Its value is a boolean.

Set it with (set! (split-button:use-underline self) value).

Procedures

Method: split-button:get-can-shrink? self ⇒ %return
Method: get-can-shrink? self ⇒ %return

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

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a boolean.

whether the button can shrink

Method: split-button:get-child self ⇒ %return
Method: get-child self ⇒ %return

Gets the child widget.

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a <GtkWidget>, or #f.

the child widget

Method: split-button:get-direction self ⇒ %return
Method: get-direction self ⇒ %return

Gets the direction in which the popup will be popped up.

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a <GtkArrowType>.

the direction

Method: split-button:get-dropdown-tooltip self ⇒ %return
Method: get-dropdown-tooltip self ⇒ %return

Gets the tooltip of the dropdown button of self.

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a string.

the dropdown tooltip of self

Method: split-button:get-icon-name self ⇒ %return
Method: get-icon-name self ⇒ %return

Gets the name of the icon used to automatically populate the button.

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a string, or #f.

the icon name

Method: split-button:get-label self ⇒ %return
Method: get-label self ⇒ %return

Gets the label for self.

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a string, or #f.

the label for self

Method: split-button:get-menu-model self ⇒ %return
Method: get-menu-model self ⇒ %return

Gets the menu model from which the popup will be created.

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a <GMenuModel>, or #f.

the menu model

Method: split-button:get-popover self ⇒ %return
Method: get-popover self ⇒ %return

Gets the popover that will be popped up when the dropdown is clicked.

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a <GtkPopover>, or #f.

the popover

Method: split-button:get-use-underline? self ⇒ %return
Method: get-use-underline? self ⇒ %return

Gets whether an underline in the text indicates a mnemonic.

self

Passed: a <AdwSplitButton>.

a split button

%return

Returned: a boolean.

whether an underline in the text indicates a mnemonic

Procedure: split-button:new ⇒ %return

Creates a new <AdwSplitButton>.

%return

Returned: a <GtkWidget>.

the newly created <AdwSplitButton>

Method: split-button:popdown self
Method: popdown self

Dismisses the menu.

self

Passed: a <AdwSplitButton>.

a split button

Method: split-button:popup self
Method: popup self

Pops up the menu.

self

Passed: a <AdwSplitButton>.

a split button

Method: split-button:set-can-shrink self can-shrink
Method: set-can-shrink self can-shrink

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

If set to TRUE, the label will ellipsize.

See button:set-can-shrink and menu-button:set-can-shrink.

self

Passed: a <AdwSplitButton>.

a split button

can-shrink

Passed: a boolean.

whether the button can shrink

Method: split-button:set-child self [child]
Method: set-child self [child]

Sets the child widget.

Setting the child widget will set SplitButton:label and SplitButton:icon-name to NULL.

self

Passed: a <AdwSplitButton>.

a split button

child

Passed, or left out: a <GtkWidget>, or #f.

the new child widget

Method: split-button:set-direction self direction
Method: set-direction self direction

Sets the direction in which the popup will be popped up.

The dropdown arrow icon will point at the same direction.

If the does not fit in the available space in the given direction, GTK will try its best to keep it inside the screen and fully visible.

Gtk.ArrowType.none behaves same as Gtk.ArrowType.down.

self

Passed: a <AdwSplitButton>.

a split button

direction

Passed: a <GtkArrowType>, or one of its symbols.

the direction

Method: split-button:set-dropdown-tooltip self tooltip
Method: set-dropdown-tooltip self tooltip

Sets the tooltip of the dropdown button of self.

The tooltip can be marked up with the Pango text markup language.

self

Passed: a <AdwSplitButton>.

a split button

tooltip

Passed: a string.

the dropdown tooltip of self

Method: split-button:set-icon-name self icon-name
Method: set-icon-name self icon-name

Sets the name of the icon used to automatically populate the button.

Setting the icon name will set SplitButton:label and SplitButton:child to NULL.

self

Passed: a <AdwSplitButton>.

a split button

icon-name

Passed: a string.

the icon name to set

Method: split-button:set-label self label
Method: set-label self label

Sets the label for self.

Setting the label will set SplitButton:icon-name and SplitButton:child to NULL.

self

Passed: a <AdwSplitButton>.

a split button

label

Passed: a string.

the label to set

Method: split-button:set-menu-model self [menu-model]
Method: set-menu-model self [menu-model]

Sets the menu model from which the popup will be created.

If the menu model is NULL, the dropdown is disabled.

A <GtkPopover> will be created from the menu model with popover-menu:new-from-model. Actions will be connected as documented for this function.

If SplitButton:popover is already set, it will be dissociated from the button, and the property is set to NULL.

self

Passed: a <AdwSplitButton>.

a split button

menu-model

Passed, or left out: a <GMenuModel>, or #f.

the menu model

Method: split-button:set-popover self [popover]
Method: set-popover self [popover]

Sets the popover that will be popped up when the dropdown is clicked.

If the popover is NULL, the dropdown is disabled.

If SplitButton:menu-model is set, the menu model is dissociated from the button, and the property is set to NULL.

self

Passed: a <AdwSplitButton>.

a split button

popover

Passed, or left out: a <GtkPopover>, or #f.

the popover

Method: split-button:set-use-underline self use-underline
Method: set-use-underline self use-underline

Sets whether an underline in the text indicates a mnemonic.

See SplitButton:label.

self

Passed: a <AdwSplitButton>.

a split button

use-underline

Passed: a boolean.

whether an underline in the text indicates a mnemonic

Signals

Signal: split-button:activate

Connect a handler with (connect object split-button:activate handler). It is called as (handler self).

Emitted to animate press then release.

This is an action signal. Applications should never connect to this signal, but use the "clicked" signal.

self

Passed: a <AdwSplitButton>.

Signal: split-button:clicked

Connect a handler with (connect object split-button:clicked handler). It is called as (handler self).

Emitted when the button has been activated (pressed and released).

self

Passed: a <AdwSplitButton>.