[][src]Struct libhandy4::Avatar

pub struct Avatar(_);

Implementations

impl Avatar[src]

pub fn new(size: i32, text: Option<&str>, show_initials: bool) -> Avatar[src]

Creates a new Avatar.

size

The size of the avatar

text

The text used to generate the color and initials if show_initials is true. The color is selected at random if text is empty.

show_initials

whether to show the initials or the fallback icon on top of the color generated based on text.

Returns

the newly created Avatar

pub fn draw_to_pixbuf(&self, size: i32, scale_factor: i32) -> Option<Pixbuf>[src]

Renders self into a pixbuf at size and scale_factor. This can be used to export the fallback avatar.

size

The size of the pixbuf

scale_factor

The scale factor

Returns

the pixbuf.

pub fn get_icon_name(&self) -> Option<GString>[src]

Gets the name of the icon in the icon theme to use when the icon should be displayed.

Returns

the name of the icon from the icon theme.

pub fn get_show_initials(&self) -> bool[src]

Returns whether initials are used for the fallback or the icon.

Returns

true if the initials are used for the fallback.

pub fn get_size(&self) -> i32[src]

Returns the size of the avatar.

Returns

the size of the avatar.

pub fn get_text(&self) -> Option<GString>[src]

Get the text used to generate the fallback initials and color

Returns

returns the text used to generate the fallback initials. This is the internal string used by the Avatar, and must not be modified.

pub fn set_icon_name(&self, icon_name: Option<&str>)[src]

Sets the name of the icon in the icon theme to use when the icon should be displayed. 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.

icon_name

the name of the icon from the icon theme

pub fn set_image_load_func(
    &self,
    load_image: Option<Box_<dyn Fn(i32) -> Option<Pixbuf> + 'static>>
)
[src]

A callback which is called when the custom image need to be reloaded for some reason (e.g. scale-factor changes).

load_image

callback to set a custom image

user_data

user data passed to load_image

destroy

destroy notifier for user_data

pub fn set_show_initials(&self, show_initials: bool)[src]

Sets whether the initials should be shown on the fallback avatar or the icon.

show_initials

whether the initials should be shown on the fallback avatar or the icon.

pub fn set_size(&self, size: i32)[src]

Sets the size of the avatar.

size

The size to be used for the avatar

pub fn set_text(&self, text: Option<&str>)[src]

Set the text used to generate the fallback initials color

text

the text used to get the initials and color

pub fn connect_property_icon_name_notify<F: Fn(&Avatar) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_show_initials_notify<F: Fn(&Avatar) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_size_notify<F: Fn(&Avatar) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_text_notify<F: Fn(&Avatar) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Trait Implementations

impl Clone for Avatar[src]

impl Debug for Avatar[src]

impl Display for Avatar[src]

impl Eq for Avatar[src]

impl Hash for Avatar[src]

impl IsA<Accessible> for Avatar[src]

impl IsA<Buildable> for Avatar[src]

impl IsA<ConstraintTarget> for Avatar[src]

impl IsA<Widget> for Avatar[src]

impl Ord for Avatar[src]

impl ParentClassIs for Avatar[src]

type Parent = Widget

impl<T: ObjectType> PartialEq<T> for Avatar[src]

impl<T: ObjectType> PartialOrd<T> for Avatar[src]

impl StaticType for Avatar[src]

impl StructuralEq for Avatar[src]

Auto Trait Implementations

impl RefUnwindSafe for Avatar[src]

impl !Send for Avatar[src]

impl !Sync for Avatar[src]

impl Unpin for Avatar[src]

impl UnwindSafe for Avatar[src]

Blanket Implementations

impl<O> AccessibleExt for O where
    O: IsA<Accessible>, 

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<O> BuildableExt for O where
    O: IsA<Buildable>, 

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<O> ConstraintTargetExt for O where
    O: IsA<ConstraintTarget>, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<O> WidgetExt for O where
    O: IsA<Widget>, 

impl<O> WidgetExtManual for O where
    O: IsA<Widget>,