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