Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 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.
Accessibility
AdwSplitButton
uses the GTK_ACCESSIBLE_ROLE_GROUP
role.
Since: 1.0
Synopsis
- newtype SplitButton = SplitButton (ManagedPtr SplitButton)
- class (GObject o, IsDescendantOf SplitButton o) => IsSplitButton o
- toSplitButton :: (MonadIO m, IsSplitButton o) => o -> m SplitButton
- splitButtonGetChild :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m (Maybe Widget)
- splitButtonGetDirection :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m ArrowType
- splitButtonGetIconName :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m (Maybe Text)
- splitButtonGetLabel :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m (Maybe Text)
- splitButtonGetMenuModel :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m (Maybe MenuModel)
- splitButtonGetPopover :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m (Maybe Popover)
- splitButtonGetUseUnderline :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m Bool
- splitButtonNew :: (HasCallStack, MonadIO m) => m SplitButton
- splitButtonPopdown :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m ()
- splitButtonPopup :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> m ()
- splitButtonSetChild :: (HasCallStack, MonadIO m, IsSplitButton a, IsWidget b) => a -> Maybe b -> m ()
- splitButtonSetDirection :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> ArrowType -> m ()
- splitButtonSetIconName :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> Text -> m ()
- splitButtonSetLabel :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> Text -> m ()
- splitButtonSetMenuModel :: (HasCallStack, MonadIO m, IsSplitButton a, IsMenuModel b) => a -> Maybe b -> m ()
- splitButtonSetPopover :: (HasCallStack, MonadIO m, IsSplitButton a, IsPopover b) => a -> Maybe b -> m ()
- splitButtonSetUseUnderline :: (HasCallStack, MonadIO m, IsSplitButton a) => a -> Bool -> m ()
- clearSplitButtonChild :: (MonadIO m, IsSplitButton o) => o -> m ()
- constructSplitButtonChild :: (IsSplitButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getSplitButtonChild :: (MonadIO m, IsSplitButton o) => o -> m (Maybe Widget)
- setSplitButtonChild :: (MonadIO m, IsSplitButton o, IsWidget a) => o -> a -> m ()
- constructSplitButtonDirection :: (IsSplitButton o, MonadIO m) => ArrowType -> m (GValueConstruct o)
- getSplitButtonDirection :: (MonadIO m, IsSplitButton o) => o -> m ArrowType
- setSplitButtonDirection :: (MonadIO m, IsSplitButton o) => o -> ArrowType -> m ()
- constructSplitButtonIconName :: (IsSplitButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getSplitButtonIconName :: (MonadIO m, IsSplitButton o) => o -> m (Maybe Text)
- setSplitButtonIconName :: (MonadIO m, IsSplitButton o) => o -> Text -> m ()
- constructSplitButtonLabel :: (IsSplitButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getSplitButtonLabel :: (MonadIO m, IsSplitButton o) => o -> m (Maybe Text)
- setSplitButtonLabel :: (MonadIO m, IsSplitButton o) => o -> Text -> m ()
- clearSplitButtonMenuModel :: (MonadIO m, IsSplitButton o) => o -> m ()
- constructSplitButtonMenuModel :: (IsSplitButton o, MonadIO m, IsMenuModel a) => a -> m (GValueConstruct o)
- getSplitButtonMenuModel :: (MonadIO m, IsSplitButton o) => o -> m (Maybe MenuModel)
- setSplitButtonMenuModel :: (MonadIO m, IsSplitButton o, IsMenuModel a) => o -> a -> m ()
- clearSplitButtonPopover :: (MonadIO m, IsSplitButton o) => o -> m ()
- constructSplitButtonPopover :: (IsSplitButton o, MonadIO m, IsPopover a) => a -> m (GValueConstruct o)
- getSplitButtonPopover :: (MonadIO m, IsSplitButton o) => o -> m (Maybe Popover)
- setSplitButtonPopover :: (MonadIO m, IsSplitButton o, IsPopover a) => o -> a -> m ()
- constructSplitButtonUseUnderline :: (IsSplitButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSplitButtonUseUnderline :: (MonadIO m, IsSplitButton o) => o -> m Bool
- setSplitButtonUseUnderline :: (MonadIO m, IsSplitButton o) => o -> Bool -> m ()
- type SplitButtonActivateCallback = IO ()
- afterSplitButtonActivate :: (IsSplitButton a, MonadIO m) => a -> ((?self :: a) => SplitButtonActivateCallback) -> m SignalHandlerId
- onSplitButtonActivate :: (IsSplitButton a, MonadIO m) => a -> ((?self :: a) => SplitButtonActivateCallback) -> m SignalHandlerId
- type SplitButtonClickedCallback = IO ()
- afterSplitButtonClicked :: (IsSplitButton a, MonadIO m) => a -> ((?self :: a) => SplitButtonClickedCallback) -> m SignalHandlerId
- onSplitButtonClicked :: (IsSplitButton a, MonadIO m) => a -> ((?self :: a) => SplitButtonClickedCallback) -> m SignalHandlerId
Exported types
newtype SplitButton Source #
Memory-managed wrapper type.
SplitButton (ManagedPtr SplitButton) |
Instances
Eq SplitButton Source # | |
Defined in GI.Adw.Objects.SplitButton (==) :: SplitButton -> SplitButton -> Bool # (/=) :: SplitButton -> SplitButton -> Bool # | |
GObject SplitButton Source # | |
Defined in GI.Adw.Objects.SplitButton | |
ManagedPtrNewtype SplitButton Source # | |
Defined in GI.Adw.Objects.SplitButton toManagedPtr :: SplitButton -> ManagedPtr SplitButton | |
TypedObject SplitButton Source # | |
Defined in GI.Adw.Objects.SplitButton | |
HasParentTypes SplitButton Source # | |
Defined in GI.Adw.Objects.SplitButton | |
IsGValue (Maybe SplitButton) Source # | Convert |
Defined in GI.Adw.Objects.SplitButton gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe SplitButton -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe SplitButton) | |
type ParentTypes SplitButton Source # | |
Defined in GI.Adw.Objects.SplitButton type ParentTypes SplitButton = '[Widget, Object, Accessible, Actionable, Buildable, ConstraintTarget] |
class (GObject o, IsDescendantOf SplitButton o) => IsSplitButton o Source #
Type class for types which can be safely cast to SplitButton
, for instance with toSplitButton
.
Instances
(GObject o, IsDescendantOf SplitButton o) => IsSplitButton o Source # | |
Defined in GI.Adw.Objects.SplitButton |
toSplitButton :: (MonadIO m, IsSplitButton o) => o -> m SplitButton Source #
Cast to SplitButton
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, popdown, popup, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleRole, getActionName, getActionTargetValue, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBuildableId, getCanFocus, getCanTarget, getChild, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getIconName, getLabel, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMenuModel, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPopover, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getUseUnderline, getValign, getVexpand, getVexpandSet, getVisible, getWidth.
Setters
setActionName, setActionTargetValue, setCanFocus, setCanTarget, setChild, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDetailedActionName, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setIconName, setLabel, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMenuModel, setName, setOpacity, setOverflow, setParent, setPopover, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible.
getChild
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the child widget |
Gets the child widget.
Since: 1.0
getDirection
splitButtonGetDirection Source #
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m ArrowType | Returns: the direction |
Gets the direction in which the popup will be popped up.
Since: 1.0
getIconName
splitButtonGetIconName Source #
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m (Maybe Text) | Returns: the icon name |
Gets the name of the icon used to automatically populate the button.
If the icon name has not been set with [methodsplitButton
.set_icon_name]
the return value will be NULL
.
Since: 1.0
getLabel
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m (Maybe Text) | Returns: the label for |
Gets the label for self
.
Since: 1.0
getMenuModel
splitButtonGetMenuModel Source #
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m (Maybe MenuModel) | Returns: the menu model |
Gets the menu model from which the popup will be created.
Since: 1.0
getPopover
splitButtonGetPopover Source #
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m (Maybe Popover) | Returns: the popover |
Gets the popover that will be popped up when the dropdown is clicked.
Since: 1.0
getUseUnderline
splitButtonGetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m Bool | Returns: whether an underline in the text indicates a mnemonic |
Gets whether an underline in the text indicates a mnemonic.
Since: 1.0
new
:: (HasCallStack, MonadIO m) | |
=> m SplitButton | Returns: the newly created |
Creates a new AdwSplitButton
.
Since: 1.0
popdown
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m () |
Dismisses the menu.
Since: 1.0
popup
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> m () |
Pops up the menu.
Since: 1.0
setChild
:: (HasCallStack, MonadIO m, IsSplitButton a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the child widget.
Since: 1.0
setDirection
splitButtonSetDirection Source #
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> ArrowType |
|
-> m () |
Sets the direction in which the popup will be popped up.
Since: 1.0
setIconName
splitButtonSetIconName Source #
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the name of the icon used to automatically populate the button.
Since: 1.0
setLabel
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the label for self
.
Since: 1.0
setMenuModel
splitButtonSetMenuModel Source #
:: (HasCallStack, MonadIO m, IsSplitButton a, IsMenuModel b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the menu model from which the popup will be created.
Since: 1.0
setPopover
splitButtonSetPopover Source #
:: (HasCallStack, MonadIO m, IsSplitButton a, IsPopover b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the popover that will be popped up when the dropdown is clicked.
Since: 1.0
setUseUnderline
splitButtonSetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsSplitButton a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether an underline in the text indicates a mnemonic.
Since: 1.0
Properties
child
The child widget.
Setting the child widget will set [propertysplitButton
:label] and
[propertysplitButton
:icon-name] to NULL
.
Since: 1.0
clearSplitButtonChild :: (MonadIO m, IsSplitButton o) => o -> m () Source #
Set the value of the “child
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#child
constructSplitButtonChild :: (IsSplitButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “child
” property. This is rarely needed directly, but it is used by new
.
getSplitButtonChild :: (MonadIO m, IsSplitButton o) => o -> m (Maybe Widget) Source #
Get the value of the “child
” property.
When overloading is enabled, this is equivalent to
get
splitButton #child
setSplitButtonChild :: (MonadIO m, IsSplitButton o, IsWidget a) => o -> a -> m () Source #
Set the value of the “child
” property.
When overloading is enabled, this is equivalent to
set
splitButton [ #child:=
value ]
direction
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 its best to keep it inside the screen and fully visible.
If you pass GTK_ARROW_NONE
, it's equivalent to GTK_ARROW_DOWN
.
Since: 1.0
constructSplitButtonDirection :: (IsSplitButton o, MonadIO m) => ArrowType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “direction
” property. This is rarely needed directly, but it is used by new
.
getSplitButtonDirection :: (MonadIO m, IsSplitButton o) => o -> m ArrowType Source #
Get the value of the “direction
” property.
When overloading is enabled, this is equivalent to
get
splitButton #direction
setSplitButtonDirection :: (MonadIO m, IsSplitButton o) => o -> ArrowType -> m () Source #
Set the value of the “direction
” property.
When overloading is enabled, this is equivalent to
set
splitButton [ #direction:=
value ]
iconName
The name of the icon used to automatically populate the button.
Setting the icon name will set [propertysplitButton
:label] and
[propertysplitButton
:child] to NULL
.
Since: 1.0
constructSplitButtonIconName :: (IsSplitButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “icon-name
” property. This is rarely needed directly, but it is used by new
.
getSplitButtonIconName :: (MonadIO m, IsSplitButton o) => o -> m (Maybe Text) Source #
Get the value of the “icon-name
” property.
When overloading is enabled, this is equivalent to
get
splitButton #iconName
setSplitButtonIconName :: (MonadIO m, IsSplitButton o) => o -> Text -> m () Source #
Set the value of the “icon-name
” property.
When overloading is enabled, this is equivalent to
set
splitButton [ #iconName:=
value ]
label
The label for the button.
Setting the label will set [propertysplitButton
:icon-name] and
[propertysplitButton
:child] to NULL
.
Since: 1.0
constructSplitButtonLabel :: (IsSplitButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “label
” property. This is rarely needed directly, but it is used by new
.
getSplitButtonLabel :: (MonadIO m, IsSplitButton o) => o -> m (Maybe Text) Source #
Get the value of the “label
” property.
When overloading is enabled, this is equivalent to
get
splitButton #label
setSplitButtonLabel :: (MonadIO m, IsSplitButton o) => o -> Text -> m () Source #
Set the value of the “label
” property.
When overloading is enabled, this is equivalent to
set
splitButton [ #label:=
value ]
menuModel
The GMenuModel
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 with
popoverMenuNewFromModel
. Actions will be connected
as documented for this function.
If [propertysplitButton
:popover] is already set, it will be dissociated
from the button, and the property is set to NULL
.
Since: 1.0
clearSplitButtonMenuModel :: (MonadIO m, IsSplitButton o) => o -> m () Source #
Set the value of the “menu-model
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#menuModel
constructSplitButtonMenuModel :: (IsSplitButton o, MonadIO m, IsMenuModel a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “menu-model
” property. This is rarely needed directly, but it is used by new
.
getSplitButtonMenuModel :: (MonadIO m, IsSplitButton o) => o -> m (Maybe MenuModel) Source #
Get the value of the “menu-model
” property.
When overloading is enabled, this is equivalent to
get
splitButton #menuModel
setSplitButtonMenuModel :: (MonadIO m, IsSplitButton o, IsMenuModel a) => o -> a -> m () Source #
Set the value of the “menu-model
” property.
When overloading is enabled, this is equivalent to
set
splitButton [ #menuModel:=
value ]
popover
The GtkPopover
that will be popped up when the dropdown is clicked.
If the popover is NULL
, the dropdown is disabled.
If [propertysplitButton
:menu-model] is set, the menu model is dissociated
from the button, and the property is set to NULL
.
Since: 1.0
clearSplitButtonPopover :: (MonadIO m, IsSplitButton o) => o -> m () Source #
Set the value of the “popover
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#popover
constructSplitButtonPopover :: (IsSplitButton o, MonadIO m, IsPopover a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “popover
” property. This is rarely needed directly, but it is used by new
.
getSplitButtonPopover :: (MonadIO m, IsSplitButton o) => o -> m (Maybe Popover) Source #
Get the value of the “popover
” property.
When overloading is enabled, this is equivalent to
get
splitButton #popover
setSplitButtonPopover :: (MonadIO m, IsSplitButton o, IsPopover a) => o -> a -> m () Source #
Set the value of the “popover
” property.
When overloading is enabled, this is equivalent to
set
splitButton [ #popover:=
value ]
useUnderline
Whether an underline in the text indicates a mnemonic.
See [propertysplitButton
:label].
Since: 1.0
constructSplitButtonUseUnderline :: (IsSplitButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-underline
” property. This is rarely needed directly, but it is used by new
.
getSplitButtonUseUnderline :: (MonadIO m, IsSplitButton o) => o -> m Bool Source #
Get the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
get
splitButton #useUnderline
setSplitButtonUseUnderline :: (MonadIO m, IsSplitButton o) => o -> Bool -> m () Source #
Set the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
set
splitButton [ #useUnderline:=
value ]
Signals
activate
type SplitButtonActivateCallback = IO () Source #
Emitted to animate press then release.
This is an action signal. Applications should never connect to this signal,
but use the signalsplitButton
[clicked] signal.
Since: 1.0
afterSplitButtonActivate :: (IsSplitButton a, MonadIO m) => a -> ((?self :: a) => SplitButtonActivateCallback) -> m SignalHandlerId Source #
Connect a signal handler for the activate signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
splitButton #activate callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSplitButtonActivate :: (IsSplitButton a, MonadIO m) => a -> ((?self :: a) => SplitButtonActivateCallback) -> m SignalHandlerId Source #
Connect a signal handler for the activate signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
splitButton #activate callback
clicked
type SplitButtonClickedCallback = IO () Source #
Emitted when the button has been activated (pressed and released).
Since: 1.0
afterSplitButtonClicked :: (IsSplitButton a, MonadIO m) => a -> ((?self :: a) => SplitButtonClickedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the clicked signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
splitButton #clicked callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSplitButtonClicked :: (IsSplitButton a, MonadIO m) => a -> ((?self :: a) => SplitButtonClickedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the clicked signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
splitButton #clicked callback