gtkmm
3.93.0
|
#include <gtkmm/iconinfo.h>
Public Member Functions | |
IconInfo (IconInfo&& src) noexcept | |
IconInfo& | operator= (IconInfo&& src) noexcept |
~IconInfo () noexcept override | |
GtkIconInfo* | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkIconInfo* | gobj () const |
Provides access to the underlying C GObject. More... | |
GtkIconInfo* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
int | get_base_size () const |
Gets the base size for the icon. More... | |
int | get_base_scale () const |
Gets the base scale for the icon. More... | |
Glib::ustring | get_filename () const |
Gets the filename for the icon. More... | |
bool | is_symbolic () const |
Checks if the icon is symbolic or not. More... | |
Glib::RefPtr< const Gdk::Pixbuf > | load_icon () const |
Renders an icon previously looked up in an icon theme using Gtk::IconTheme::lookup_icon(); the size will be based on the size passed to Gtk::IconTheme::lookup_icon(). More... | |
Cairo::RefPtr< const Cairo::Surface > | load_surface (const Glib::RefPtr< Gdk::Window >& for_window) const |
Renders an icon previously looked up in an icon theme using Gtk::IconTheme::lookup_icon(); the size will be based on the size passed to Gtk::IconTheme::lookup_icon(). More... | |
Glib::RefPtr< const Gdk::Texture > | load_texture () const |
Returns a texture object that can be used to render the icon with GSK. More... | |
void | load_icon_async (const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable) const |
Asynchronously load, render and scale an icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon(). More... | |
void | load_icon_async (const Gio::SlotAsyncReady& slot) const |
A load_icon_async() convenience overload. More... | |
Glib::RefPtr< const Gdk::Pixbuf > | load_icon_finish (const Glib::RefPtr< Gio::AsyncResult >& result) const |
Finishes an async icon load, see load_icon_async(). More... | |
Glib::RefPtr< const Gdk::Pixbuf > | load_symbolic (const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, bool& was_symbolic) const |
Loads an icon, modifying it to match the system colours for the foreground, success, warning and error colors provided. More... | |
void | load_symbolic_async (const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable) const |
Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon(). More... | |
void | load_symbolic_async (const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot) const |
A load_symbolic_async() convenience overload. More... | |
Glib::RefPtr< const Gdk::Pixbuf > | load_symbolic_finish (const Glib::RefPtr< Gio::AsyncResult >& result, bool& was_symbolic) const |
Finishes an async icon load, see load_symbolic_async(). More... | |
Glib::RefPtr< const Gdk::Pixbuf > | load_symbolic_for_context (const Glib::RefPtr< StyleContext >& context, bool& was_symbolic) const |
Loads an icon, modifying it to match the system colors for the foreground, success, warning and error colors provided. More... | |
void | load_symbolic_for_context_async (const Glib::RefPtr< StyleContext >& context, const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable) const |
Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon(). More... | |
void | load_symbolic_for_context_async (const Glib::RefPtr< StyleContext >& context, const Gio::SlotAsyncReady& slot) const |
A load_symbolic_for_context_async() convenience overload. More... | |
Glib::RefPtr< const Gdk::Pixbuf > | load_symbolic_for_context_finish (const Glib::RefPtr< Gio::AsyncResult >& result, bool& was_symbolic) const |
Finishes an async icon load, see load_symbolic_for_context_async(). More... | |
![]() | |
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 (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) |
![]() | |
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 |
![]() | |
trackable () noexcept | |
trackable (const trackable &src) noexcept | |
trackable (trackable &&src) | |
~trackable () | |
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const |
void | notify_callbacks () |
trackable & | operator= (const trackable &src) |
trackable & | operator= (trackable &&src) |
void | remove_destroy_notify_callback (void *data) 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< IconInfo > | create (const Glib::RefPtr< IconTheme >& icon_theme, const Glib::RefPtr< Gdk::Pixbuf >& pixbuf) |
Creates an IconInfo for a Gdk::Pixbuf. More... | |
Protected Member Functions | |
IconInfo (const Glib::RefPtr< IconTheme >& icon_theme, const Glib::RefPtr< Gdk::Pixbuf >& pixbuf) | |
![]() | |
Object () | |
Object (const Glib::ConstructParams &construct_params) | |
Object (GObject *castitem) | |
~Object () noexcept override | |
![]() | |
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) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gtk::IconInfo > | wrap (GtkIconInfo* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Additional Inherited Members | |
![]() | |
typedef void(*)(gpointer data | DestroyNotify) |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
|
noexcept |
|
overridenoexcept |
|
protected |
|
static |
Creates an IconInfo for a Gdk::Pixbuf.
icon_theme | A Gtk::IconTheme. |
pixbuf | The pixbuf to wrap in an IconInfo. |
int Gtk::IconInfo::get_base_scale | ( | ) | const |
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 monitor with window scale 2 for a base size of 32 will be 64 pixels tall and have a base scale of 2.
int Gtk::IconInfo::get_base_size | ( | ) | const |
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.
Glib::ustring Gtk::IconInfo::get_filename | ( | ) | const |
Gets the filename for the icon.
If the Gtk::IconLookupFlags::USE_BUILTIN flag was passed to Gtk::IconTheme::lookup_icon(), there may be no filename if a builtin icon is returned; in this case, you should use gtk_icon_info_get_builtin_pixbuf().
nullptr
if gtk_icon_info_get_builtin_pixbuf() should be used instead.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GtkIconInfo* Gtk::IconInfo::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool Gtk::IconInfo::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.
true
if the icon is symbolic, false
otherwise. Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_icon | ( | ) | const |
Renders an icon previously looked up in an icon theme using Gtk::IconTheme::lookup_icon(); the size will be based on the size passed to Gtk::IconTheme::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 Gtk::IconLookupFlags::FORCE_SIZE flag when obtaining the Gtk::IconInfo. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size.
Glib::Error |
void Gtk::IconInfo::load_icon_async | ( | const Gio::SlotAsyncReady & | slot, |
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) | const |
Asynchronously load, render and scale an icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon().
For more details, see load_icon() which is the synchronous version of this call.
cancellable | Optional Cancellable object, nullptr to ignore. |
slot | A SlotAsyncReady to call when the request is satisfied. |
void Gtk::IconInfo::load_icon_async | ( | const Gio::SlotAsyncReady & | slot | ) | const |
A load_icon_async() convenience overload.
Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_icon_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const |
Finishes an async icon load, see load_icon_async().
result | A Gio::AsyncResult. |
Glib::Error |
Cairo::RefPtr<const Cairo::Surface> Gtk::IconInfo::load_surface | ( | const Glib::RefPtr< Gdk::Window >& | for_window | ) | const |
Renders an icon previously looked up in an icon theme using Gtk::IconTheme::lookup_icon(); the size will be based on the size passed to Gtk::IconTheme::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 Gtk::IconLookupFlags::FORCE_SIZE flag when obtaining the Gtk::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 nullptr . |
Glib::Error |
Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_symbolic | ( | const Gdk::RGBA& | fg, |
const Gdk::RGBA& | success_color, | ||
const Gdk::RGBA& | warning_color, | ||
const Gdk::RGBA& | error_color, | ||
bool & | was_symbolic | ||
) | const |
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 load_icon().
This allows loading symbolic icons that will match the system theme.
Unless you are implementing a widget, you will want to use Glib::themed_icon_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 nullptr to use the default color. |
warning_color | A Gdk::RGBA representing the warning color of the icon or nullptr to use the default color. |
error_color | A Gdk::RGBA representing the error color of the icon or nullptr to use the default color (allow-none). |
was_symbolic | A bool , returns whether the loaded icon was a symbolic one and whether the fg color was applied to it. |
Glib::Error |
void Gtk::IconInfo::load_symbolic_async | ( | const Gdk::RGBA& | fg, |
const Gdk::RGBA& | success_color, | ||
const Gdk::RGBA& | warning_color, | ||
const Gdk::RGBA& | error_color, | ||
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) | const |
Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon().
For more details, see 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 nullptr to use the default color. |
warning_color | A Gdk::RGBA representing the warning color of the icon or nullptr to use the default color. |
error_color | A Gdk::RGBA representing the error color of the icon or nullptr to use the default color (allow-none). |
cancellable | Optional Cancellable object, nullptr to ignore. |
slot | A SlotAsyncReady to call when the request is satisfied. |
void Gtk::IconInfo::load_symbolic_async | ( | const Gdk::RGBA& | fg, |
const Gdk::RGBA& | success_color, | ||
const Gdk::RGBA& | warning_color, | ||
const Gdk::RGBA& | error_color, | ||
const Gio::SlotAsyncReady & | slot | ||
) | const |
A load_symbolic_async() convenience overload.
Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_symbolic_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result, |
bool & | was_symbolic | ||
) | const |
Finishes an async icon load, see load_symbolic_async().
result | A Gio::AsyncResult. |
was_symbolic | A bool , returns whether the loaded icon was a symbolic one and whether the fg color was applied to it. |
Glib::Error |
Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_symbolic_for_context | ( | const Glib::RefPtr< StyleContext >& | context, |
bool & | was_symbolic | ||
) | const |
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 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 load_symbolic() for more details.
context | A Gtk::StyleContext. |
was_symbolic | A bool , returns whether the loaded icon was a symbolic one and whether the fg color was applied to it. |
Glib::Error |
void Gtk::IconInfo::load_symbolic_for_context_async | ( | const Glib::RefPtr< StyleContext >& | context, |
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) | const |
Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon().
For more details, see load_symbolic_for_context() which is the synchronous version of this call.
context | A Gtk::StyleContext. |
cancellable | Optional Cancellable object, nullptr to ignore. |
slot | A SlotAsyncReady to call when the request is satisfied. |
void Gtk::IconInfo::load_symbolic_for_context_async | ( | const Glib::RefPtr< StyleContext >& | context, |
const Gio::SlotAsyncReady & | slot | ||
) | const |
A load_symbolic_for_context_async() convenience overload.
Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_symbolic_for_context_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result, |
bool & | was_symbolic | ||
) | const |
Finishes an async icon load, see load_symbolic_for_context_async().
result | A Gio::AsyncResult. |
was_symbolic | A bool , returns whether the loaded icon was a symbolic one and whether the fg color was applied to it. |
Glib::Error |
Glib::RefPtr<const Gdk::Texture> Gtk::IconInfo::load_texture | ( | ) | const |
Returns a texture object that can be used to render the icon with GSK.
|
related |
A Glib::wrap() method for this object.
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. |