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  = 
27  * outPack = gdkpixbuf
28  * outFile = PixbufAnimationIter
29  * strct   = GdkPixbufAnimationIter
30  * realStrct=
31  * ctorStrct=
32  * clss    = PixbufAnimationIter
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = GObject
38  * implements:
39  * prefixes:
40  * 	- gdk_pixbuf_animation_iter_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- gdk.Pixbuf
47  * structWrap:
48  * 	- GdkPixbuf* -> Pixbuf
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module gdkpixbuf.PixbufAnimationIter;
55 
56 public  import gtkc.gdkpixbuftypes;
57 
58 private import gtkc.gdkpixbuf;
59 private import glib.ConstructionException;
60 private import gobject.ObjectG;
61 
62 private import gdk.Pixbuf;
63 
64 
65 private import gobject.ObjectG;
66 
67 /**
68  * The GdkPixBuf library provides a simple mechanism to load and
69  * represent animations. An animation is conceptually a series of
70  * frames to be displayed over time. The animation may not be
71  * represented as a series of frames internally; for example, it may
72  * be stored as a sprite and instructions for moving the sprite around
73  * a background. To display an animation you don't need to understand
74  * its representation, however; you just ask GdkPixBuf what should
75  * be displayed at a given point in time.
76  */
77 public class PixbufAnimationIter : ObjectG
78 {
79 	
80 	/** the main Gtk struct */
81 	protected GdkPixbufAnimationIter* gdkPixbufAnimationIter;
82 	
83 	
84 	/** Get the main Gtk struct */
85 	public GdkPixbufAnimationIter* getPixbufAnimationIterStruct()
86 	{
87 		return gdkPixbufAnimationIter;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected override void* getStruct()
93 	{
94 		return cast(void*)gdkPixbufAnimationIter;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (GdkPixbufAnimationIter* gdkPixbufAnimationIter)
101 	{
102 		super(cast(GObject*)gdkPixbufAnimationIter);
103 		this.gdkPixbufAnimationIter = gdkPixbufAnimationIter;
104 	}
105 	
106 	protected override void setStruct(GObject* obj)
107 	{
108 		super.setStruct(obj);
109 		gdkPixbufAnimationIter = cast(GdkPixbufAnimationIter*)obj;
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Possibly advances an animation to a new frame. Chooses the frame based
117 	 * on the start time passed to gdk_pixbuf_animation_get_iter().
118 	 * current_time would normally come from g_get_current_time(), and
119 	 * must be greater than or equal to the time passed to
120 	 * gdk_pixbuf_animation_get_iter(), and must increase or remain
121 	 * unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
122 	 * called. That is, you can't go backward in time; animations only
123 	 * play forward.
124 	 * As a shortcut, pass NULL for the current time and g_get_current_time()
125 	 * will be invoked on your behalf. So you only need to explicitly pass
126 	 * current_time if you're doing something odd like playing the animation
127 	 * at double speed.
128 	 * If this function returns FALSE, there's no need to update the animation
129 	 * display, assuming the display had been rendered prior to advancing;
130 	 * if TRUE, you need to call gdk_pixbuf_animation_iter_get_pixbuf()
131 	 * and update the display with the new pixbuf.
132 	 * Params:
133 	 * currentTime = current time. [allow-none]
134 	 * Returns: TRUE if the image may need updating
135 	 */
136 	public int advance(ref GTimeVal currentTime)
137 	{
138 		// gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter,  const GTimeVal *current_time);
139 		return gdk_pixbuf_animation_iter_advance(gdkPixbufAnimationIter, &currentTime);
140 	}
141 	
142 	/**
143 	 * Gets the number of milliseconds the current pixbuf should be displayed,
144 	 * or -1 if the current pixbuf should be displayed forever. g_timeout_add()
145 	 * conveniently takes a timeout in milliseconds, so you can use a timeout
146 	 * to schedule the next update.
147 	 * Returns: delay time in milliseconds (thousandths of a second)
148 	 */
149 	public int getDelayTime()
150 	{
151 		// int gdk_pixbuf_animation_iter_get_delay_time  (GdkPixbufAnimationIter *iter);
152 		return gdk_pixbuf_animation_iter_get_delay_time(gdkPixbufAnimationIter);
153 	}
154 	
155 	/**
156 	 * Used to determine how to respond to the area_updated signal on
157 	 * GdkPixbufLoader when loading an animation. area_updated is emitted
158 	 * for an area of the frame currently streaming in to the loader. So if
159 	 * you're on the currently loading frame, you need to redraw the screen for
160 	 * the updated area.
161 	 * Returns: TRUE if the frame we're on is partially loaded, or the last frame
162 	 */
163 	public int onCurrentlyLoadingFrame()
164 	{
165 		// gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame  (GdkPixbufAnimationIter *iter);
166 		return gdk_pixbuf_animation_iter_on_currently_loading_frame(gdkPixbufAnimationIter);
167 	}
168 	
169 	/**
170 	 * Gets the current pixbuf which should be displayed; the pixbuf might not
171 	 * be the same size as the animation itself
172 	 * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
173 	 * This pixbuf should be displayed for
174 	 * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. The caller
175 	 * of this function does not own a reference to the returned pixbuf;
176 	 * the returned pixbuf will become invalid when the iterator advances
177 	 * to the next frame, which may happen anytime you call
178 	 * gdk_pixbuf_animation_iter_advance(). Copy the pixbuf to keep it
179 	 * (don't just add a reference), as it may get recycled as you advance
180 	 * the iterator.
181 	 * Returns: the pixbuf to be displayed. [transfer none]
182 	 */
183 	public Pixbuf getPixbuf()
184 	{
185 		// GdkPixbuf * gdk_pixbuf_animation_iter_get_pixbuf  (GdkPixbufAnimationIter *iter);
186 		auto p = gdk_pixbuf_animation_iter_get_pixbuf(gdkPixbufAnimationIter);
187 		
188 		if(p is null)
189 		{
190 			return null;
191 		}
192 		
193 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
194 	}
195 }