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  = gtk-Feature-Test-Macros.html
27  * outPack = gtk
28  * outFile = Version
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Version
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gtkc.Loader
48  * 	- gtkc.paths
49  * structWrap:
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gtk.Version;
56 
57 public  import gtkc.gtktypes;
58 
59 private import gtkc.gtk;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 
64 private import glib.Str;
65 private import gtkc.Loader;
66 private import gtkc.paths;
67 
68 
69 
70 
71 /**
72  * Description
73  * GTK+ provides version information, primarily useful in configure checks
74  * for builds that have a configure script. Applications will not
75  * typically use the features described here.
76  */
77 public class Version
78 {
79 	
80 	/*
81 	 * The major version number of the GTK+ library. (e.g. in GTK+ version 2.12.4 this is 2.)
82 	 * This variable is in the library, so represents the GTK+ library you have linked against.
83 	 */
84 	public static int major()
85 	{
86 		uint* vers;
87 		
88 		Linker.link(vers, "gtk_major_version", LIBRARY.GTK);
89 		
90 		if ( vers is null )
91 		{
92 			return -1;
93 		}
94 		else
95 		{
96 			return *vers;
97 		}
98 	}
99 	
100 	/*
101 	 * The minor version number of the GTK+ library. (e.g. in GTK+ version 2.12.4 this is 12.)
102 	 * This variable is in the library, so represents the GTK+ library you have linked against.
103 	 */
104 	public static int minor()
105 	{
106 		uint* vers;
107 		
108 		Linker.link(vers, "gtk_minor_version", LIBRARY.GTK);
109 		
110 		if ( vers is null )
111 		{
112 			return -1;
113 		}
114 		else
115 		{
116 			return *vers;
117 		}
118 	}
119 	
120 	/*
121 	 * The micro version number of the GTK+ library. (e.g. in GTK+ version 2.12.4 this is 4.)
122 	 * This variable is in the library, so represents the GTK+ library you have linked against.
123 	 */
124 	public static int micro()
125 	{
126 		uint* vers;
127 		
128 		Linker.link(vers, "gtk_micro_version", LIBRARY.GTK);
129 		
130 		if ( vers is null )
131 		{
132 			return -1;
133 		}
134 		else
135 		{
136 			return *vers;
137 		}
138 	}
139 	
140 	/**
141 	 */
142 	
143 	/**
144 	 * Checks that the GTK+ library in use is compatible with the
145 	 * given version. Generally you would pass in the constants
146 	 * GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION
147 	 * as the three arguments to this function; that produces
148 	 * a check that the library in use is compatible with
149 	 * the version of GTK+ the application or module was compiled
150 	 * against.
151 	 * Compatibility is defined by two things: first the version
152 	 * of the running library is newer than the version
153 	 * required_major.required_minor.required_micro. Second
154 	 * the running library must be binary compatible with the
155 	 * version required_major.required_minor.required_micro
156 	 * (same major version.)
157 	 * This function is primarily for GTK+ modules; the module
158 	 * can call this function to check that it wasn't loaded
159 	 * into an incompatible version of GTK+. However, such a
160 	 * a check isn't completely reliable, since the module may be
161 	 * linked against an old version of GTK+ and calling the
162 	 * old version of gtk_check_version(), but still get loaded
163 	 * into an application using a newer version of GTK+.
164 	 * Params:
165 	 * requiredMajor = the required major version.
166 	 * requiredMinor = the required minor version.
167 	 * requiredMicro = the required micro version.
168 	 * Returns: NULL if the GTK+ library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by GTK+ and should not be modified or freed.
169 	 */
170 	public static string checkVersion(uint requiredMajor, uint requiredMinor, uint requiredMicro)
171 	{
172 		// const gchar * gtk_check_version (guint required_major,  guint required_minor,  guint required_micro);
173 		return Str.toString(gtk_check_version(requiredMajor, requiredMinor, requiredMicro));
174 	}
175 }