]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/cppconst.tex
More docs.
[wxWidgets.git] / docs / latex / wx / cppconst.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: cppconst.tex
3 %% Purpose: Peprocessor symbols
4 %% Author:
5 %% Modified by:
6 %% Created:
7 %% RCS-ID: $Id$
8 %% Copyright: (c) wxWidgets
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \section{Preprocessor symbols defined by wxWidgets}\label{cppconst}
13
14 These are preprocessor symbols used in the wxWidgets source, grouped
15 by category (and sorted by alphabetical order inside each category). All of
16 these macros except for the \texttt{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 \texttt{#ifdef} and not \texttt{#if}.
19
20 \subsection{GUI system}\label{guisystemconst}
21
22 \begin{twocollist}\itemsep=0pt
23 \twocolitem{\_\_WINDOWS\_\_}{any Windows, yom may also use \_\_WXMSW\_\_}
24 \twocolitem{\_\_WIN16\_\_}{Win16 API (not supported since wxWidgets 2.6)}
25 \twocolitem{\_\_WIN32\_\_}{Win32 API}
26 \twocolitem{\_\_WXBASE\_\_}{Only wxBase, no GUI features (same as \texttt{wxUSE\_GUI} $== 0$)}
27 \twocolitem{\_\_WXCOCOA\_\_}{OS X using Cocoa API}
28 \twocolitem{\_\_WXWINCE\_\_}{Windows CE}
29 \twocolitem{\_\_WXGTK\_\_}{GTK+}
30 \twocolitem{\_\_WXGTK12\_\_}{GTK+ 1.2 or higher}
31 \twocolitem{\_\_WXGTK20\_\_}{GTK+ 2.0 or higher}
32 \twocolitem{\_\_WXMOTIF\_\_}{Motif}
33 \twocolitem{\_\_WXMOTIF20\_\_}{Motif 2.0 or higher}
34 \twocolitem{\_\_WXMAC\_\_}{Mac OS all targets}
35 \twocolitem{\_\_WXMAC\_CLASSIC\_\_}{MacOS for Classic}
36 \twocolitem{\_\_WXMAC\_CARBON\_\_}{MacOS for Carbon CFM (running under Classic or OSX) or true OS X Mach-O Builds}
37 \twocolitem{\_\_WXMAC\_OSX\_\_}{MacOS X Carbon Mach-O Builds}
38 \twocolitem{\_\_WXMGL\_\_}{SciTech Soft MGL (\_\_WXUNIVERSAL\_\_ will be also
39 defined)}
40 \twocolitem{\_\_WXMSW\_\_}{Any Windows}
41 \twocolitem{\_\_WXOSX\_\_}{Any Mac OS X port (either Carbon or Cocoa)}
42 \twocolitem{\_\_WXPALMOS\_\_}{PalmOS}
43 \twocolitem{\_\_WXPM\_\_}{OS/2 native Presentation Manager}
44 \twocolitem{\_\_WXSTUBS\_\_}{Stubbed version ('template' wxWin implementation)}
45 \twocolitem{\_\_WXXT\_\_}{Xt; mutually exclusive with WX\_MOTIF, not
46 implemented in wxWidgets 2.x}
47 \twocolitem{\_\_WXX11\_\_}{wxX11 (\_\_WXUNIVERSAL\_\_ will be also defined)}
48 \twocolitem{\_\_WXWINE\_\_}{WINE (i.e. WIN32 on Unix)}
49 \twocolitem{\_\_WXUNIVERSAL\_\_}{wxUniversal port, always defined in addition
50 to one of the symbols above so this should be tested first.}
51 \twocolitem{\_\_X\_\_}{any X11-based GUI toolkit except GTK+}
52 \end{twocollist}
53
54 There are two wxWidgets ports to Mac OS. One of them, wxMac, exists in two versions: Classic and
55 Carbon. The Classic version is the only one to work on Mac OS version 8. The
56 Carbon version may be built either as CFM or Mach-O (binary format, like ELF)
57 and the former may run under OS 9 while the latter only runs under OS X.
58 Finally, there is a new Cocoa port which can only be used under OS X. To
59 summarize:
60
61 \begin{itemize}
62 \item If you want to test for all Mac platforms, classic and OS X, you
63 should test both \texttt{\_\_WXMAC\_\_} and \texttt{\_\_WXCOCOA\_\_}.
64 \item If you want to test for any GUI Mac port under OS X, use
65 \texttt{\_\_WXOSX\_\_}.
66 \item If you want to test for any port under Mac OS X, including, for
67 example, wxGTK and also wxBase, use \texttt{\_\_DARWIN\_\_} (see below).
68 \end{itemize}
69
70 The convention is to use the \texttt{\_\_WX} prefix for these
71 symbols, although this has not always been followed.
72
73 \subsection{Operating systems}\label{osconst}
74
75 \begin{twocollist}\itemsep=0pt
76 \twocolitem{\_\_APPLE\_\_}{any Mac OS version}
77 \twocolitem{\_\_AIX\_\_}{AIX}
78 \twocolitem{\_\_BSD\_\_}{Any *BSD system}
79 \twocolitem{\_\_CYGWIN\_\_}{Cygwin: Unix on Win32}
80 \twocolitem{\_\_DARWIN\_\_}{Mac OS X using the BSD Unix C library (as opposed to using the Metrowerks MSL C/C++ library)}
81 \twocolitem{\_\_DATA\_GENERAL\_\_}{DG-UX}
82 \twocolitem{\_\_DOS\_GENERAL\_\_}{DOS (used with wxMGL only)}
83 \twocolitem{\_\_FREEBSD\_\_}{FreeBSD}
84 \twocolitem{\_\_HPUX\_\_}{HP-UX (Unix)}
85 \twocolitem{\_\_GNU\_\_}{GNU Hurd}
86 \twocolitem{\_\_LINUX\_\_}{Linux}
87 \twocolitem{\_\_MACH\_\_}{Mach-O Architecture (Mac OS X only builds)}
88 \twocolitem{\_\_OSF\_\_}{OSF/1}
89 \twocolitem{\_\_PALMOS\_\_}{PalmOS}
90 \twocolitem{\_\_SGI\_\_}{IRIX}
91 \twocolitem{\_\_SOLARIS\_\_}{Solaris}
92 \twocolitem{\_\_SUN\_\_}{Any Sun}
93 \twocolitem{\_\_SUNOS\_\_}{Sun OS}
94 \twocolitem{\_\_SVR4\_\_}{SystemV R4}
95 \twocolitem{\_\_SYSV\_\_}{SystemV generic}
96 \twocolitem{\_\_ULTRIX\_\_}{Ultrix}
97 \twocolitem{\_\_UNIX\_\_}{any Unix}
98 \twocolitem{\_\_UNIX\_LIKE\_\_}{Unix, BeOS or VMS}
99 \twocolitem{\_\_VMS\_\_}{VMS}
100 \twocolitem{\_\_WINDOWS\_\_}{any Windows}
101 \twocolitem{\_\_WINE\_\_}{Wine}
102 \end{twocollist}
103
104
105 \subsection{Hardware architectures (CPU)}\label{cpuconst}
106
107 Note that not all of these symbols are always defined, it depends on the
108 compiler used.
109
110 \begin{twocollist}\itemsep=0pt
111 \twocolitem{\_\_ALPHA\_\_}{DEC Alpha architecture}
112 \twocolitem{\_\_INTEL\_\_}{Intel i386 or compatible}
113 \twocolitem{\_\_IA64\_\_}{Intel 64 bit architecture}
114 \twocolitem{\_\_POWERPC\_\_}{Motorola Power PC}
115 \end{twocollist}
116
117
118 \subsection{Hardware type}\label{hardwareconst}
119
120 \begin{twocollist}\itemsep=0pt
121 \twocolitem{\_\_SMARTPHONE\_\_}{Generic mobile devices with phone buttons and a small display}
122 \twocolitem{\_\_PDA\_\_}{Personal digital assistant, usually with touch screen}
123 \twocolitem{\_\_HANDHELD\_\_}{Small but powerful computer, usually with a keyboard}
124 \twocolitem{\_\_POCKETPC\_\_}{Microsoft-powered PocketPC devices with touch-screen}
125 \twocolitem{\_\_WINCE\_STANDARDSDK\_\_}{Microsoft-powered Windows CE devices, for generic Windows CE applications}
126 \twocolitem{\_\_WINCE\_NET\_\_}{Microsoft-powered Windows CE .NET devices (\_WIN32\_WCE is 400 or greater)}
127 \twocolitem{WIN32\_PLATFORM\_WFSP}{Microsoft-powered smartphone}
128 \end{twocollist}
129
130
131 \subsection{Compilers}\label{compilerconst}
132
133 \begin{twocollist}\itemsep=0pt
134 \twocolitem{\_\_BORLANDC\_\_}{Borland C++. The value of the macro corresponds
135 to the compiler version: $500$ is $5.0$.}
136 \twocolitem{\_\_DJGPP\_\_}{DJGPP}
137 \twocolitem{\_\_DIGITALMARS\_\_}{Digital Mars}
138 \twocolitem{\_\_GNUG\_\_}{Gnu C++ on any platform, see also
139 \helpref{wxCHECK\_GCC\_VERSION}{wxcheckgccversion}}
140 \twocolitem{\_\_GNUWIN32\_\_}{Gnu-Win32 compiler, see also
141 \helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}}
142 \twocolitem{\_\_MINGW32\_\_}{MinGW}
143 \twocolitem{\_\_MWERKS\_\_}{CodeWarrior MetroWerks compiler}
144 \twocolitem{\_\_SUNCC\_\_}{Sun CC}
145 \twocolitem{\_\_SYMANTECC\_\_}{Symantec C++}
146 \twocolitem{\_\_VISAGECPP\_\_}{IBM Visual Age (OS/2)}
147 \twocolitem{\_\_VISUALC\_\_}{Microsoft Visual C++. The value of this macro
148 corresponds to the compiler version: $1020$ for $4.2$ (the first supported
149 version), $1100$ for $5.0$, $1200$ for $6.0$ and so on}
150 \twocolitem{\_\_XLC\_\_}{AIX compiler}
151 \twocolitem{\_\_WATCOMC\_\_}{Watcom C++. The value of this macro corresponds to
152 the compiler version, $1100$ is $11.0$ and $1200$ is OpenWatcom.}
153 \twocolitem{\_WIN32\_WCE}{Windows CE version}
154 \end{twocollist}
155
156
157 \subsection{Miscellaneous}\label{miscellaneousconst}
158
159 \begin{twocollist}\itemsep=0pt
160 \twocolitem{\_\_WXWINDOWS\_\_}{always defined in wxWidgets applications, see
161 also \helpref{wxCHECK\_VERSION}{wxcheckversion}}
162 \twocolitem{\_\_WXDEBUG\_\_}{defined in debug mode, undefined in release mode}
163 \twocolitem{wxUSE\_XXX}{if defined as $1$, feature XXX is active
164 (the symbols of this form are always defined, use \#if and not \#ifdef to test
165 for them)}
166 \twocolitem{WX\_PRECOMP}{is defined if precompiled headers (PCH) are in use. In
167 this case, \texttt{wx/wxprec.h} includes \texttt{wx/wx.h} which, in turn,
168 includes a number of wxWidgets headers thus making it unnecessary to include
169 them explicitly. However if this is not defined, you do need to include them
170 and so the usual idiom which allows to support both cases is to first include
171 \texttt{wx/wxprec.h} and then, inside \texttt{#ifndef WX\_PRECOMP}, individual
172 headers you need.}
173 \twocolitem{\_UNICODE and UNICODE}{both are defined if wxUSE\_UNICODE is set to $1$}
174 \twocolitem{wxUSE\_GUI}{this particular feature test macro is defined to $1$
175 when compiling or using the library with the GUI features activated, if it is
176 defined as $0$, only wxBase is available.}
177 \twocolitem{wxUSE\_BASE}{only used by wxWidgets internally (defined as $1$ when
178 building wxBase code, either as a standalone library or as part of the
179 monolithic wxWidgets library, defined as $0$ when building GUI library only)}
180 \twocolitem{wxNO\_RTTI}{is defined if the compiler RTTI support has been switched off}
181 \twocolitem{wxNO\_EXCEPTIONS}{is defined if the compiler support for C++
182 exceptions has been switched off}
183 \twocolitem{wxNO\_THREADS}{if this macro is defined, the compilation options
184 don't include compiler flags needed for multithreaded code generation. This
185 implies that wxUSE\_THREADS is $0$ and also that other (non-wx-based) threading
186 packages cannot be used neither.}
187 \end{twocollist}