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 gdk.FrameTimings;
26 
27 private import gobject.ObjectG;
28 private import gtkc.gdk;
29 public  import gtkc.gdktypes;
30 private import gtkd.Loader;
31 
32 
33 /**
34  * A #GdkFrameTimings object holds timing information for a single frame
35  * of the application’s displays. To retrieve #GdkFrameTimings objects,
36  * use gdk_frame_clock_get_timings() or gdk_frame_clock_get_current_timings().
37  * The information in #GdkFrameTimings is useful for precise synchronization
38  * of video with the event or audio streams, and for measuring
39  * quality metrics for the application’s display, such as latency and jitter.
40  */
41 public class FrameTimings
42 {
43 	/** the main Gtk struct */
44 	protected GdkFrameTimings* gdkFrameTimings;
45 	protected bool ownedRef;
46 
47 	/** Get the main Gtk struct */
48 	public GdkFrameTimings* getFrameTimingsStruct(bool transferOwnership = false)
49 	{
50 		if (transferOwnership)
51 			ownedRef = false;
52 		return gdkFrameTimings;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected void* getStruct()
57 	{
58 		return cast(void*)gdkFrameTimings;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (GdkFrameTimings* gdkFrameTimings, bool ownedRef = false)
65 	{
66 		this.gdkFrameTimings = gdkFrameTimings;
67 		this.ownedRef = ownedRef;
68 	}
69 
70 	~this ()
71 	{
72 		if (  Linker.isLoaded(LIBRARY_GDK) && ownedRef )
73 			gdk_frame_timings_unref(gdkFrameTimings);
74 	}
75 
76 
77 	/** */
78 	public static GType getType()
79 	{
80 		return gdk_frame_timings_get_type();
81 	}
82 
83 	/**
84 	 * The timing information in a #GdkFrameTimings is filled in
85 	 * incrementally as the frame as drawn and passed off to the
86 	 * window system for processing and display to the user. The
87 	 * accessor functions for #GdkFrameTimings can return 0 to
88 	 * indicate an unavailable value for two reasons: either because
89 	 * the information is not yet available, or because it isn't
90 	 * available at all. Once gdk_frame_timings_get_complete() returns
91 	 * %TRUE for a frame, you can be certain that no further values
92 	 * will become available and be stored in the #GdkFrameTimings.
93 	 *
94 	 * Returns: %TRUE if all information that will be available
95 	 *     for the frame has been filled in.
96 	 *
97 	 * Since: 3.8
98 	 */
99 	public bool getComplete()
100 	{
101 		return gdk_frame_timings_get_complete(gdkFrameTimings) != 0;
102 	}
103 
104 	/**
105 	 * Gets the frame counter value of the #GdkFrameClock when this
106 	 * this frame was drawn.
107 	 *
108 	 * Returns: the frame counter value for this frame
109 	 *
110 	 * Since: 3.8
111 	 */
112 	public long getFrameCounter()
113 	{
114 		return gdk_frame_timings_get_frame_counter(gdkFrameTimings);
115 	}
116 
117 	/**
118 	 * Returns the frame time for the frame. This is the time value
119 	 * that is typically used to time animations for the frame. See
120 	 * gdk_frame_clock_get_frame_time().
121 	 *
122 	 * Returns: the frame time for the frame, in the timescale
123 	 *     of g_get_monotonic_time()
124 	 */
125 	public long getFrameTime()
126 	{
127 		return gdk_frame_timings_get_frame_time(gdkFrameTimings);
128 	}
129 
130 	/**
131 	 * Gets the predicted time at which this frame will be displayed. Although
132 	 * no predicted time may be available, if one is available, it will
133 	 * be available while the frame is being generated, in contrast to
134 	 * gdk_frame_timings_get_presentation_time(), which is only available
135 	 * after the frame has been presented. In general, if you are simply
136 	 * animating, you should use gdk_frame_clock_get_frame_time() rather
137 	 * than this function, but this function is useful for applications
138 	 * that want exact control over latency. For example, a movie player
139 	 * may want this information for Audio/Video synchronization.
140 	 *
141 	 * Returns: The predicted time at which the frame will be presented,
142 	 *     in the timescale of g_get_monotonic_time(), or 0 if no predicted
143 	 *     presentation time is available.
144 	 *
145 	 * Since: 3.8
146 	 */
147 	public long getPredictedPresentationTime()
148 	{
149 		return gdk_frame_timings_get_predicted_presentation_time(gdkFrameTimings);
150 	}
151 
152 	/**
153 	 * Reurns the presentation time. This is the time at which the frame
154 	 * became visible to the user.
155 	 *
156 	 * Returns: the time the frame was displayed to the user, in the
157 	 *     timescale of g_get_monotonic_time(), or 0 if no presentation
158 	 *     time is available. See gdk_frame_timings_get_complete()
159 	 *
160 	 * Since: 3.8
161 	 */
162 	public long getPresentationTime()
163 	{
164 		return gdk_frame_timings_get_presentation_time(gdkFrameTimings);
165 	}
166 
167 	/**
168 	 * Gets the natural interval between presentation times for
169 	 * the display that this frame was displayed on. Frame presentation
170 	 * usually happens during the “vertical blanking interval”.
171 	 *
172 	 * Returns: the refresh interval of the display, in microseconds,
173 	 *     or 0 if the refresh interval is not available.
174 	 *     See gdk_frame_timings_get_complete().
175 	 *
176 	 * Since: 3.8
177 	 */
178 	public long getRefreshInterval()
179 	{
180 		return gdk_frame_timings_get_refresh_interval(gdkFrameTimings);
181 	}
182 
183 	/**
184 	 * Increases the reference count of @timings.
185 	 *
186 	 * Returns: @timings
187 	 *
188 	 * Since: 3.8
189 	 */
190 	public FrameTimings doref()
191 	{
192 		auto p = gdk_frame_timings_ref(gdkFrameTimings);
193 		
194 		if(p is null)
195 		{
196 			return null;
197 		}
198 		
199 		return ObjectG.getDObject!(FrameTimings)(cast(GdkFrameTimings*) p, true);
200 	}
201 
202 	/**
203 	 * Decreases the reference count of @timings. If @timings
204 	 * is no longer referenced, it will be freed.
205 	 *
206 	 * Since: 3.8
207 	 */
208 	public void unref()
209 	{
210 		gdk_frame_timings_unref(gdkFrameTimings);
211 	}
212 }