]> Pileus Git - ~andy/gtk/blob - gdk/gdkversionmacros.h.in
docs: Fix copy/paste typo
[~andy/gtk] / gdk / gdkversionmacros.h.in
1 /* gdkversionmacros.h - version boundaries checks
2  * Copyright (C) 2012 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.▸ See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
21 #error "Only <gdk/gdk.h> can be included directly."
22 #endif
23
24 #ifndef __GDK_VERSION_MACROS_H__
25 #define __GDK_VERSION_MACROS_H__
26
27 #include <glib.h>
28
29 #define GDK_MAJOR_VERSION (@GTK_MAJOR_VERSION@)
30 #define GDK_MINOR_VERSION (@GTK_MINOR_VERSION@)
31 #define GDK_MICRO_VERSION (@GTK_MICRO_VERSION@)
32
33 /**
34  * GDK_DISABLE_DEPRECATION_WARNINGS:
35  *
36  * A macro that should be defined before including the gdk.h header.
37  * If it is defined, no compiler warnings will be produced for uses
38  * of deprecated GDK and GTK+ APIs.
39  */
40
41 #ifdef GDK_DISABLE_DEPRECATION_WARNINGS
42 #define GDK_DEPRECATED
43 #define GDK_DEPRECATED_FOR(f)
44 #define GDK_UNAVAILABLE(maj,min)
45 #else
46 #define GDK_DEPRECATED G_DEPRECATED
47 #define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
48 #define GDK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min)
49 #endif
50
51 /* XXX: Every new stable minor release bump should add a macro here */
52
53 /**
54  * GDK_VERSION_3_0:
55  *
56  * A macro that evaluates to the 3.0 version of GDK, in a format
57  * that can be used by the C pre-processor.
58  *
59  * Since: 3.4
60  */
61 #define GDK_VERSION_3_0         (G_ENCODE_VERSION (3, 0))
62
63 /**
64  * GDK_VERSION_3_2:
65  *
66  * A macro that evaluates to the 3.2 version of GDK, in a format
67  * that can be used by the C pre-processor.
68  *
69  * Since: 3.4
70  */
71 #define GDK_VERSION_3_2         (G_ENCODE_VERSION (3, 2))
72
73 /**
74  * GDK_VERSION_3_4:
75  *
76  * A macro that evaluates to the 3.4 version of GDK, in a format
77  * that can be used by the C pre-processor.
78  *
79  * Since: 3.4
80  */
81 #define GDK_VERSION_3_4         (G_ENCODE_VERSION (3, 4))
82
83 /**
84  * GDK_VERSION_3_6:
85  *
86  * A macro that evaluates to the 3.6 version of GDK, in a format
87  * that can be used by the C pre-processor.
88  *
89  * Since: 3.6
90  */
91 #define GDK_VERSION_3_6         (G_ENCODE_VERSION (3, 6))
92
93
94 /* evaluates to the current stable version; for development cycles,
95  * this means the next stable target
96  */
97 #if (GDK_MINOR_VERSION % 2)
98 #define GDK_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
99 #else
100 #define GDK_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
101 #endif
102
103 /* evaluates to the previous stable version */
104 #if (GDK_MINOR_VERSION % 2)
105 #define GDK_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
106 #else
107 #define GDK_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
108 #endif
109
110 /**
111  * GDK_VERSION_MIN_REQUIRED:
112  *
113  * A macro that should be defined by the user prior to including
114  * the gdk.h header.
115  * The definition should be one of the predefined GDK version
116  * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
117  *
118  * This macro defines the lower bound for the GDK API to use.
119  *
120  * If a function has been deprecated in a newer version of GDK,
121  * it is possible to use this symbol to avoid the compiler warnings
122  * without disabling warning for every deprecated function.
123  *
124  * Since: 3.4
125  */
126 #ifndef GDK_VERSION_MIN_REQUIRED
127 # define GDK_VERSION_MIN_REQUIRED      (GDK_VERSION_PREV_STABLE)
128 #endif
129
130 /**
131  * GDK_VERSION_MAX_ALLOWED:
132  *
133  * A macro that should be defined by the user prior to including
134  * the gdk.h header.
135  * The definition should be one of the predefined GDK version
136  * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
137  *
138  * This macro defines the upper bound for the GDK API to use.
139  *
140  * If a function has been introduced in a newer version of GDK,
141  * it is possible to use this symbol to get compiler warnings when
142  * trying to use that function.
143  *
144  * Since: 3.4
145  */
146 #ifndef GDK_VERSION_MAX_ALLOWED
147 # if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
148 #  define GDK_VERSION_MAX_ALLOWED      GDK_VERSION_MIN_REQUIRED
149 # else
150 #  define GDK_VERSION_MAX_ALLOWED      GDK_VERSION_CUR_STABLE
151 # endif
152 #endif
153
154 /* sanity checks */
155 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
156 #error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
157 #endif
158 #if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_3_0
159 #error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_3_0"
160 #endif
161
162 /* XXX: Every new stable minor release should add a set of macros here */
163
164 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_0
165 # define GDK_DEPRECATED_IN_3_0                GDK_DEPRECATED
166 # define GDK_DEPRECATED_IN_3_0_FOR(f)         GDK_DEPRECATED_FOR(f)
167 #else
168 # define GDK_DEPRECATED_IN_3_0
169 # define GDK_DEPRECATED_IN_3_0_FOR(f)
170 #endif
171
172 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_0
173 # define GDK_AVAILABLE_IN_3_0                 GDK_UNAVAILABLE(3, 0)
174 #else
175 # define GDK_AVAILABLE_IN_3_0
176 #endif
177
178 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_2
179 # define GDK_DEPRECATED_IN_3_2                GDK_DEPRECATED
180 # define GDK_DEPRECATED_IN_3_2_FOR(f)         GDK_DEPRECATED_FOR(f)
181 #else
182 # define GDK_DEPRECATED_IN_3_2
183 # define GDK_DEPRECATED_IN_3_2_FOR(f)
184 #endif
185
186 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_2
187 # define GDK_AVAILABLE_IN_3_2                 GDK_UNAVAILABLE(3, 2)
188 #else
189 # define GDK_AVAILABLE_IN_3_2
190 #endif
191
192 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_4
193 # define GDK_DEPRECATED_IN_3_4                GDK_DEPRECATED
194 # define GDK_DEPRECATED_IN_3_4_FOR(f)         GDK_DEPRECATED_FOR(f)
195 #else
196 # define GDK_DEPRECATED_IN_3_4
197 # define GDK_DEPRECATED_IN_3_4_FOR(f)
198 #endif
199
200 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_4
201 # define GDK_AVAILABLE_IN_3_4                 GDK_UNAVAILABLE(3, 4)
202 #else
203 # define GDK_AVAILABLE_IN_3_4
204 #endif
205
206 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_6
207 # define GDK_DEPRECATED_IN_3_6                GDK_DEPRECATED
208 # define GDK_DEPRECATED_IN_3_6_FOR(f)         GDK_DEPRECATED_FOR(f)
209 #else
210 # define GDK_DEPRECATED_IN_3_6
211 # define GDK_DEPRECATED_IN_3_6_FOR(f)
212 #endif
213
214 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_6
215 # define GDK_AVAILABLE_IN_3_6                 GDK_UNAVAILABLE(3, 6)
216 #else
217 # define GDK_AVAILABLE_IN_3_6
218 #endif
219
220 #endif  /* __GDK_VERSION_MACROS_H__ */