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