Class SplitButton
- All Implemented Interfaces:
Proxy
,Accessible
,Actionable
,Buildable
,ConstraintTarget
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
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theActivateCallback
callback.static class
SplitButton.Builder<B extends SplitButton.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theClickedCallback
callback.static class
Nested 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.WidgetClass, Widget.WidgetImpl
Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.AccessibleImpl, Accessible.AccessibleInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Actionable
Actionable.ActionableImpl, Actionable.ActionableInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.BuildableIface, Buildable.BuildableImpl
Nested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTargetImpl, ConstraintTarget.ConstraintTargetInterface
-
Constructor Summary
ConstructorDescriptionCreates a newAdwSplitButton
.SplitButton
(MemorySegment address) Create a SplitButton proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SplitButton
asParent()
Returns this instance as if it were its parent type.static SplitButton.Builder
<? extends SplitButton.Builder> builder()
ASplitButton.Builder
object constructs aSplitButton
with the specified properties.void
Emits the "activate" signal.void
Emits the "clicked" signal.Gets the direction in which the popup will be popped up.boolean
gets whether the button can be smaller than the natural size of its contents.getChild()
Gets the child widget.Gets the tooltip of the dropdown button of this SplitButton.Gets the name of the icon used to automatically populate the button.getLabel()
Gets the label for this SplitButton.Gets the menu model from which the popup will be created.Gets the popover that will be popped up when the dropdown is clicked.static Type
getType()
Get the GType of the SplitButton classboolean
Gets 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).void
popdown()
Dismisses the menu.void
popup()
Pops up the menu.void
setCanShrink
(boolean canShrink) Sets whether the button can be smaller than the natural size of its contents.void
Sets the child widget.void
setDirection
(ArrowType direction) Sets the direction in which the popup will be popped up.void
setDropdownTooltip
(String tooltip) Sets the tooltip of the dropdown button of this SplitButton.void
setIconName
(String iconName) Sets the name of the icon used to automatically populate the button.void
Sets the label for this SplitButton.void
setMenuModel
(@Nullable MenuModel menuModel) Sets the menu model from which the popup will be created.void
setPopover
(@Nullable Popover popover) Sets the popover that will be popped up when the dropdown is clicked.void
setUseUnderline
(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, 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, 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, unsetStateFlags
Methods 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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updateProperty, updateRelation, updateState
Methods inherited from interface org.gnome.gtk.Actionable
getActionName, getActionTargetValue, setActionName, setActionTarget, setActionTargetValue, setDetailedActionName
Methods 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 newAdwSplitButton
.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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
-
getChild
-
getArrowDirection
Gets the direction in which the popup will be popped up.- Returns:
- the direction
-
getDropdownTooltip
Gets the tooltip of the dropdown button of this SplitButton.- Returns:
- the dropdown tooltip of this SplitButton
-
getIconName
Gets the name of the icon used to automatically populate the button.- Returns:
- the icon name
-
getLabel
Gets the label for this SplitButton.- Returns:
- the label for this SplitButton
-
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
-
setChild
Sets the child widget.Setting the child widget will set
SplitButton:label
andSplitButton:icon-name
toNULL
.- 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 of this SplitButton.The tooltip can be marked up with the Pango text markup language.
- Parameters:
tooltip
- the dropdown tooltip of this SplitButton
-
setIconName
Sets the name of the icon used to automatically populate the button.Setting the icon name will set
SplitButton:label
andSplitButton:child
toNULL
.- Parameters:
iconName
- the icon name to set
-
setLabel
Sets the label for this SplitButton.Setting the label will set
SplitButton:icon-name
andSplitButton:child
toNULL
.- 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
Popover
will be created from the menu model withPopoverMenu.fromModel(org.gnome.gio.MenuModel)
. 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 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-model
is 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::clicked
signal.- 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.Builder
object constructs aSplitButton
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withSplitButton.Builder.build()
.
-