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 gdkpixbuf.PixbufSimpleAnimation; 26 27 private import gdkpixbuf.Pixbuf; 28 private import gdkpixbuf.PixbufAnimation; 29 private import gdkpixbuf.c.functions; 30 public import gdkpixbuf.c.types; 31 private import glib.ConstructionException; 32 private import gobject.ObjectG; 33 34 35 /** 36 * An opaque struct representing a simple animation. 37 */ 38 public class PixbufSimpleAnimation : PixbufAnimation 39 { 40 /** the main Gtk struct */ 41 protected GdkPixbufSimpleAnim* gdkPixbufSimpleAnim; 42 43 /** Get the main Gtk struct */ 44 public GdkPixbufSimpleAnim* getPixbufSimpleAnimationStruct(bool transferOwnership = false) 45 { 46 if (transferOwnership) 47 ownedRef = false; 48 return gdkPixbufSimpleAnim; 49 } 50 51 /** the main Gtk struct as a void* */ 52 protected override void* getStruct() 53 { 54 return cast(void*)gdkPixbufSimpleAnim; 55 } 56 57 /** 58 * Sets our main struct and passes it to the parent class. 59 */ 60 public this (GdkPixbufSimpleAnim* gdkPixbufSimpleAnim, bool ownedRef = false) 61 { 62 this.gdkPixbufSimpleAnim = gdkPixbufSimpleAnim; 63 super(cast(GdkPixbufAnimation*)gdkPixbufSimpleAnim, ownedRef); 64 } 65 66 67 /** */ 68 public static GType getType() 69 { 70 return gdk_pixbuf_simple_anim_get_type(); 71 } 72 73 /** 74 * Creates a new, empty animation. 75 * 76 * Params: 77 * width = the width of the animation 78 * height = the height of the animation 79 * rate = the speed of the animation, in frames per second 80 * 81 * Returns: a newly allocated #GdkPixbufSimpleAnim 82 * 83 * Since: 2.8 84 * 85 * Throws: ConstructionException GTK+ fails to create the object. 86 */ 87 public this(int width, int height, float rate) 88 { 89 auto __p = gdk_pixbuf_simple_anim_new(width, height, rate); 90 91 if(__p is null) 92 { 93 throw new ConstructionException("null returned by new"); 94 } 95 96 this(cast(GdkPixbufSimpleAnim*) __p, true); 97 } 98 99 /** 100 * Adds a new frame to @animation. The @pixbuf must 101 * have the dimensions specified when the animation 102 * was constructed. 103 * 104 * Params: 105 * pixbuf = the pixbuf to add 106 * 107 * Since: 2.8 108 */ 109 public void addFrame(Pixbuf pixbuf) 110 { 111 gdk_pixbuf_simple_anim_add_frame(gdkPixbufSimpleAnim, (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 112 } 113 114 /** 115 * Gets whether @animation should loop indefinitely when it reaches the end. 116 * 117 * Returns: %TRUE if the animation loops forever, %FALSE otherwise 118 * 119 * Since: 2.18 120 */ 121 public bool getLoop() 122 { 123 return gdk_pixbuf_simple_anim_get_loop(gdkPixbufSimpleAnim) != 0; 124 } 125 126 /** 127 * Sets whether @animation should loop indefinitely when it reaches the end. 128 * 129 * Params: 130 * loop = whether to loop the animation 131 * 132 * Since: 2.18 133 */ 134 public void setLoop(bool loop) 135 { 136 gdk_pixbuf_simple_anim_set_loop(gdkPixbufSimpleAnim, loop); 137 } 138 }