Gtk.NumerableIcon

g GObject.GInterface GObject.GInterface Gio.Icon Gio.Icon GObject.GInterface->Gio.Icon GObject.Object GObject.Object Gio.EmblemedIcon Gio.EmblemedIcon GObject.Object->Gio.EmblemedIcon Gtk.NumerableIcon Gtk.NumerableIcon Gio.EmblemedIcon->Gtk.NumerableIcon Gio.Icon->Gio.EmblemedIcon

Subclasses:

None

Methods

Inherited:

Gio.EmblemedIcon (5), GObject.Object (37), Gio.Icon (6)

Structs:

GObject.ObjectClass (5)

class

new (base_icon)

class

new_with_style_context (base_icon, context)

get_background_gicon ()

get_background_icon_name ()

get_count ()

get_label ()

get_style_context ()

set_background_gicon (icon)

set_background_icon_name (icon_name)

set_count (count)

set_label (label)

set_style_context (style)

Virtual Methods

Inherited:

GObject.Object (7), Gio.Icon (4)

Properties

Inherited:

Gio.EmblemedIcon (1)

Name

Type

Flags

Short Description

background-icon

Gio.Icon

r/w

The icon for the number emblem background

background-icon-name

str

r/w

The icon name for the number emblem background

count

int

r/w

The count of the emblem currently displayed

label

str

r/w

The label to be displayed over the icon

style-context

Gtk.StyleContext

r/w

The style context to theme the icon appearance

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

Gio.EmblemedIcon

r

Class Details

class Gtk.NumerableIcon(**kwargs)
Bases:

Gio.EmblemedIcon

Abstract:

No

Structure:

Gtk.NumerableIconClass

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 Gtk.StyleContext; see Gtk.NumerableIcon.set_style_context().

Typical numerable icons:

classmethod new(base_icon)[source]
Parameters:

base_icon (Gio.Icon) – a Gio.Icon to overlay on

Returns:

a new Gio.Icon

Return type:

Gio.Icon

Creates a new unthemed Gtk.NumerableIcon.

New in version 3.0.

Deprecated since version 3.14.

classmethod new_with_style_context(base_icon, context)[source]
Parameters:
Returns:

a new Gio.Icon

Return type:

Gio.Icon

Creates a new Gtk.NumerableIcon which will themed according to the passed Gtk.StyleContext. This is a convenience constructor that calls Gtk.NumerableIcon.set_style_context() internally.

New in version 3.0.

Deprecated since version 3.14.

get_background_gicon()[source]
Returns:

a Gio.Icon, or None

Return type:

Gio.Icon or None

Returns the Gio.Icon that was set as the base background image, or None if there’s none. The caller of this function does not own a reference to the returned Gio.Icon.

New in version 3.0.

Deprecated since version 3.14.

get_background_icon_name()[source]
Returns:

an icon name, or None

Return type:

str or None

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

New in version 3.0.

Deprecated since version 3.14.

get_count()[source]
Returns:

the currently displayed value

Return type:

int

Returns the value currently displayed by self.

New in version 3.0.

Deprecated since version 3.14.

get_label()[source]
Returns:

the currently displayed label

Return type:

str or None

Returns the currently displayed label of the icon, or None.

New in version 3.0.

Deprecated since version 3.14.

get_style_context()[source]
Returns:

a Gtk.StyleContext, or None. This object is internal to GTK+ and should not be unreffed. Use GObject.Object.ref() if you want to keep it around

Return type:

Gtk.StyleContext or None

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

New in version 3.0.

Deprecated since version 3.14.

set_background_gicon(icon)[source]
Parameters:

icon (Gio.Icon or None) – a Gio.Icon, or None

Updates the icon to use icon as the base background image. If icon is None, 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 Gtk.NumerableIcon.set_background_gicon() and Gtk.NumerableIcon.set_background_icon_name() has always priority.

New in version 3.0.

Deprecated since version 3.14.

set_background_icon_name(icon_name)[source]
Parameters:

icon_name (str or None) – an icon name, or None

Updates the icon to use the icon named icon_name from the current icon theme as the base background image. If icon_name is None, 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 Gtk.NumerableIcon.set_background_icon_name() and Gtk.NumerableIcon.set_background_gicon() has always priority.

New in version 3.0.

Deprecated since version 3.14.

set_count(count)[source]
Parameters:

count (int) – a number between -99 and 99

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 None before rendering the number, i.e. the last method called between Gtk.NumerableIcon.set_count() and Gtk.NumerableIcon.set_label() has always priority.

New in version 3.0.

Deprecated since version 3.14.

set_label(label)[source]
Parameters:

label (str or None) – a short label, or None

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 Gtk.NumerableIcon.set_label() and Gtk.NumerableIcon.set_count() has always priority.

New in version 3.0.

Deprecated since version 3.14.

set_style_context(style)[source]
Parameters:

style (Gtk.StyleContext) – a Gtk.StyleContext

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

New in version 3.0.

Deprecated since version 3.14.

Property Details

Gtk.NumerableIcon.props.background_icon
Name:

background-icon

Type:

Gio.Icon

Default Value:

None

Flags:

READABLE, WRITABLE

The icon for the number emblem background

Gtk.NumerableIcon.props.background_icon_name
Name:

background-icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The icon name for the number emblem background

Gtk.NumerableIcon.props.count
Name:

count

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The count of the emblem currently displayed

Gtk.NumerableIcon.props.label
Name:

label

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The label to be displayed over the icon

Gtk.NumerableIcon.props.style_context
Name:

style-context

Type:

Gtk.StyleContext

Default Value:

None

Flags:

READABLE, WRITABLE

The style context to theme the icon appearance