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