gtkmm  4.8.0
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:
Inheritance graph
[legend]

Public Member Functions

 IconPaintable (IconPaintable && src) noexcept
 
IconPaintableoperator= (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 Gdk::Paintable
 Paintable (Paintable && src) noexcept
 
Paintableoperator= (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 Paintableget_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 ()
 

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< IconPaintablecreate (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::IconPaintablewrap (GtkIconPaintable * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Additional Inherited Members

- Public Types inherited from Gdk::Paintable
enum class  Flags {
  STATIC_SIZE = 1 << 0 ,
  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. More...
 
virtual void snapshot_vfunc (const Glib::RefPtr< Gdk::Snapshot > &snapshot, double width, double height)
 
virtual Glib::RefPtr< Paintableget_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
fileA Gio::File.
sizeDesired icon size.
scaleThe 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
objectThe C instance.
take_copyFalse 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.