gi-adwaita-1.0.7: Adwaita bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

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
    ╰── label

AdwButtonContent'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

Exported types

newtype ButtonContent Source #

Memory-managed wrapper type.

Constructors

ButtonContent (ManagedPtr ButtonContent) 

Instances

Instances details
Eq ButtonContent Source # 
Instance details

Defined in GI.Adw.Objects.ButtonContent

GObject ButtonContent Source # 
Instance details

Defined in GI.Adw.Objects.ButtonContent

ManagedPtrNewtype ButtonContent Source # 
Instance details

Defined in GI.Adw.Objects.ButtonContent

Methods

toManagedPtr :: ButtonContent -> ManagedPtr ButtonContent

TypedObject ButtonContent Source # 
Instance details

Defined in GI.Adw.Objects.ButtonContent

Methods

glibType :: IO GType

HasParentTypes ButtonContent Source # 
Instance details

Defined in GI.Adw.Objects.ButtonContent

IsGValue (Maybe ButtonContent) Source #

Convert ButtonContent to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Adw.Objects.ButtonContent

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe ButtonContent -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe ButtonContent)

type ParentTypes ButtonContent Source # 
Instance details

Defined in GI.Adw.Objects.ButtonContent

type ParentTypes ButtonContent = '[Widget, Object, Accessible, Buildable, ConstraintTarget]

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

Instances details
(GObject o, IsDescendantOf ButtonContent o) => IsButtonContent o Source # 
Instance details

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

Expand

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

self: a button content

-> 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

self: a button content

-> m Text

Returns: the icon name

Gets the name of the displayed icon.

getLabel

buttonContentGetLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsButtonContent a) 
=> a

self: a button content

-> m Text

Returns: the label

Gets the displayed label.

getUseUnderline

buttonContentGetUseUnderline Source #

Arguments

:: (HasCallStack, MonadIO m, IsButtonContent a) 
=> a

self: a button content

-> m Bool

Returns: whether an underline in the text indicates a mnemonic

Gets whether an underline in the text indicates a mnemonic.

new

buttonContentNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ButtonContent

Returns: the new created AdwButtonContent

Creates a new AdwButtonContent.

setCanShrink

buttonContentSetCanShrink Source #

Arguments

:: (HasCallStack, MonadIO m, IsButtonContent a) 
=> a

self: a button content

-> Bool

canShrink: whether the button can shrink

-> 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

self: a button content

-> Text

iconName: the new icon name

-> 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

self: a button content

-> Text

label: the new label

-> m () 

Sets the displayed label.

setUseUnderline

buttonContentSetUseUnderline Source #

Arguments

:: (HasCallStack, MonadIO m, IsButtonContent a) 
=> a

self: a button content

-> Bool

useUnderline: whether an underline in the text indicates a mnemonic

-> 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

set buttonContent [ #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

set buttonContent [ #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

set buttonContent [ #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

set buttonContent [ #useUnderline := value ]