Class SplitButton
- All Implemented Interfaces:
Accessible,Actionable,Buildable,ConstraintTarget,Proxy
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 Button and 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 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.
Style classes
AdwSplitButton can use some of the same style classes as Button:
Other style classes, like .pill, cannot be used.
Accessibility
AdwSplitButton uses the GTK_ACCESSIBLE_ROLE_GROUP role.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theActivateCallbackcallback.static classSplitButton.Builder<B extends SplitButton.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theClickedCallbackcallback.static classNested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.Widget$Impl, Widget.WidgetClassNested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.Accessible$Impl, Accessible.AccessibleInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Actionable
Actionable.Actionable$Impl, Actionable.ActionableInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterface -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SplitButton.SplitButton(MemorySegment address) Create a SplitButton proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SplitButtonasParent()Returns this instance as if it were its parent type.static SplitButton.Builder<? extends SplitButton.Builder> builder()ASplitButton.Builderobject constructs aSplitButtonwith the specified properties.voidEmits the "activate" signal.voidEmits the "clicked" signal.Gets the direction in which the popup will be popped up.booleangets whether the button can be smaller than the natural size of its contents.@Nullable WidgetgetChild()Gets the child widget.Gets the tooltip of the dropdown button ofself.@Nullable StringGets the name of the icon used to automatically populate the button.@Nullable StringgetLabel()Gets the label forself.@Nullable MenuModelGets the menu model from which the popup will be created.@Nullable PopoverGets the popover that will be popped up when the dropdown is clicked.static @Nullable TypegetType()Get the GType of the SplitButton classbooleanGets whether an underline in the text indicates a mnemonic.onActivate(SplitButton.ActivateCallback handler) Emitted to animate press then release.onClicked(SplitButton.ClickedCallback handler) Emitted when the button has been activated (pressed and released).voidpopdown()Dismisses the menu.voidpopup()Pops up the menu.voidsetCanShrink(boolean canShrink) Sets whether the button can be smaller than the natural size of its contents.voidSets the child widget.voidsetDirection(ArrowType direction) Sets the direction in which the popup will be popped up.voidsetDropdownTooltip(String tooltip) Sets the tooltip of the dropdown button ofself.voidsetIconName(String iconName) Sets the name of the icon used to automatically populate the button.voidSets the label forself.voidsetMenuModel(@Nullable MenuModel menuModel) Sets the menu model from which the popup will be created.voidsetPopover(@Nullable Popover popover) Sets the popover that will be popped up when the dropdown is clicked.voidsetUseUnderline(boolean useUnderline) Sets whether an underline in the text indicates a mnemonic.Methods inherited from class org.gnome.gtk.Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMemoryLayout, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlagsMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateStateMethods inherited from interface org.gnome.gtk.Actionable
getActionName, getActionTargetValue, setActionName, setActionTarget, setActionTargetValue, setDetailedActionNameMethods inherited from interface org.gnome.gtk.Buildable
getBuildableId
-
Constructor Details
-
SplitButton
Create a SplitButton proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
SplitButton
public SplitButton()Creates a new SplitButton.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getCanShrink
public boolean getCanShrink()gets whether the button can be smaller than the natural size of its contents.- Returns:
- whether the button can shrink
- Since:
- 1.4
-
getChild
-
getArrowDirection
Gets the direction in which the popup will be popped up.- Returns:
- the direction
-
getDropdownTooltip
Gets the tooltip of the dropdown button ofself.- Returns:
- the dropdown tooltip of this SplitButton
- Since:
- 1.2
-
getIconName
Gets the name of the icon used to automatically populate the button.- Returns:
- the icon name
-
getLabel
-
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. -
setCanShrink
public void setCanShrink(boolean canShrink) Sets whether the button can be smaller than the natural size of its contents.If set to
TRUE, the label will ellipsize.See
Button.setCanShrink(boolean)andMenuButton.setCanShrink(boolean).- Parameters:
canShrink- whether the button can shrink- Since:
- 1.4
-
setChild
Sets the child widget.Setting the child widget will set
SplitButton:labelandSplitButton:icon-nametoNULL.- Parameters:
child- the new child widget
-
setDirection
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.- Parameters:
direction- the direction
-
setDropdownTooltip
Sets the tooltip of the dropdown button ofself.The tooltip can be marked up with the Pango text markup language.
- Parameters:
tooltip- the dropdown tooltip of this SplitButton- Since:
- 1.2
-
setIconName
Sets the name of the icon used to automatically populate the button.Setting the icon name will set
SplitButton:labelandSplitButton:childtoNULL.- Parameters:
iconName- the icon name to set
-
setLabel
Sets the label forself.Setting the label will set
SplitButton:icon-nameandSplitButton:childtoNULL.- 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
Popoverwill be created from the menu model withPopoverMenu.fromModel(org.gnome.gio.MenuModel). Actions will be connected as documented for this function.If
SplitButton:popoveris already set, it will be dissociated from the button, and the property is set toNULL.- Parameters:
menuModel- 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
SplitButton:menu-modelis set, the menu model is dissociated from the button, and the property is set toNULL.- Parameters:
popover- the popover
-
setUseUnderline
public void setUseUnderline(boolean useUnderline) Sets whether an underline in the text indicates a mnemonic.See
SplitButton:label.- Parameters:
useUnderline- whether an underline in the text indicates a mnemonic
-
onActivate
public SignalConnection<SplitButton.ActivateCallback> onActivate(SplitButton.ActivateCallback handler) Emitted to animate press then release.This is an action signal. Applications should never connect to this signal, but use the
SplitButton::clickedsignal.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitActivate
public void emitActivate()Emits the "activate" signal. SeeonActivate(org.gnome.adw.SplitButton.ActivateCallback). -
onClicked
Emitted when the button has been activated (pressed and released).- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitClicked
public void emitClicked()Emits the "clicked" signal. SeeonClicked(org.gnome.adw.SplitButton.ClickedCallback). -
builder
ASplitButton.Builderobject constructs aSplitButtonwith the specified properties. Use the variousset...()methods to set properties, and finish construction withSplitButton.Builder.build().- Returns:
- the builder object
-