Class (GI Struct)

Gtk-3.0GtkIconSet

Index

Constructors

Properties

$gtype: GType<IconSet>

Methods

  • 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_icon_set_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.

    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_icon_set_new_from_pixbuf() creates a new icon set with a default icon source based on the given pixbuf.

    Parameters

    Returns void

  • Obtains a list of icon sizes this icon set can render. The returned array must be freed with g_free().

    Returns number[]

  • 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 returns null; if the icon can’t be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead.

    Parameters

    • style: Gtk.Style

      a Gtk.Style associated with widget, or null

    • direction: Gtk.TextDirection

      text direction

    • state: Gtk.StateType

      widget state

    • size: number

      icon size (Gtk.IconSize). A size of (GtkIconSize)-1 means render at the size of the source and don’t scale.

    • Optionalwidget: Gtk.Widget

      widget that will display the icon, or null. The only use that is typically made of this is to determine the appropriate Gdk.Screen.

    • Optionaldetail: string

      detail to pass to the theme engine, or null. Note that passing a detail of anything but null will disable caching.

    Returns GdkPixbuf.Pixbuf

    a GdkPixbuf.Pixbuf to be displayed

  • 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 returns null; if the icon can’t be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead.

    Parameters

    Returns GdkPixbuf.Pixbuf

    a GdkPixbuf.Pixbuf to be displayed

  • Renders an icon using gtk_render_icon_pixbuf() and converts it to a cairo surface.

    This function never returns null; if the icon can’t be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead.

    Parameters

    Returns default.Surface

    a cairo.Surface to be displayed

  • Decrements the reference count on icon_set, and frees memory if the reference count reaches 0.

    Returns void