Adw.SplitButton¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Actionable (5)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted to animate press then release. |
|
Emitted when the button has been activated (pressed and released). |
Fields¶
- Inherited:
Class Details¶
- class Adw.SplitButton(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A combined button and dropdown widget.
<picture> <source srcset=”split-button-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”split-button.png” alt=”split-button”> </picture>
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 [class`Gtk`.Button] and [class`Gtk`.MenuButton], see their documentation for details.
- CSS nodes
`` splitbutton[.image-button][.text-button] ├── button │ ╰── <content> ├── separator ╰── menubutton
- ╰── button.toggle
╰── arrow
AdwSplitButton
’s CSS node is calledsplitbutton
. It contains the css nodes:button
,separator
,menubutton
. See [class`Gtk`.MenuButton] documentation for themenubutton
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.- Accessibility
AdwSplitButton
uses theGTK_ACCESSIBLE_ROLE_GROUP
role.- classmethod new()¶
- Returns:
the newly created
AdwSplitButton
- Return type:
Creates a new
AdwSplitButton
.
- get_can_shrink()¶
- Returns:
whether the button can shrink
- Return type:
gets whether the button can be smaller than the natural size of its contents.
New in version 1.4.
- get_child()¶
- Returns:
the child widget
- Return type:
Gtk.Widget
orNone
Gets the child widget.
- get_direction()¶
- Returns:
the direction
- Return type:
Gets the direction in which the popup will be popped up.
- get_dropdown_tooltip()¶
- Returns:
the dropdown tooltip of self
- Return type:
Gets the tooltip of the dropdown button of self.
New in version 1.2.
- get_icon_name()¶
-
Gets the name of the icon used to automatically populate the button.
- get_menu_model()¶
- Returns:
the menu model
- Return type:
Gets the menu model from which the popup will be created.
- get_popover()¶
- Returns:
the popover
- Return type:
Gtk.Popover
orNone
Gets the popover that will be popped up when the dropdown is clicked.
- get_use_underline()¶
- Returns:
whether an underline in the text indicates a mnemonic
- Return type:
Gets whether an underline in the text indicates a mnemonic.
- popdown()¶
Dismisses the menu.
- popup()¶
Pops up the menu.
- set_can_shrink(can_shrink)¶
- Parameters:
can_shrink (
bool
) – whether the button 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 [method`Gtk`.Button.set_can_shrink] and [method`Gtk`.MenuButton.set_can_shrink].
New in version 1.4.
- set_child(child)¶
- Parameters:
child (
Gtk.Widget
orNone
) – the new child widget
Sets the child widget.
Setting the child widget will set [property`SplitButton`:py:data::label<Adw.SplitButton.props.label>] and [property`SplitButton`:py:data::icon-name<Adw.SplitButton.props.icon_name>] to
NULL
.
- set_direction(direction)¶
- Parameters:
direction (
Gtk.ArrowType
) – the 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.
If you pass
GTK_ARROW_NONE
, it’s equivalent toGTK_ARROW_DOWN
.
- set_dropdown_tooltip(tooltip)¶
- Parameters:
tooltip (
str
) – the dropdown tooltip of self
Sets the tooltip of the dropdown button of self.
The tooltip can be marked up with the Pango text markup language.
New in version 1.2.
- set_icon_name(icon_name)¶
- Parameters:
icon_name (
str
) – the icon name to set
Sets the name of the icon used to automatically populate the button.
Setting the icon name will set [property`SplitButton`:py:data::label<Adw.SplitButton.props.label>] and [property`SplitButton`:py:data::child<Adw.SplitButton.props.child>] to
NULL
.
- set_label(label)¶
- Parameters:
label (
str
) – the label to set
Sets the label for self.
Setting the label will set [property`SplitButton`:py:data::icon-name<Adw.SplitButton.props.icon_name>] and [property`SplitButton`:py:data::child<Adw.SplitButton.props.child>] to
NULL
.
- set_menu_model(menu_model)¶
- Parameters:
menu_model (
Gio.MenuModel
orNone
) – the menu model
Sets the menu model from which the popup will be created.
If the menu model is
NULL
, the dropdown is disabled.A [class`Gtk`.Popover] will be created from the menu model with [ctor`Gtk`.PopoverMenu.new_from_model]. Actions will be connected as documented for this function.
If [property`SplitButton`:py:data::popover<Adw.SplitButton.props.popover>] is already set, it will be dissociated from the button, and the property is set to
NULL
.
- set_popover(popover)¶
- Parameters:
popover (
Gtk.Popover
orNone
) – the popover
Sets the popover that will be popped up when the dropdown is clicked.
If the popover is
NULL
, the dropdown is disabled.If [property`SplitButton`:py:data::menu-model<Adw.SplitButton.props.menu_model>] is set, the menu model is dissociated from the button, and the property is set to
NULL
.
Signal Details¶
- Adw.SplitButton.signals.activate(split_button)¶
- Signal Name:
activate
- Flags:
- Parameters:
split_button (
Adw.SplitButton
) – The object which received the signal
Emitted to animate press then release.
This is an action signal. Applications should never connect to this signal, but use the [signal`SplitButton`:py:func:::clicked<Adw.SplitButton.signals.clicked>] signal.
- Adw.SplitButton.signals.clicked(split_button)¶
- Signal Name:
clicked
- Flags:
- Parameters:
split_button (
Adw.SplitButton
) – The object which received the signal
Emitted when the button has been activated (pressed and released).
Property Details¶
- Adw.SplitButton.props.can_shrink¶
- Name:
can-shrink
- Type:
- Default Value:
- Flags:
Whether the button can be smaller than the natural size of its contents.
If set to
TRUE
, the label will ellipsize.See [property`Gtk`.Button:can-shrink] and [property`Gtk`.MenuButton:can-shrink].
New in version 1.4.
- Adw.SplitButton.props.child¶
- Name:
child
- Type:
- Default Value:
- Flags:
The child widget.
Setting the child widget will set [property`SplitButton`:py:data::label<Adw.SplitButton.props.label>] and [property`SplitButton`:py:data::icon-name<Adw.SplitButton.props.icon_name>] to
NULL
.
- Adw.SplitButton.props.direction¶
- Name:
direction
- Type:
- Default Value:
- Flags:
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.
If you pass
GTK_ARROW_NONE
, it’s equivalent toGTK_ARROW_DOWN
.
- Adw.SplitButton.props.dropdown_tooltip¶
- Name:
dropdown-tooltip
- Type:
- Default Value:
''
- Flags:
The tooltip of the dropdown button.
The tooltip can be marked up with the Pango text markup language.
New in version 1.2.
- Adw.SplitButton.props.icon_name¶
- Name:
icon-name
- Type:
- Default Value:
- Flags:
The name of the icon used to automatically populate the button.
Setting the icon name will set [property`SplitButton`:py:data::label<Adw.SplitButton.props.label>] and [property`SplitButton`:py:data::child<Adw.SplitButton.props.child>] to
NULL
.
- Adw.SplitButton.props.label¶
- Name:
label
- Type:
- Default Value:
- Flags:
The label for the button.
Setting the label will set [property`SplitButton`:py:data::icon-name<Adw.SplitButton.props.icon_name>] and [property`SplitButton`:py:data::child<Adw.SplitButton.props.child>] to
NULL
.
- Adw.SplitButton.props.menu_model¶
- Name:
menu-model
- Type:
- Default Value:
- Flags:
The
GMenuModel
from which the popup will be created.If the menu model is
NULL
, the dropdown is disabled.A [class`Gtk`.Popover] will be created from the menu model with [ctor`Gtk`.PopoverMenu.new_from_model]. Actions will be connected as documented for this function.
If [property`SplitButton`:py:data::popover<Adw.SplitButton.props.popover>] is already set, it will be dissociated from the button, and the property is set to
NULL
.
- Adw.SplitButton.props.popover¶
- Name:
popover
- Type:
- Default Value:
- Flags:
The
GtkPopover
that will be popped up when the dropdown is clicked.If the popover is
NULL
, the dropdown is disabled.If [property`SplitButton`:py:data::menu-model<Adw.SplitButton.props.menu_model>] is set, the menu model is dissociated from the button, and the property is set to
NULL
.