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.IconSetrepresents a single icon in various sizes and widget states. It can provide aGdkPixbuf.Pixbuffor a given size and state on request, and automatically caches some of the renderedGdkPixbuf.Pixbufobjects.Normally you would use
Gtk.Widget.render_icon_pixbuf() instead of usingGtk.IconSetdirectly. The one case where you’d useGtk.IconSetis to create application-specific icon sets to place in aGtk.IconFactory.Deprecated since version 3.10: Use
Gtk.IconThemeinstead.
- classmethod new_from_pixbuf(pixbuf)[source]¶
 - Parameters:
 pixbuf (
GdkPixbuf.Pixbuf) – aGdkPixbuf.Pixbuf- Returns:
 a new
Gtk.IconSet- Return type:
 
Creates a new
Gtk.IconSetwith pixbuf as the default/fallback source image. If you don’t add any additionalGtk.IconSourceto 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.IconThemeinstead.
- 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.IconSetneeds 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.IconSetalways 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.IconThemeinstead.
- copy()[source]¶
 - Returns:
 a new
Gtk.IconSetidentical to the first.- Return type:
 
Copies self by value.
Deprecated since version 3.10: Use
Gtk.IconThemeinstead.
- 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.IconThemeinstead.
- ref()[source]¶
 - Returns:
 self.
- Return type:
 
Increments the reference count on self.
Deprecated since version 3.10: Use
Gtk.IconThemeinstead.
- render_icon(style, direction, state, size, widget, detail)[source]¶
 - Parameters:
 style (
Gtk.StyleorNone) – aGtk.Styleassociated with widget, orNonedirection (
Gtk.TextDirection) – text directionstate (
Gtk.StateType) – widget statesize (
int) – icon size (Gtk.IconSize). A size of(GtkIconSize)-1means render at the size of the source and don’t scale.widget (
Gtk.WidgetorNone) – widget that will display the icon, orNone. The only use that is typically made of this is to determine the appropriateGdk.Screen.detail (
strorNone) – detail to pass to the theme engine, orNone. Note that passing a detail of anything butNonewill disable caching.
- Returns:
 a
GdkPixbuf.Pixbufto 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.StyleContextsize (
int) – icon size (Gtk.IconSize). A size of(GtkIconSize)-1means render at the size of the source and don’t scale.
- Returns:
 a
GdkPixbuf.Pixbufto 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.IconThemeinstead.
- render_icon_surface(context, size, scale, for_window)[source]¶
 - Parameters:
 context (
Gtk.StyleContext) – aGtk.StyleContextsize (
int) – icon size (Gtk.IconSize). A size of(GtkIconSize)-1means render at the size of the source and don’t scale.scale (
int) – the window scale to render forfor_window (
Gdk.WindoworNone) –Gdk.Windowto optimize drawing for, orNone
- Returns:
 a
cairo.Surfaceto 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.IconThemeinstead.
- unref()[source]¶
 Decrements the reference count on self, and frees memory if the reference count reaches 0.
Deprecated since version 3.10: Use
Gtk.IconThemeinstead.