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 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
.
Since: 1.0
Synopsis
- newtype Avatar = Avatar (ManagedPtr Avatar)
- class (GObject o, IsDescendantOf Avatar o) => IsAvatar o
- toAvatar :: (MonadIO m, IsAvatar o) => o -> m Avatar
- avatarDrawToTexture :: (HasCallStack, MonadIO m, IsAvatar a) => a -> Int32 -> m Texture
- avatarGetCustomImage :: (HasCallStack, MonadIO m, IsAvatar a) => a -> m (Maybe Paintable)
- avatarGetIconName :: (HasCallStack, MonadIO m, IsAvatar a) => a -> m (Maybe Text)
- avatarGetShowInitials :: (HasCallStack, MonadIO m, IsAvatar a) => a -> m Bool
- avatarGetSize :: (HasCallStack, MonadIO m, IsAvatar a) => a -> m Int32
- avatarGetText :: (HasCallStack, MonadIO m, IsAvatar a) => a -> m (Maybe Text)
- avatarNew :: (HasCallStack, MonadIO m) => Int32 -> Maybe Text -> Bool -> m Avatar
- avatarSetCustomImage :: (HasCallStack, MonadIO m, IsAvatar a, IsPaintable b) => a -> Maybe b -> m ()
- avatarSetIconName :: (HasCallStack, MonadIO m, IsAvatar a) => a -> Maybe Text -> m ()
- avatarSetShowInitials :: (HasCallStack, MonadIO m, IsAvatar a) => a -> Bool -> m ()
- avatarSetSize :: (HasCallStack, MonadIO m, IsAvatar a) => a -> Int32 -> m ()
- avatarSetText :: (HasCallStack, MonadIO m, IsAvatar a) => a -> Maybe Text -> m ()
- clearAvatarCustomImage :: (MonadIO m, IsAvatar o) => o -> m ()
- constructAvatarCustomImage :: (IsAvatar o, MonadIO m, IsPaintable a) => a -> m (GValueConstruct o)
- getAvatarCustomImage :: (MonadIO m, IsAvatar o) => o -> m (Maybe Paintable)
- setAvatarCustomImage :: (MonadIO m, IsAvatar o, IsPaintable a) => o -> a -> m ()
- clearAvatarIconName :: (MonadIO m, IsAvatar o) => o -> m ()
- constructAvatarIconName :: (IsAvatar o, MonadIO m) => Text -> m (GValueConstruct o)
- getAvatarIconName :: (MonadIO m, IsAvatar o) => o -> m (Maybe Text)
- setAvatarIconName :: (MonadIO m, IsAvatar o) => o -> Text -> m ()
- constructAvatarShowInitials :: (IsAvatar o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAvatarShowInitials :: (MonadIO m, IsAvatar o) => o -> m Bool
- setAvatarShowInitials :: (MonadIO m, IsAvatar o) => o -> Bool -> m ()
- constructAvatarSize :: (IsAvatar o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getAvatarSize :: (MonadIO m, IsAvatar o) => o -> m Int32
- setAvatarSize :: (MonadIO m, IsAvatar o) => o -> Int32 -> m ()
- clearAvatarText :: (MonadIO m, IsAvatar o) => o -> m ()
- constructAvatarText :: (IsAvatar o, MonadIO m) => Text -> m (GValueConstruct o)
- getAvatarText :: (MonadIO m, IsAvatar o) => o -> m (Maybe Text)
- setAvatarText :: (MonadIO m, IsAvatar o) => o -> Text -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Avatar Source # | |
GObject Avatar Source # | |
Defined in GI.Adw.Objects.Avatar | |
ManagedPtrNewtype Avatar Source # | |
Defined in GI.Adw.Objects.Avatar toManagedPtr :: Avatar -> ManagedPtr Avatar | |
TypedObject Avatar Source # | |
Defined in GI.Adw.Objects.Avatar | |
HasParentTypes Avatar Source # | |
Defined in GI.Adw.Objects.Avatar | |
IsGValue (Maybe Avatar) Source # | Convert |
Defined in GI.Adw.Objects.Avatar gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Avatar -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Avatar) | |
type ParentTypes Avatar Source # | |
Defined in GI.Adw.Objects.Avatar type ParentTypes Avatar = '[Widget, Object, Accessible, Buildable, ConstraintTarget] |
class (GObject o, IsDescendantOf Avatar o) => IsAvatar o Source #
Instances
(GObject o, IsDescendantOf Avatar o) => IsAvatar o Source # | |
Defined in GI.Adw.Objects.Avatar |
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, 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, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getCustomImage, getData, getDirection, getDisplay, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getIconName, 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, getShowInitials, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getText, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.
Setters
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
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> Int32 |
|
-> m Texture | Returns: the texture |
Renders self
into a Texture
at scaleFactor
.
This can be used to export the fallback avatar.
Since: 1.0
getCustomImage
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> m (Maybe Paintable) | Returns: the custom image |
Gets the custom image paintable.
Since: 1.0
getIconName
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> m (Maybe Text) | Returns: the icon name |
Gets the name of an icon to use as a fallback.
Since: 1.0
getShowInitials
avatarGetShowInitials Source #
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> 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.
Since: 1.0
getSize
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> m Int32 | Returns: the size of the avatar |
Gets the size of the avatar.
Since: 1.0
getText
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> 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.
Since: 1.0
new
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> Maybe Text |
|
-> Bool |
|
-> m Avatar | Returns: the newly created |
Creates a new AdwAvatar
.
Since: 1.0
setCustomImage
:: (HasCallStack, MonadIO m, IsAvatar a, IsPaintable b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the custom image paintable.
Since: 1.0
setIconName
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the name of an icon to use as a fallback.
If no name is set, avatar-default-symbolic
will be used.
Since: 1.0
setShowInitials
avatarSetShowInitials Source #
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether to use initials instead of an icon on the fallback avatar.
Since: 1.0
setSize
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the size of the avatar.
Since: 1.0
setText
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the text used to generate the fallback initials and color.
Since: 1.0
Properties
customImage
A custom image to use instead of initials or icon.
Since: 1.0
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.
Since: 1.0
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.
Since: 1.0
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.
Since: 1.0
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
.
Since: 1.0
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 ]