1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.IconTheme;
26 
27 private import cairo.Surface;
28 private import gdk.Screen;
29 private import gdk.Window;
30 private import gdkpixbuf.Pixbuf;
31 private import gio.IconIF;
32 private import glib.ConstructionException;
33 private import glib.ErrorG;
34 private import glib.GException;
35 private import glib.ListG;
36 private import glib.Str;
37 private import gobject.ObjectG;
38 private import gobject.Signals;
39 private import gtk.IconInfo;
40 public  import gtkc.gdktypes;
41 private import gtkc.gtk;
42 public  import gtkc.gtktypes;
43 
44 
45 /**
46  * #GtkIconTheme provides a facility for looking up icons by name
47  * and size. The main reason for using a name rather than simply
48  * providing a filename is to allow different icons to be used
49  * depending on what “icon theme” is selected
50  * by the user. The operation of icon themes on Linux and Unix
51  * follows the [Icon Theme Specification](http://www.freedesktop.org/Standards/icon-theme-spec)
52  * There is a fallback icon theme, named `hicolor`, where applications
53  * should install their icons, but additional icon themes can be installed
54  * as operating system vendors and users choose.
55  * 
56  * Named icons are similar to the deprecated [Stock Items][gtkstock],
57  * and the distinction between the two may be a bit confusing.
58  * A few things to keep in mind:
59  * 
60  * - Stock images usually are used in conjunction with
61  * [Stock Items][gtkstock], such as %GTK_STOCK_OK or
62  * %GTK_STOCK_OPEN. Named icons are easier to set up and therefore
63  * are more useful for new icons that an application wants to
64  * add, such as application icons or window icons.
65  * 
66  * - Stock images can only be loaded at the symbolic sizes defined
67  * by the #GtkIconSize enumeration, or by custom sizes defined
68  * by gtk_icon_size_register(), while named icons are more flexible
69  * and any pixel size can be specified.
70  * 
71  * - Because stock images are closely tied to stock items, and thus
72  * to actions in the user interface, stock images may come in
73  * multiple variants for different widget states or writing
74  * directions.
75  * 
76  * A good rule of thumb is that if there is a stock image for what
77  * you want to use, use it, otherwise use a named icon. It turns
78  * out that internally stock images are generally defined in
79  * terms of one or more named icons. (An example of the
80  * more than one case is icons that depend on writing direction;
81  * %GTK_STOCK_GO_FORWARD uses the two themed icons
82  * “gtk-stock-go-forward-ltr” and “gtk-stock-go-forward-rtl”.)
83  * 
84  * In many cases, named themes are used indirectly, via #GtkImage
85  * or stock items, rather than directly, but looking up icons
86  * directly is also simple. The #GtkIconTheme object acts
87  * as a database of all the icons in the current theme. You
88  * can create new #GtkIconTheme objects, but it’s much more
89  * efficient to use the standard icon theme for the #GdkScreen
90  * so that the icon information is shared with other people
91  * looking up icons.
92  * |[<!-- language="C" -->
93  * GError *error = NULL;
94  * GtkIconTheme *icon_theme;
95  * GdkPixbuf *pixbuf;
96  * 
97  * icon_theme = gtk_icon_theme_get_default ();
98  * pixbuf = gtk_icon_theme_load_icon (icon_theme,
99  * "my-icon-name", // icon name
100  * 48, // icon size
101  * 0,  // flags
102  * &error);
103  * if (!pixbuf)
104  * {
105  * g_warning ("Couldn’t load icon: %s", error->message);
106  * g_error_free (error);
107  * }
108  * else
109  * {
110  * // Use the pixbuf
111  * g_object_unref (pixbuf);
112  * }
113  * ]|
114  */
115 public class IconTheme : ObjectG
116 {
117 	/** the main Gtk struct */
118 	protected GtkIconTheme* gtkIconTheme;
119 
120 	/** Get the main Gtk struct */
121 	public GtkIconTheme* getIconThemeStruct()
122 	{
123 		return gtkIconTheme;
124 	}
125 
126 	/** the main Gtk struct as a void* */
127 	protected override void* getStruct()
128 	{
129 		return cast(void*)gtkIconTheme;
130 	}
131 
132 	protected override void setStruct(GObject* obj)
133 	{
134 		gtkIconTheme = cast(GtkIconTheme*)obj;
135 		super.setStruct(obj);
136 	}
137 
138 	/**
139 	 * Sets our main struct and passes it to the parent class.
140 	 */
141 	public this (GtkIconTheme* gtkIconTheme, bool ownedRef = false)
142 	{
143 		this.gtkIconTheme = gtkIconTheme;
144 		super(cast(GObject*)gtkIconTheme, ownedRef);
145 	}
146 
147 
148 	/** */
149 	public static GType getType()
150 	{
151 		return gtk_icon_theme_get_type();
152 	}
153 
154 	/**
155 	 * Creates a new icon theme object. Icon theme objects are used
156 	 * to lookup up an icon by name in a particular icon theme.
157 	 * Usually, you’ll want to use gtk_icon_theme_get_default()
158 	 * or gtk_icon_theme_get_for_screen() rather than creating
159 	 * a new icon theme object for scratch.
160 	 *
161 	 * Return: the newly created #GtkIconTheme object.
162 	 *
163 	 * Since: 2.4
164 	 *
165 	 * Throws: ConstructionException GTK+ fails to create the object.
166 	 */
167 	public this()
168 	{
169 		auto p = gtk_icon_theme_new();
170 		
171 		if(p is null)
172 		{
173 			throw new ConstructionException("null returned by new");
174 		}
175 		
176 		this(cast(GtkIconTheme*) p, true);
177 	}
178 
179 	/**
180 	 * Registers a built-in icon for icon theme lookups. The idea
181 	 * of built-in icons is to allow an application or library
182 	 * that uses themed icons to function requiring files to
183 	 * be present in the file system. For instance, the default
184 	 * images for all of GTK+’s stock icons are registered
185 	 * as built-icons.
186 	 *
187 	 * In general, if you use gtk_icon_theme_add_builtin_icon()
188 	 * you should also install the icon in the icon theme, so
189 	 * that the icon is generally available.
190 	 *
191 	 * This function will generally be used with pixbufs loaded
192 	 * via gdk_pixbuf_new_from_inline().
193 	 *
194 	 * Deprecated: Use gtk_icon_theme_add_resource_path()
195 	 * to add application-specific icons to the icon theme.
196 	 *
197 	 * Params:
198 	 *     iconName = the name of the icon to register
199 	 *     size = the size in pixels at which to register the icon (different
200 	 *         images can be registered for the same icon name at different sizes.)
201 	 *     pixbuf = #GdkPixbuf that contains the image to use for @icon_name
202 	 *
203 	 * Since: 2.4
204 	 */
205 	public static void addBuiltinIcon(string iconName, int size, Pixbuf pixbuf)
206 	{
207 		gtk_icon_theme_add_builtin_icon(Str.toStringz(iconName), size, (pixbuf is null) ? null : pixbuf.getPixbufStruct());
208 	}
209 
210 	/**
211 	 * Gets the icon theme for the default screen. See
212 	 * gtk_icon_theme_get_for_screen().
213 	 *
214 	 * Return: A unique #GtkIconTheme associated with
215 	 *     the default screen. This icon theme is associated with
216 	 *     the screen and can be used as long as the screen
217 	 *     is open. Do not ref or unref it.
218 	 *
219 	 * Since: 2.4
220 	 */
221 	public static IconTheme getDefault()
222 	{
223 		auto p = gtk_icon_theme_get_default();
224 		
225 		if(p is null)
226 		{
227 			return null;
228 		}
229 		
230 		return ObjectG.getDObject!(IconTheme)(cast(GtkIconTheme*) p);
231 	}
232 
233 	/**
234 	 * Gets the icon theme object associated with @screen; if this
235 	 * function has not previously been called for the given
236 	 * screen, a new icon theme object will be created and
237 	 * associated with the screen. Icon theme objects are
238 	 * fairly expensive to create, so using this function
239 	 * is usually a better choice than calling than gtk_icon_theme_new()
240 	 * and setting the screen yourself; by using this function
241 	 * a single icon theme object will be shared between users.
242 	 *
243 	 * Params:
244 	 *     screen = a #GdkScreen
245 	 *
246 	 * Return: A unique #GtkIconTheme associated with
247 	 *     the given screen. This icon theme is associated with
248 	 *     the screen and can be used as long as the screen
249 	 *     is open. Do not ref or unref it.
250 	 *
251 	 * Since: 2.4
252 	 */
253 	public static IconTheme getForScreen(Screen screen)
254 	{
255 		auto p = gtk_icon_theme_get_for_screen((screen is null) ? null : screen.getScreenStruct());
256 		
257 		if(p is null)
258 		{
259 			return null;
260 		}
261 		
262 		return ObjectG.getDObject!(IconTheme)(cast(GtkIconTheme*) p);
263 	}
264 
265 	/**
266 	 * Adds a resource path that will be looked at when looking
267 	 * for icons, similar to search paths.
268 	 *
269 	 * This function should be used to make application-specific icons
270 	 * available as part of the icon theme.
271 	 *
272 	 * The resources are considered as part of the hicolor icon theme
273 	 * and must be located in subdirectories that are defined in the
274 	 * hicolor icon theme, such as `@path/16x16/actions/run.png`.
275 	 * Icons that are directly placed in the resource path instead
276 	 * of a subdirectory are also considered as ultimate fallback.
277 	 *
278 	 * Params:
279 	 *     path = a resource path
280 	 *
281 	 * Since: 3.14
282 	 */
283 	public void addResourcePath(string path)
284 	{
285 		gtk_icon_theme_add_resource_path(gtkIconTheme, Str.toStringz(path));
286 	}
287 
288 	/**
289 	 * Appends a directory to the search path.
290 	 * See gtk_icon_theme_set_search_path().
291 	 *
292 	 * Params:
293 	 *     path = directory name to append to the icon path
294 	 *
295 	 * Since: 2.4
296 	 */
297 	public void appendSearchPath(string path)
298 	{
299 		gtk_icon_theme_append_search_path(gtkIconTheme, Str.toStringz(path));
300 	}
301 
302 	/**
303 	 * Looks up a named icon and returns a #GtkIconInfo containing
304 	 * information such as the filename of the icon. The icon
305 	 * can then be rendered into a pixbuf using
306 	 * gtk_icon_info_load_icon(). (gtk_icon_theme_load_icon()
307 	 * combines these two steps if all you need is the pixbuf.)
308 	 *
309 	 * If @icon_names contains more than one name, this function
310 	 * tries them all in the given order before falling back to
311 	 * inherited icon themes.
312 	 *
313 	 * Params:
314 	 *     iconNames = %NULL-terminated array of
315 	 *         icon names to lookup
316 	 *     size = desired icon size
317 	 *     flags = flags modifying the behavior of the icon lookup
318 	 *
319 	 * Return: a #GtkIconInfo object
320 	 *     containing information about the icon, or %NULL if the icon wasn’t
321 	 *     found.
322 	 *
323 	 * Since: 2.12
324 	 */
325 	public IconInfo chooseIcon(string iconNames, int size, GtkIconLookupFlags flags)
326 	{
327 		auto p = gtk_icon_theme_choose_icon(gtkIconTheme, Str.toStringz(iconNames), size, flags);
328 		
329 		if(p is null)
330 		{
331 			return null;
332 		}
333 		
334 		return ObjectG.getDObject!(IconInfo)(cast(GtkIconInfo*) p, true);
335 	}
336 
337 	/**
338 	 * Looks up a named icon for a particular window scale and returns
339 	 * a #GtkIconInfo containing information such as the filename of the
340 	 * icon. The icon can then be rendered into a pixbuf using
341 	 * gtk_icon_info_load_icon(). (gtk_icon_theme_load_icon()
342 	 * combines these two steps if all you need is the pixbuf.)
343 	 *
344 	 * If @icon_names contains more than one name, this function
345 	 * tries them all in the given order before falling back to
346 	 * inherited icon themes.
347 	 *
348 	 * Params:
349 	 *     iconNames = %NULL-terminated
350 	 *         array of icon names to lookup
351 	 *     size = desired icon size
352 	 *     scale = desired scale
353 	 *     flags = flags modifying the behavior of the icon lookup
354 	 *
355 	 * Return: a #GtkIconInfo object
356 	 *     containing information about the icon, or %NULL if the
357 	 *     icon wasn’t found.
358 	 *
359 	 * Since: 3.10
360 	 */
361 	public IconInfo chooseIconForScale(string iconNames, int size, int scale, GtkIconLookupFlags flags)
362 	{
363 		auto p = gtk_icon_theme_choose_icon_for_scale(gtkIconTheme, Str.toStringz(iconNames), size, scale, flags);
364 		
365 		if(p is null)
366 		{
367 			return null;
368 		}
369 		
370 		return ObjectG.getDObject!(IconInfo)(cast(GtkIconInfo*) p, true);
371 	}
372 
373 	/**
374 	 * Gets the name of an icon that is representative of the
375 	 * current theme (for instance, to use when presenting
376 	 * a list of themes to the user.)
377 	 *
378 	 * Return: the name of an example icon or %NULL.
379 	 *     Free with g_free().
380 	 *
381 	 * Since: 2.4
382 	 */
383 	public string getExampleIconName()
384 	{
385 		return Str.toString(gtk_icon_theme_get_example_icon_name(gtkIconTheme));
386 	}
387 
388 	/**
389 	 * Returns an array of integers describing the sizes at which
390 	 * the icon is available without scaling. A size of -1 means
391 	 * that the icon is available in a scalable format. The array
392 	 * is zero-terminated.
393 	 *
394 	 * Params:
395 	 *     iconName = the name of an icon
396 	 *
397 	 * Return: An newly
398 	 *     allocated array describing the sizes at which the icon is
399 	 *     available. The array should be freed with g_free() when it is no
400 	 *     longer needed.
401 	 *
402 	 * Since: 2.6
403 	 */
404 	public int[] getIconSizes(string iconName)
405 	{
406 		auto p = gtk_icon_theme_get_icon_sizes(gtkIconTheme, Str.toStringz(iconName));
407 		
408 		return p[0 .. getArrayLength(p)];
409 	}
410 
411 	/**
412 	 * Gets the current search path. See gtk_icon_theme_set_search_path().
413 	 *
414 	 * Params:
415 	 *     path = location to store a list of icon theme path directories or %NULL.
416 	 *         The stored value should be freed with g_strfreev().
417 	 *     nElements = location to store number of elements in @path, or %NULL
418 	 *
419 	 * Since: 2.4
420 	 */
421 	public void getSearchPath(out string path)
422 	{
423 		char* outpath = null;
424 		int nElements;
425 		
426 		gtk_icon_theme_get_search_path(gtkIconTheme, &outpath, &nElements);
427 		
428 		path = Str.toString(outpath, nElements);
429 	}
430 
431 	/**
432 	 * Checks whether an icon theme includes an icon
433 	 * for a particular name.
434 	 *
435 	 * Params:
436 	 *     iconName = the name of an icon
437 	 *
438 	 * Return: %TRUE if @icon_theme includes an
439 	 *     icon for @icon_name.
440 	 *
441 	 * Since: 2.4
442 	 */
443 	public bool hasIcon(string iconName)
444 	{
445 		return gtk_icon_theme_has_icon(gtkIconTheme, Str.toStringz(iconName)) != 0;
446 	}
447 
448 	/**
449 	 * Gets the list of contexts available within the current
450 	 * hierarchy of icon themes.
451 	 * See gtk_icon_theme_list_icons() for details about contexts.
452 	 *
453 	 * Return: a #GList list
454 	 *     holding the names of all the contexts in the theme. You must first
455 	 *     free each element in the list with g_free(), then free the list
456 	 *     itself with g_list_free().
457 	 *
458 	 * Since: 2.12
459 	 */
460 	public ListG listContexts()
461 	{
462 		auto p = gtk_icon_theme_list_contexts(gtkIconTheme);
463 		
464 		if(p is null)
465 		{
466 			return null;
467 		}
468 		
469 		return new ListG(cast(GList*) p);
470 	}
471 
472 	/**
473 	 * Lists the icons in the current icon theme. Only a subset
474 	 * of the icons can be listed by providing a context string.
475 	 * The set of values for the context string is system dependent,
476 	 * but will typically include such values as “Applications” and
477 	 * “MimeTypes”. Contexts are explained in the
478 	 * [Icon Theme Specification](http://www.freedesktop.org/wiki/Specifications/icon-theme-spec).
479 	 * The standard contexts are listed in the
480 	 * [Icon Naming Specification](http://www.freedesktop.org/wiki/Specifications/icon-naming-spec).
481 	 * Also see gtk_icon_theme_list_contexts().
482 	 *
483 	 * Params:
484 	 *     context = a string identifying a particular type of
485 	 *         icon, or %NULL to list all icons.
486 	 *
487 	 * Return: a #GList list
488 	 *     holding the names of all the icons in the theme. You must
489 	 *     first free each element in the list with g_free(), then
490 	 *     free the list itself with g_list_free().
491 	 *
492 	 * Since: 2.4
493 	 */
494 	public ListG listIcons(string context)
495 	{
496 		auto p = gtk_icon_theme_list_icons(gtkIconTheme, Str.toStringz(context));
497 		
498 		if(p is null)
499 		{
500 			return null;
501 		}
502 		
503 		return new ListG(cast(GList*) p);
504 	}
505 
506 	/**
507 	 * Looks up an icon in an icon theme, scales it to the given size
508 	 * and renders it into a pixbuf. This is a convenience function;
509 	 * if more details about the icon are needed, use
510 	 * gtk_icon_theme_lookup_icon() followed by gtk_icon_info_load_icon().
511 	 *
512 	 * Note that you probably want to listen for icon theme changes and
513 	 * update the icon. This is usually done by connecting to the
514 	 * GtkWidget::style-set signal. If for some reason you do not want to
515 	 * update the icon when the icon theme changes, you should consider
516 	 * using gdk_pixbuf_copy() to make a private copy of the pixbuf
517 	 * returned by this function. Otherwise GTK+ may need to keep the old
518 	 * icon theme loaded, which would be a waste of memory.
519 	 *
520 	 * Params:
521 	 *     iconName = the name of the icon to lookup
522 	 *     size = the desired icon size. The resulting icon may not be
523 	 *         exactly this size; see gtk_icon_info_load_icon().
524 	 *     flags = flags modifying the behavior of the icon lookup
525 	 *
526 	 * Return: the rendered icon; this may be
527 	 *     a newly created icon or a new reference to an internal icon, so
528 	 *     you must not modify the icon. Use g_object_unref() to release
529 	 *     your reference to the icon. %NULL if the icon isn’t found.
530 	 *
531 	 * Since: 2.4
532 	 *
533 	 * Throws: GException on failure.
534 	 */
535 	public Pixbuf loadIcon(string iconName, int size, GtkIconLookupFlags flags)
536 	{
537 		GError* err = null;
538 		
539 		auto p = gtk_icon_theme_load_icon(gtkIconTheme, Str.toStringz(iconName), size, flags, &err);
540 		
541 		if (err !is null)
542 		{
543 			throw new GException( new ErrorG(err) );
544 		}
545 		
546 		if(p is null)
547 		{
548 			return null;
549 		}
550 		
551 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
552 	}
553 
554 	/**
555 	 * Looks up an icon in an icon theme for a particular window scale,
556 	 * scales it to the given size and renders it into a pixbuf. This is a
557 	 * convenience function; if more details about the icon are needed,
558 	 * use gtk_icon_theme_lookup_icon() followed by
559 	 * gtk_icon_info_load_icon().
560 	 *
561 	 * Note that you probably want to listen for icon theme changes and
562 	 * update the icon. This is usually done by connecting to the
563 	 * GtkWidget::style-set signal. If for some reason you do not want to
564 	 * update the icon when the icon theme changes, you should consider
565 	 * using gdk_pixbuf_copy() to make a private copy of the pixbuf
566 	 * returned by this function. Otherwise GTK+ may need to keep the old
567 	 * icon theme loaded, which would be a waste of memory.
568 	 *
569 	 * Params:
570 	 *     iconName = the name of the icon to lookup
571 	 *     size = the desired icon size. The resulting icon may not be
572 	 *         exactly this size; see gtk_icon_info_load_icon().
573 	 *     scale = desired scale
574 	 *     flags = flags modifying the behavior of the icon lookup
575 	 *
576 	 * Return: the rendered icon; this may be
577 	 *     a newly created icon or a new reference to an internal icon, so
578 	 *     you must not modify the icon. Use g_object_unref() to release
579 	 *     your reference to the icon. %NULL if the icon isn’t found.
580 	 *
581 	 * Since: 3.10
582 	 *
583 	 * Throws: GException on failure.
584 	 */
585 	public Pixbuf loadIconForScale(string iconName, int size, int scale, GtkIconLookupFlags flags)
586 	{
587 		GError* err = null;
588 		
589 		auto p = gtk_icon_theme_load_icon_for_scale(gtkIconTheme, Str.toStringz(iconName), size, scale, flags, &err);
590 		
591 		if (err !is null)
592 		{
593 			throw new GException( new ErrorG(err) );
594 		}
595 		
596 		if(p is null)
597 		{
598 			return null;
599 		}
600 		
601 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
602 	}
603 
604 	/**
605 	 * Looks up an icon in an icon theme for a particular window scale,
606 	 * scales it to the given size and renders it into a cairo surface. This is a
607 	 * convenience function; if more details about the icon are needed,
608 	 * use gtk_icon_theme_lookup_icon() followed by
609 	 * gtk_icon_info_load_surface().
610 	 *
611 	 * Note that you probably want to listen for icon theme changes and
612 	 * update the icon. This is usually done by connecting to the
613 	 * GtkWidget::style-set signal.
614 	 *
615 	 * Params:
616 	 *     iconName = the name of the icon to lookup
617 	 *     size = the desired icon size. The resulting icon may not be
618 	 *         exactly this size; see gtk_icon_info_load_icon().
619 	 *     scale = desired scale
620 	 *     forWindow = #GdkWindow to optimize drawing for, or %NULL
621 	 *     flags = flags modifying the behavior of the icon lookup
622 	 *
623 	 * Return: the rendered icon; this may be
624 	 *     a newly created icon or a new reference to an internal icon, so
625 	 *     you must not modify the icon. Use cairo_surface_destroy() to
626 	 *     release your reference to the icon. %NULL if the icon isn’t
627 	 *     found.
628 	 *
629 	 * Since: 3.10
630 	 *
631 	 * Throws: GException on failure.
632 	 */
633 	public Surface loadSurface(string iconName, int size, int scale, Window forWindow, GtkIconLookupFlags flags)
634 	{
635 		GError* err = null;
636 		
637 		auto p = gtk_icon_theme_load_surface(gtkIconTheme, Str.toStringz(iconName), size, scale, (forWindow is null) ? null : forWindow.getWindowStruct(), flags, &err);
638 		
639 		if (err !is null)
640 		{
641 			throw new GException( new ErrorG(err) );
642 		}
643 		
644 		if(p is null)
645 		{
646 			return null;
647 		}
648 		
649 		return new Surface(cast(cairo_surface_t*) p);
650 	}
651 
652 	/**
653 	 * Looks up an icon and returns a #GtkIconInfo containing information
654 	 * such as the filename of the icon. The icon can then be rendered
655 	 * into a pixbuf using gtk_icon_info_load_icon().
656 	 *
657 	 * When rendering on displays with high pixel densities you should not
658 	 * use a @size multiplied by the scaling factor returned by functions
659 	 * like gdk_window_get_scale_factor(). Instead, you should use
660 	 * gtk_icon_theme_lookup_by_gicon_for_scale(), as the assets loaded
661 	 * for a given scaling factor may be different.
662 	 *
663 	 * Params:
664 	 *     icon = the #GIcon to look up
665 	 *     size = desired icon size
666 	 *     flags = flags modifying the behavior of the icon lookup
667 	 *
668 	 * Return: a #GtkIconInfo containing
669 	 *     information about the icon, or %NULL if the icon wasn’t
670 	 *     found. Unref with g_object_unref()
671 	 *
672 	 * Since: 2.14
673 	 */
674 	public IconInfo lookupByGicon(IconIF icon, int size, GtkIconLookupFlags flags)
675 	{
676 		auto p = gtk_icon_theme_lookup_by_gicon(gtkIconTheme, (icon is null) ? null : icon.getIconStruct(), size, flags);
677 		
678 		if(p is null)
679 		{
680 			return null;
681 		}
682 		
683 		return ObjectG.getDObject!(IconInfo)(cast(GtkIconInfo*) p, true);
684 	}
685 
686 	/**
687 	 * Looks up an icon and returns a #GtkIconInfo containing information
688 	 * such as the filename of the icon. The icon can then be rendered into
689 	 * a pixbuf using gtk_icon_info_load_icon().
690 	 *
691 	 * Params:
692 	 *     icon = the #GIcon to look up
693 	 *     size = desired icon size
694 	 *     scale = the desired scale
695 	 *     flags = flags modifying the behavior of the icon lookup
696 	 *
697 	 * Return: a #GtkIconInfo containing
698 	 *     information about the icon, or %NULL if the icon wasn’t
699 	 *     found. Unref with g_object_unref()
700 	 *
701 	 * Since: 3.10
702 	 */
703 	public IconInfo lookupByGiconForScale(IconIF icon, int size, int scale, GtkIconLookupFlags flags)
704 	{
705 		auto p = gtk_icon_theme_lookup_by_gicon_for_scale(gtkIconTheme, (icon is null) ? null : icon.getIconStruct(), size, scale, flags);
706 		
707 		if(p is null)
708 		{
709 			return null;
710 		}
711 		
712 		return ObjectG.getDObject!(IconInfo)(cast(GtkIconInfo*) p, true);
713 	}
714 
715 	/**
716 	 * Looks up a named icon and returns a #GtkIconInfo containing
717 	 * information such as the filename of the icon. The icon
718 	 * can then be rendered into a pixbuf using
719 	 * gtk_icon_info_load_icon(). (gtk_icon_theme_load_icon()
720 	 * combines these two steps if all you need is the pixbuf.)
721 	 *
722 	 * When rendering on displays with high pixel densities you should not
723 	 * use a @size multiplied by the scaling factor returned by functions
724 	 * like gdk_window_get_scale_factor(). Instead, you should use
725 	 * gtk_icon_theme_lookup_icon_for_scale(), as the assets loaded
726 	 * for a given scaling factor may be different.
727 	 *
728 	 * Params:
729 	 *     iconName = the name of the icon to lookup
730 	 *     size = desired icon size
731 	 *     flags = flags modifying the behavior of the icon lookup
732 	 *
733 	 * Return: a #GtkIconInfo object
734 	 *     containing information about the icon, or %NULL if the
735 	 *     icon wasn’t found.
736 	 *
737 	 * Since: 2.4
738 	 */
739 	public IconInfo lookupIcon(string iconName, int size, GtkIconLookupFlags flags)
740 	{
741 		auto p = gtk_icon_theme_lookup_icon(gtkIconTheme, Str.toStringz(iconName), size, flags);
742 		
743 		if(p is null)
744 		{
745 			return null;
746 		}
747 		
748 		return ObjectG.getDObject!(IconInfo)(cast(GtkIconInfo*) p, true);
749 	}
750 
751 	/**
752 	 * Looks up a named icon for a particular window scale and returns a
753 	 * #GtkIconInfo containing information such as the filename of the
754 	 * icon. The icon can then be rendered into a pixbuf using
755 	 * gtk_icon_info_load_icon(). (gtk_icon_theme_load_icon() combines
756 	 * these two steps if all you need is the pixbuf.)
757 	 *
758 	 * Params:
759 	 *     iconName = the name of the icon to lookup
760 	 *     size = desired icon size
761 	 *     scale = the desired scale
762 	 *     flags = flags modifying the behavior of the icon lookup
763 	 *
764 	 * Return: a #GtkIconInfo object
765 	 *     containing information about the icon, or %NULL if the
766 	 *     icon wasn’t found.
767 	 *
768 	 * Since: 3.10
769 	 */
770 	public IconInfo lookupIconForScale(string iconName, int size, int scale, GtkIconLookupFlags flags)
771 	{
772 		auto p = gtk_icon_theme_lookup_icon_for_scale(gtkIconTheme, Str.toStringz(iconName), size, scale, flags);
773 		
774 		if(p is null)
775 		{
776 			return null;
777 		}
778 		
779 		return ObjectG.getDObject!(IconInfo)(cast(GtkIconInfo*) p, true);
780 	}
781 
782 	/**
783 	 * Prepends a directory to the search path.
784 	 * See gtk_icon_theme_set_search_path().
785 	 *
786 	 * Params:
787 	 *     path = directory name to prepend to the icon path
788 	 *
789 	 * Since: 2.4
790 	 */
791 	public void prependSearchPath(string path)
792 	{
793 		gtk_icon_theme_prepend_search_path(gtkIconTheme, Str.toStringz(path));
794 	}
795 
796 	/**
797 	 * Checks to see if the icon theme has changed; if it has, any
798 	 * currently cached information is discarded and will be reloaded
799 	 * next time @icon_theme is accessed.
800 	 *
801 	 * Return: %TRUE if the icon theme has changed and needed
802 	 *     to be reloaded.
803 	 *
804 	 * Since: 2.4
805 	 */
806 	public bool rescanIfNeeded()
807 	{
808 		return gtk_icon_theme_rescan_if_needed(gtkIconTheme) != 0;
809 	}
810 
811 	/**
812 	 * Sets the name of the icon theme that the #GtkIconTheme object uses
813 	 * overriding system configuration. This function cannot be called
814 	 * on the icon theme objects returned from gtk_icon_theme_get_default()
815 	 * and gtk_icon_theme_get_for_screen().
816 	 *
817 	 * Params:
818 	 *     themeName = name of icon theme to use instead of
819 	 *         configured theme, or %NULL to unset a previously set custom theme
820 	 *
821 	 * Since: 2.4
822 	 */
823 	public void setCustomTheme(string themeName)
824 	{
825 		gtk_icon_theme_set_custom_theme(gtkIconTheme, Str.toStringz(themeName));
826 	}
827 
828 	/**
829 	 * Sets the screen for an icon theme; the screen is used
830 	 * to track the user’s currently configured icon theme,
831 	 * which might be different for different screens.
832 	 *
833 	 * Params:
834 	 *     screen = a #GdkScreen
835 	 *
836 	 * Since: 2.4
837 	 */
838 	public void setScreen(Screen screen)
839 	{
840 		gtk_icon_theme_set_screen(gtkIconTheme, (screen is null) ? null : screen.getScreenStruct());
841 	}
842 
843 	/**
844 	 * Sets the search path for the icon theme object. When looking
845 	 * for an icon theme, GTK+ will search for a subdirectory of
846 	 * one or more of the directories in @path with the same name
847 	 * as the icon theme containing an index.theme file. (Themes from
848 	 * multiple of the path elements are combined to allow themes to be
849 	 * extended by adding icons in the user’s home directory.)
850 	 *
851 	 * In addition if an icon found isn’t found either in the current
852 	 * icon theme or the default icon theme, and an image file with
853 	 * the right name is found directly in one of the elements of
854 	 * @path, then that image will be used for the icon name.
855 	 * (This is legacy feature, and new icons should be put
856 	 * into the fallback icon theme, which is called hicolor,
857 	 * rather than directly on the icon path.)
858 	 *
859 	 * Params:
860 	 *     path = array of
861 	 *         directories that are searched for icon themes
862 	 *     nElements = number of elements in @path.
863 	 *
864 	 * Since: 2.4
865 	 */
866 	public void setSearchPath(string[] path)
867 	{
868 		gtk_icon_theme_set_search_path(gtkIconTheme, Str.toStringzArray(path), cast(int)path.length);
869 	}
870 
871 	int[string] connectedSignals;
872 
873 	void delegate(IconTheme)[] onChangedListeners;
874 	/**
875 	 * Emitted when the current icon theme is switched or GTK+ detects
876 	 * that a change has occurred in the contents of the current
877 	 * icon theme.
878 	 */
879 	void addOnChanged(void delegate(IconTheme) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
880 	{
881 		if ( "changed" !in connectedSignals )
882 		{
883 			Signals.connectData(
884 				this,
885 				"changed",
886 				cast(GCallback)&callBackChanged,
887 				cast(void*)this,
888 				null,
889 				connectFlags);
890 			connectedSignals["changed"] = 1;
891 		}
892 		onChangedListeners ~= dlg;
893 	}
894 	extern(C) static void callBackChanged(GtkIconTheme* iconthemeStruct, IconTheme _icontheme)
895 	{
896 		foreach ( void delegate(IconTheme) dlg; _icontheme.onChangedListeners )
897 		{
898 			dlg(_icontheme);
899 		}
900 	}
901 }