gtkmm: Gtk::IconPaintable Class Reference

gtkmm 4.14.0

Public Member Functions | Static Public Member Functions | Related Symbols | List of all members
Gtk::IconPaintable Class Reference

An icon, used with Gtk::IconTheme. More...

`#include <gtkmm/iconpaintable.h>`

Inheritance diagram for Gtk::IconPaintable:
[legend]

## Public Member Functions
| IconPaintable (IconPaintable &&src) noexcept
IconPaintable & | operator= (IconPaintable &&src) noexcept
| ~IconPaintable () noexcept override
GtkIconPaintable * | gobj ()
| Provides access to the underlying C GObject.
const GtkIconPaintable * | gobj () const
| Provides access to the underlying C GObject.
GtkIconPaintable * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Gio::File > | get_file () const
| Gets the `Gio::File` that was used to load the icon.
Glib::ustring | get_icon_name () const
| Get the icon name being used for this icon.
bool | is_symbolic () const
| Checks if the icon is symbolic or not.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > | property_file () const
| The file representing the icon, if any.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_icon_name () const
| The icon name that was chosen during lookup.
Glib::PropertyProxy_ReadOnly< bool > | property_is_symbolic () const
| Whether the icon is symbolic or not.
Public Member Functions inherited from Gdk::Paintable
| Paintable (Paintable &&src) noexcept
Paintable & | operator= (Paintable &&src) noexcept
| ~Paintable () noexcept override
GdkPaintable * | gobj ()
| Provides access to the underlying C GObject.
const GdkPaintable * | gobj () const
| Provides access to the underlying C GObject.
void | snapshot (const Glib::RefPtr< Gdk::Snapshot > & snapshot, double width, double height)
| Snapshots the given paintable with the given width and height.
Glib::RefPtr< const Paintable > | get_current_image () const
| Gets an immutable paintable for the current contents displayed by paintable.
Flags | get_flags () const
| Get flags for the paintable.
int | get_intrinsic_width () const
| Gets the preferred width the paintable would like to be displayed at.
int | get_intrinsic_height () const
| Gets the preferred height the paintable would like to be displayed at.
double | get_intrinsic_aspect_ratio () const
| Gets the preferred aspect ratio the paintable would like to be displayed at.
void | compute_concrete_size (double specified_width, double specified_height, double default_width, double default_height, double &concrete_width, double &concrete_height) const
| Compute a concrete size for the `Gdk::Paintable`.
void | invalidate_contents ()
| Called by implementations of `Gdk::Paintable` to invalidate their contents.
void | invalidate_size ()
| Called by implementations of `Gdk::Paintable` to invalidate their size.
Glib::SignalProxy< void()> | signal_invalidate_contents ()
Glib::SignalProxy< void()> | signal_invalidate_size ()

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Glib::RefPtr< IconPaintable > | create (const Glib::RefPtr< Gio::File > & file, int size, int scale=1)
| Creates a `Gtk::IconPaintable` for a file with a given size and scale.
Static Public Member Functions inherited from Gdk::Paintable
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::IconPaintable > | wrap (GtkIconPaintable *object, bool take_copy=false)
| A Glib::wrap() method for this object.
Related Symbols inherited from Gdk::Paintable
Glib::RefPtr< Gdk::Paintable > | wrap (GdkPaintable *object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Gdk::Paintable
enum class | Flags { Flags::STATIC_SIZE = 1 << 0 , Flags::STATIC_CONTENTS = 1 << 1 }
| Flags about a paintable object. More...
Protected Member Functions inherited from Gdk::Paintable
| Paintable ()
| You should derive from this class to use it.
virtual void | snapshot_vfunc (const Glib::RefPtr< Gdk::Snapshot > &snapshot, double width, double height)
virtual Glib::RefPtr< Paintable > | get_current_image_vfunc () const
virtual Flags | get_flags_vfunc () const
virtual int | get_intrinsic_width_vfunc () const
virtual int | get_intrinsic_height_vfunc () const
virtual double | get_intrinsic_aspect_ratio_vfunc () const

## Detailed Description

An icon, used with Gtk::IconTheme.

## Constructor & Destructor Documentation

## ◆ IconPaintable()

Gtk::IconPaintable::IconPaintable | ( | IconPaintable && | src | ) |
| noexcept

## ◆ ~IconPaintable()

Gtk::IconPaintable::~IconPaintable | ( |  | ) |
| overridenoexcept

## Member Function Documentation

## ◆ create()

static Glib::RefPtr< IconPaintable > Gtk::IconPaintable::create | ( | const Glib::RefPtr< Gio::File > & | file,
|  | int | size,
|  | int | scale = 1 )
| static

Creates a `Gtk::IconPaintable` for a file with a given size and scale.

The icon can then be rendered by using it as a `Gdk::Paintable`.

Parameters

  file | A `Gio::File`.
  size | Desired icon size.
  scale | The desired scale.

Returns
  A `Gtk::IconPaintable` containing for the icon. Unref with Glib::object_unref().

## ◆ get_file()

Glib::RefPtr< Gio::File > Gtk::IconPaintable::get_file | ( |  | ) | const

Gets the `Gio::File` that was used to load the icon.

Returns
  The `Gio::File` for the icon.

## ◆ get_icon_name()

Glib::ustring Gtk::IconPaintable::get_icon_name | ( |  | ) | const

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::IconTheme::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 `nullptr`.

Returns
  The themed icon-name for the icon, or `nullptr` if its not a themed icon.

## ◆ get_type()

static GType Gtk::IconPaintable::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GtkIconPaintable * Gtk::IconPaintable::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkIconPaintable * Gtk::IconPaintable::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkIconPaintable * Gtk::IconPaintable::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ is_symbolic()

bool Gtk::IconPaintable::is_symbolic | ( |  | ) | const

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 `Gtk::IconPaintable` properly (with recoloring), you have to set its icon name on a `Gtk::Image`.

Returns
  `true` if the icon is symbolic, `false` otherwise.

## ◆ operator=()

IconPaintable & Gtk::IconPaintable::operator= | ( | IconPaintable && | src | ) |
| noexcept

## ◆ property_file()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > Gtk::IconPaintable::property_file | ( |  | ) | const

The file representing the icon, if any.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_icon_name()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::IconPaintable::property_icon_name | ( |  | ) | const

The icon name that was chosen during lookup.

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_is_symbolic()

Glib::PropertyProxy_ReadOnly< bool > Gtk::IconPaintable::property_is_symbolic | ( |  | ) | const

Whether the icon is symbolic or not.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::IconPaintable > wrap | ( | GtkIconPaintable * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.