adw.avatar

Module for [Avatar] class

Types 3

A widget displaying an image, with a generated fallback.

avatar

adw.avatar.Avatar is a widget that shows a round avatar.

adw.avatar.Avatar generates an avatar with the initials of the adw.avatar.Avatar.text on top of a colored background.

The color is picked based on the hash of the adw.avatar.Avatar.text.

If adw.avatar.Avatar.showInitials is set to FALSE, adw.avatar.Avatar.iconName or avatar-default-symbolic is shown instead of the initials.

Use adw.avatar.Avatar.customImage to set a custom image.

CSS nodes

adw.avatar.Avatar has a single CSS node with name avatar.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
Avatar self() nothrowReturns `this`, for use in `with` statements.
AvatarGidBuilder builder() static nothrowGet builder for [adw.avatar.Avatar] Returns: New builder object
gdk.paintable.Paintable customImage() @property nothrowGet `customImage` property. Returns: A custom image paintable.
void customImage(gdk.paintable.Paintable propval) @property nothrowSet `customImage` property. Params: propval = A custom image paintable.
string iconName() @property nothrowGet `iconName` property. Returns: The name of an icon to use as a fallback.
void iconName(string propval) @property nothrowSet `iconName` property. Params: propval = The name of an icon to use as a fallback.
bool showInitials() @property nothrowGet `showInitials` property. Returns: Whether initials are used instead of an icon on the fallback avatar.
void showInitials(bool propval) @property nothrowSet `showInitials` property. Params: propval = Whether initials are used instead of an icon on the fallback avatar.
int size() @property nothrowGet `size` property. Returns: The size of the avatar.
void size(int propval) @property nothrowSet `size` property. Params: propval = The size of the avatar.
string text() @property nothrowGet `text` property. Returns: Sets the text used to generate the fallback initials and color.
void text(string propval) @property nothrowSet `text` property. Params: propval = Sets the text used to generate the fallback initials and color.
gdk.texture.Texture drawToTexture(int scaleFactor) nothrowRenders self into a [gdk.texture.Texture] at scale_factor.
gdk.paintable.Paintable getCustomImage() nothrowGets the custom image paintable. Returns: the custom image
string getIconName() nothrowGets the name of an icon to use as a fallback. Returns: the icon name
bool getShowInitials() nothrowGets whether initials are used instead of an icon on the fallback avatar. Returns: whether initials are used instead of an icon as fallback
int getSize() nothrowGets the size of the avatar. Returns: the size of the avatar
string getText() nothrowGets the text used to generate the fallback initials and color. Returns: the text used to generate the fallback initials and color
void setCustomImage(gdk.paintable.Paintable customImage = null) nothrowSets the custom image paintable.
void setIconName(string iconName = null) nothrowSets the name of an icon to use as a fallback.
void setShowInitials(bool showInitials) nothrowSets whether to use initials instead of an icon on the fallback avatar.
void setSize(int size) nothrowSets the size of the avatar.
void setText(string text = null) nothrowSets the text used to generate the fallback initials and color.
Constructors
this(void * ptr, Flag!"Take" take)
this(int size, string text, bool showInitials)Creates a new [adw.avatar.Avatar].

Fluent builder implementation template for adw.avatar.Avatar

Methods
T customImage(gdk.paintable.Paintable propval) nothrowSet `customImage` property. Params: propval = A custom image paintable.
T iconName(string propval) nothrowSet `iconName` property. Params: propval = The name of an icon to use as a fallback.
T showInitials(bool propval) nothrowSet `showInitials` property. Params: propval = Whether initials are used instead of an icon on the fallback avatar.
T size(int propval) nothrowSet `size` property. Params: propval = The size of the avatar. Returns: Builder instance for fluent chaining
T text(string propval) nothrowSet `text` property. Params: propval = Sets the text used to generate the fallback initials and color.

Fluent builder for adw.avatar.Avatar

Methods
Avatar build() nothrowCreate object from builder. Returns: New object