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