gi-handy-1.0.4: libhandy bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Handy.Objects.Avatar

Description

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

Exported types

newtype Avatar Source #

Memory-managed wrapper type.

Constructors

Avatar (ManagedPtr Avatar) 

Instances

Instances details
Eq Avatar Source # 
Instance details

Defined in GI.Handy.Objects.Avatar

Methods

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

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

GObject Avatar Source # 
Instance details

Defined in GI.Handy.Objects.Avatar

ManagedPtrNewtype Avatar Source # 
Instance details

Defined in GI.Handy.Objects.Avatar

Methods

toManagedPtr :: Avatar -> ManagedPtr Avatar

TypedObject Avatar Source # 
Instance details

Defined in GI.Handy.Objects.Avatar

Methods

glibType :: IO GType

HasParentTypes Avatar Source # 
Instance details

Defined in GI.Handy.Objects.Avatar

IsGValue (Maybe Avatar) Source #

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

Instance details

Defined in GI.Handy.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.Handy.Objects.Avatar

type ParentTypes Avatar = '[DrawingArea, Widget, Object, ImplementorIface, Buildable]

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

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

avatarDrawToPixbuf Source #

Arguments

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

self: an avatar

-> Int32

size: the size of the pixbuf

-> Int32

scaleFactor: the scale factor

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

Arguments

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

self: an avatar

-> Int32

size: the size of the pixbuf

-> Int32

scaleFactor: the scale factor

-> Maybe b

cancellable: a cancellable

-> Maybe AsyncReadyCallback

callback: a [callbackgio.AsyncReadyCallback] to call when the avatar is generated

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

Arguments

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

self: an avatar

-> b

asyncResult: a AsyncResult

-> m Pixbuf

Returns: the resulting pixbuf

Finishes an asynchronous draw of an avatar to a pixbuf.

Since: 1.2

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.

Since: 1.0

getLoadableIcon

avatarGetLoadableIcon Source #

Arguments

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

self: an avatar

-> m (Maybe LoadableIcon)

Returns: the LoadableIcon

Gets the LoadableIcon set via [methodavatar.set_loadable_icon].

Since: 1.2

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.

Since: 1.0

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.

Since: 1.0

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.

Since: 1.0

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 HdyAvatar

Creates a new HdyAvatar.

Since: 1.0

setIconName

avatarSetIconName Source #

Arguments

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

self: an avatar

-> Maybe Text

iconName: the name of the icon from the icon theme

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

Arguments

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

self: an avatar

-> Maybe AvatarImageLoadFunc

loadImage: callback to set a custom image

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

Arguments

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

self: an avatar

-> Maybe b

icon: a LoadableIcon

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

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.

Since: 1.0

setSize

avatarSetSize Source #

Arguments

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

self: an avatar

-> Int32

size: the size to be used for the avatar

-> m () 

Sets the size of the avatar.

Since: 1.0

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

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 ]