Avatar
Object Hierarchy:
Hdy.Avatar
Hdy.Avatar
Hdy.Avatar
Gtk.DrawingArea
Gtk.DrawingArea
Gtk.DrawingArea->Hdy.Avatar
Gtk.Widget
Gtk.Widget
Gtk.Widget->Gtk.DrawingArea
GLib.InitiallyUnowned
GLib.InitiallyUnowned
GLib.InitiallyUnowned->Gtk.Widget
GLib.Object
GLib.Object
GLib.Object->GLib.InitiallyUnowned
Atk.Implementor
Atk.Implementor
Atk.Implementor->Hdy.Avatar
Atk.Implementor->Gtk.DrawingArea
Atk.Implementor->Gtk.Widget
Gtk.Buildable
Gtk.Buildable
Gtk.Buildable->Hdy.Avatar
Gtk.Buildable->Gtk.DrawingArea
Gtk.Buildable->Gtk.Widget
Description:
[ CCode ( type_id = "hdy_avatar_get_type ()" ) ] [ Version ( since = "1.0" ) ]public class Avatar : DrawingArea , Implementor , Buildable
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 [
property@Avatar:text] on top of a colored background.
The color is picked based on the hash of the [property@Avatar:text].
If [property@Avatar:show-initials] is set to `FALSE`, `avatar-default-symbolic` is shown instead of the initials.
Use [[email protected] _loadable_icon] or [property@Avatar:loadable-icon] to set a custom image.
CSS nodes
`HdyAvatar` has a single CSS node with name `avatar`.
Content:
Properties:
public string icon_name { get ; set ; }
The name of an icon to use as a fallback.
public LoadableIcon loadable_icon { get ; set ; }
A [iface@Gio.
public bool show_initials { get ; set ; }
Whether to show the initials or the fallback icon on the generated
avatar.
public int size { get ; set ; }
The avatar size of the avatar.
public string text { get ; set ; }
Sets the text used to generate the fallback initials and color.
Creation methods:
Methods:
public Pixbuf draw_to_pixbuf (int size, int scale_factor)
Renders this into a [
class@GdkPixbuf.
public async Pixbuf draw_to_pixbuf_async (int size, int scale_factor, Cancellable ? cancellable)
Renders asynchronously this into a
pixbuf at size
and scale_factor
.
public unowned string ? get_icon_name ()
Gets the name of an icon to use as a fallback.
public unowned LoadableIcon ? get_loadable_icon ()
Gets the [iface@Gio.
public bool get_show_initials ()
Gets whether initials are used instead of an icon on the fallback
avatar.
public int get_size ()
Gets the size of the avatar.
public unowned string ? get_text ()
Gets the text used to generate the fallback initials and color.
public void set_icon_name (string ? icon_name)
Sets the name of an icon to use as a fallback.
public void set_image_load_func (owned AvatarImageLoadFunc ? load_image)
A callback which is called when the custom image needs to be reloaded.
public void set_loadable_icon (LoadableIcon ? icon)
Sets the [iface@Gio.
public void set_show_initials (bool show_initials)
Sets whether to use initials instead of an icon on the fallback
avatar.
public void set_size (int size)
Sets the size of the avatar.
public void set_text (string ? text)
Set the text used to generate the fallback initials color.
Inherited Members:
All known members inherited from class Gtk.Widget
All known members inherited from class GLib.Object
@get
@new
@ref
@set
add_toggle_ref
add_weak_pointer
bind_property
connect
constructed
disconnect
dispose
dup_data
dup_qdata
force_floating
freeze_notify
get_class
get_data
get_property
get_qdata
get_type
getv
interface_find_property
interface_install_property
interface_list_properties
is_floating
new_valist
new_with_properties
newv
notify
notify_property
ref_count
ref_sink
remove_toggle_ref
remove_weak_pointer
replace_data
replace_qdata
set_data
set_data_full
set_property
set_qdata
set_qdata_full
set_valist
setv
steal_data
steal_qdata
thaw_notify
unref
watch_closure
weak_ref
weak_unref
All known members inherited from interface Atk.Implementor
All known members inherited from interface Gtk.Buildable
add_child
construct_child
custom_finished
custom_tag_end
custom_tag_start
get_internal_child
get_name
parser_finished
set_buildable_property
set_name