]>
Commit | Line | Data |
---|---|---|
4514447c FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: const_cpp.h | |
3 | // Purpose: Preprocessor symbols | |
4 | // Author: Vadim Zeitlin | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | ||
880efa2a | 10 | /** |
4514447c | 11 | |
928f1a07 FM |
12 | @page page_cppconst Preprocessor symbols defined by wxWidgets |
13 | ||
14 | These are preprocessor symbols used in the wxWidgets source, grouped | |
15 | by category (and sorted by alphabetical order inside each category). | |
16 | All of these macros except for the @c wxUSE_XXX variety is defined if the | |
17 | corresponding condition is @true and undefined if it isn't, so they should be | |
18 | always tested using @ifdef_ and not @if_. | |
19 | ||
20 | @li @ref page_cppconst_guisystem | |
21 | @li @ref page_cppconst_os | |
22 | @li @ref page_cppconst_cpu | |
23 | @li @ref page_cppconst_hardware | |
24 | @li @ref page_cppconst_compiler | |
25 | @li @ref page_cppconst_featuretests | |
3fb26cf2 | 26 | @li @ref page_cppconst_msvc_setup_h |
928f1a07 FM |
27 | @li @ref page_cppconst_miscellaneous |
28 | ||
29 | <hr> | |
30 | ||
31 | ||
32 | @section page_cppconst_guisystem GUI system | |
33 | ||
34 | @beginDefList | |
35 | @itemdef{__WINDOWS__, any Windows, you may also use __WXMSW__} | |
36 | @itemdef{__WIN16__, Win16 API (not supported since wxWidgets 2.6)} | |
37 | @itemdef{__WIN32__, Win32 API} | |
e2742bd6 | 38 | @itemdef{__WXBASE__, Only wxBase, no GUI features (same as @c wxUSE_GUI == 0)} |
928f1a07 FM |
39 | @itemdef{__WXCOCOA__, OS X using Cocoa API} |
40 | @itemdef{__WXDFB__, wxUniversal using DirectFB} | |
41 | @itemdef{__WXWINCE__, Windows CE} | |
42 | @itemdef{__WXGTK__, GTK+} | |
43 | @itemdef{__WXGTK12__, GTK+ 1.2 or higher} | |
44 | @itemdef{__WXGTK20__, GTK+ 2.0 or higher} | |
45 | @itemdef{__WXGTK24__, GTK+ 2.4 or higher} | |
46 | @itemdef{__WXGTK26__, GTK+ 2.6 or higher} | |
47 | @itemdef{__WXGTK210__, GTK+ 2.10 or higher} | |
48 | @itemdef{__WXMOTIF__, Motif} | |
49 | @itemdef{__WXMOTIF20__, Motif 2.0 or higher} | |
50 | @itemdef{__WXMAC__, Mac OS all targets} | |
51 | @itemdef{__WXMAC_CLASSIC__, MacOS for Classic} | |
52 | @itemdef{__WXMAC_CARBON__, MacOS for Carbon CFM (running under Classic or OSX) | |
4514447c | 53 | or true OS X Mach-O Builds} |
928f1a07 FM |
54 | @itemdef{__WXMAC_OSX__, MacOS X Carbon Mach-O Builds} |
55 | @itemdef{__WXMGL__, SciTech Soft MGL (__WXUNIVERSAL__ will be also defined)} | |
56 | @itemdef{__WXMSW__, Any Windows} | |
57 | @itemdef{__WXOSX__, Any Mac OS X port (either Carbon or Cocoa)} | |
58 | @itemdef{__WXPALMOS__, PalmOS} | |
59 | @itemdef{__WXPM__, OS/2 native Presentation Manager} | |
60 | @itemdef{__WXSTUBS__, Stubbed version ('template' wxWin implementation)} | |
61 | @itemdef{__WXXT__, Xt; mutually exclusive with WX_MOTIF, not implemented in wxWidgets 2.x} | |
62 | @itemdef{__WXX11__, wxX11 (__WXUNIVERSAL__ will be also defined)} | |
63 | @itemdef{__WXWINE__, WINE (i.e. WIN32 on Unix)} | |
64 | @itemdef{__WXUNIVERSAL__, wxUniversal port, always defined in addition | |
65 | to one of the symbols above so this should be tested first.} | |
66 | @itemdef{__X__, any X11-based GUI toolkit except GTK+} | |
67 | @endDefList | |
68 | ||
69 | There are two wxWidgets ports to Mac OS. One of them, wxMac, exists in two versions: | |
70 | Classic and Carbon. The Classic version is the only one to work on Mac OS version 8. | |
71 | The Carbon version may be built either as CFM or Mach-O (binary format, like ELF) | |
72 | and the former may run under OS 9 while the latter only runs under OS X. | |
73 | Finally, there is a new Cocoa port which can only be used under OS X. To | |
74 | summarize: | |
75 | ||
76 | @li If you want to test for all Mac platforms, classic and OS X, you | |
77 | should test both @c __WXMAC__ and @c __WXCOCOA__. | |
78 | @li If you want to test for any GUI Mac port under OS X, use | |
79 | @c __WXOSX__. | |
80 | @li If you want to test for any port under Mac OS X, including, for | |
81 | example, wxGTK and also wxBase, use @c __DARWIN__ (see below). | |
82 | ||
83 | The convention is to use the @c __WX prefix for these | |
84 | symbols, although this has not always been followed. | |
85 | ||
86 | ||
87 | @section page_cppconst_os Operating systems | |
88 | ||
89 | @beginDefList | |
90 | @itemdef{__APPLE__, any Mac OS version} | |
91 | @itemdef{__AIX__, AIX} | |
92 | @itemdef{__BSD__, Any *BSD system} | |
93 | @itemdef{__CYGWIN__, Cygwin: Unix on Win32} | |
94 | @itemdef{__DARWIN__, Mac OS X using the BSD Unix C library | |
95 | (as opposed to using the Metrowerks MSL C/C++ library)} | |
96 | @itemdef{__DATA_GENERAL__, DG-UX} | |
97 | @itemdef{__DOS_GENERAL__, DOS (used with wxMGL only)} | |
98 | @itemdef{__FREEBSD__, FreeBSD} | |
99 | @itemdef{__HPUX__, HP-UX (Unix)} | |
100 | @itemdef{__GNU__, GNU Hurd} | |
101 | @itemdef{__LINUX__, Linux} | |
102 | @itemdef{__MACH__, Mach-O Architecture (Mac OS X only builds)} | |
103 | @itemdef{__OSF__, OSF/1} | |
104 | @itemdef{__PALMOS__, PalmOS} | |
105 | @itemdef{__SGI__, IRIX} | |
106 | @itemdef{__SOLARIS__, Solaris} | |
107 | @itemdef{__SUN__, Any Sun} | |
108 | @itemdef{__SUNOS__, Sun OS} | |
109 | @itemdef{__SVR4__, SystemV R4} | |
110 | @itemdef{__SYSV__, SystemV generic} | |
111 | @itemdef{__ULTRIX__, Ultrix} | |
112 | @itemdef{__UNIX__, any Unix} | |
113 | @itemdef{__UNIX_LIKE__, Unix, BeOS or VMS} | |
114 | @itemdef{__VMS__, VMS} | |
115 | @itemdef{__WINDOWS__, any Windows} | |
116 | @itemdef{__WINE__, Wine} | |
117 | @endDefList | |
118 | ||
119 | ||
120 | ||
121 | @section page_cppconst_cpu Hardware architectures (CPU) | |
122 | ||
123 | Note that not all of these symbols are always defined, it depends on the | |
124 | compiler used. | |
125 | ||
126 | @beginDefList | |
127 | @itemdef{__ALPHA__, DEC Alpha architecture} | |
128 | @itemdef{__INTEL__, Intel i386 or compatible} | |
129 | @itemdef{__IA64__, Intel 64 bit architecture} | |
130 | @itemdef{__POWERPC__, Motorola Power PC} | |
131 | @endDefList | |
132 | ||
133 | ||
134 | ||
135 | @section page_cppconst_hardware Hardware type | |
136 | ||
137 | @beginDefList | |
138 | @itemdef{__SMARTPHONE__, Generic mobile devices with phone buttons and a small display} | |
139 | @itemdef{__PDA__, Personal digital assistant, usually with touch screen} | |
140 | @itemdef{__HANDHELD__, Small but powerful computer, usually with a keyboard} | |
141 | @itemdef{__POCKETPC__, Microsoft-powered PocketPC devices with touch-screen} | |
142 | @itemdef{__WINCE_STANDARDSDK__, Microsoft-powered Windows CE devices, for generic Windows CE applications} | |
143 | @itemdef{__WINCE_NET__, Microsoft-powered Windows CE .NET devices (_WIN32_WCE is 400 or greater)} | |
144 | @itemdef{WIN32_PLATFORM_WFSP, Microsoft-powered smartphone} | |
145 | @endDefList | |
146 | ||
147 | ||
148 | ||
149 | @section page_cppconst_compiler Compilers | |
150 | ||
151 | @beginDefList | |
152 | @itemdef{__BORLANDC__, Borland C++. The value of the macro corresponds | |
e2742bd6 | 153 | to the compiler version: 500 is 5.0.} |
928f1a07 FM |
154 | @itemdef{__DJGPP__, DJGPP} |
155 | @itemdef{__DIGITALMARS__, Digital Mars} | |
156 | @itemdef{__GNUG__, Gnu C++ on any platform, see also wxCHECK_GCC_VERSION} | |
157 | @itemdef{__GNUWIN32__, Gnu-Win32 compiler, see also wxCHECK_W32API_VERSION} | |
158 | @itemdef{__MINGW32__, MinGW} | |
159 | @itemdef{__MWERKS__, CodeWarrior MetroWerks compiler} | |
160 | @itemdef{__SUNCC__, Sun CC, see also wxCHECK_SUNCC_VERSION} | |
161 | @itemdef{__SYMANTECC__, Symantec C++} | |
162 | @itemdef{__VISAGECPP__, IBM Visual Age (OS/2)} | |
163 | @itemdef{__VISUALC__, Microsoft Visual C++, see also wxCHECK_VISUALC_VERSION. | |
164 | The value of this macro corresponds to the compiler version: | |
165 | @c 1020 for @c 4.2 (the first supported version), @c 1100 for | |
166 | @c 5.0, @c 1200 for @c 6.0 and so on. For convenience, the symbols | |
167 | __VISUALCn__ are also defined for each major compiler version from | |
168 | 5 to 9, i.e. you can use tests such @ifdef_ __VISUALC7__ to test | |
169 | for compiler version being precisely 7.} | |
170 | @itemdef{__XLC__, AIX compiler} | |
171 | @itemdef{__WATCOMC__, Watcom C++. The value of this macro corresponds to | |
172 | the compiler version, @c 1100 is @c 11.0 and @c 1200 is OpenWatcom.} | |
173 | @itemdef{_WIN32_WCE, Windows CE version} | |
174 | @endDefList | |
175 | ||
176 | ||
177 | ||
178 | @section page_cppconst_featuretests Feature tests | |
179 | ||
180 | Some library features may not be always available even if they were selected | |
181 | by the user. To make it possible to check if this is the case, the library | |
182 | predefines the symbols in the form @c wxHAS_FEATURE. Unlike | |
183 | @c wxUSE_FEATURE symbols which are defined by the library user (directly | |
184 | in @c setup.h or by running configure script) and which must be always | |
e2742bd6 | 185 | defined as either 0 or 1, the @c wxHAS symbols are only defined if |
928f1a07 FM |
186 | the corresponding feature is available and not defined at all otherwise. |
187 | ||
188 | Currently the following symbols exist: | |
189 | ||
190 | @beginDefList | |
42124e68 VZ |
191 | @itemdef{wxHAS_ATOMIC_OPS, Defined if wxAtomicInc() and wxAtomicDec() functions |
192 | have an efficient (CPU-specific) implementation. Notice that the functions | |
193 | themselves are always available but can be prohibitively slow to use when | |
194 | implemented in a generic way, using a critical section.} | |
928f1a07 FM |
195 | @itemdef{wxHAS_LARGE_FILES, Defined if wxFile supports files more than 4GB in size.} |
196 | @itemdef{wxHAS_LARGE_FFILES, Defined if wxFFile supports files more than 4GB in size.} | |
197 | @itemdef{wxHAS_POWER_EVENTS, Defined if wxPowerEvent are ever generated on the current platform.} | |
198 | @itemdef{wxHAS_RADIO_MENU_ITEMS, | |
199 | Defined if the current port supports radio menu items (see wxMenu::AppendRadioItem).} | |
24671bc9 | 200 | @itemdef{wxHAS_RAW_BITMAP, Defined if direct access to bitmap data using the classes in @c wx/rawbmp.h is supported.} |
928f1a07 FM |
201 | @itemdef{wxHAS_RAW_KEY_CODES, Defined if raw key codes (see wxKeyEvent::GetRawKeyCode are supported.} |
202 | @itemdef{wxHAS_REGEX_ADVANCED, Defined if advanced syntax is available in wxRegEx.} | |
203 | @itemdef{wxHAS_TASK_BAR_ICON, Defined if wxTaskBarIcon is available on the current platform.} | |
204 | @endDefList | |
205 | ||
206 | ||
207 | ||
3fb26cf2 VZ |
208 | @section page_cppconst_msvc_setup_h Libraries selection for MSVC setup.h |
209 | ||
210 | Microsoft Visual C++ users may use the special @c wx/setup.h file for this | |
211 | compiler in @c include/msvc subdirectory. This file implicitly links in all the | |
212 | wxWidgets libraries using MSVC-specific pragmas which usually is much more | |
213 | convenient than manually specifying the libraries list in all of the project | |
214 | configurations. However sometimes linking with all the libraries is not | |
215 | desirable, for example because some of them were not built and this is where | |
216 | the symbols in this section can be helpful: defining them allows to not link | |
217 | with the corresponding library. The following symbols are honoured: | |
218 | - wxNO_ADV_LIB | |
219 | - wxNO_AUI_LIB | |
220 | - wxNO_HTML_LIB | |
221 | - wxNO_MEDIA_LIB | |
222 | - wxNO_NET_LIB | |
1c4293cb | 223 | - wxNO_PROPGRID_LIB |
3fb26cf2 VZ |
224 | - wxNO_QA_LIB |
225 | - wxNO_RICHTEXT_LIB | |
226 | - wxNO_XML_LIB | |
227 | - wxNO_REGEX_LIB | |
228 | - wxNO_EXPAT_LIB | |
229 | - wxNO_JPEG_LIB | |
230 | - wxNO_PNG_LIB | |
231 | - wxNO_TIFF_LIB | |
232 | - wxNO_ZLIB_LIB | |
233 | ||
234 | Notice that the base library is always included and the core is always included | |
235 | for the GUI applications (i.e. those which don't define @c wxUSE_GUI as 0). | |
236 | ||
237 | ||
928f1a07 FM |
238 | @section page_cppconst_miscellaneous Miscellaneous |
239 | ||
240 | @beginDefList | |
241 | @itemdef{__WXWINDOWS__, | |
242 | always defined in wxWidgets applications, see also wxCHECK_VERSION} | |
243 | @itemdef{__WXDEBUG__, defined in debug mode, undefined in release mode} | |
244 | @itemdef{wxUSE_XXX, | |
e2742bd6 | 245 | if defined as 1, feature XXX is active, see the |
928f1a07 FM |
246 | @ref page_wxusedef (the symbols of this form are always defined, |
247 | use @if_ and not @ifdef_ to test for them)} | |
248 | @itemdef{WX_PRECOMP, | |
249 | is defined if precompiled headers (PCH) are in use. In | |
250 | this case, @c wx/wxprec.h includes @c wx/wx.h which, in turn, | |
251 | includes a number of wxWidgets headers thus making it unnecessary to include | |
252 | them explicitly. However if this is not defined, you do need to include them | |
253 | and so the usual idiom which allows to support both cases is to first include | |
254 | @c wx/wxprec.h} and then, inside @ifndef_ WX_PRECOMP, individual | |
255 | headers you need.} | |
256 | @itemdef{_UNICODE and UNICODE, both are defined if wxUSE_UNICODE is set to @c 1} | |
257 | @itemdef{wxUSE_GUI, | |
e2742bd6 | 258 | this particular feature test macro is defined to 1 |
928f1a07 FM |
259 | when compiling or using the library with the GUI features activated, |
260 | if it is defined as @c 0, only wxBase is available.} | |
261 | @itemdef{wxUSE_BASE, | |
e2742bd6 | 262 | only used by wxWidgets internally (defined as 1 when |
928f1a07 | 263 | building wxBase code, either as a standalone library or as part of the |
e2742bd6 | 264 | monolithic wxWidgets library, defined as 0 when building GUI library only)} |
928f1a07 FM |
265 | @itemdef{wxNO_RTTI, is defined if the compiler RTTI support has been switched off} |
266 | @itemdef{wxNO_EXCEPTIONS, | |
267 | is defined if the compiler support for C++ exceptions has been switched off} | |
268 | @itemdef{wxNO_THREADS, | |
269 | if this macro is defined, the compilation options | |
270 | don't include compiler flags needed for multithreaded code generation. This | |
e2742bd6 | 271 | implies that wxUSE_THREADS is 0 and also that other (non-wx-based) threading |
928f1a07 FM |
272 | packages cannot be used neither.} |
273 | @itemdef{WXMAKINGDLL_XXX, | |
274 | used internally and defined when building the | |
275 | library @c XXX as a DLL; when a monolithic wxWidgets build is used only a | |
276 | single @c WXMAKINGDLL symbol is defined} | |
277 | @itemdef{WXUSINGDLL, | |
278 | defined when compiling code which uses wxWidgets as a DLL/shared library} | |
279 | @itemdef{WXBUILDING, | |
280 | defined when building wxWidgets itself, whether as a static or shared library} | |
281 | @endDefList | |
4514447c FM |
282 | |
283 | */ |