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