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