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