]> git.saurik.com Git - wxWidgets.git/blob - include/wx/platform.h
Added wxTreeCtrl::GetItemParent to deprecate GetParent.
[wxWidgets.git] / include / wx / platform.h
1 /*
2 * Name: wx/platform.h
3 * Purpose: define the OS and compiler identification macros
4 * Author: Vadim Zeitlin
5 * Modified by:
6 * Created: 29.10.01 (extracted from wx/defs.h)
7 * RCS-ID: $Id$
8 * Copyright: (c) 1997-2001 wxWindows team
9 * Licence: wxWindows license
10 */
11
12 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
13
14 #ifndef _WX_PLATFORM_H_
15 #define _WX_PLATFORM_H_
16
17 /*
18 first define Windows symbols if they're not defined on the command line: we
19 can autodetect everything we need if _WIN32 is defined
20 */
21 #if defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)
22 #ifndef __WXMSW__
23 #define __WXMSW__
24 #endif
25
26 #ifndef __WIN32__
27 #define __WIN32__
28 #endif
29
30 /* Win95 means Win95-style UI, i.e. Win9x/NT 4+ */
31 #if !defined(__WIN95__) && defined(WINVER) && (WINVER >= 0x0400)
32 #define __WIN95__
33 #endif
34 #endif /* Win32 */
35
36 #if defined(__WXMSW__) || defined(__WIN32__)
37 #if !defined(__WINDOWS__)
38 #define __WINDOWS__
39 #endif
40 #endif
41
42 #ifdef __WXWINE__
43 #ifndef __WIN32__
44 #define __WIN32__
45 #endif
46 #ifndef __WIN95__
47 #define __WIN95__
48 #endif
49 #ifndef STRICT
50 #define STRICT
51 #endif
52 #endif /* WINE */
53
54 #if defined(TWIN32) && !defined(__TWIN32__)
55 #define __TWIN32__
56 #endif /* Twin32 */
57
58 /*
59 Include wx/setup.h for the Unix platform defines generated by configure and
60 the library compilation options
61 */
62 #include "wx/setup.h"
63
64 /* check the consistency of the settings in setup.h */
65 #include "wx/chkconf.h"
66
67 /*
68 old C++ headers (like <iostream.h>) declare classes in the global namespace
69 while the new, standard ones (like <iostream>) do it in std:: namespace
70
71 using this macro allows constuctions like "wxSTD iostream" to work in
72 either case
73 */
74 #if !wxUSE_IOSTREAMH
75 #define wxSTD std::
76 #else
77 #define wxSTD
78 #endif
79
80 /*
81 OS: first of all, test for MS-DOS platform. We must do this before testing
82 for Unix, because DJGPP compiler defines __unix__ under MS-DOS
83 */
84 #if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__)
85 #ifndef __DOS__
86 #define __DOS__
87 #endif
88 /* size_t is the same as unsigned int for Watcom 11 compiler, */
89 /* so define it if it hadn't been done by configure yet */
90 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
91 #ifdef __WATCOMC__
92 #define wxSIZE_T_IS_UINT
93 #endif
94 #ifdef __DJGPP__
95 #define wxSIZE_T_IS_ULONG
96 #endif
97 #endif
98
99 /*
100 OS: then test for generic Unix defines, then for particular flavours and
101 finally for Unix-like systems
102 */
103 #elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \
104 defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
105 defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
106 defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
107
108 #define __UNIX_LIKE__
109
110 /* Helps SGI compilation, apparently */
111 #ifdef __SGI__
112 #ifdef __GNUG__
113 #define __need_wchar_t
114 #else /* !gcc */
115 /*
116 Note I use the term __SGI_CC__ for both cc and CC, its not a good
117 idea to mix gcc and cc/CC, the name mangling is different
118 */
119 #define __SGI_CC__
120 #endif /* gcc/!gcc */
121 #endif /* SGI */
122
123 #if defined(sun) || defined(__SUN__)
124 #ifndef __GNUG__
125 #ifndef __SUNCC__
126 #define __SUNCC__
127 #endif /* Sun CC */
128 #endif
129 #endif /* Sun */
130
131 #ifdef __EMX__
132 #define OS2EMX_PLAIN_CHAR
133 #endif
134
135 /* define __HPUX__ for HP-UX where standard macro is __hpux */
136 #if defined(__hpux) && !defined(__HPUX__)
137 #define __HPUX__
138 #endif /* HP-UX */
139
140 #if defined(__CYGWIN__)
141 #if !defined(wxSIZE_T_IS_UINT)
142 #define wxSIZE_T_IS_UINT
143 #endif
144 #endif
145 #elif defined(applec) || \
146 defined(THINK_C) || \
147 (defined(__MWERKS__) && !defined(__INTEL__))
148 /* MacOS */
149 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
150 #define wxSIZE_T_IS_ULONG
151 #endif
152 #elif defined(__WXMAC__) && defined(__APPLE__)
153 /* Mac OS X */
154 #define __UNIX_LIKE__
155
156 /*
157 These defines are needed when compiling using Project Builder
158 with a non generated setup0.h
159 */
160 #ifndef __UNIX__
161 #define __UNIX__ 1
162 #endif
163 #ifndef __BSD__
164 #define __BSD__ 1
165 #endif
166 #ifndef __DARWIN__
167 #define __DARWIN__ 1
168 #endif
169 #ifndef __POWERPC__
170 #define __POWERPC__ 1
171 #endif
172
173 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
174 #define wxSIZE_T_IS_ULONG
175 #endif
176 /*
177 Some code has been added to workaround defects(?) in the
178 bundled gcc compiler. These corrections are identified by
179 __DARWIN__ for Darwin related corrections (wxMac, wxMotif)
180 */
181 #elif defined(__OS2__)
182 #if defined(__IBMCPP__)
183 #define __VISAGEAVER__ __IBMCPP__
184 #endif
185 #ifndef __WXOS2__
186 #define __WXOS2__
187 #endif
188 #ifndef __WXPM__
189 #define __WXPM__
190 #endif
191
192 /* Place other OS/2 compiler environment defines here */
193 #if defined(__VISAGECPP__)
194 /* VisualAge is the only thing that understands _Optlink */
195 #define LINKAGEMODE _Optlink
196 #endif
197 #define wxSIZE_T_IS_UINT
198
199 #else /* Windows */
200 #ifndef __WINDOWS__
201 #define __WINDOWS__
202 #endif /* Windows */
203
204 /* to be changed for Win64! */
205 #ifndef __WIN32__
206 #define __WIN16__
207 #endif
208
209 /*
210 define another standard symbol for Microsoft Visual C++: the standard
211 one (_MSC_VER) is also defined by Metrowerks compiler
212 */
213 #if defined(_MSC_VER) && !defined(__MWERKS__)
214 #define __VISUALC__ _MSC_VER
215 #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
216 #define __BORLANDC__
217 #elif defined(__WATCOMC__)
218 #elif defined(__SC__)
219 #define __SYMANTECC__
220 #endif /* compiler */
221
222 /* size_t is the same as unsigned int for all Windows compilers we know, */
223 /* so define it if it hadn't been done by configure yet */
224 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
225 #define wxSIZE_T_IS_UINT
226 #endif
227 #endif /* OS */
228
229 /*
230 if we're on a Unix system but didn't use configure (so that setup.h didn't
231 define __UNIX__), do define __UNIX__ now
232 */
233 #if !defined(__UNIX__) && defined(__UNIX_LIKE__)
234 #define __UNIX__
235 #endif /* Unix */
236
237 #if defined(__HPUX__) && !defined(__WXGTK__)
238 #ifndef __WXMOTIF__
239 #define __WXMOTIF__
240 #endif /* __WXMOTIF__ */
241 #endif
242
243 #if defined(__WXMOTIF__) || defined(__WXX11__)
244 #define __X__
245 #endif
246
247 /*
248 This macro can be used to test the gcc version and can be used like this:
249
250 #if wxCHECK_GCC_VERSION(3, 1)
251 ... we have gcc 3.1 or later ...
252 #else
253 ... no gcc at all or gcc < 3.1 ...
254 #endif
255 */
256 #define wxCHECK_GCC_VERSION( major, minor ) \
257 ( defined(__GNUC__) && defined(__GNUC_MINOR__) \
258 && ( ( __GNUC__ > (major) ) \
259 || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) )
260
261 /*
262 This macro can be used to check that the version of mingw32 compiler is
263 at least maj.min
264 */
265 #if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || defined( __CYGWIN__ )
266 #include "wx/msw/gccpriv.h"
267 #else
268 #undef wxCHECK_W32API_VERSION
269 #define wxCHECK_W32API_VERSION(maj, min) (0)
270 #endif
271
272 #endif /* _WX_PLATFORM_H_ */
273