IconTheme

open class IconTheme(pointer: <Error class: unknown class><<Error class: unknown class>>)

GtkIconTheme 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 class@Gtk.Image rather than directly, but looking up icons directly is also simple. The GtkIconTheme object acts as a database of all the icons in the current theme. You can create new GtkIconTheme objects, but it’s much more efficient to use the standard icon theme of the GtkWidget 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);

Skipped during bindings generation

  • method get_icon_sizes: Array parameter of type gint is not supported

  • method theme-name: Property TypeInfo of getter and setter do not match

Constructors

Link copied to clipboard
constructor()

Creates a new icon theme object.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val display: <Error class: unknown class>?

The display that this icon theme object is attached to.

Link copied to clipboard
val gtkIconThemePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val iconNames: List<String>

The icon names that are supported by the icon theme.

Link copied to clipboard

Resource paths that will be looked at when looking for icons, similar to search paths.

Link copied to clipboard
open var searchPath: List<String>?

The search path for this icon theme.

Functions

Link copied to clipboard
open fun addResourcePath(path: String)

Adds a resource path that will be looked at when looking for icons, similar to search paths.

Link copied to clipboard
open fun addSearchPath(path: String)

Appends a directory to the search path.

Link copied to clipboard
fun connectChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the icon theme changes.

Link copied to clipboard
open fun getThemeName(): String

Gets the current icon theme name.

Link copied to clipboard
open fun hasGicon(gicon: <Error class: unknown class>): Boolean

Checks whether an icon theme includes an icon for a particular GIcon.

Link copied to clipboard
open fun hasIcon(iconName: String): Boolean

Checks whether an icon theme includes an icon for a particular name.

Link copied to clipboard
open fun lookupByGicon(icon: <Error class: unknown class>, size: <Error class: unknown class>, scale: <Error class: unknown class>, direction: TextDirection, flags: IconLookupFlags): IconPaintable

Looks up a icon for a desired size and window scale.

Link copied to clipboard
open fun lookupIcon(iconName: String, fallbacks: List<String>? = null, size: <Error class: unknown class>, scale: <Error class: unknown class>, direction: TextDirection, flags: IconLookupFlags): IconPaintable

Looks up a named icon for a desired size and window scale, returning a GtkIconPaintable.

Link copied to clipboard
open fun setThemeName(themeName: String? = null)

Sets the name of the icon theme that the GtkIconTheme object uses overriding system configuration.