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  = GtkImage.html
27  * outPack = gtk
28  * outFile = Image
29  * strct   = GtkImage
30  * realStrct=
31  * ctorStrct=
32  * clss    = Image
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_image_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * 	- gtk_image_new_from_stock
46  * 	- gtk_image_new_from_icon_name
47  * omit signals:
48  * imports:
49  * 	- glib.Str
50  * 	- gio.Icon
51  * 	- gio.IconIF
52  * 	- gtk.IconSet
53  * 	- gdk.ImageGdk
54  * 	- gdk.Bitmap
55  * 	- gdk.Pixbuf
56  * 	- gdk.Pixmap
57  * 	- gdkpixbuf.PixbufAnimation
58  * 	- gtk.IconSet
59  * 	- gdk.ImageGdk
60  * 	- gdk.Bitmap
61  * 	- gdk.Pixmap
62  * structWrap:
63  * 	- GIcon* -> IconIF
64  * 	- GdkBitmap* -> Bitmap
65  * 	- GdkImage* -> ImageGdk
66  * 	- GdkPixbuf* -> Pixbuf
67  * 	- GdkPixbufAnimation* -> PixbufAnimation
68  * 	- GdkPixmap* -> Pixmap
69  * 	- GtkIconSet* -> IconSet
70  * module aliases:
71  * local aliases:
72  * overrides:
73  */
74 
75 module gtk.Image;
76 
77 public  import gtkc.gtktypes;
78 
79 private import gtkc.gtk;
80 private import glib.ConstructionException;
81 private import gobject.ObjectG;
82 
83 
84 private import glib.Str;
85 private import gio.Icon;
86 private import gio.IconIF;
87 private import gtk.IconSet;
88 private import gdk.ImageGdk;
89 private import gdk.Bitmap;
90 private import gdk.Pixbuf;
91 private import gdk.Pixmap;
92 private import gdkpixbuf.PixbufAnimation;
93 private import gtk.IconSet;
94 private import gdk.ImageGdk;
95 private import gdk.Bitmap;
96 private import gdk.Pixmap;
97 
98 
99 
100 private import gtk.Misc;
101 
102 /**
103  * Description
104  * The GtkImage widget displays an image. Various kinds of object
105  * can be displayed as an image; most typically, you would load a
106  * GdkPixbuf ("pixel buffer") from a file, and then display that.
107  * There's a convenience function to do this, gtk_image_new_from_file(),
108  * used as follows:
109  * $(DDOC_COMMENT example)
110  * If the file isn't loaded successfully, the image will contain a
111  * "broken image" icon similar to that used in many web browsers.
112  * If you want to handle errors in loading the file yourself,
113  * for example by displaying an error message, then load the image with
114  * gdk_pixbuf_new_from_file(), then create the GtkImage with
115  * gtk_image_new_from_pixbuf().
116  * The image file may contain an animation, if so the GtkImage will
117  * display an animation (GdkPixbufAnimation) instead of a static image.
118  * GtkImage is a subclass of GtkMisc, which implies that you can
119  * align it (center, left, right) and add padding to it, using
120  * GtkMisc methods.
121  * GtkImage is a "no window" widget (has no GdkWindow of its own),
122  * so by default does not receive events. If you want to receive events
123  * on the image, such as button clicks, place the image inside a
124  * GtkEventBox, then connect to the event signals on the event box.
125  * $(DDOC_COMMENT example)
126  * When handling events on the event box, keep in mind that coordinates
127  * in the image may be different from event box coordinates due to
128  * the alignment and padding settings on the image (see GtkMisc).
129  * The simplest way to solve this is to set the alignment to 0.0
130  * (left/top), and set the padding to zero. Then the origin of
131  * the image will be the same as the origin of the event box.
132  * Sometimes an application will want to avoid depending on external data
133  * files, such as image files. GTK+ comes with a program to avoid this,
134  * called gdk-pixbuf-csource. This program
135  * allows you to convert an image into a C variable declaration, which
136  * can then be loaded into a GdkPixbuf using
137  * gdk_pixbuf_new_from_inline().
138  */
139 public class Image : Misc
140 {
141 	
142 	/** the main Gtk struct */
143 	protected GtkImage* gtkImage;
144 	
145 	
146 	public GtkImage* getImageStruct()
147 	{
148 		return gtkImage;
149 	}
150 	
151 	
152 	/** the main Gtk struct as a void* */
153 	protected override void* getStruct()
154 	{
155 		return cast(void*)gtkImage;
156 	}
157 	
158 	/**
159 	 * Sets our main struct and passes it to the parent class
160 	 */
161 	public this (GtkImage* gtkImage)
162 	{
163 		super(cast(GtkMisc*)gtkImage);
164 		this.gtkImage = gtkImage;
165 	}
166 	
167 	protected override void setStruct(GObject* obj)
168 	{
169 		super.setStruct(obj);
170 		gtkImage = cast(GtkImage*)obj;
171 	}
172 	
173 	// this will be an enum
174 	/**
175 	 * Creates a GtkImage displaying a stock icon. Sample stock icon
176 	 * names are GTK_STOCK_OPEN, GTK_STOCK_EXIT. Sample stock sizes
177 	 * are GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_SMALL_TOOLBAR. If the stock
178 	 * icon name isn't known, the image will be empty.
179 	 * You can register your own stock icon names, see
180 	 * gtk_icon_factory_add_default() and gtk_icon_factory_add().
181 	 * Params:
182 	 *  StockID = a stock icon name
183 	 *  size = a stock icon size
184 	 * Returns:
185 	 *  a new GtkImage displaying the stock icon
186 	 * Throws: ConstructionException GTK+ fails to create the object.
187 	 */
188 	public this (StockID stockID, GtkIconSize size)
189 	{
190 		// GtkWidget* gtk_image_new_from_stock (const gchar *stock_id,  GtkIconSize size);
191 		auto p = gtk_image_new_from_stock(Str.toStringz(StockDesc[stockID]), size);
192 		if(p is null)
193 		{
194 			throw new ConstructionException("null returned by gtk_image_new_from_stock(Str.toStringz(StockDesc[stockID]), size)");
195 		}
196 		this(cast(GtkImage*)p);
197 	}
198 	
199 	/**
200 	 * Creates a GtkImage displaying an icon from the current icon theme.
201 	 * If the icon name isn't known, a "broken image" icon will be
202 	 * displayed instead. If the current icon theme is changed, the icon
203 	 * will be updated appropriately. Since 2.6
204 	 * Params:
205 	 *  iconName = an icon name
206 	 *  size = a stock icon size
207 	 * Returns:
208 	 *  a new GtkImage displaying the themed icon
209 	 * Throws: ConstructionException GTK+ fails to create the object.
210 	 */
211 	public this (string iconName, GtkIconSize size)
212 	{
213 		// GtkWidget* gtk_image_new_from_icon_name (const gchar *icon_name,  GtkIconSize size);
214 		auto p = gtk_image_new_from_icon_name(Str.toStringz(iconName), size);
215 		if(p is null)
216 		{
217 			throw new ConstructionException("null returned by gtk_image_new_from_icon_name(Str.toStringz(iconName), size)");
218 		}
219 		this(cast(GtkImage*)p);
220 	}
221 	
222 	
223 	/**
224 	 */
225 	
226 	/**
227 	 * Gets the icon set and size being displayed by the GtkImage.
228 	 * The storage type of the image must be GTK_IMAGE_EMPTY or
229 	 * GTK_IMAGE_ICON_SET (see gtk_image_get_storage_type()).
230 	 * Params:
231 	 * iconSet = location to store a
232 	 *  GtkIconSet, or NULL. [out][transfer none][allow-none]
233 	 * size = location to store a stock
234 	 *  icon size, or NULL. [out][allow-none][type int]
235 	 */
236 	public void getIconSet(out IconSet iconSet, out GtkIconSize size)
237 	{
238 		// void gtk_image_get_icon_set (GtkImage *image,  GtkIconSet **icon_set,  GtkIconSize *size);
239 		GtkIconSet* outiconSet = null;
240 		
241 		gtk_image_get_icon_set(gtkImage, &outiconSet, &size);
242 		
243 		iconSet = ObjectG.getDObject!(IconSet)(outiconSet);
244 	}
245 	
246 	/**
247 	 * Gets the GdkImage and mask being displayed by the GtkImage.
248 	 * The storage type of the image must be GTK_IMAGE_EMPTY or
249 	 * GTK_IMAGE_IMAGE (see gtk_image_get_storage_type()).
250 	 * The caller of this function does not own a reference to the
251 	 * returned image and mask.
252 	 * Params:
253 	 * gdkImage = return location for
254 	 *  a GtkImage, or NULL. [out][transfer none][allow-none]
255 	 * mask = return location for a
256 	 *  GdkBitmap, or NULL. [out][transfer none][allow-none]
257 	 */
258 	public void getImage(out ImageGdk gdkImage, out Bitmap mask)
259 	{
260 		// void gtk_image_get_image (GtkImage *image,  GdkImage **gdk_image,  GdkBitmap **mask);
261 		GdkImage* outgdkImage = null;
262 		GdkBitmap* outmask = null;
263 		
264 		gtk_image_get_image(gtkImage, &outgdkImage, &outmask);
265 		
266 		gdkImage = ObjectG.getDObject!(ImageGdk)(outgdkImage);
267 		mask = ObjectG.getDObject!(Bitmap)(outmask);
268 	}
269 	
270 	/**
271 	 * Gets the GdkPixbuf being displayed by the GtkImage.
272 	 * The storage type of the image must be GTK_IMAGE_EMPTY or
273 	 * GTK_IMAGE_PIXBUF (see gtk_image_get_storage_type()).
274 	 * The caller of this function does not own a reference to the
275 	 * returned pixbuf.
276 	 * Returns: the displayed pixbuf, or NULL if the image is empty. [transfer none]
277 	 */
278 	public Pixbuf getPixbuf()
279 	{
280 		// GdkPixbuf* gtk_image_get_pixbuf (GtkImage *image);
281 		auto p = gtk_image_get_pixbuf(gtkImage);
282 		
283 		if(p is null)
284 		{
285 			return null;
286 		}
287 		
288 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
289 	}
290 	
291 	/**
292 	 * Gets the pixmap and mask being displayed by the GtkImage.
293 	 * The storage type of the image must be GTK_IMAGE_EMPTY or
294 	 * GTK_IMAGE_PIXMAP (see gtk_image_get_storage_type()).
295 	 * The caller of this function does not own a reference to the
296 	 * returned pixmap and mask.
297 	 * Params:
298 	 * pixmap = location to store the
299 	 *  pixmap, or NULL. [out][transfer none][allow-none]
300 	 * mask = location to store the
301 	 *  mask, or NULL. [out][transfer none][allow-none]
302 	 */
303 	public void getPixmap(out Pixmap pixmap, out Bitmap mask)
304 	{
305 		// void gtk_image_get_pixmap (GtkImage *image,  GdkPixmap **pixmap,  GdkBitmap **mask);
306 		GdkPixmap* outpixmap = null;
307 		GdkBitmap* outmask = null;
308 		
309 		gtk_image_get_pixmap(gtkImage, &outpixmap, &outmask);
310 		
311 		pixmap = ObjectG.getDObject!(Pixmap)(outpixmap);
312 		mask = ObjectG.getDObject!(Bitmap)(outmask);
313 	}
314 	
315 	/**
316 	 * Gets the stock icon name and size being displayed by the GtkImage.
317 	 * The storage type of the image must be GTK_IMAGE_EMPTY or
318 	 * GTK_IMAGE_STOCK (see gtk_image_get_storage_type()).
319 	 * The returned string is owned by the GtkImage and should not
320 	 * be freed.
321 	 * Params:
322 	 * stockId = place to store a
323 	 *  stock icon name, or NULL. [out][transfer none][allow-none]
324 	 * size = place to store a stock icon
325 	 *  size, or NULL. [out][allow-none][type int]
326 	 */
327 	public void getStock(out string stockId, out GtkIconSize size)
328 	{
329 		// void gtk_image_get_stock (GtkImage *image,  gchar **stock_id,  GtkIconSize *size);
330 		char* outstockId = null;
331 		
332 		gtk_image_get_stock(gtkImage, &outstockId, &size);
333 		
334 		stockId = Str.toString(outstockId);
335 	}
336 	
337 	/**
338 	 * Gets the GdkPixbufAnimation being displayed by the GtkImage.
339 	 * The storage type of the image must be GTK_IMAGE_EMPTY or
340 	 * GTK_IMAGE_ANIMATION (see gtk_image_get_storage_type()).
341 	 * The caller of this function does not own a reference to the
342 	 * returned animation.
343 	 * Returns: the displayed animation, or NULL if the image is empty. [transfer none]
344 	 */
345 	public PixbufAnimation getAnimation()
346 	{
347 		// GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
348 		auto p = gtk_image_get_animation(gtkImage);
349 		
350 		if(p is null)
351 		{
352 			return null;
353 		}
354 		
355 		return ObjectG.getDObject!(PixbufAnimation)(cast(GdkPixbufAnimation*) p);
356 	}
357 	
358 	/**
359 	 * Gets the icon name and size being displayed by the GtkImage.
360 	 * The storage type of the image must be GTK_IMAGE_EMPTY or
361 	 * GTK_IMAGE_ICON_NAME (see gtk_image_get_storage_type()).
362 	 * The returned string is owned by the GtkImage and should not
363 	 * be freed.
364 	 * Since 2.6
365 	 * Params:
366 	 * iconName = place to store an
367 	 *  icon name, or NULL. [out][transfer none][allow-none]
368 	 * size = place to store an icon size,
369 	 *  or NULL. [out][allow-none][type int]
370 	 */
371 	public void getIconName(out string iconName, out GtkIconSize size)
372 	{
373 		// void gtk_image_get_icon_name (GtkImage *image,  G_CONST_RETURN gchar **icon_name,  GtkIconSize *size);
374 		char* outiconName = null;
375 		
376 		gtk_image_get_icon_name(gtkImage, &outiconName, &size);
377 		
378 		iconName = Str.toString(outiconName);
379 	}
380 	
381 	/**
382 	 * Gets the GIcon and size being displayed by the GtkImage.
383 	 * The storage type of the image must be GTK_IMAGE_EMPTY or
384 	 * GTK_IMAGE_GICON (see gtk_image_get_storage_type()).
385 	 * The caller of this function does not own a reference to the
386 	 * returned GIcon.
387 	 * Since 2.14
388 	 * Params:
389 	 * gicon = place to store a
390 	 *  GIcon, or NULL. [out][transfer none][allow-none]
391 	 * size = place to store an icon size,
392 	 *  or NULL. [out][allow-none][type int]
393 	 */
394 	public void getGicon(out IconIF gicon, out GtkIconSize size)
395 	{
396 		// void gtk_image_get_gicon (GtkImage *image,  GIcon **gicon,  GtkIconSize *size);
397 		GIcon* outgicon = null;
398 		
399 		gtk_image_get_gicon(gtkImage, &outgicon, &size);
400 		
401 		gicon = ObjectG.getDObject!(Icon, IconIF)(outgicon);
402 	}
403 	
404 	/**
405 	 * Gets the type of representation being used by the GtkImage
406 	 * to store image data. If the GtkImage has no image data,
407 	 * the return value will be GTK_IMAGE_EMPTY.
408 	 * Returns: image representation being used
409 	 */
410 	public GtkImageType getStorageType()
411 	{
412 		// GtkImageType gtk_image_get_storage_type (GtkImage *image);
413 		return gtk_image_get_storage_type(gtkImage);
414 	}
415 	
416 	/**
417 	 * Creates a new GtkImage displaying the file filename. If the file
418 	 * isn't found or can't be loaded, the resulting GtkImage will
419 	 * display a "broken image" icon. This function never returns NULL,
420 	 * it always returns a valid GtkImage widget.
421 	 * If the file contains an animation, the image will contain an
422 	 * animation.
423 	 * If you need to detect failures to load the file, use
424 	 * gdk_pixbuf_new_from_file() to load the file yourself, then create
425 	 * the GtkImage from the pixbuf. (Or for animations, use
426 	 * gdk_pixbuf_animation_new_from_file()).
427 	 * The storage type (gtk_image_get_storage_type()) of the returned
428 	 * image is not defined, it will be whatever is appropriate for
429 	 * displaying the file.
430 	 * Params:
431 	 * filename = a filename
432 	 * Throws: ConstructionException GTK+ fails to create the object.
433 	 */
434 	public this (string filename)
435 	{
436 		// GtkWidget* gtk_image_new_from_file (const gchar *filename);
437 		auto p = gtk_image_new_from_file(Str.toStringz(filename));
438 		if(p is null)
439 		{
440 			throw new ConstructionException("null returned by gtk_image_new_from_file(Str.toStringz(filename))");
441 		}
442 		this(cast(GtkImage*) p);
443 	}
444 	
445 	/**
446 	 * Creates a GtkImage displaying an icon set. Sample stock sizes are
447 	 * GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_SMALL_TOOLBAR. Instead of using
448 	 * this function, usually it's better to create a GtkIconFactory, put
449 	 * your icon sets in the icon factory, add the icon factory to the
450 	 * list of default factories with gtk_icon_factory_add_default(), and
451 	 * then use gtk_image_new_from_stock(). This will allow themes to
452 	 * override the icon you ship with your application.
453 	 * The GtkImage does not assume a reference to the
454 	 * icon set; you still need to unref it if you own references.
455 	 * GtkImage will add its own reference rather than adopting yours.
456 	 * Params:
457 	 * iconSet = a GtkIconSet
458 	 * size = a stock icon size. [type int]
459 	 * Throws: ConstructionException GTK+ fails to create the object.
460 	 */
461 	public this (IconSet iconSet, GtkIconSize size)
462 	{
463 		// GtkWidget* gtk_image_new_from_icon_set (GtkIconSet *icon_set,  GtkIconSize size);
464 		auto p = gtk_image_new_from_icon_set((iconSet is null) ? null : iconSet.getIconSetStruct(), size);
465 		if(p is null)
466 		{
467 			throw new ConstructionException("null returned by gtk_image_new_from_icon_set((iconSet is null) ? null : iconSet.getIconSetStruct(), size)");
468 		}
469 		this(cast(GtkImage*) p);
470 	}
471 	
472 	/**
473 	 * Creates a GtkImage widget displaying a image with a mask.
474 	 * A GdkImage is a client-side image buffer in the pixel format of the
475 	 * current display. The GtkImage does not assume a reference to the
476 	 * image or mask; you still need to unref them if you own references.
477 	 * GtkImage will add its own reference rather than adopting yours.
478 	 * Params:
479 	 * image = a GdkImage, or NULL. [allow-none]
480 	 * mask = a GdkBitmap, or NULL. [allow-none]
481 	 * Throws: ConstructionException GTK+ fails to create the object.
482 	 */
483 	public this (ImageGdk image, Bitmap mask)
484 	{
485 		// GtkWidget* gtk_image_new_from_image (GdkImage *image,  GdkBitmap *mask);
486 		auto p = gtk_image_new_from_image((image is null) ? null : image.getImageGdkStruct(), (mask is null) ? null : mask.getBitmapStruct());
487 		if(p is null)
488 		{
489 			throw new ConstructionException("null returned by gtk_image_new_from_image((image is null) ? null : image.getImageGdkStruct(), (mask is null) ? null : mask.getBitmapStruct())");
490 		}
491 		this(cast(GtkImage*) p);
492 	}
493 	
494 	/**
495 	 * Creates a new GtkImage displaying pixbuf.
496 	 * The GtkImage does not assume a reference to the
497 	 * pixbuf; you still need to unref it if you own references.
498 	 * GtkImage will add its own reference rather than adopting yours.
499 	 * Note that this function just creates an GtkImage from the pixbuf. The
500 	 * GtkImage created will not react to state changes. Should you want that,
501 	 * you should use gtk_image_new_from_icon_set().
502 	 * Params:
503 	 * pixbuf = a GdkPixbuf, or NULL. [allow-none]
504 	 * Throws: ConstructionException GTK+ fails to create the object.
505 	 */
506 	public this (Pixbuf pixbuf)
507 	{
508 		// GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
509 		auto p = gtk_image_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct());
510 		if(p is null)
511 		{
512 			throw new ConstructionException("null returned by gtk_image_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct())");
513 		}
514 		this(cast(GtkImage*) p);
515 	}
516 	
517 	/**
518 	 * Creates a GtkImage widget displaying pixmap with a mask.
519 	 * A GdkPixmap is a server-side image buffer in the pixel format of the
520 	 * current display. The GtkImage does not assume a reference to the
521 	 * pixmap or mask; you still need to unref them if you own references.
522 	 * GtkImage will add its own reference rather than adopting yours.
523 	 * Params:
524 	 * pixmap = a GdkPixmap, or NULL. [allow-none]
525 	 * mask = a GdkBitmap, or NULL. [allow-none]
526 	 * Throws: ConstructionException GTK+ fails to create the object.
527 	 */
528 	public this (Pixmap pixmap, Bitmap mask)
529 	{
530 		// GtkWidget* gtk_image_new_from_pixmap (GdkPixmap *pixmap,  GdkBitmap *mask);
531 		auto p = gtk_image_new_from_pixmap((pixmap is null) ? null : pixmap.getPixmapStruct(), (mask is null) ? null : mask.getBitmapStruct());
532 		if(p is null)
533 		{
534 			throw new ConstructionException("null returned by gtk_image_new_from_pixmap((pixmap is null) ? null : pixmap.getPixmapStruct(), (mask is null) ? null : mask.getBitmapStruct())");
535 		}
536 		this(cast(GtkImage*) p);
537 	}
538 	
539 	/**
540 	 * Creates a GtkImage displaying the given animation.
541 	 * The GtkImage does not assume a reference to the
542 	 * animation; you still need to unref it if you own references.
543 	 * GtkImage will add its own reference rather than adopting yours.
544 	 * Note that the animation frames are shown using a timeout with
545 	 * G_PRIORITY_DEFAULT. When using animations to indicate busyness,
546 	 * keep in mind that the animation will only be shown if the main loop
547 	 * is not busy with something that has a higher priority.
548 	 * Params:
549 	 * animation = an animation
550 	 * Throws: ConstructionException GTK+ fails to create the object.
551 	 */
552 	public this (PixbufAnimation animation)
553 	{
554 		// GtkWidget* gtk_image_new_from_animation (GdkPixbufAnimation *animation);
555 		auto p = gtk_image_new_from_animation((animation is null) ? null : animation.getPixbufAnimationStruct());
556 		if(p is null)
557 		{
558 			throw new ConstructionException("null returned by gtk_image_new_from_animation((animation is null) ? null : animation.getPixbufAnimationStruct())");
559 		}
560 		this(cast(GtkImage*) p);
561 	}
562 	
563 	/**
564 	 * Creates a GtkImage displaying an icon from the current icon theme.
565 	 * If the icon name isn't known, a "broken image" icon will be
566 	 * displayed instead. If the current icon theme is changed, the icon
567 	 * will be updated appropriately.
568 	 * Since 2.14
569 	 * Params:
570 	 * icon = an icon
571 	 * size = a stock icon size. [type int]
572 	 * Throws: ConstructionException GTK+ fails to create the object.
573 	 */
574 	public this (IconIF icon, GtkIconSize size)
575 	{
576 		// GtkWidget* gtk_image_new_from_gicon (GIcon *icon,  GtkIconSize size);
577 		auto p = gtk_image_new_from_gicon((icon is null) ? null : icon.getIconTStruct(), size);
578 		if(p is null)
579 		{
580 			throw new ConstructionException("null returned by gtk_image_new_from_gicon((icon is null) ? null : icon.getIconTStruct(), size)");
581 		}
582 		this(cast(GtkImage*) p);
583 	}
584 	
585 	/**
586 	 * See gtk_image_new_from_file() for details.
587 	 * Params:
588 	 * filename = a filename or NULL. [allow-none]
589 	 */
590 	public void setFromFile(string filename)
591 	{
592 		// void gtk_image_set_from_file (GtkImage *image,  const gchar *filename);
593 		gtk_image_set_from_file(gtkImage, Str.toStringz(filename));
594 	}
595 	
596 	/**
597 	 * See gtk_image_new_from_icon_set() for details.
598 	 * Params:
599 	 * iconSet = a GtkIconSet
600 	 * size = a stock icon size. [type int]
601 	 */
602 	public void setFromIconSet(IconSet iconSet, GtkIconSize size)
603 	{
604 		// void gtk_image_set_from_icon_set (GtkImage *image,  GtkIconSet *icon_set,  GtkIconSize size);
605 		gtk_image_set_from_icon_set(gtkImage, (iconSet is null) ? null : iconSet.getIconSetStruct(), size);
606 	}
607 	
608 	/**
609 	 * See gtk_image_new_from_image() for details.
610 	 * Params:
611 	 * gdkImage = a GdkImage or NULL. [allow-none]
612 	 * mask = a GdkBitmap or NULL. [allow-none]
613 	 */
614 	public void setFromImage(ImageGdk gdkImage, Bitmap mask)
615 	{
616 		// void gtk_image_set_from_image (GtkImage *image,  GdkImage *gdk_image,  GdkBitmap *mask);
617 		gtk_image_set_from_image(gtkImage, (gdkImage is null) ? null : gdkImage.getImageGdkStruct(), (mask is null) ? null : mask.getBitmapStruct());
618 	}
619 	
620 	/**
621 	 * See gtk_image_new_from_pixbuf() for details.
622 	 * Params:
623 	 * pixbuf = a GdkPixbuf or NULL. [allow-none]
624 	 */
625 	public void setFromPixbuf(Pixbuf pixbuf)
626 	{
627 		// void gtk_image_set_from_pixbuf (GtkImage *image,  GdkPixbuf *pixbuf);
628 		gtk_image_set_from_pixbuf(gtkImage, (pixbuf is null) ? null : pixbuf.getPixbufStruct());
629 	}
630 	
631 	/**
632 	 * See gtk_image_new_from_pixmap() for details.
633 	 * Params:
634 	 * pixmap = a GdkPixmap or NULL. [allow-none]
635 	 * mask = a GdkBitmap or NULL. [allow-none]
636 	 */
637 	public void setFromPixmap(Pixmap pixmap, Bitmap mask)
638 	{
639 		// void gtk_image_set_from_pixmap (GtkImage *image,  GdkPixmap *pixmap,  GdkBitmap *mask);
640 		gtk_image_set_from_pixmap(gtkImage, (pixmap is null) ? null : pixmap.getPixmapStruct(), (mask is null) ? null : mask.getBitmapStruct());
641 	}
642 	
643 	/**
644 	 * See gtk_image_new_from_stock() for details.
645 	 * Params:
646 	 * stockId = a stock icon name
647 	 * size = a stock icon size. [type int]
648 	 */
649 	public void setFromStock(string stockId, GtkIconSize size)
650 	{
651 		// void gtk_image_set_from_stock (GtkImage *image,  const gchar *stock_id,  GtkIconSize size);
652 		gtk_image_set_from_stock(gtkImage, Str.toStringz(stockId), size);
653 	}
654 	
655 	/**
656 	 * Causes the GtkImage to display the given animation (or display
657 	 * nothing, if you set the animation to NULL).
658 	 * Params:
659 	 * animation = the GdkPixbufAnimation
660 	 */
661 	public void setFromAnimation(PixbufAnimation animation)
662 	{
663 		// void gtk_image_set_from_animation (GtkImage *image,  GdkPixbufAnimation *animation);
664 		gtk_image_set_from_animation(gtkImage, (animation is null) ? null : animation.getPixbufAnimationStruct());
665 	}
666 	
667 	/**
668 	 * See gtk_image_new_from_icon_name() for details.
669 	 * Since 2.6
670 	 * Params:
671 	 * iconName = an icon name
672 	 * size = an icon size. [type int]
673 	 */
674 	public void setFromIconName(string iconName, GtkIconSize size)
675 	{
676 		// void gtk_image_set_from_icon_name (GtkImage *image,  const gchar *icon_name,  GtkIconSize size);
677 		gtk_image_set_from_icon_name(gtkImage, Str.toStringz(iconName), size);
678 	}
679 	
680 	/**
681 	 * See gtk_image_new_from_gicon() for details.
682 	 * Since 2.14
683 	 * Params:
684 	 * icon = an icon
685 	 * size = an icon size. [type int]
686 	 */
687 	public void setFromGicon(IconIF icon, GtkIconSize size)
688 	{
689 		// void gtk_image_set_from_gicon (GtkImage *image,  GIcon *icon,  GtkIconSize size);
690 		gtk_image_set_from_gicon(gtkImage, (icon is null) ? null : icon.getIconTStruct(), size);
691 	}
692 	
693 	/**
694 	 * Resets the image to be empty.
695 	 * Since 2.8
696 	 */
697 	public void clear()
698 	{
699 		// void gtk_image_clear (GtkImage *image);
700 		gtk_image_clear(gtkImage);
701 	}
702 	
703 	/**
704 	 * Creates a new empty GtkImage widget.
705 	 * Throws: ConstructionException GTK+ fails to create the object.
706 	 */
707 	public this ()
708 	{
709 		// GtkWidget* gtk_image_new (void);
710 		auto p = gtk_image_new();
711 		if(p is null)
712 		{
713 			throw new ConstructionException("null returned by gtk_image_new()");
714 		}
715 		this(cast(GtkImage*) p);
716 	}
717 	
718 	/**
719 	 * Warning
720 	 * gtk_image_set has been deprecated since version 2.0 and should not be used in newly-written code. Use gtk_image_set_from_image() instead.
721 	 * Sets the GtkImage.
722 	 * Params:
723 	 * val = a GdkImage
724 	 * mask = a GdkBitmap that indicates which parts of the image should be transparent.
725 	 */
726 	public void set(ImageGdk val, Bitmap mask)
727 	{
728 		// void gtk_image_set (GtkImage *image,  GdkImage *val,  GdkBitmap *mask);
729 		gtk_image_set(gtkImage, (val is null) ? null : val.getImageGdkStruct(), (mask is null) ? null : mask.getBitmapStruct());
730 	}
731 	
732 	/**
733 	 * Warning
734 	 * gtk_image_get has been deprecated since version 2.0 and should not be used in newly-written code. Use gtk_image_get_image() instead.
735 	 * Gets the GtkImage.
736 	 * Params:
737 	 * val = return location for a GdkImage
738 	 * mask = a GdkBitmap that indicates which parts of the image should be transparent.
739 	 */
740 	public void get(out ImageGdk val, out Bitmap mask)
741 	{
742 		// void gtk_image_get (GtkImage *image,  GdkImage **val,  GdkBitmap **mask);
743 		GdkImage* outval = null;
744 		GdkBitmap* outmask = null;
745 		
746 		gtk_image_get(gtkImage, &outval, &outmask);
747 		
748 		val = ObjectG.getDObject!(ImageGdk)(outval);
749 		mask = ObjectG.getDObject!(Bitmap)(outmask);
750 	}
751 	
752 	/**
753 	 * Sets the pixel size to use for named icons. If the pixel size is set
754 	 * to a value != -1, it is used instead of the icon size set by
755 	 * gtk_image_set_from_icon_name().
756 	 * Since 2.6
757 	 * Params:
758 	 * pixelSize = the new pixel size
759 	 */
760 	public void setPixelSize(int pixelSize)
761 	{
762 		// void gtk_image_set_pixel_size (GtkImage *image,  gint pixel_size);
763 		gtk_image_set_pixel_size(gtkImage, pixelSize);
764 	}
765 	
766 	/**
767 	 * Gets the pixel size used for named icons.
768 	 * Since 2.6
769 	 * Returns: the pixel size used for named icons.
770 	 */
771 	public int getPixelSize()
772 	{
773 		// gint gtk_image_get_pixel_size (GtkImage *image);
774 		return gtk_image_get_pixel_size(gtkImage);
775 	}
776 }