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