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.
HdyAvatar
is a widget to display a round avatar.
A provided image is made round before displaying, if no image is given this
widget generates a round fallback 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
,
avatar-default-symbolic
is shown instead of the initials.
Use [methodavatar
.set_loadable_icon] or [propertyavatar
:loadable-icon] to
set a custom image.
CSS nodes
HdyAvatar
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
- avatarDrawToPixbuf :: (HasCallStack, MonadIO m, IsAvatar a) => a -> Int32 -> Int32 -> m Pixbuf
- avatarDrawToPixbufAsync :: (HasCallStack, MonadIO m, IsAvatar a, IsCancellable b) => a -> Int32 -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- avatarDrawToPixbufFinish :: (HasCallStack, MonadIO m, IsAvatar a, IsAsyncResult b) => a -> b -> m Pixbuf
- avatarGetIconName :: (HasCallStack, MonadIO m, IsAvatar a) => a -> m (Maybe Text)
- avatarGetLoadableIcon :: (HasCallStack, MonadIO m, IsAvatar a) => a -> m (Maybe LoadableIcon)
- 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
- avatarSetIconName :: (HasCallStack, MonadIO m, IsAvatar a) => a -> Maybe Text -> m ()
- avatarSetImageLoadFunc :: (HasCallStack, MonadIO m, IsAvatar a) => a -> Maybe AvatarImageLoadFunc -> m ()
- avatarSetLoadableIcon :: (HasCallStack, MonadIO m, IsAvatar a, IsLoadableIcon b) => a -> Maybe b -> 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 ()
- 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 ()
- clearAvatarLoadableIcon :: (MonadIO m, IsAvatar o) => o -> m ()
- constructAvatarLoadableIcon :: (IsAvatar o, MonadIO m, IsLoadableIcon a) => a -> m (GValueConstruct o)
- getAvatarLoadableIcon :: (MonadIO m, IsAvatar o) => o -> m (Maybe LoadableIcon)
- setAvatarLoadableIcon :: (MonadIO m, IsAvatar o, IsLoadableIcon a) => o -> a -> 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.Handy.Objects.Avatar | |
ManagedPtrNewtype Avatar Source # | |
Defined in GI.Handy.Objects.Avatar toManagedPtr :: Avatar -> ManagedPtr Avatar | |
TypedObject Avatar Source # | |
Defined in GI.Handy.Objects.Avatar | |
HasParentTypes Avatar Source # | |
Defined in GI.Handy.Objects.Avatar | |
IsGValue (Maybe Avatar) Source # | Convert |
Defined in GI.Handy.Objects.Avatar gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Avatar -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Avatar) | |
type ParentTypes Avatar Source # | |
Defined in GI.Handy.Objects.Avatar type ParentTypes Avatar = '[DrawingArea, Widget, Object, ImplementorIface, Buildable] |
class (GObject o, IsDescendantOf Avatar o) => IsAvatar o Source #
Instances
(GObject o, IsDescendantOf Avatar o) => IsAvatar o Source # | |
Defined in GI.Handy.Objects.Avatar |
Methods
Click to display all available methods, including inherited ones
Methods
activate, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, childFocus, childNotify, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, destroy, destroyed, deviceIsShadowed, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, drawToPixbuf, drawToPixbufAsync, drawToPixbufFinish, ensureStyle, errorBell, event, forceFloating, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetStateFlags, watchClosure.
Getters
getAccessible, getActionGroup, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getCanDefault, getCanFocus, getChildRequisition, getChildVisible, getClip, getClipboard, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEvents, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getIconName, getInternalChild, getLoadableIcon, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentWindow, getPath, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getShowInitials, getSize, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getText, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.
Setters
setAccelPath, setAllocation, setAppPaintable, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEvents, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setIconName, setImageLoadFunc, setLoadableIcon, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setProperty, setRealized, setReceivesDefault, setRedrawOnAllocate, setSensitive, setShowInitials, setSize, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setText, setTooltipMarkup, setTooltipText, setTooltipWindow, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.
drawToPixbuf
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m Pixbuf | Returns: the pixbuf |
Renders self
into a Pixbuf
at size
and scaleFactor
.
This can be used to export the fallback avatar.
Since: 1.2
drawToPixbufAsync
avatarDrawToPixbufAsync Source #
:: (HasCallStack, MonadIO m, IsAvatar a, IsCancellable b) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Renders asynchronously self
into a pixbuf at size
and scaleFactor
.
This can be used to export the fallback avatar.
Since: 1.2
drawToPixbufFinish
avatarDrawToPixbufFinish Source #
:: (HasCallStack, MonadIO m, IsAvatar a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m Pixbuf | Returns: the resulting pixbuf |
Finishes an asynchronous draw of an avatar to a pixbuf.
Since: 1.2
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
getLoadableIcon
avatarGetLoadableIcon Source #
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> m (Maybe LoadableIcon) | Returns: the |
Gets the LoadableIcon
set via [methodavatar
.set_loadable_icon].
Since: 1.2
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 HdyAvatar
.
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
setImageLoadFunc
avatarSetImageLoadFunc Source #
:: (HasCallStack, MonadIO m, IsAvatar a) | |
=> a |
|
-> Maybe AvatarImageLoadFunc |
|
-> m () |
Deprecated: (Since version 1.2)use [methodavatar
.set_loadable_icon] instead.
A callback which is called when the custom image needs to be reloaded.
It will be called on [propertyavatar
:size] or
Widget:scaleFactor changes.
Since: 1.0
setLoadableIcon
avatarSetLoadableIcon Source #
:: (HasCallStack, MonadIO m, IsAvatar a, IsLoadableIcon b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the LoadableIcon
to use as an avatar.
The previous avatar is displayed till the new avatar is loaded, to
immediately remove the custom avatar set the loadable-icon to NULL
.
The LoadableIcon
set via this function is preferred over a set
[callbackavatarImageLoadFunc
].
Since: 1.2
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 () |
Set the text used to generate the fallback initials color.
Since: 1.0
Properties
iconName
The name of an icon to use as a fallback.
If no name is set, the avatar-default-symbolic icon will be used. If the name doesn't match a valid icon, it is an error and no icon will be displayed. If the icon theme is changed, the image will be updated automatically.
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 ]
loadableIcon
A LoadableIcon
used to load the avatar.
Since: 1.2
clearAvatarLoadableIcon :: (MonadIO m, IsAvatar o) => o -> m () Source #
Set the value of the “loadable-icon
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#loadableIcon
constructAvatarLoadableIcon :: (IsAvatar o, MonadIO m, IsLoadableIcon a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “loadable-icon
” property. This is rarely needed directly, but it is used by new
.
getAvatarLoadableIcon :: (MonadIO m, IsAvatar o) => o -> m (Maybe LoadableIcon) Source #
Get the value of the “loadable-icon
” property.
When overloading is enabled, this is equivalent to
get
avatar #loadableIcon
setAvatarLoadableIcon :: (MonadIO m, IsAvatar o, IsLoadableIcon a) => o -> a -> m () Source #
Set the value of the “loadable-icon
” property.
When overloading is enabled, this is equivalent to
set
avatar [ #loadableIcon:=
value ]
showInitials
Whether to show the initials or the fallback icon on the generated avatar.
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 avatar 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 ]