| 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 |
GI.Adw.Objects.ButtonContent
Description
A helper widget for creating buttons.
<picture> <source srcset="button-content-dark.png" media="(prefers-color-scheme: dark)"> <img src="button-content.png" alt="button-content"> </picture>
AdwButtonContent is a box-like widget with an icon and a label.
It's intended to be used as a direct child of Button,
MenuButton or [classsplitButton], when they need to have both an
icon and a label, as follows:
xml code
<object class="GtkButton">
<property name="child">
<object class="AdwButtonContent">
<property name="icon-name">document-open-symbolic</property>
<property name="label" translatable="yes">_Open</property>
<property name="use-underline">True</property>
</object>
</property>
</object>AdwButtonContent handles style classes and connecting the mnemonic to the
button automatically.
CSS nodes
buttoncontent ├── image ╰── label
AdwButtonContent's CSS node is called buttoncontent. It contains the
subnodes image and label.
When inside a GtkButton or AdwSplitButton, the button will receive the
.image-text-button style class. When inside a GtkMenuButton, the
internal GtkButton will receive it instead.
Accessibility
AdwButtonContent uses the GTK_ACCESSIBLE_ROLE_GROUP role.
Since: 1.0
Synopsis
- newtype ButtonContent = ButtonContent (ManagedPtr ButtonContent)
- class (GObject o, IsDescendantOf ButtonContent o) => IsButtonContent o
- toButtonContent :: (MonadIO m, IsButtonContent o) => o -> m ButtonContent
- buttonContentGetIconName :: (HasCallStack, MonadIO m, IsButtonContent a) => a -> m Text
- buttonContentGetLabel :: (HasCallStack, MonadIO m, IsButtonContent a) => a -> m Text
- buttonContentGetUseUnderline :: (HasCallStack, MonadIO m, IsButtonContent a) => a -> m Bool
- buttonContentNew :: (HasCallStack, MonadIO m) => m ButtonContent
- buttonContentSetIconName :: (HasCallStack, MonadIO m, IsButtonContent a) => a -> Text -> m ()
- buttonContentSetLabel :: (HasCallStack, MonadIO m, IsButtonContent a) => a -> Text -> m ()
- buttonContentSetUseUnderline :: (HasCallStack, MonadIO m, IsButtonContent a) => a -> Bool -> m ()
- constructButtonContentIconName :: (IsButtonContent o, MonadIO m) => Text -> m (GValueConstruct o)
- getButtonContentIconName :: (MonadIO m, IsButtonContent o) => o -> m Text
- setButtonContentIconName :: (MonadIO m, IsButtonContent o) => o -> Text -> m ()
- constructButtonContentLabel :: (IsButtonContent o, MonadIO m) => Text -> m (GValueConstruct o)
- getButtonContentLabel :: (MonadIO m, IsButtonContent o) => o -> m Text
- setButtonContentLabel :: (MonadIO m, IsButtonContent o) => o -> Text -> m ()
- constructButtonContentUseUnderline :: (IsButtonContent o, MonadIO m) => Bool -> m (GValueConstruct o)
- getButtonContentUseUnderline :: (MonadIO m, IsButtonContent o) => o -> m Bool
- setButtonContentUseUnderline :: (MonadIO m, IsButtonContent o) => o -> Bool -> m ()
Exported types
newtype ButtonContent Source #
Memory-managed wrapper type.
Constructors
| ButtonContent (ManagedPtr ButtonContent) |
Instances
class (GObject o, IsDescendantOf ButtonContent o) => IsButtonContent o Source #
Type class for types which can be safely cast to ButtonContent, for instance with toButtonContent.
Instances
| (GObject o, IsDescendantOf ButtonContent o) => IsButtonContent o Source # | |
Defined in GI.Adw.Objects.ButtonContent | |
toButtonContent :: (MonadIO m, IsButtonContent o) => o -> m ButtonContent Source #
Cast to ButtonContent, 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, disposeTemplate, 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, 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, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBuildableId, getCanFocus, getCanTarget, 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, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, 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
setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setIconName, setLabel, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible.
getIconName
buttonContentGetIconName Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> m Text | Returns: the icon name |
Gets the name of the displayed icon.
Since: 1.0
getLabel
buttonContentGetLabel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> m Text | Returns: the label |
Gets the displayed label.
Since: 1.0
getUseUnderline
buttonContentGetUseUnderline Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent 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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m ButtonContent | Returns: the new created |
Creates a new AdwButtonContent.
Since: 1.0
setIconName
buttonContentSetIconName Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> Text |
|
| -> m () |
Sets the name of the displayed icon.
If empty, the icon is not shown.
Since: 1.0
setLabel
buttonContentSetLabel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> Text |
|
| -> m () |
Sets the displayed label.
Since: 1.0
setUseUnderline
buttonContentSetUseUnderline Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> Bool |
|
| -> m () |
Sets whether an underline in the text indicates a mnemonic.
The mnemonic can be used to activate the parent button.
See [propertybuttonContent:label].
Since: 1.0
Properties
iconName
The name of the displayed icon.
If empty, the icon is not shown.
Since: 1.0
constructButtonContentIconName :: (IsButtonContent 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.
getButtonContentIconName :: (MonadIO m, IsButtonContent o) => o -> m Text Source #
Get the value of the “icon-name” property.
When overloading is enabled, this is equivalent to
get buttonContent #iconName
setButtonContentIconName :: (MonadIO m, IsButtonContent o) => o -> Text -> m () Source #
Set the value of the “icon-name” property.
When overloading is enabled, this is equivalent to
setbuttonContent [ #iconName:=value ]
label
The displayed label.
Since: 1.0
constructButtonContentLabel :: (IsButtonContent 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.
getButtonContentLabel :: (MonadIO m, IsButtonContent o) => o -> m Text Source #
Get the value of the “label” property.
When overloading is enabled, this is equivalent to
get buttonContent #label
setButtonContentLabel :: (MonadIO m, IsButtonContent o) => o -> Text -> m () Source #
Set the value of the “label” property.
When overloading is enabled, this is equivalent to
setbuttonContent [ #label:=value ]
useUnderline
Whether an underline in the text indicates a mnemonic.
The mnemonic can be used to activate the parent button.
See [propertybuttonContent:label].
Since: 1.0
constructButtonContentUseUnderline :: (IsButtonContent 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.
getButtonContentUseUnderline :: (MonadIO m, IsButtonContent o) => o -> m Bool Source #
Get the value of the “use-underline” property.
When overloading is enabled, this is equivalent to
get buttonContent #useUnderline
setButtonContentUseUnderline :: (MonadIO m, IsButtonContent o) => o -> Bool -> m () Source #
Set the value of the “use-underline” property.
When overloading is enabled, this is equivalent to
setbuttonContent [ #useUnderline:=value ]