]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/cppconst.tex
added copy constr
[wxWidgets.git] / docs / latex / wx / cppconst.tex
CommitLineData
cb7d7375
WS
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: cppconst.tex
a4acaafa
VZ
3%% Purpose: Preprocessor symbols
4%% Author: Vadim Zeitlin
5%% Created: 2002-08-22
cb7d7375 6%% RCS-ID: $Id$
a4acaafa 7%% Copyright: (c) 2002-2006 wxWidgets
cb7d7375
WS
8%% License: wxWindows license
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11\section{Preprocessor symbols defined by wxWidgets}\label{cppconst}
14aea4f9 12
dceb1c09 13These are preprocessor symbols used in the wxWidgets source, grouped
d80fc6df 14by category (and sorted by alphabetical order inside each category). All of
dceb1c09 15these macros except for the \texttt{wxUSE\_XXX} variety is defined if the
d80fc6df 16corresponding condition is true and undefined if it isn't, so they should be
dceb1c09 17always tested using \texttt{#ifdef} and not \texttt{#if}.
14aea4f9 18
a203f6c0 19\subsection{GUI system}\label{guisystemconst}
14aea4f9
VZ
20
21\begin{twocollist}\itemsep=0pt
21686ff4 22\twocolitem{\_\_WINDOWS\_\_}{any Windows, you may also use \_\_WXMSW\_\_}
fc2171bd 23\twocolitem{\_\_WIN16\_\_}{Win16 API (not supported since wxWidgets 2.6)}
14aea4f9 24\twocolitem{\_\_WIN32\_\_}{Win32 API}
d80fc6df
VZ
25\twocolitem{\_\_WXBASE\_\_}{Only wxBase, no GUI features (same as \texttt{wxUSE\_GUI} $== 0$)}
26\twocolitem{\_\_WXCOCOA\_\_}{OS X using Cocoa API}
21686ff4 27\twocolitem{\_\_WXDFB\_\_}{wxUniversal using DirectFB}
69a126b0
JS
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}
21686ff4
VZ
32\twocolitem{\_\_WXGTK24\_\_}{GTK+ 2.4 or higher}
33\twocolitem{\_\_WXGTK26\_\_}{GTK+ 2.6 or higher}
34\twocolitem{\_\_WXGTK210\_\_}{GTK+ 2.10 or higher}
14aea4f9 35\twocolitem{\_\_WXMOTIF\_\_}{Motif}
65ed0182 36\twocolitem{\_\_WXMOTIF20\_\_}{Motif 2.0 or higher}
73e54eb4
SC
37\twocolitem{\_\_WXMAC\_\_}{Mac OS all targets}
38\twocolitem{\_\_WXMAC\_CLASSIC\_\_}{MacOS for Classic}
39\twocolitem{\_\_WXMAC\_CARBON\_\_}{MacOS for Carbon CFM (running under Classic or OSX) or true OS X Mach-O Builds}
d80fc6df 40\twocolitem{\_\_WXMAC\_OSX\_\_}{MacOS X Carbon Mach-O Builds}
14aea4f9
VZ
41\twocolitem{\_\_WXMGL\_\_}{SciTech Soft MGL (\_\_WXUNIVERSAL\_\_ will be also
42defined)}
43\twocolitem{\_\_WXMSW\_\_}{Any Windows}
d80fc6df 44\twocolitem{\_\_WXOSX\_\_}{Any Mac OS X port (either Carbon or Cocoa)}
8e1bf704 45\twocolitem{\_\_WXPALMOS\_\_}{PalmOS}
14aea4f9
VZ
46\twocolitem{\_\_WXPM\_\_}{OS/2 native Presentation Manager}
47\twocolitem{\_\_WXSTUBS\_\_}{Stubbed version ('template' wxWin implementation)}
48\twocolitem{\_\_WXXT\_\_}{Xt; mutually exclusive with WX\_MOTIF, not
fc2171bd 49implemented in wxWidgets 2.x}
14aea4f9 50\twocolitem{\_\_WXX11\_\_}{wxX11 (\_\_WXUNIVERSAL\_\_ will be also defined)}
69a126b0 51\twocolitem{\_\_WXWINE\_\_}{WINE (i.e. WIN32 on Unix)}
14aea4f9
VZ
52\twocolitem{\_\_WXUNIVERSAL\_\_}{wxUniversal port, always defined in addition
53to one of the symbols above so this should be tested first.}
54\twocolitem{\_\_X\_\_}{any X11-based GUI toolkit except GTK+}
55\end{twocollist}
56
9ceeecb9 57There are two wxWidgets ports to Mac OS. One of them, wxMac, exists in two versions: Classic and
d80fc6df
VZ
58Carbon. The Classic version is the only one to work on Mac OS version 8. The
59Carbon version may be built either as CFM or Mach-O (binary format, like ELF)
60and the former may run under OS 9 while the latter only runs under OS X.
61Finally, there is a new Cocoa port which can only be used under OS X. To
62summarize:
9ceeecb9 63
d80fc6df 64\begin{itemize}
9ceeecb9
JS
65\item If you want to test for all Mac platforms, classic and OS X, you
66should test both \texttt{\_\_WXMAC\_\_} and \texttt{\_\_WXCOCOA\_\_}.
cb7d7375 67\item If you want to test for any GUI Mac port under OS X, use
9ceeecb9
JS
68\texttt{\_\_WXOSX\_\_}.
69\item If you want to test for any port under Mac OS X, including, for
70example, wxGTK and also wxBase, use \texttt{\_\_DARWIN\_\_} (see below).
d80fc6df
VZ
71\end{itemize}
72
9ceeecb9
JS
73The convention is to use the \texttt{\_\_WX} prefix for these
74symbols, although this has not always been followed.
14aea4f9 75
a203f6c0 76\subsection{Operating systems}\label{osconst}
14aea4f9
VZ
77
78\begin{twocollist}\itemsep=0pt
79\twocolitem{\_\_APPLE\_\_}{any Mac OS version}
80\twocolitem{\_\_AIX\_\_}{AIX}
81\twocolitem{\_\_BSD\_\_}{Any *BSD system}
82\twocolitem{\_\_CYGWIN\_\_}{Cygwin: Unix on Win32}
0211e0d5 83\twocolitem{\_\_DARWIN\_\_}{Mac OS X using the BSD Unix C library (as opposed to using the Metrowerks MSL C/C++ library)}
14aea4f9
VZ
84\twocolitem{\_\_DATA\_GENERAL\_\_}{DG-UX}
85\twocolitem{\_\_DOS\_GENERAL\_\_}{DOS (used with wxMGL only)}
86\twocolitem{\_\_FREEBSD\_\_}{FreeBSD}
87\twocolitem{\_\_HPUX\_\_}{HP-UX (Unix)}
e2478fde 88\twocolitem{\_\_GNU\_\_}{GNU Hurd}
14aea4f9 89\twocolitem{\_\_LINUX\_\_}{Linux}
ab83849c 90\twocolitem{\_\_MACH\_\_}{Mach-O Architecture (Mac OS X only builds)}
14aea4f9 91\twocolitem{\_\_OSF\_\_}{OSF/1}
8e1bf704 92\twocolitem{\_\_PALMOS\_\_}{PalmOS}
14aea4f9
VZ
93\twocolitem{\_\_SGI\_\_}{IRIX}
94\twocolitem{\_\_SOLARIS\_\_}{Solaris}
95\twocolitem{\_\_SUN\_\_}{Any Sun}
96\twocolitem{\_\_SUNOS\_\_}{Sun OS}
97\twocolitem{\_\_SVR4\_\_}{SystemV R4}
98\twocolitem{\_\_SYSV\_\_}{SystemV generic}
99\twocolitem{\_\_ULTRIX\_\_}{Ultrix}
100\twocolitem{\_\_UNIX\_\_}{any Unix}
101\twocolitem{\_\_UNIX\_LIKE\_\_}{Unix, BeOS or VMS}
102\twocolitem{\_\_VMS\_\_}{VMS}
103\twocolitem{\_\_WINDOWS\_\_}{any Windows}
d92c8cd9 104\twocolitem{\_\_WINE\_\_}{Wine}
14aea4f9
VZ
105\end{twocollist}
106
d80fc6df 107
57ff58bd 108\subsection{Hardware architectures (CPU)}\label{cpuconst}
14aea4f9
VZ
109
110Note that not all of these symbols are always defined, it depends on the
111compiler used.
112
113\begin{twocollist}\itemsep=0pt
114\twocolitem{\_\_ALPHA\_\_}{DEC Alpha architecture}
115\twocolitem{\_\_INTEL\_\_}{Intel i386 or compatible}
748a4684 116\twocolitem{\_\_IA64\_\_}{Intel 64 bit architecture}
14aea4f9
VZ
117\twocolitem{\_\_POWERPC\_\_}{Motorola Power PC}
118\end{twocollist}
119
d80fc6df 120
57ff58bd
WS
121\subsection{Hardware type}\label{hardwareconst}
122
57ff58bd 123\begin{twocollist}\itemsep=0pt
b669780b
JS
124\twocolitem{\_\_SMARTPHONE\_\_}{Generic mobile devices with phone buttons and a small display}
125\twocolitem{\_\_PDA\_\_}{Personal digital assistant, usually with touch screen}
126\twocolitem{\_\_HANDHELD\_\_}{Small but powerful computer, usually with a keyboard}
9ceeecb9
JS
127\twocolitem{\_\_POCKETPC\_\_}{Microsoft-powered PocketPC devices with touch-screen}
128\twocolitem{\_\_WINCE\_STANDARDSDK\_\_}{Microsoft-powered Windows CE devices, for generic Windows CE applications}
129\twocolitem{\_\_WINCE\_NET\_\_}{Microsoft-powered Windows CE .NET devices (\_WIN32\_WCE is 400 or greater)}
b669780b 130\twocolitem{WIN32\_PLATFORM\_WFSP}{Microsoft-powered smartphone}
57ff58bd
WS
131\end{twocollist}
132
d80fc6df 133
a203f6c0 134\subsection{Compilers}\label{compilerconst}
14aea4f9
VZ
135
136\begin{twocollist}\itemsep=0pt
14347204
VZ
137\twocolitem{\_\_BORLANDC\_\_}{Borland C++. The value of the macro corresponds
138to the compiler version: $500$ is $5.0$.}
14aea4f9 139\twocolitem{\_\_DJGPP\_\_}{DJGPP}
69a126b0 140\twocolitem{\_\_DIGITALMARS\_\_}{Digital Mars}
cb7d7375 141\twocolitem{\_\_GNUG\_\_}{Gnu C++ on any platform, see also
14347204 142\helpref{wxCHECK\_GCC\_VERSION}{wxcheckgccversion}}
cb7d7375 143\twocolitem{\_\_GNUWIN32\_\_}{Gnu-Win32 compiler, see also
14347204 144\helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}}
69a126b0 145\twocolitem{\_\_MINGW32\_\_}{MinGW}
14aea4f9 146\twocolitem{\_\_MWERKS\_\_}{CodeWarrior MetroWerks compiler}
2686d933 147\twocolitem{\_\_SUNCC\_\_}{Sun CC, see also \helpref{wxCHECK\_SUNCC\_VERSION}{wxchecksunccversion}}
14aea4f9
VZ
148\twocolitem{\_\_SYMANTECC\_\_}{Symantec C++}
149\twocolitem{\_\_VISAGECPP\_\_}{IBM Visual Age (OS/2)}
14347204
VZ
150\twocolitem{\_\_VISUALC\_\_}{Microsoft Visual C++. The value of this macro
151corresponds to the compiler version: $1020$ for $4.2$ (the first supported
152version), $1100$ for $5.0$, $1200$ for $6.0$ and so on}
14aea4f9 153\twocolitem{\_\_XLC\_\_}{AIX compiler}
14347204
VZ
154\twocolitem{\_\_WATCOMC\_\_}{Watcom C++. The value of this macro corresponds to
155the compiler version, $1100$ is $11.0$ and $1200$ is OpenWatcom.}
69a126b0 156\twocolitem{\_WIN32\_WCE}{Windows CE version}
14aea4f9
VZ
157\end{twocollist}
158
d80fc6df 159
a4acaafa
VZ
160\subsection{Feature tests}\label{featuretests}
161
162Some library features may not be always available even if they were selected by
163the user. To make it possible to check if this is the case, the library
164predefines the symbols in the form \texttt{wxHAS\_FEATURE}. Unlike
165\texttt{wxUSE\_FEATURE} symbols which are defined by the library user (directly
166in \texttt{setup.h} or by running configure script) and which must be always
167defined as either $0$ or $1$, the \texttt{wxHAS} symbols are only defined if
168the corresponding feature is available and not defined at all otherwise.
169
170Currently the following symbols exist:
171\begin{twocollist}\itemsep=0pt
172\twocolitem{wxHAS\_LARGE\_FILES}{Defined if \helpref{wxFile}{wxfile} supports
173files more than 4GB in size.}
174\twocolitem{wxHAS\_LARGE\_FFILES}{Defined if \helpref{wxFFile}{wxffile}
175supports files more than 4GB in size.}
176\twocolitem{wxHAS\_POWER\_EVENTS}{Defined if
177\helpref{wxPowerEvent}{wxpowerevent} are ever generated on the current platform.}
178\twocolitem{wxHAS\_RADIO\_MENU\_ITEMS}{Defined if the current port supports
179\helpref{radio menu items}{wxmenuappendradioitem}.}
180\twocolitem{wxHAS\_RAW\_KEY\_CODES}{Defined if
181\helpref{raw key codes}{wxkeyeventgetrawkeycode} are supported.}
182\twocolitem{wxHAS\_REGEX\_ADVANCED}{Defined if advanced syntax is available in
183\helpref{wxRegEx}{wxregex}.}
184\twocolitem{wxHAS\_TASK\_BAR\_ICON}{Defined if
185\helpref{wxTaskBarIcon}{wxtaskbaricon} is available on the current platform.}
186\end{twocollist}
187
188
a203f6c0 189\subsection{Miscellaneous}\label{miscellaneousconst}
14aea4f9
VZ
190
191\begin{twocollist}\itemsep=0pt
fc2171bd 192\twocolitem{\_\_WXWINDOWS\_\_}{always defined in wxWidgets applications, see
e2478fde 193also \helpref{wxCHECK\_VERSION}{wxcheckversion}}
14aea4f9 194\twocolitem{\_\_WXDEBUG\_\_}{defined in debug mode, undefined in release mode}
01cd7f75
VZ
195\twocolitem{wxUSE\_XXX}{if defined as $1$, feature XXX is active, see the
196\helpref{complete list}{wxusedef} (the symbols of this form are always defined,
197use \#if and not \#ifdef to test for them)}
d5df6918
VZ
198\twocolitem{WX\_PRECOMP}{is defined if precompiled headers (PCH) are in use. In
199this case, \texttt{wx/wxprec.h} includes \texttt{wx/wx.h} which, in turn,
200includes a number of wxWidgets headers thus making it unnecessary to include
201them explicitly. However if this is not defined, you do need to include them
cb7d7375 202and so the usual idiom which allows to support both cases is to first include
d5df6918
VZ
203\texttt{wx/wxprec.h} and then, inside \texttt{#ifndef WX\_PRECOMP}, individual
204headers you need.}
b9e34846 205\twocolitem{\_UNICODE and UNICODE}{both are defined if wxUSE\_UNICODE is set to $1$}
002568cc
VZ
206\twocolitem{wxUSE\_GUI}{this particular feature test macro is defined to $1$
207when compiling or using the library with the GUI features activated, if it is
208defined as $0$, only wxBase is available.}
fc2171bd 209\twocolitem{wxUSE\_BASE}{only used by wxWidgets internally (defined as $1$ when
002568cc 210building wxBase code, either as a standalone library or as part of the
fc2171bd 211monolithic wxWidgets library, defined as $0$ when building GUI library only)}
78603ad2
VZ
212\twocolitem{wxNO\_RTTI}{is defined if the compiler RTTI support has been switched off}
213\twocolitem{wxNO\_EXCEPTIONS}{is defined if the compiler support for C++
214exceptions has been switched off}
215\twocolitem{wxNO\_THREADS}{if this macro is defined, the compilation options
216don't include compiler flags needed for multithreaded code generation. This
154b6b0f 217implies that wxUSE\_THREADS is $0$ and also that other (non-wx-based) threading
78603ad2 218packages cannot be used neither.}
149210fb
VZ
219\twocolitem{WXMAKINGDLL\_XXX}{used internally and defined when building the
220library \texttt{XXX} as a DLL; when a monolithic wxWidgets build is used only a
221single \texttt{WXMAKINGDLL} symbol is defined}
222\twocolitem{WXUSINGDLL}{defined when compiling code which uses wxWidgets as a
223DLL/shared library}
5d88a6b5
VZ
224\twocolitem{WXBUILDING}{defined when building wxWidgets itself, whether as a
225static or shared library}
14aea4f9 226\end{twocollist}