A Gtk::IconSet represents a single icon in various sizes and widget states. It can provide a Gdk::Pixbuf for a given size and state on request, and automatically caches some of the rendered Gdk::Pixbuf objects.
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. in Gtk::IconSet#render_icon, but Gtk::IconSet needs base images to work with. The base images and when to use them are described by a Gtk::IconSource.
Gtk::IconSet.new(pixbuf = nil)
Creates a new Gtk::IconSet. Normally you would use Gtk::Widget#render_icon instead of using Gtk::IconSet directly. The one case where you'd use Gtk::IconSet is to create application-specific icon sets to place in a Gtk::IconFactory.
- pixbuf: As the default/fallback source image. If you don't add any additional Gtk::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.
- Returns: a new Gtk::IconSet.
This method 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(pixbuf) creates a new icon set with a default icon source based on the given pixbuf
- source: a Gtk::IconSource
- Returns: self
render_icon(style, direction, state, size, width = nil, detail = nil)
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 method never returns nil; if the icon can't be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead.
- style: a Gtk::Style associated with widget, or nil
- direction: text direction(GtkTextDirection)
- state: widget state(GtkStateType)
- size: icon size(GtkIconSize)
- widget: a Gtk::Widget that will display the icon, or nil
- detail: detail to pass to the theme engine, or nil
- Returns: a Gdk::Pixbuf to be displayed
Gets the list of icon sizes this icon set can render.
- Returns: an array of sizes.