gtkmm: Gtk::IconPaintable Class Reference

gtkmm 4.13.2

Public Member Functions | Static Public Member Functions | Related Functions | 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. More...
const GtkIconPaintable * | gobj () const
| Provides access to the underlying C GObject. More...
GtkIconPaintable * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::RefPtr< Gio::File > | get_file () const
| Gets the `Gio::File` that was used to load the icon. More...
Glib::ustring | get_icon_name () const
| Get the icon name being used for this icon. More...
bool | is_symbolic () const
| Checks if the icon is symbolic or not. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > | property_file () const
| The file representing the icon, if any. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_icon_name () const
| The icon name that was chosen during lookup. More...
Glib::PropertyProxy_ReadOnly< bool > | property_is_symbolic () const
| Whether the icon is symbolic or not. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const
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. More...
const GdkPaintable * | gobj () const
| Provides access to the underlying C GObject. More...
void | snapshot (const Glib::RefPtr< Gdk::Snapshot > & snapshot, double width, double height)
| Snapshots the given paintable with the given width and height. More...
Glib::RefPtr< const Paintable > | get_current_image () const
| Gets an immutable paintable for the current contents displayed by paintable. More...
Flags | get_flags () const
| Get flags for the paintable. More...
int | get_intrinsic_width () const
| Gets the preferred width the paintable would like to be displayed at. More...
int | get_intrinsic_height () const
| Gets the preferred height the paintable would like to be displayed at. More...
double | get_intrinsic_aspect_ratio () const
| Gets the preferred aspect ratio the paintable would like to be displayed at. More...
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`. More...
void | invalidate_contents ()
| Called by implementations of `Gdk::Paintable` to invalidate their contents. More...
void | invalidate_size ()
| Called by implementations of `Gdk::Paintable` to invalidate their size. More...
Glib::SignalProxy< void()> | signal_invalidate_contents ()
Glib::SignalProxy< void()> | signal_invalidate_size ()
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
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. More...
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. More...

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

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify
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 Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
Protected Member Functions inherited from Gdk::Paintable
| Paintable ()
| You should derive from this class to use it. More...
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 Function 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.