wxWidgets/docs/latex/wx/cppconst.tex
Vadim Zeitlin a4acaafa5f added wxHAS_XXX section
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-23 21:59:15 +00:00

216 lines
10 KiB
TeX

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: cppconst.tex
%% Purpose: Preprocessor symbols
%% Author: Vadim Zeitlin
%% Created: 2002-08-22
%% RCS-ID: $Id$
%% Copyright: (c) 2002-2006 wxWidgets
%% License: wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Preprocessor symbols defined by wxWidgets}\label{cppconst}
These are preprocessor symbols used in the wxWidgets source, grouped
by category (and sorted by alphabetical order inside each category). All of
these macros except for the \texttt{wxUSE\_XXX} variety is defined if the
corresponding condition is true and undefined if it isn't, so they should be
always tested using \texttt{#ifdef} and not \texttt{#if}.
\subsection{GUI system}\label{guisystemconst}
\begin{twocollist}\itemsep=0pt
\twocolitem{\_\_WINDOWS\_\_}{any Windows, yom may also use \_\_WXMSW\_\_}
\twocolitem{\_\_WIN16\_\_}{Win16 API (not supported since wxWidgets 2.6)}
\twocolitem{\_\_WIN32\_\_}{Win32 API}
\twocolitem{\_\_WXBASE\_\_}{Only wxBase, no GUI features (same as \texttt{wxUSE\_GUI} $== 0$)}
\twocolitem{\_\_WXCOCOA\_\_}{OS X using Cocoa API}
\twocolitem{\_\_WXWINCE\_\_}{Windows CE}
\twocolitem{\_\_WXGTK\_\_}{GTK+}
\twocolitem{\_\_WXGTK12\_\_}{GTK+ 1.2 or higher}
\twocolitem{\_\_WXGTK20\_\_}{GTK+ 2.0 or higher}
\twocolitem{\_\_WXMOTIF\_\_}{Motif}
\twocolitem{\_\_WXMOTIF20\_\_}{Motif 2.0 or higher}
\twocolitem{\_\_WXMAC\_\_}{Mac OS all targets}
\twocolitem{\_\_WXMAC\_CLASSIC\_\_}{MacOS for Classic}
\twocolitem{\_\_WXMAC\_CARBON\_\_}{MacOS for Carbon CFM (running under Classic or OSX) or true OS X Mach-O Builds}
\twocolitem{\_\_WXMAC\_OSX\_\_}{MacOS X Carbon Mach-O Builds}
\twocolitem{\_\_WXMGL\_\_}{SciTech Soft MGL (\_\_WXUNIVERSAL\_\_ will be also
defined)}
\twocolitem{\_\_WXMSW\_\_}{Any Windows}
\twocolitem{\_\_WXOSX\_\_}{Any Mac OS X port (either Carbon or Cocoa)}
\twocolitem{\_\_WXPALMOS\_\_}{PalmOS}
\twocolitem{\_\_WXPM\_\_}{OS/2 native Presentation Manager}
\twocolitem{\_\_WXSTUBS\_\_}{Stubbed version ('template' wxWin implementation)}
\twocolitem{\_\_WXXT\_\_}{Xt; mutually exclusive with WX\_MOTIF, not
implemented in wxWidgets 2.x}
\twocolitem{\_\_WXX11\_\_}{wxX11 (\_\_WXUNIVERSAL\_\_ will be also defined)}
\twocolitem{\_\_WXWINE\_\_}{WINE (i.e. WIN32 on Unix)}
\twocolitem{\_\_WXUNIVERSAL\_\_}{wxUniversal port, always defined in addition
to one of the symbols above so this should be tested first.}
\twocolitem{\_\_X\_\_}{any X11-based GUI toolkit except GTK+}
\end{twocollist}
There are two wxWidgets ports to Mac OS. One of them, wxMac, exists in two versions: Classic and
Carbon. The Classic version is the only one to work on Mac OS version 8. The
Carbon version may be built either as CFM or Mach-O (binary format, like ELF)
and the former may run under OS 9 while the latter only runs under OS X.
Finally, there is a new Cocoa port which can only be used under OS X. To
summarize:
\begin{itemize}
\item If you want to test for all Mac platforms, classic and OS X, you
should test both \texttt{\_\_WXMAC\_\_} and \texttt{\_\_WXCOCOA\_\_}.
\item If you want to test for any GUI Mac port under OS X, use
\texttt{\_\_WXOSX\_\_}.
\item If you want to test for any port under Mac OS X, including, for
example, wxGTK and also wxBase, use \texttt{\_\_DARWIN\_\_} (see below).
\end{itemize}
The convention is to use the \texttt{\_\_WX} prefix for these
symbols, although this has not always been followed.
\subsection{Operating systems}\label{osconst}
\begin{twocollist}\itemsep=0pt
\twocolitem{\_\_APPLE\_\_}{any Mac OS version}
\twocolitem{\_\_AIX\_\_}{AIX}
\twocolitem{\_\_BSD\_\_}{Any *BSD system}
\twocolitem{\_\_CYGWIN\_\_}{Cygwin: Unix on Win32}
\twocolitem{\_\_DARWIN\_\_}{Mac OS X using the BSD Unix C library (as opposed to using the Metrowerks MSL C/C++ library)}
\twocolitem{\_\_DATA\_GENERAL\_\_}{DG-UX}
\twocolitem{\_\_DOS\_GENERAL\_\_}{DOS (used with wxMGL only)}
\twocolitem{\_\_FREEBSD\_\_}{FreeBSD}
\twocolitem{\_\_HPUX\_\_}{HP-UX (Unix)}
\twocolitem{\_\_GNU\_\_}{GNU Hurd}
\twocolitem{\_\_LINUX\_\_}{Linux}
\twocolitem{\_\_MACH\_\_}{Mach-O Architecture (Mac OS X only builds)}
\twocolitem{\_\_OSF\_\_}{OSF/1}
\twocolitem{\_\_PALMOS\_\_}{PalmOS}
\twocolitem{\_\_SGI\_\_}{IRIX}
\twocolitem{\_\_SOLARIS\_\_}{Solaris}
\twocolitem{\_\_SUN\_\_}{Any Sun}
\twocolitem{\_\_SUNOS\_\_}{Sun OS}
\twocolitem{\_\_SVR4\_\_}{SystemV R4}
\twocolitem{\_\_SYSV\_\_}{SystemV generic}
\twocolitem{\_\_ULTRIX\_\_}{Ultrix}
\twocolitem{\_\_UNIX\_\_}{any Unix}
\twocolitem{\_\_UNIX\_LIKE\_\_}{Unix, BeOS or VMS}
\twocolitem{\_\_VMS\_\_}{VMS}
\twocolitem{\_\_WINDOWS\_\_}{any Windows}
\twocolitem{\_\_WINE\_\_}{Wine}
\end{twocollist}
\subsection{Hardware architectures (CPU)}\label{cpuconst}
Note that not all of these symbols are always defined, it depends on the
compiler used.
\begin{twocollist}\itemsep=0pt
\twocolitem{\_\_ALPHA\_\_}{DEC Alpha architecture}
\twocolitem{\_\_INTEL\_\_}{Intel i386 or compatible}
\twocolitem{\_\_IA64\_\_}{Intel 64 bit architecture}
\twocolitem{\_\_POWERPC\_\_}{Motorola Power PC}
\end{twocollist}
\subsection{Hardware type}\label{hardwareconst}
\begin{twocollist}\itemsep=0pt
\twocolitem{\_\_SMARTPHONE\_\_}{Generic mobile devices with phone buttons and a small display}
\twocolitem{\_\_PDA\_\_}{Personal digital assistant, usually with touch screen}
\twocolitem{\_\_HANDHELD\_\_}{Small but powerful computer, usually with a keyboard}
\twocolitem{\_\_POCKETPC\_\_}{Microsoft-powered PocketPC devices with touch-screen}
\twocolitem{\_\_WINCE\_STANDARDSDK\_\_}{Microsoft-powered Windows CE devices, for generic Windows CE applications}
\twocolitem{\_\_WINCE\_NET\_\_}{Microsoft-powered Windows CE .NET devices (\_WIN32\_WCE is 400 or greater)}
\twocolitem{WIN32\_PLATFORM\_WFSP}{Microsoft-powered smartphone}
\end{twocollist}
\subsection{Compilers}\label{compilerconst}
\begin{twocollist}\itemsep=0pt
\twocolitem{\_\_BORLANDC\_\_}{Borland C++. The value of the macro corresponds
to the compiler version: $500$ is $5.0$.}
\twocolitem{\_\_DJGPP\_\_}{DJGPP}
\twocolitem{\_\_DIGITALMARS\_\_}{Digital Mars}
\twocolitem{\_\_GNUG\_\_}{Gnu C++ on any platform, see also
\helpref{wxCHECK\_GCC\_VERSION}{wxcheckgccversion}}
\twocolitem{\_\_GNUWIN32\_\_}{Gnu-Win32 compiler, see also
\helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}}
\twocolitem{\_\_MINGW32\_\_}{MinGW}
\twocolitem{\_\_MWERKS\_\_}{CodeWarrior MetroWerks compiler}
\twocolitem{\_\_SUNCC\_\_}{Sun CC}
\twocolitem{\_\_SYMANTECC\_\_}{Symantec C++}
\twocolitem{\_\_VISAGECPP\_\_}{IBM Visual Age (OS/2)}
\twocolitem{\_\_VISUALC\_\_}{Microsoft Visual C++. The value of this macro
corresponds to the compiler version: $1020$ for $4.2$ (the first supported
version), $1100$ for $5.0$, $1200$ for $6.0$ and so on}
\twocolitem{\_\_XLC\_\_}{AIX compiler}
\twocolitem{\_\_WATCOMC\_\_}{Watcom C++. The value of this macro corresponds to
the compiler version, $1100$ is $11.0$ and $1200$ is OpenWatcom.}
\twocolitem{\_WIN32\_WCE}{Windows CE version}
\end{twocollist}
\subsection{Feature tests}\label{featuretests}
Some library features may not be always available even if they were selected by
the user. To make it possible to check if this is the case, the library
predefines the symbols in the form \texttt{wxHAS\_FEATURE}. Unlike
\texttt{wxUSE\_FEATURE} symbols which are defined by the library user (directly
in \texttt{setup.h} or by running configure script) and which must be always
defined as either $0$ or $1$, the \texttt{wxHAS} symbols are only defined if
the corresponding feature is available and not defined at all otherwise.
Currently the following symbols exist:
\begin{twocollist}\itemsep=0pt
\twocolitem{wxHAS\_LARGE\_FILES}{Defined if \helpref{wxFile}{wxfile} supports
files more than 4GB in size.}
\twocolitem{wxHAS\_LARGE\_FFILES}{Defined if \helpref{wxFFile}{wxffile}
supports files more than 4GB in size.}
\twocolitem{wxHAS\_POWER\_EVENTS}{Defined if
\helpref{wxPowerEvent}{wxpowerevent} are ever generated on the current platform.}
\twocolitem{wxHAS\_RADIO\_MENU\_ITEMS}{Defined if the current port supports
\helpref{radio menu items}{wxmenuappendradioitem}.}
\twocolitem{wxHAS\_RAW\_KEY\_CODES}{Defined if
\helpref{raw key codes}{wxkeyeventgetrawkeycode} are supported.}
\twocolitem{wxHAS\_REGEX\_ADVANCED}{Defined if advanced syntax is available in
\helpref{wxRegEx}{wxregex}.}
\twocolitem{wxHAS\_TASK\_BAR\_ICON}{Defined if
\helpref{wxTaskBarIcon}{wxtaskbaricon} is available on the current platform.}
\end{twocollist}
\subsection{Miscellaneous}\label{miscellaneousconst}
\begin{twocollist}\itemsep=0pt
\twocolitem{\_\_WXWINDOWS\_\_}{always defined in wxWidgets applications, see
also \helpref{wxCHECK\_VERSION}{wxcheckversion}}
\twocolitem{\_\_WXDEBUG\_\_}{defined in debug mode, undefined in release mode}
\twocolitem{wxUSE\_XXX}{if defined as $1$, feature XXX is active
(the symbols of this form are always defined, use \#if and not \#ifdef to test
for them)}
\twocolitem{WX\_PRECOMP}{is defined if precompiled headers (PCH) are in use. In
this case, \texttt{wx/wxprec.h} includes \texttt{wx/wx.h} which, in turn,
includes a number of wxWidgets headers thus making it unnecessary to include
them explicitly. However if this is not defined, you do need to include them
and so the usual idiom which allows to support both cases is to first include
\texttt{wx/wxprec.h} and then, inside \texttt{#ifndef WX\_PRECOMP}, individual
headers you need.}
\twocolitem{\_UNICODE and UNICODE}{both are defined if wxUSE\_UNICODE is set to $1$}
\twocolitem{wxUSE\_GUI}{this particular feature test macro is defined to $1$
when compiling or using the library with the GUI features activated, if it is
defined as $0$, only wxBase is available.}
\twocolitem{wxUSE\_BASE}{only used by wxWidgets internally (defined as $1$ when
building wxBase code, either as a standalone library or as part of the
monolithic wxWidgets library, defined as $0$ when building GUI library only)}
\twocolitem{wxNO\_RTTI}{is defined if the compiler RTTI support has been switched off}
\twocolitem{wxNO\_EXCEPTIONS}{is defined if the compiler support for C++
exceptions has been switched off}
\twocolitem{wxNO\_THREADS}{if this macro is defined, the compilation options
don't include compiler flags needed for multithreaded code generation. This
implies that wxUSE\_THREADS is $0$ and also that other (non-wx-based) threading
packages cannot be used neither.}
\end{twocollist}