About all my projects
Gnome::Gtk4::IconPaintable

Gnome::Gtk4::IconPaintable

Description

Contains information found when looking up an icon in Gnome::Gtk4::IconTheme.

Gnome::Gtk4::IconPaintable implements Gnome::Gdk4::R-Paintable.

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

new-for-file

Creates a Gnome::Gtk4::IconPaintable for a file with a given size and scale.

The icon can then be rendered by using it as a Gnome::Gdk4::R-Paintable.

method new-for-file ( N-Object() $file, Int() $size, Int() $scale --> Gnome::Gtk4::IconPaintable \)
  • $file; a Gnome::Gio::R-File.

  • $size; desired icon size.

  • $scale; the desired scale.

Methods

get-file

Gets the Gnome::Gio::R-File that was used to load the icon.

Returns undefined if the icon was not loaded from a file.

method get-file (--> N-Object )

Return value; the Gnome::Gio::R-File for the icon.

get-icon-name

Get the icon name being used for this icon.

When an icon looked up in the icon theme was not available, the icon theme may use fallback icons - either those specified to gtk_icon_theme_lookup_icon() or the always-available "image-missing". The icon chosen is returned by this function.

If the icon was created without an icon theme, this function returns undefined.

method get-icon-name (--> Str )

Return value; the themed icon-name for the icon, or undefined if its not a themed icon..

is-symbolic

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.

Note that to render a symbolic Gnome::Gtk4::IconPaintable properly (with recoloring), you have to set its icon name on a Gnome::Gtk4::Image.

method is-symbolic (--> Bool )

Return value; True if the icon is symbolic, False otherwise.