[]Struct gtk::IconInfo

pub struct IconInfo(_, _);

Contains information found when looking up an icon in an icon theme.

Implements

glib::object::ObjectExt

Implementations

impl IconInfo[src]

pub fn new_for_pixbuf<P: IsA<IconTheme>>(
    icon_theme: &P,
    pixbuf: &Pixbuf
) -> IconInfo
[src]

Creates a IconInfo for a gdk_pixbuf::Pixbuf.

icon_theme

a IconTheme

pixbuf

the pixbuf to wrap in a IconInfo

Returns

a IconInfo

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

Gets the base scale for the icon. The base scale is a scale for the icon that was specified by the icon theme creator. For instance an icon drawn for a high-dpi screen with window scale 2 for a base size of 32 will be 64 pixels tall and have a base scale of 2.

Returns

the base scale

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

Gets the base size for the icon. The base size is a size for the icon that was specified by the icon theme creator. This may be different than the actual size of image; an example of this is small emblem icons that can be attached to a larger icon. These icons will be given the same base size as the larger icons to which they are attached.

Note that for scaled icons the base size does not include the base scale.

Returns

the base size, or 0, if no base size is known for the icon.

pub fn get_filename(&self) -> Option<PathBuf>[src]

Gets the filename for the icon. If the IconLookupFlags::UseBuiltin flag was passed to IconThemeExt::lookup_icon, there may be no filename if a builtin icon is returned; in this case, you should use IconInfo::get_builtin_pixbuf.

Returns

the filename for the icon, or None if IconInfo::get_builtin_pixbuf should be used instead. The return value is owned by GTK+ and should not be modified or freed.

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

Checks if the icon is symbolic or not. This currently uses only the file name and not the file contents for determining this. This behaviour may change in the future.

Returns

true if the icon is symbolic, false otherwise

pub fn load_icon(&self) -> Result<Pixbuf, Error>[src]

Renders an icon previously looked up in an icon theme using IconThemeExt::lookup_icon; the size will be based on the size passed to IconThemeExt::lookup_icon. Note that the resulting pixbuf may not be exactly this size; an icon theme may have icons that differ slightly from their nominal sizes, and in addition GTK+ will avoid scaling icons that it considers sufficiently close to the requested size or for which the source image would have to be scaled up too far. (This maintains sharpness.). This behaviour can be changed by passing the IconLookupFlags::ForceSize flag when obtaining the IconInfo. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size.

Returns

the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use gobject::ObjectExt::unref to release your reference to the icon.

pub fn load_icon_async<P: IsA<Cancellable>, Q: FnOnce(Result<Pixbuf, Error>) + Send + 'static>(
    &self,
    cancellable: Option<&P>,
    callback: Q
)
[src]

Asynchronously load, render and scale an icon previously looked up from the icon theme using IconThemeExt::lookup_icon.

For more details, see IconInfo::load_icon which is the synchronous version of this call.

cancellable

optional gio::Cancellable object, None to ignore

callback

a GAsyncReadyCallback to call when the request is satisfied

user_data

the data to pass to callback function

pub fn load_icon_async_future(
    &self
) -> Pin<Box_<dyn Future<Output = Result<Pixbuf, Error>> + 'static>>
[src]

pub fn load_surface<P: IsA<Window>>(
    &self,
    for_window: Option<&P>
) -> Result<Surface, Error>
[src]

Renders an icon previously looked up in an icon theme using IconThemeExt::lookup_icon; the size will be based on the size passed to IconThemeExt::lookup_icon. Note that the resulting surface may not be exactly this size; an icon theme may have icons that differ slightly from their nominal sizes, and in addition GTK+ will avoid scaling icons that it considers sufficiently close to the requested size or for which the source image would have to be scaled up too far. (This maintains sharpness.). This behaviour can be changed by passing the IconLookupFlags::ForceSize flag when obtaining the IconInfo. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size.

for_window

gdk::Window to optimize drawing for, or None

Returns

the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use cairo_surface_destroy to release your reference to the icon.

pub fn load_symbolic(
    &self,
    fg: &RGBA,
    success_color: Option<&RGBA>,
    warning_color: Option<&RGBA>,
    error_color: Option<&RGBA>
) -> Result<(Pixbuf, bool), Error>
[src]

Loads an icon, modifying it to match the system colours for the foreground, success, warning and error colors provided. If the icon is not a symbolic one, the function will return the result from IconInfo::load_icon.

This allows loading symbolic icons that will match the system theme.

Unless you are implementing a widget, you will want to use gio::ThemedIcon::new_with_default_fallbacks to load the icon.

As implementation details, the icon loaded needs to be of SVG type, contain the “symbolic” term as the last component of the icon name, and use the “fg”, “success”, “warning” and “error” CSS styles in the SVG file itself.

See the Symbolic Icons Specification for more information about symbolic icons.

fg

a gdk::RGBA representing the foreground color of the icon

success_color

a gdk::RGBA representing the warning color of the icon or None to use the default color

warning_color

a gdk::RGBA representing the warning color of the icon or None to use the default color

error_color

a gdk::RGBA representing the error color of the icon or None to use the default color (allow-none)

was_symbolic

a gboolean, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.

Returns

a gdk_pixbuf::Pixbuf representing the loaded icon

pub fn load_symbolic_async<P: IsA<Cancellable>, Q: FnOnce(Result<(Pixbuf, bool), Error>) + Send + 'static>(
    &self,
    fg: &RGBA,
    success_color: Option<&RGBA>,
    warning_color: Option<&RGBA>,
    error_color: Option<&RGBA>,
    cancellable: Option<&P>,
    callback: Q
)
[src]

Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using IconThemeExt::lookup_icon.

For more details, see IconInfo::load_symbolic which is the synchronous version of this call.

fg

a gdk::RGBA representing the foreground color of the icon

success_color

a gdk::RGBA representing the warning color of the icon or None to use the default color

warning_color

a gdk::RGBA representing the warning color of the icon or None to use the default color

error_color

a gdk::RGBA representing the error color of the icon or None to use the default color (allow-none)

cancellable

optional gio::Cancellable object, None to ignore

callback

a GAsyncReadyCallback to call when the request is satisfied

user_data

the data to pass to callback function

pub fn load_symbolic_async_future(
    &self,
    fg: &RGBA,
    success_color: Option<&RGBA>,
    warning_color: Option<&RGBA>,
    error_color: Option<&RGBA>
) -> Pin<Box_<dyn Future<Output = Result<(Pixbuf, bool), Error>> + 'static>>
[src]

pub fn load_symbolic_for_context<P: IsA<StyleContext>>(
    &self,
    context: &P
) -> Result<(Pixbuf, bool), Error>
[src]

Loads an icon, modifying it to match the system colors for the foreground, success, warning and error colors provided. If the icon is not a symbolic one, the function will return the result from IconInfo::load_icon. This function uses the regular foreground color and the symbolic colors with the names “success_color”, “warning_color” and “error_color” from the context.

This allows loading symbolic icons that will match the system theme.

See IconInfo::load_symbolic for more details.

context

a StyleContext

was_symbolic

a gboolean, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.

Returns

a gdk_pixbuf::Pixbuf representing the loaded icon

pub fn load_symbolic_for_context_async<P: IsA<StyleContext>, Q: IsA<Cancellable>, R: FnOnce(Result<(Pixbuf, bool), Error>) + Send + 'static>(
    &self,
    context: &P,
    cancellable: Option<&Q>,
    callback: R
)
[src]

Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using IconThemeExt::lookup_icon.

For more details, see IconInfo::load_symbolic_for_context which is the synchronous version of this call.

context

a StyleContext

cancellable

optional gio::Cancellable object, None to ignore

callback

a GAsyncReadyCallback to call when the request is satisfied

user_data

the data to pass to callback function

pub fn load_symbolic_for_context_async_future<P: IsA<StyleContext> + Clone + 'static>(
    &self,
    context: &P
) -> Pin<Box_<dyn Future<Output = Result<(Pixbuf, bool), Error>> + 'static>>
[src]

Trait Implementations

impl Clone for IconInfo

impl Debug for IconInfo

impl Display for IconInfo[src]

impl Eq for IconInfo

impl Hash for IconInfo

impl Ord for IconInfo

impl<T: ObjectType> PartialEq<T> for IconInfo

impl<T: ObjectType> PartialOrd<T> for IconInfo

impl StaticType for IconInfo

Auto Trait Implementations

impl RefUnwindSafe for IconInfo

impl !Send for IconInfo

impl !Sync for IconInfo

impl Unpin for IconInfo

impl UnwindSafe for IconInfo

Blanket Implementations

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<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

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

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<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

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.