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