]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/cppconst.tex
don't use _T() inside wxGetTranslation() and related macros (wxTRANSLATE, _, ......
[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, you 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{\_\_WXDFB\_\_}{wxUniversal using DirectFB}
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{\_\_WXGTK24\_\_}{GTK+ 2.4 or higher}
33 \twocolitem{\_\_WXGTK26\_\_}{GTK+ 2.6 or higher}
34 \twocolitem{\_\_WXGTK210\_\_}{GTK+ 2.10 or higher}
35 \twocolitem{\_\_WXMOTIF\_\_}{Motif}
36 \twocolitem{\_\_WXMOTIF20\_\_}{Motif 2.0 or higher}
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}
40 \twocolitem{\_\_WXMAC\_OSX\_\_}{MacOS X Carbon Mach-O Builds}
41 \twocolitem{\_\_WXMGL\_\_}{SciTech Soft MGL (\_\_WXUNIVERSAL\_\_ will be also
42 defined)}
43 \twocolitem{\_\_WXMSW\_\_}{Any Windows}
44 \twocolitem{\_\_WXOSX\_\_}{Any Mac OS X port (either Carbon or Cocoa)}
45 \twocolitem{\_\_WXPALMOS\_\_}{PalmOS}
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
49 implemented in wxWidgets 2.x}
50 \twocolitem{\_\_WXX11\_\_}{wxX11 (\_\_WXUNIVERSAL\_\_ will be also defined)}
51 \twocolitem{\_\_WXWINE\_\_}{WINE (i.e. WIN32 on Unix)}
52 \twocolitem{\_\_WXUNIVERSAL\_\_}{wxUniversal port, always defined in addition
53 to 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
57 There are two wxWidgets ports to Mac OS. One of them, wxMac, exists in two versions: Classic and
58 Carbon. The Classic version is the only one to work on Mac OS version 8. The
59 Carbon version may be built either as CFM or Mach-O (binary format, like ELF)
60 and the former may run under OS 9 while the latter only runs under OS X.
61 Finally, there is a new Cocoa port which can only be used under OS X. To
62 summarize:
63
64 \begin{itemize}
65 \item If you want to test for all Mac platforms, classic and OS X, you
66 should test both \texttt{\_\_WXMAC\_\_} and \texttt{\_\_WXCOCOA\_\_}.
67 \item If you want to test for any GUI Mac port under OS X, use
68 \texttt{\_\_WXOSX\_\_}.
69 \item If you want to test for any port under Mac OS X, including, for
70 example, wxGTK and also wxBase, use \texttt{\_\_DARWIN\_\_} (see below).
71 \end{itemize}
72
73 The convention is to use the \texttt{\_\_WX} prefix for these
74 symbols, although this has not always been followed.
75
76 \subsection{Operating systems}\label{osconst}
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}
83 \twocolitem{\_\_DARWIN\_\_}{Mac OS X using the BSD Unix C library (as opposed to using the Metrowerks MSL C/C++ library)}
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)}
88 \twocolitem{\_\_GNU\_\_}{GNU Hurd}
89 \twocolitem{\_\_LINUX\_\_}{Linux}
90 \twocolitem{\_\_MACH\_\_}{Mach-O Architecture (Mac OS X only builds)}
91 \twocolitem{\_\_OSF\_\_}{OSF/1}
92 \twocolitem{\_\_PALMOS\_\_}{PalmOS}
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}
104 \twocolitem{\_\_WINE\_\_}{Wine}
105 \end{twocollist}
106
107
108 \subsection{Hardware architectures (CPU)}\label{cpuconst}
109
110 Note that not all of these symbols are always defined, it depends on the
111 compiler used.
112
113 \begin{twocollist}\itemsep=0pt
114 \twocolitem{\_\_ALPHA\_\_}{DEC Alpha architecture}
115 \twocolitem{\_\_INTEL\_\_}{Intel i386 or compatible}
116 \twocolitem{\_\_IA64\_\_}{Intel 64 bit architecture}
117 \twocolitem{\_\_POWERPC\_\_}{Motorola Power PC}
118 \end{twocollist}
119
120
121 \subsection{Hardware type}\label{hardwareconst}
122
123 \begin{twocollist}\itemsep=0pt
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}
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)}
130 \twocolitem{WIN32\_PLATFORM\_WFSP}{Microsoft-powered smartphone}
131 \end{twocollist}
132
133
134 \subsection{Compilers}\label{compilerconst}
135
136 \begin{twocollist}\itemsep=0pt
137 \twocolitem{\_\_BORLANDC\_\_}{Borland C++. The value of the macro corresponds
138 to the compiler version: $500$ is $5.0$.}
139 \twocolitem{\_\_DJGPP\_\_}{DJGPP}
140 \twocolitem{\_\_DIGITALMARS\_\_}{Digital Mars}
141 \twocolitem{\_\_GNUG\_\_}{Gnu C++ on any platform, see also
142 \helpref{wxCHECK\_GCC\_VERSION}{wxcheckgccversion}}
143 \twocolitem{\_\_GNUWIN32\_\_}{Gnu-Win32 compiler, see also
144 \helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}}
145 \twocolitem{\_\_MINGW32\_\_}{MinGW}
146 \twocolitem{\_\_MWERKS\_\_}{CodeWarrior MetroWerks compiler}
147 \twocolitem{\_\_SUNCC\_\_}{Sun CC, see also \helpref{wxCHECK\_SUNCC\_VERSION}{wxchecksunccversion}}
148 \twocolitem{\_\_SYMANTECC\_\_}{Symantec C++}
149 \twocolitem{\_\_VISAGECPP\_\_}{IBM Visual Age (OS/2)}
150 \twocolitem{\_\_VISUALC\_\_}{Microsoft Visual C++. The value of this macro
151 corresponds to the compiler version: $1020$ for $4.2$ (the first supported
152 version), $1100$ for $5.0$, $1200$ for $6.0$ and so on}
153 \twocolitem{\_\_XLC\_\_}{AIX compiler}
154 \twocolitem{\_\_WATCOMC\_\_}{Watcom C++. The value of this macro corresponds to
155 the compiler version, $1100$ is $11.0$ and $1200$ is OpenWatcom.}
156 \twocolitem{\_WIN32\_WCE}{Windows CE version}
157 \end{twocollist}
158
159
160 \subsection{Feature tests}\label{featuretests}
161
162 Some library features may not be always available even if they were selected by
163 the user. To make it possible to check if this is the case, the library
164 predefines the symbols in the form \texttt{wxHAS\_FEATURE}. Unlike
165 \texttt{wxUSE\_FEATURE} symbols which are defined by the library user (directly
166 in \texttt{setup.h} or by running configure script) and which must be always
167 defined as either $0$ or $1$, the \texttt{wxHAS} symbols are only defined if
168 the corresponding feature is available and not defined at all otherwise.
169
170 Currently the following symbols exist:
171 \begin{twocollist}\itemsep=0pt
172 \twocolitem{wxHAS\_LARGE\_FILES}{Defined if \helpref{wxFile}{wxfile} supports
173 files more than 4GB in size.}
174 \twocolitem{wxHAS\_LARGE\_FFILES}{Defined if \helpref{wxFFile}{wxffile}
175 supports 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
189 \subsection{Miscellaneous}\label{miscellaneousconst}
190
191 \begin{twocollist}\itemsep=0pt
192 \twocolitem{\_\_WXWINDOWS\_\_}{always defined in wxWidgets applications, see
193 also \helpref{wxCHECK\_VERSION}{wxcheckversion}}
194 \twocolitem{\_\_WXDEBUG\_\_}{defined in debug mode, undefined in release mode}
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,
197 use \#if and not \#ifdef to test for them)}
198 \twocolitem{WX\_PRECOMP}{is defined if precompiled headers (PCH) are in use. In
199 this case, \texttt{wx/wxprec.h} includes \texttt{wx/wx.h} which, in turn,
200 includes a number of wxWidgets headers thus making it unnecessary to include
201 them explicitly. However if this is not defined, you do need to include them
202 and so the usual idiom which allows to support both cases is to first include
203 \texttt{wx/wxprec.h} and then, inside \texttt{#ifndef WX\_PRECOMP}, individual
204 headers you need.}
205 \twocolitem{\_UNICODE and UNICODE}{both are defined if wxUSE\_UNICODE is set to $1$}
206 \twocolitem{wxUSE\_GUI}{this particular feature test macro is defined to $1$
207 when compiling or using the library with the GUI features activated, if it is
208 defined as $0$, only wxBase is available.}
209 \twocolitem{wxUSE\_BASE}{only used by wxWidgets internally (defined as $1$ when
210 building wxBase code, either as a standalone library or as part of the
211 monolithic wxWidgets library, defined as $0$ when building GUI library only)}
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++
214 exceptions has been switched off}
215 \twocolitem{wxNO\_THREADS}{if this macro is defined, the compilation options
216 don't include compiler flags needed for multithreaded code generation. This
217 implies that wxUSE\_THREADS is $0$ and also that other (non-wx-based) threading
218 packages cannot be used neither.}
219 \twocolitem{WXMAKINGDLL\_XXX}{used internally and defined when building the
220 library \texttt{XXX} as a DLL; when a monolithic wxWidgets build is used only a
221 single \texttt{WXMAKINGDLL} symbol is defined}
222 \twocolitem{WXUSINGDLL}{defined when compiling code which uses wxWidgets as a
223 DLL/shared library}
224 \twocolitem{WXBUILDING}{defined when building wxWidgets itself, whether as a
225 static or shared library}
226 \end{twocollist}