Gtk.IconSet¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gtk.IconSet(*args, **kwargs)¶
- classmethod new()[source]¶
- Returns:
a new
Gtk.IconSet
- Return type:
Creates a new
Gtk.IconSet
. AGtk.IconSet
represents a single icon in various sizes and widget states. It can provide aGdkPixbuf.Pixbuf
for a given size and state on request, and automatically caches some of the renderedGdkPixbuf.Pixbuf
objects.Normally you would use
Gtk.Widget.render_icon_pixbuf
() instead of usingGtk.IconSet
directly. The one case where you’d useGtk.IconSet
is to create application-specific icon sets to place in aGtk.IconFactory
.Deprecated since version 3.10: Use
Gtk.IconTheme
instead.
- classmethod new_from_pixbuf(pixbuf)[source]¶
- Parameters:
pixbuf (
GdkPixbuf.Pixbuf
) – aGdkPixbuf.Pixbuf
- Returns:
a new
Gtk.IconSet
- Return type:
Creates a new
Gtk.IconSet
with pixbuf as the default/fallback source image. If you don’t add any additionalGtk.IconSource
to the icon set, all variants of the icon will be created from pixbuf, using scaling, pixelation, etc. as required to adjust the icon size or make the icon look insensitive/prelighted.Deprecated since version 3.10: Use
Gtk.IconTheme
instead.
- add_source(source)[source]¶
- Parameters:
source (
Gtk.IconSource
) – aGtk.IconSource
Icon sets have a list of
Gtk.IconSource
, which they use as base icons for rendering icons in different states and sizes. Icons are scaled, made to look insensitive, etc. inGtk.IconSet.render_icon
(), butGtk.IconSet
needs base images to work with. The base images and when to use them are described by aGtk.IconSource
.This function copies source, so you can reuse the same source immediately without affecting the icon set.
An example of when you’d use this function: a web browser’s “Back to Previous Page” icon might point in a different direction in Hebrew and in English; it might look different when insensitive; and it might change size depending on toolbar mode (small/large icons). So a single icon set would contain all those variants of the icon, and you might add a separate source for each one.
You should nearly always add a “default” icon source with all fields wildcarded, which will be used as a fallback if no more specific source matches.
Gtk.IconSet
always prefers more specific icon sources to more generic icon sources. The order in which you add the sources to the icon set does not matter.Gtk.IconSet.new_from_pixbuf
() creates a new icon set with a default icon source based on the given pixbuf.Deprecated since version 3.10: Use
Gtk.IconTheme
instead.
- copy()[source]¶
- Returns:
a new
Gtk.IconSet
identical to the first.- Return type:
Copies self by value.
Deprecated since version 3.10: Use
Gtk.IconTheme
instead.
- get_sizes()[source]¶
- Returns:
return location for array of sizes (
Gtk.IconSize
)- Return type:
sizes: [
int
]
Obtains a list of icon sizes this icon set can render. The returned array must be freed with
GLib.free
().Deprecated since version 3.10: Use
Gtk.IconTheme
instead.
- ref()[source]¶
- Returns:
self.
- Return type:
Increments the reference count on self.
Deprecated since version 3.10: Use
Gtk.IconTheme
instead.
- render_icon(style, direction, state, size, widget, detail)[source]¶
- Parameters:
style (
Gtk.Style
orNone
) – aGtk.Style
associated with widget, orNone
direction (
Gtk.TextDirection
) – text directionstate (
Gtk.StateType
) – widget statesize (
int
) – icon size (Gtk.IconSize
). A size of(GtkIconSize)-1
means render at the size of the source and don’t scale.widget (
Gtk.Widget
orNone
) – widget that will display the icon, orNone
. The only use that is typically made of this is to determine the appropriateGdk.Screen
.detail (
str
orNone
) – detail to pass to the theme engine, orNone
. Note that passing a detail of anything butNone
will disable caching.
- Returns:
a
GdkPixbuf.Pixbuf
to be displayed- Return type:
Renders an icon using
Gtk.Style.render_icon
(). In most cases,Gtk.Widget.render_icon
() is better, since it automatically provides most of the arguments from the current widget settings. This function never returnsNone
; if the icon can’t be rendered (perhaps because an image file fails to load), a default “missing image” icon will be returned instead.Deprecated since version 3.0: Use
Gtk.IconSet.render_icon_pixbuf
() instead
- render_icon_pixbuf(context, size)[source]¶
- Parameters:
context (
Gtk.StyleContext
) – aGtk.StyleContext
size (
int
) – icon size (Gtk.IconSize
). A size of(GtkIconSize)-1
means render at the size of the source and don’t scale.
- Returns:
a
GdkPixbuf.Pixbuf
to be displayed- Return type:
Renders an icon using
Gtk.render_icon_pixbuf
(). In most cases,Gtk.Widget.render_icon_pixbuf
() is better, since it automatically provides most of the arguments from the current widget settings. This function never returnsNone
; if the icon can’t be rendered (perhaps because an image file fails to load), a default “missing image” icon will be returned instead.New in version 3.0.
Deprecated since version 3.10: Use
Gtk.IconTheme
instead.
- render_icon_surface(context, size, scale, for_window)[source]¶
- Parameters:
context (
Gtk.StyleContext
) – aGtk.StyleContext
size (
int
) – icon size (Gtk.IconSize
). A size of(GtkIconSize)-1
means render at the size of the source and don’t scale.scale (
int
) – the window scale to render forfor_window (
Gdk.Window
orNone
) –Gdk.Window
to optimize drawing for, orNone
- Returns:
a
cairo.Surface
to be displayed- Return type:
Renders an icon using
Gtk.render_icon_pixbuf
() and converts it to a cairo surface.This function never returns
None
; if the icon can’t be rendered (perhaps because an image file fails to load), a default “missing image” icon will be returned instead.New in version 3.10.
Deprecated since version 3.10: Use
Gtk.IconTheme
instead.
- unref()[source]¶
Decrements the reference count on self, and frees memory if the reference count reaches 0.
Deprecated since version 3.10: Use
Gtk.IconTheme
instead.