| 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
╰── box
├── image
╰── labelAdwButtonContent's CSS node is called buttoncontent. It contains a box
subnode that serves as a container for the image and label nodes.
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.
Synopsis
- newtype ButtonContent = ButtonContent (ManagedPtr ButtonContent)
- class (GObject o, IsDescendantOf ButtonContent o) => IsButtonContent o
- toButtonContent :: (MonadIO m, IsButtonContent o) => o -> m ButtonContent
- buttonContentGetCanShrink :: (HasCallStack, MonadIO m, IsButtonContent a) => a -> m Bool
- 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
- buttonContentSetCanShrink :: (HasCallStack, MonadIO m, IsButtonContent a) => a -> Bool -> m ()
- 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 ()
- constructButtonContentCanShrink :: (IsButtonContent o, MonadIO m) => Bool -> m (GValueConstruct o)
- getButtonContentCanShrink :: (MonadIO m, IsButtonContent o) => o -> m Bool
- setButtonContentCanShrink :: (MonadIO m, IsButtonContent o) => o -> 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, announce, 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, updateNextAccessibleSibling, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanShrink, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getIconName, getLabel, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, 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
setAccessibleParent, setCanFocus, setCanShrink, 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.
getCanShrink
buttonContentGetCanShrink Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> m Bool | Returns: whether the button can shrink |
gets whether the button can be smaller than the natural size of its contents.
Since: 1.4
getIconName
buttonContentGetIconName Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> m Text | Returns: the icon name |
Gets the name of the displayed icon.
getLabel
buttonContentGetLabel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> m Text | Returns: the label |
Gets the displayed label.
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.
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m ButtonContent | Returns: the new created |
Creates a new AdwButtonContent.
setCanShrink
buttonContentSetCanShrink Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> Bool |
|
| -> m () |
Sets whether the button can be smaller than the natural size of its contents.
If set to TRUE, the label will ellipsize.
See buttonSetCanShrink.
Since: 1.4
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.
setLabel
buttonContentSetLabel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsButtonContent a) | |
| => a |
|
| -> Text |
|
| -> m () |
Sets the displayed label.
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].
Properties
canShrink
Whether the button can be smaller than the natural size of its contents.
If set to TRUE, the label will ellipsize.
See Button:canShrink.
Since: 1.4
constructButtonContentCanShrink :: (IsButtonContent o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “can-shrink” property. This is rarely needed directly, but it is used by new.
getButtonContentCanShrink :: (MonadIO m, IsButtonContent o) => o -> m Bool Source #
Get the value of the “can-shrink” property.
When overloading is enabled, this is equivalent to
get buttonContent #canShrink
setButtonContentCanShrink :: (MonadIO m, IsButtonContent o) => o -> Bool -> m () Source #
Set the value of the “can-shrink” property.
When overloading is enabled, this is equivalent to
setbuttonContent [ #canShrink:=value ]
iconName
The name of the displayed icon.
If empty, the icon is not shown.
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.
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].
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 ]