gtk.icon_theme
Module for [IconTheme] class
Types 3
gtk.icon_theme.IconTheme provides a facility for loading themed icons.
The main reason for using a name rather than simply providing a filename is to allow different icons to be used depending on what “icon theme” is selected by the user. The operation of icon themes on Linux and Unix follows the Icon Theme Specification There is a fallback icon theme, named hicolor, where applications should install their icons, but additional icon themes can be installed as operating system vendors and users choose.
In many cases, named themes are used indirectly, via gtk.image.Image rather than directly, but looking up icons directly is also simple. The gtk.icon_theme.IconTheme object acts as a database of all the icons in the current theme. You can create new gtk.icon_theme.IconTheme objects, but it’s much more efficient to use the standard icon theme of the gtk.widget.Widget so that the icon information is shared with other people looking up icons.
GtkIconTheme *icon_theme;
GtkIconPaintable *icon;
GdkPaintable *paintable;
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (my_widget));
icon = gtk_icon_theme_lookup_icon (icon_theme,
"my-icon-name", // icon name
48, // icon size
1, // scale
0, // flags);
paintable = GDK_PAINTABLE (icon);
// Use the paintable
g_object_unref (icon);IconThemeGidBuilder builder() static nothrowGet builder for [gtk.icon_theme.IconTheme] Returns: New builder objectgdk.display.Display display() @property nothrowGet `display` property. Returns: The display that this icon theme object is attached to.void display(gdk.display.Display propval) @property nothrowSet `display` property. Params: propval = The display that this icon theme object is attached to.string themeName() @property nothrowGet `themeName` property. Returns: The name of the icon theme that is being used.void themeName(string propval) @property nothrowSet `themeName` property. Params: propval = The name of the icon theme that is being used.gtk.icon_theme.IconTheme getForDisplay(gdk.display.Display display) static nothrowGets the icon theme object associated with display.void addResourcePath(string path) nothrowAdds a resource path that will be looked at when looking for icons, similar to search paths.gdk.display.Display getDisplay() nothrowReturns the display that the [gtk.icon_theme.IconTheme] object was created for. Returns: the display of icon_themestring[] getIconNames() nothrowLists the names of icons in the current icon theme. Returns: a string array holding the names of all the icons in the theme. You must free the array using [glib.global.strfreev].int[] getIconSizes(string iconName) nothrowReturns an array of integers describing the sizes at which the icon is available without scaling.bool hasGicon(gio.icon.Icon gicon) nothrowChecks whether an icon theme includes an icon for a particular [gio.icon.Icon].bool hasIcon(string iconName) nothrowChecks whether an icon theme includes an icon for a particular name.gtk.icon_paintable.IconPaintable lookupByGicon(gio.icon.Icon icon, int size, int scale, gtk.types.TextDirection direction, gtk.types.IconLookupFlags flags) nothrowLooks up a icon for a desired size and window scale.gtk.icon_paintable.IconPaintable lookupIcon(string iconName, string[] fallbacks, int size, int scale, gtk.types.TextDirection direction, gtk.types.IconLookupFlags flags) nothrowLooks up a named icon for a desired size and window scale, returning a [gtk.icon_paintable.IconPaintable].void setResourcePath(string[] path = null) nothrowSets the resource paths that will be looked at when looking for icons, similar to search paths.void setThemeName(string themeName = null) nothrowSets the name of the icon theme that the [gtk.icon_theme.IconTheme] object uses overriding system configuration.gulong connectChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.icon_theme.IconTheme)))
&& Parameters!T.length < 2) nothrowConnect to `Changed` signal.Fluent builder implementation template for gtk.icon_theme.IconTheme
T display(gdk.display.Display propval) nothrowSet `display` property. Params: propval = The display that this icon theme object is attached to. Returns: Builder instance for fluent chainingT themeName(string propval) nothrowSet `themeName` property. Params: propval = The name of the icon theme that is being used.Fluent builder for gtk.icon_theme.IconTheme