gi-adwaita-1.0.6: 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.Avatar

Description

A widget displaying an image, with a generated fallback.

<picture> <source srcset="avatar-dark.png" media="(prefers-color-scheme: dark)"> <img src="avatar.png" alt="avatar"> </picture>

AdwAvatar is a widget that shows a round avatar.

AdwAvatar generates an avatar with the initials of the [propertyavatar:text] on top of a colored background.

The color is picked based on the hash of the [propertyavatar:text].

If [propertyavatar:show-initials] is set to FALSE, [propertyavatar:icon-name] or avatar-default-symbolic is shown instead of the initials.

Use [propertyavatar:custom-image] to set a custom image.

CSS nodes

AdwAvatar has a single CSS node with name avatar.

Synopsis

Exported types

newtype Avatar Source #

Memory-managed wrapper type.

Constructors

Avatar (ManagedPtr Avatar) 

Instances

Instances details
Eq Avatar Source # 
Instance details

Defined in GI.Adw.Objects.Avatar

Methods

(==) :: Avatar -> Avatar -> Bool #

(/=) :: Avatar -> Avatar -> Bool #

GObject Avatar Source # 
Instance details

Defined in GI.Adw.Objects.Avatar

ManagedPtrNewtype Avatar Source # 
Instance details

Defined in GI.Adw.Objects.Avatar

Methods

toManagedPtr :: Avatar -> ManagedPtr Avatar

TypedObject Avatar Source # 
Instance details

Defined in GI.Adw.Objects.Avatar

Methods

glibType :: IO GType

HasParentTypes Avatar Source # 
Instance details

Defined in GI.Adw.Objects.Avatar

IsGValue (Maybe Avatar) Source #

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

Instance details

Defined in GI.Adw.Objects.Avatar

Methods

gvalueGType_ :: IO GType

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

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

type ParentTypes Avatar Source # 
Instance details

Defined in GI.Adw.Objects.Avatar

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

class (GObject o, IsDescendantOf Avatar o) => IsAvatar o Source #

Type class for types which can be safely cast to Avatar, for instance with toAvatar.

Instances

Instances details
(GObject o, IsDescendantOf Avatar o) => IsAvatar o Source # 
Instance details

Defined in GI.Adw.Objects.Avatar

toAvatar :: (MonadIO m, IsAvatar o) => o -> m Avatar Source #

Cast to Avatar, 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, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, drawToTexture, 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, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getCustomImage, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getIconName, 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, getShowInitials, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getText, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

Setters

setAccessibleParent, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCustomImage, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setIconName, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setShowInitials, setSize, setSizeRequest, setStateFlags, setText, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

drawToTexture

avatarDrawToTexture Source #

Arguments

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

self: an avatar

-> Int32

scaleFactor: The scale factor

-> m Texture

Returns: the texture

Renders self into a Texture at scaleFactor.

This can be used to export the fallback avatar.

getCustomImage

avatarGetCustomImage Source #

Arguments

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

self: an avatar

-> m (Maybe Paintable)

Returns: the custom image

Gets the custom image paintable.

getIconName

avatarGetIconName Source #

Arguments

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

self: an avatar

-> m (Maybe Text)

Returns: the icon name

Gets the name of an icon to use as a fallback.

getShowInitials

avatarGetShowInitials Source #

Arguments

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

self: an avatar

-> m Bool

Returns: whether initials are used instead of an icon as fallback

Gets whether initials are used instead of an icon on the fallback avatar.

getSize

avatarGetSize Source #

Arguments

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

self: an avatar

-> m Int32

Returns: the size of the avatar

Gets the size of the avatar.

getText

avatarGetText Source #

Arguments

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

self: an avatar

-> m (Maybe Text)

Returns: the text used to generate the fallback initials and color

Gets the text used to generate the fallback initials and color.

new

avatarNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

size: The size of the avatar

-> Maybe Text

text: the text used to get the initials and color

-> Bool

showInitials: whether to use initials instead of an icon as fallback

-> m Avatar

Returns: the newly created AdwAvatar

Creates a new AdwAvatar.

setCustomImage

avatarSetCustomImage Source #

Arguments

:: (HasCallStack, MonadIO m, IsAvatar a, IsPaintable b) 
=> a

self: an avatar

-> Maybe b

customImage: a custom image

-> m () 

Sets the custom image paintable.

Custom image is displayed instead of initials or icon.

setIconName

avatarSetIconName Source #

Arguments

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

self: an avatar

-> Maybe Text

iconName: the icon name

-> m () 

Sets the name of an icon to use as a fallback.

If no name is set, avatar-default-symbolic will be used.

setShowInitials

avatarSetShowInitials Source #

Arguments

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

self: an avatar

-> Bool

showInitials: whether to use initials instead of an icon as fallback

-> m () 

Sets whether to use initials instead of an icon on the fallback avatar.

See [propertyavatar:icon-name] for how to change the fallback icon.

setSize

avatarSetSize Source #

Arguments

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

self: an avatar

-> Int32

size: The size of the avatar

-> m () 

Sets the size of the avatar.

setText

avatarSetText Source #

Arguments

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

self: an avatar

-> Maybe Text

text: the text used to get the initials and color

-> m () 

Sets the text used to generate the fallback initials and color.

It's only used to generate the color if [propertyavatar:show-initials] is FALSE.

Properties

customImage

A custom image paintable.

Custom image is displayed instead of initials or icon.

clearAvatarCustomImage :: (MonadIO m, IsAvatar o) => o -> m () Source #

Set the value of the “custom-image” property to Nothing. When overloading is enabled, this is equivalent to

clear #customImage

constructAvatarCustomImage :: (IsAvatar o, MonadIO m, IsPaintable a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “custom-image” property. This is rarely needed directly, but it is used by new.

getAvatarCustomImage :: (MonadIO m, IsAvatar o) => o -> m (Maybe Paintable) Source #

Get the value of the “custom-image” property. When overloading is enabled, this is equivalent to

get avatar #customImage

setAvatarCustomImage :: (MonadIO m, IsAvatar o, IsPaintable a) => o -> a -> m () Source #

Set the value of the “custom-image” property. When overloading is enabled, this is equivalent to

set avatar [ #customImage := value ]

iconName

The name of an icon to use as a fallback.

If no name is set, avatar-default-symbolic will be used.

clearAvatarIconName :: (MonadIO m, IsAvatar o) => o -> m () Source #

Set the value of the “icon-name” property to Nothing. When overloading is enabled, this is equivalent to

clear #iconName

constructAvatarIconName :: (IsAvatar 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.

getAvatarIconName :: (MonadIO m, IsAvatar o) => o -> m (Maybe Text) Source #

Get the value of the “icon-name” property. When overloading is enabled, this is equivalent to

get avatar #iconName

setAvatarIconName :: (MonadIO m, IsAvatar o) => o -> Text -> m () Source #

Set the value of the “icon-name” property. When overloading is enabled, this is equivalent to

set avatar [ #iconName := value ]

showInitials

Whether initials are used instead of an icon on the fallback avatar.

See [propertyavatar:icon-name] for how to change the fallback icon.

constructAvatarShowInitials :: (IsAvatar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “show-initials” property. This is rarely needed directly, but it is used by new.

getAvatarShowInitials :: (MonadIO m, IsAvatar o) => o -> m Bool Source #

Get the value of the “show-initials” property. When overloading is enabled, this is equivalent to

get avatar #showInitials

setAvatarShowInitials :: (MonadIO m, IsAvatar o) => o -> Bool -> m () Source #

Set the value of the “show-initials” property. When overloading is enabled, this is equivalent to

set avatar [ #showInitials := value ]

size

The size of the avatar.

constructAvatarSize :: (IsAvatar o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “size” property. This is rarely needed directly, but it is used by new.

getAvatarSize :: (MonadIO m, IsAvatar o) => o -> m Int32 Source #

Get the value of the “size” property. When overloading is enabled, this is equivalent to

get avatar #size

setAvatarSize :: (MonadIO m, IsAvatar o) => o -> Int32 -> m () Source #

Set the value of the “size” property. When overloading is enabled, this is equivalent to

set avatar [ #size := value ]

text

Sets the text used to generate the fallback initials and color.

It's only used to generate the color if [propertyavatar:show-initials] is FALSE.

clearAvatarText :: (MonadIO m, IsAvatar o) => o -> m () Source #

Set the value of the “text” property to Nothing. When overloading is enabled, this is equivalent to

clear #text

constructAvatarText :: (IsAvatar o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “text” property. This is rarely needed directly, but it is used by new.

getAvatarText :: (MonadIO m, IsAvatar o) => o -> m (Maybe Text) Source #

Get the value of the “text” property. When overloading is enabled, this is equivalent to

get avatar #text

setAvatarText :: (MonadIO m, IsAvatar o) => o -> Text -> m () Source #

Set the value of the “text” property. When overloading is enabled, this is equivalent to

set avatar [ #text := value ]