IconTheme
Object Hierarchy:
Gtk.IconTheme
Gtk.IconTheme
Gtk.IconTheme
GLib.Object
GLib.Object
GLib.Object->Gtk.IconTheme
Description:
[ CCode ( type_id = "gtk_icon_theme_get_type ()" ) ]public class IconTheme : Object
`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 [[email protected] ] 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.
```c 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); ```
Content:
Properties:
public Display display { owned get ; set ; }
The display that this icon theme object is attached to.
public string [] icon_names { owned get ; }
The icon names that are supported by the icon theme.
public string [] resource_path { owned get ; set ; }
Resource paths that will be looked at when looking for icons, similar
to search paths.
public string [] search_path { owned get ; set ; }
The search path for this icon theme.
public string theme_name { owned get ; set ; }
The name of the icon theme that is being used.
Static methods:
Creation methods:
Methods:
public void add_resource_path (string path)
Adds a resource path that will be looked at when looking for icons,
similar to search paths.
public void add_search_path (string path)
Appends a directory to the search path.
public unowned Display ? get_display ()
Returns the display that the `GtkIconTheme` object was created for.
public string [] get_icon_names ()
Lists the names of icons in the current icon theme.
public int [] get_icon_sizes (string icon_name)
Returns an array of integers describing the sizes at which the icon is
available without scaling.
public string []? get_resource_path ()
Gets the current resource path.
public string []? get_search_path ()
Gets the current search path.
public string get_theme_name ()
Gets the current icon theme name.
public bool has_gicon (Icon gicon)
Checks whether an icon theme includes an icon for a particular
`GIcon`.
public bool has_icon (string icon_name)
Checks whether an icon theme includes an icon for a particular name.
public IconPaintable lookup_by_gicon (Icon icon, int size, int scale, TextDirection direction, IconLookupFlags flags)
Looks up a icon for a desired size and window scale.
public IconPaintable lookup_icon (string icon_name, string []? fallbacks, int size, int scale, TextDirection direction, IconLookupFlags flags)
Looks up a named icon for a desired size and window scale, returning a
`GtkIconPaintable`.
public void set_resource_path (string []? path)
Sets the resource paths that will be looked at when looking for icons,
similar to search paths.
public void set_search_path (string []? path)
Sets the search path for the icon theme object.
public void set_theme_name (string ? theme_name)
Sets the name of the icon theme that the `GtkIconTheme` object uses
overriding system configuration.
Signals:
Inherited Members:
All known members inherited from class GLib.Object
@get
@new
@ref
@set
add_toggle_ref
add_weak_pointer
bind_property
connect
constructed
disconnect
dispose
dup_data
dup_qdata
force_floating
freeze_notify
get_class
get_data
get_property
get_qdata
get_type
getv
interface_find_property
interface_install_property
interface_list_properties
is_floating
new_valist
new_with_properties
newv
notify
notify_property
ref_count
ref_sink
remove_toggle_ref
remove_weak_pointer
replace_data
replace_qdata
set_data
set_data_full
set_property
set_qdata
set_qdata_full
set_valist
setv
steal_data
steal_qdata
thaw_notify
unref
watch_closure
weak_ref
weak_unref