Package ch.bailu.gtk.adw
Class SplitButton
- All Implemented Interfaces:
PointerInterface
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 called `splitbutton`. It contains the css
nodes: `button`, `separator`, `menubutton`. See [class@Gtk.MenuButton]
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.
## Accessibility
`AdwSplitButton` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
<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 called `splitbutton`. It contains the css
nodes: `button`, `separator`, `menubutton`. See [class@Gtk.MenuButton]
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.
## Accessibility
`AdwSplitButton` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.SplitButton.html
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gtk.Widget
Widget.OnDestroy, Widget.OnDestroyNotify, Widget.OnDirectionChanged, Widget.OnHide, Widget.OnKeynavFailed, Widget.OnMap, Widget.OnMnemonicActivate, Widget.OnMoveFocus, Widget.OnQueryTooltip, Widget.OnRealize, Widget.OnShow, Widget.OnStateFlagsChanged, Widget.OnTickCallback, Widget.OnUnmap, Widget.OnUnrealize
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gtk.Widget
SIGNAL_ON_DESTROY, SIGNAL_ON_DIRECTION_CHANGED, SIGNAL_ON_HIDE, SIGNAL_ON_KEYNAV_FAILED, SIGNAL_ON_MAP, SIGNAL_ON_MNEMONIC_ACTIVATE, SIGNAL_ON_MOVE_FOCUS, SIGNAL_ON_QUERY_TOOLTIP, SIGNAL_ON_REALIZE, SIGNAL_ON_SHOW, SIGNAL_ON_STATE_FLAGS_CHANGED, SIGNAL_ON_UNMAP, SIGNAL_ON_UNREALIZE
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionImplements interfaceAccessible
.Implements interfaceActionable
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.getChild()
Gets the child widget.static ClassHandler
int
Gets the direction in which the popup will be popped up.Gets the tooltip of the dropdown button of @self.Gets the name of the icon used to automatically populate the button.static int
getLabel()
Gets the label for @self.Gets the menu model from which the popup will be created.static long
static TypeSystem.TypeSize
Gets the popover that will be popped up when the dropdown is clicked.static long
static TypeSystem.TypeSize
boolean
Gets whether an underline in the text indicates a mnemonic.onActivate
(SplitButton.OnActivate signal) Connect to signal "activate".onClicked
(SplitButton.OnClicked signal) Connect to signal "clicked".void
popdown()
Dismisses the menu.void
popup()
Pops up the menu.void
Sets the child widget.void
setDirection
(int direction) Sets the direction in which the popup will be popped up.void
setDropdownTooltip
(Str tooltip) Sets the tooltip of the dropdown button of @self.void
setDropdownTooltip
(String tooltip) Sets the tooltip of the dropdown button of @self.void
setIconName
(Str icon_name) Sets the name of the icon used to automatically populate the button.void
setIconName
(String icon_name) Sets the name of the icon used to automatically populate the button.void
Sets the label for @self.void
Sets the label for @self.void
setMenuModel
(MenuModel menu_model) Sets the menu model from which the popup will be created.void
setPopover
(Popover popover) Sets the popover that will be popped up when the dropdown is clicked.void
setUseUnderline
(boolean use_underline) Sets whether an underline in the text indicates a mnemonic.Methods inherited from class ch.bailu.gtk.gtk.Widget
actionSetEnabled, actionSetEnabled, activate, activateAction, activateAction, activateActionVariant, activateActionVariant, activateDefault, addController, addCssClass, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getDefaultDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeCssClass, removeMnemonicLabel, removeTickCallback, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCursorFromName, setDefaultDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipMarkup, setTooltipText, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, snapshotChild, triggerTooltipQuery, unmap, unparent, unrealize, unsetStateFlags
Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_ACTIVATE
- See Also:
-
SIGNAL_ON_CLICKED
- See Also:
-
-
Constructor Details
-
SplitButton
-
SplitButton
public SplitButton()Creates a new `AdwSplitButton`.
-
-
Method Details
-
getClassHandler
-
getChild
Gets the child widget.- Returns:
- the child widget
-
getDirection
public int getDirection()Gets the direction in which the popup will be popped up.- Overrides:
getDirection
in classWidget
- Returns:
- the direction
-
getDropdownTooltip
Gets the tooltip of the dropdown button of @self.- Returns:
- the dropdown tooltip of @self
-
getIconName
Gets the name of the icon used to automatically populate the button.- Returns:
- the icon name
-
getLabel
Gets the label for @self.- Returns:
- the label for @self
-
getMenuModel
Gets the menu model from which the popup will be created.- Returns:
- the menu model
-
getPopover
Gets the popover that will be popped up when the dropdown is clicked.- Returns:
- the popover
-
getUseUnderline
public boolean getUseUnderline()Gets whether an underline in the text indicates a mnemonic.- Returns:
- whether an underline in the text indicates a mnemonic
-
popdown
public void popdown()Dismisses the menu. -
popup
public void popup()Pops up the menu. -
setChild
Sets the child widget.
Setting the child widget will set [property@SplitButton:label] and
[property@SplitButton:icon-name] to `NULL`.- Parameters:
child
- the new child widget
-
setDirection
public void setDirection(int 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 to `GTK_ARROW_DOWN`.- Overrides:
setDirection
in classWidget
- Parameters:
direction
- the direction
-
setDropdownTooltip
Sets the tooltip of the dropdown button of @self.
The tooltip can be marked up with the Pango text markup language.- Parameters:
tooltip
- the dropdown tooltip of @self
-
setDropdownTooltip
Sets the tooltip of the dropdown button of @self.
The tooltip can be marked up with the Pango text markup language.- Parameters:
tooltip
- the dropdown tooltip of @self
-
setIconName
Sets the name of the icon used to automatically populate the button.
Setting the icon name will set [property@SplitButton:label] and
[property@SplitButton:child] to `NULL`.- Parameters:
icon_name
- the icon name to set
-
setIconName
Sets the name of the icon used to automatically populate the button.
Setting the icon name will set [property@SplitButton:label] and
[property@SplitButton:child] to `NULL`.- Parameters:
icon_name
- the icon name to set
-
setLabel
Sets the label for @self.
Setting the label will set [property@SplitButton:icon-name] and
[property@SplitButton:child] to `NULL`.- Parameters:
label
- the label to set
-
setLabel
Sets the label for @self.
Setting the label will set [property@SplitButton:icon-name] and
[property@SplitButton:child] to `NULL`.- Parameters:
label
- the label to set
-
setMenuModel
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:popover] is already set, it will be dissociated from
the button, and the property is set to `NULL`.- Parameters:
menu_model
- the menu model
-
setPopover
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:menu-model] is set, the menu model is dissociated
from the button, and the property is set to `NULL`.- Parameters:
popover
- the popover
-
setUseUnderline
public void setUseUnderline(boolean use_underline) Sets whether an underline in the text indicates a mnemonic.
See [property@SplitButton:label].- Parameters:
use_underline
- whether an underline in the text indicates a mnemonic
-
onActivate
Connect to signal "activate".
SeeSplitButton.OnActivate.onActivate()
for signal description.
FieldSIGNAL_ON_ACTIVATE
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onClicked
Connect to signal "clicked".
SeeSplitButton.OnClicked.onClicked()
for signal description.
FieldSIGNAL_ON_CLICKED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Overrides:
asAccessible
in classWidget
- Returns:
Accessible
-
asActionable
Implements interfaceActionable
. Call this to get access to interface functions.- Returns:
Actionable
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Overrides:
asBuildable
in classWidget
- Returns:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Overrides:
asConstraintTarget
in classWidget
- Returns:
ConstraintTarget
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-