gtkmm: Gtk::NumerableIcon Class Reference

gtkmm 3.24.8

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

A Gio::Icon that allows numbered emblems. More...

`#include <gtkmm/numerableicon.h>`

Inheritance diagram for Gtk::NumerableIcon:
[legend]

## Public Member Functions
| NumerableIcon (NumerableIcon && src) noexcept
NumerableIcon & | operator= (NumerableIcon && src) noexcept
| ~NumerableIcon () noexcept override
GtkNumerableIcon * | gobj ()
| Provides access to the underlying C GObject.
const GtkNumerableIcon * | gobj () const
| Provides access to the underlying C GObject.
GtkNumerableIcon * | 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< StyleContext > | get_style_context ()
| Returns the Gtk::StyleContext used by the icon for theming, or `nullptr` if there’s none.
Glib::RefPtr< const StyleContext > | get_style_context () const
| Returns the Gtk::StyleContext used by the icon for theming, or `nullptr` if there’s none.
void | set_style_context (const Glib::RefPtr< StyleContext > & style)
| Updates the icon to fetch theme information from the given Gtk::StyleContext.
int | get_count () const
| Returns the value currently displayed by self.
void | set_count (int count)
| Sets the currently displayed value of self to count.
Glib::ustring | get_label () const
| Returns the currently displayed label of the icon, or `nullptr`.
void | set_label (const Glib::ustring & label)
| Sets the currently displayed value of self to the string in label.
void | set_background_gicon (const Glib::RefPtr< Gio::Icon > & icon)
| Updates the icon to use icon as the base background image.
Glib::RefPtr< Gio::Icon > | get_background_gicon ()
| Returns the Gio::Icon that was set as the base background image, or `nullptr` if there’s none.
Glib::RefPtr< const Gio::Icon > | get_background_gicon () const
| Returns the Gio::Icon that was set as the base background image, or `nullptr` if there’s none.
void | set_background_icon_name (const Glib::ustring & icon_name)
| Updates the icon to use the icon named icon_name from the current icon theme as the base background image.
Glib::ustring | get_background_icon_name () const
| Returns the icon name used as the base background image, or `nullptr` if there’s none.
Glib::PropertyProxy< int > | property_count ()
| The count of the emblem currently displayed.
Glib::PropertyProxy_ReadOnly< int > | property_count () const
| The count of the emblem currently displayed.
Glib::PropertyProxy< Glib::ustring > | property_label ()
| The label to be displayed over the icon.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_label () const
| The label to be displayed over the icon.
Glib::PropertyProxy< Glib::RefPtr< StyleContext > > | property_style_context ()
| The style context to theme the icon appearance.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< StyleContext > > | property_style_context () const
| The style context to theme the icon appearance.
Glib::PropertyProxy< Glib::RefPtr< Gio::Icon > > | property_background_icon ()
| The icon for the number emblem background.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::Icon > > | property_background_icon () const
| The icon for the number emblem background.
Glib::PropertyProxy< Glib::ustring > | property_background_icon_name ()
| The icon name for the number emblem background.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_background_icon_name () const
| The icon name for the number emblem background.
Public Member Functions inherited from Gio::EmblemedIcon
| EmblemedIcon (EmblemedIcon &&src) noexcept
EmblemedIcon & | operator= (EmblemedIcon &&src) noexcept
| ~EmblemedIcon () noexcept override
GEmblemedIcon * | gobj ()
const GEmblemedIcon * | gobj () const
GEmblemedIcon * | gobj_copy ()
Glib::RefPtr< Icon > | get_icon ()
Glib::RefPtr< const Icon > | get_icon () const
Glib::ListHandle< Glib::RefPtr< Emblem > > | get_emblems ()
void | add_emblem (const Glib::RefPtr< Emblem > &emblem)
void | clear_emblems ()
Glib::RefPtr< Gio::EmblemedIcon > | wrap (GEmblemedIcon *object, bool take_copy=false)
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 (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
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (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)
| ~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
Public Member Functions inherited from Gio::Icon
| Icon (Icon &&src) noexcept
Icon & | operator= (Icon &&src) noexcept
| ~Icon () noexcept override
GIcon * | gobj ()
const GIcon * | gobj () const
guint | hash () const
std::string | to_string () const
bool | equal (const Glib::RefPtr< Icon > &other) const
Glib::VariantBase | serialize () const
Glib::RefPtr< Gio::Icon > | wrap (GIcon *object, bool take_copy=false)
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.
static Glib::RefPtr< NumerableIcon > | create (const Glib::RefPtr< Gio::Icon > & icon)
static Glib::RefPtr< NumerableIcon > | create (const Glib::RefPtr< Gio::Icon > & icon, const Glib::RefPtr< StyleContext > & context)
Static Public Member Functions inherited from Gio::EmblemedIcon
static GType | get_type ()
static Glib::RefPtr< EmblemedIcon > | create (const Glib::RefPtr< Icon > &icon, const Glib::RefPtr< Emblem > &emblem)
static Glib::RefPtr< EmblemedIcon > | create (const Glib::RefPtr< Icon > &icon)
Static Public Member Functions inherited from Gio::Icon
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
static Glib::RefPtr< Icon > | create (const std::string &str)
static Glib::RefPtr< Icon > | deserialize (const Glib::VariantBase &value)

## Protected Member Functions
| NumerableIcon (const Glib::RefPtr< Gio::Icon > & icon)
| NumerableIcon (const Glib::RefPtr< Gio::Icon > & icon, const Glib::RefPtr< StyleContext > & style_context)
Protected Member Functions inherited from Gio::EmblemedIcon
| EmblemedIcon (const Glib::RefPtr< Icon > &icon)
| EmblemedIcon (const Glib::RefPtr< Icon > &icon, const Glib::RefPtr< Emblem > &emblem)
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 Gio::Icon
| Icon ()

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::NumerableIcon > | wrap (GtkNumerableIcon * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## 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

## Detailed Description

A Gio::Icon that allows numbered emblems.

Gtk::NumerableIcon is a subclass of Gio::EmblemedIcon that can show a number or short string as an emblem. The number can be overlayed on top of another emblem, if desired.

It supports theming by taking font and color information from a provided StyleContext. See set_style_context().

Since gtkmm 3.0:

Deprecated:
  No replacement available.

## Constructor & Destructor Documentation

## ◆ NumerableIcon() [1/3]

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

## ◆ ~NumerableIcon()

Gtk::NumerableIcon::~NumerableIcon | ( |  | ) |
| overridenoexcept

## ◆ NumerableIcon() [2/3]

Gtk::NumerableIcon::NumerableIcon | ( | const Glib::RefPtr< Gio::Icon > & | icon | ) |
| explicitprotected

## ◆ NumerableIcon() [3/3]

Gtk::NumerableIcon::NumerableIcon | ( | const Glib::RefPtr< Gio::Icon > & | icon,
|  | const Glib::RefPtr< StyleContext > & | style_context
| ) |  |
| explicitprotected

## Member Function Documentation

## ◆ create() [1/2]

static Glib::RefPtr< NumerableIcon > Gtk::NumerableIcon::create | ( | const Glib::RefPtr< Gio::Icon > & | icon | ) |
| static

## ◆ create() [2/2]

static Glib::RefPtr< NumerableIcon > Gtk::NumerableIcon::create | ( | const Glib::RefPtr< Gio::Icon > & | icon,
|  | const Glib::RefPtr< StyleContext > & | context
| ) |  |
| static

## ◆ get_background_gicon() [1/2]

Glib::RefPtr< Gio::Icon > Gtk::NumerableIcon::get_background_gicon | ( |  | ) |

Returns the Gio::Icon that was set as the base background image, or `nullptr` if there’s none.

The caller of this function does not own a reference to the returned Gio::Icon.

Since gtkmm 3.0:

Deprecated: 3.14

Returns
  A Gio::Icon, or `nullptr`.

## ◆ get_background_gicon() [2/2]

Glib::RefPtr< const Gio::Icon > Gtk::NumerableIcon::get_background_gicon | ( |  | ) | const

Returns the Gio::Icon that was set as the base background image, or `nullptr` if there’s none.

The caller of this function does not own a reference to the returned Gio::Icon.

Since gtkmm 3.0:

Deprecated: 3.14

Returns
  A Gio::Icon, or `nullptr`.

## ◆ get_background_icon_name()

Glib::ustring Gtk::NumerableIcon::get_background_icon_name | ( |  | ) | const

Returns the icon name used as the base background image, or `nullptr` if there’s none.

Since gtkmm 3.0:

Deprecated: 3.14

Returns
  An icon name, or `nullptr`.

## ◆ get_count()

int Gtk::NumerableIcon::get_count | ( |  | ) | const

Returns the value currently displayed by self.

Since gtkmm 3.0:

Deprecated: 3.14

Returns
  The currently displayed value.

## ◆ get_label()

Glib::ustring Gtk::NumerableIcon::get_label | ( |  | ) | const

Returns the currently displayed label of the icon, or `nullptr`.

Since gtkmm 3.0:

Deprecated: 3.14

Returns
  The currently displayed label.

## ◆ get_style_context() [1/2]

Glib::RefPtr< StyleContext > Gtk::NumerableIcon::get_style_context | ( |  | ) |

Returns the Gtk::StyleContext used by the icon for theming, or `nullptr` if there’s none.

Since gtkmm 3.0:

Deprecated: 3.14

Returns
  A Gtk::StyleContext, or `nullptr`. This object is internal to GTK+ and should not be unreffed. Use Glib::object_ref() if you want to keep it around.

## ◆ get_style_context() [2/2]

Glib::RefPtr< const StyleContext > Gtk::NumerableIcon::get_style_context | ( |  | ) | const

Returns the Gtk::StyleContext used by the icon for theming, or `nullptr` if there’s none.

Since gtkmm 3.0:

Deprecated: 3.14

Returns
  A Gtk::StyleContext, or `nullptr`. This object is internal to GTK+ and should not be unreffed. Use Glib::object_ref() if you want to keep it around.

## ◆ get_type()

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

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

## ◆ gobj() [1/2]

GtkNumerableIcon * Gtk::NumerableIcon::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkNumerableIcon * Gtk::NumerableIcon::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkNumerableIcon * Gtk::NumerableIcon::gobj_copy | ( |  | ) |

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

## ◆ operator=()

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

## ◆ property_background_icon() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Gio::Icon > > Gtk::NumerableIcon::property_background_icon | ( |  | ) |

The icon for the number emblem background.

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

## ◆ property_background_icon() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::Icon > > Gtk::NumerableIcon::property_background_icon | ( |  | ) | const

The icon for the number emblem background.

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_background_icon_name() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::NumerableIcon::property_background_icon_name | ( |  | ) |

The icon name for the number emblem background.

Default value: ""

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

## ◆ property_background_icon_name() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::NumerableIcon::property_background_icon_name | ( |  | ) | const

The icon name for the number emblem background.

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_count() [1/2]

Glib::PropertyProxy< int > Gtk::NumerableIcon::property_count | ( |  | ) |

The count of the emblem currently displayed.

Default value: 0

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

## ◆ property_count() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::NumerableIcon::property_count | ( |  | ) | const

The count of the emblem currently displayed.

Default value: 0

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_label() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::NumerableIcon::property_label | ( |  | ) |

The label to be displayed over the icon.

Default value: ""

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

## ◆ property_label() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::NumerableIcon::property_label | ( |  | ) | const

The label to be displayed over the icon.

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_style_context() [1/2]

Glib::PropertyProxy< Glib::RefPtr< StyleContext > > Gtk::NumerableIcon::property_style_context | ( |  | ) |

The style context to theme the icon appearance.

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

## ◆ property_style_context() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< StyleContext > > Gtk::NumerableIcon::property_style_context | ( |  | ) | const

The style context to theme the icon appearance.

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

## ◆ set_background_gicon()

void Gtk::NumerableIcon::set_background_gicon | ( | const Glib::RefPtr< Gio::Icon > & | icon | ) |

Updates the icon to use icon as the base background image.

If icon is `nullptr`, self will go back using style information or default theming for its background image.

If this method is called and an icon name was already set as background for the icon, icon will be used, i.e. the last method called between set_background_gicon() and set_background_icon_name() has always priority.

Since gtkmm 3.0:

Deprecated: 3.14

Parameters

  icon | A Gio::Icon, or `nullptr`.

## ◆ set_background_icon_name()

void Gtk::NumerableIcon::set_background_icon_name | ( | const Glib::ustring & | icon_name | ) |

Updates the icon to use the icon named icon_name from the current icon theme as the base background image.

If icon_name is `nullptr`, self will go back using style information or default theming for its background image.

If this method is called and a Gio::Icon was already set as background for the icon, icon_name will be used, i.e. the last method called between set_background_icon_name() and set_background_gicon() has always priority.

Since gtkmm 3.0:

Deprecated: 3.14

Parameters

  icon_name | An icon name, or `nullptr`.

## ◆ set_count()

void Gtk::NumerableIcon::set_count | ( | int | count | ) |

Sets the currently displayed value of self to count.

The numeric value is always clamped to make it two digits, i.e. between -99 and 99. Setting a count of zero removes the emblem. If this method is called, and a label was already set on the icon, it will automatically be reset to `nullptr` before rendering the number, i.e. the last method called between set_count() and set_label() has always priority.

Since gtkmm 3.0:

Deprecated: 3.14

Parameters

  count | A number between -99 and 99.

## ◆ set_label()

void Gtk::NumerableIcon::set_label | ( | const Glib::ustring & | label | ) |

Sets the currently displayed value of self to the string in label.

Setting an empty label removes the emblem.

Note that this is meant for displaying short labels, such as roman numbers, or single letters. For roman numbers, consider using the Unicode characters U+2160 - U+217F. Strings longer than two characters will likely not be rendered very well.

If this method is called, and a number was already set on the icon, it will automatically be reset to zero before rendering the label, i.e. the last method called between set_label() and set_count() has always priority.

Since gtkmm 3.0:

Deprecated: 3.14

Parameters

  label | A short label, or `nullptr`.

## ◆ set_style_context()

void Gtk::NumerableIcon::set_style_context | ( | const Glib::RefPtr< StyleContext > & | style | ) |

Updates the icon to fetch theme information from the given Gtk::StyleContext.

Since gtkmm 3.0:

Deprecated: 3.14

Parameters

  style | A Gtk::StyleContext.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::NumerableIcon > wrap | ( | GtkNumerableIcon * | 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.