const_cpp.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: const_cpp.h
  3. // Purpose: Preprocessor symbols
  4. // Author: Vadim Zeitlin
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @page page_cppconst Preprocessor Symbols
  9. @tableofcontents
  10. These are preprocessor symbols used in the wxWidgets source, grouped by
  11. category (and sorted by alphabetical order inside each category). All of these
  12. macros except for the @c wxUSE_XXX variety is defined if the corresponding
  13. condition is @true and undefined if it isn't, so they should be always tested
  14. using @ifdef_ and not @if_.
  15. @section page_cppconst_guisystem GUI system
  16. @beginDefList
  17. @itemdef{__WXBASE__, Only wxBase, no GUI features (same as @c wxUSE_GUI == 0)}
  18. @itemdef{__WXCOCOA__, OS X using wxCocoa Port}
  19. @itemdef{__WXDFB__, wxUniversal using DirectFB}
  20. @itemdef{__WXWINCE__, Windows CE}
  21. @itemdef{__WXGTK__, GTK+}
  22. @itemdef{__WXGTK12__, GTK+ 1.2 or higher}
  23. @itemdef{__WXGTK20__, GTK+ 2.0 or higher}
  24. @itemdef{__WXGTK24__, GTK+ 2.4 or higher}
  25. @itemdef{__WXGTK26__, GTK+ 2.6 or higher}
  26. @itemdef{__WXGTK210__, GTK+ 2.10 or higher}
  27. @itemdef{__WXMAC__, old define, same as @c __WXOSX__}
  28. @itemdef{__WXMOTIF__, Motif}
  29. @itemdef{__WXMOTIF20__, Motif 2.0 or higher}
  30. @itemdef{__WXMSW__, GUI using <a href="http://en.wikipedia.org/wiki/Windows_User">Windows Controls</a>.
  31. Notice that for compatibility reasons, this symbol is defined for console
  32. applications under Windows as well, but it should only be used in the GUI code
  33. while @c __WINDOWS__ should be used for the platform tests.}
  34. @itemdef{__WXOSX__, OS X GUI using any Apple widget framework (Carbon, AppKit or UIKit)}
  35. @itemdef{__WXOSX_IPHONE__, OS X iPhone (UIKit)}
  36. @itemdef{__WXOSX_CARBON__, Mac OS X using Carbon}
  37. @itemdef{__WXOSX_COCOA__, Mac OS X using Cocoa (AppKit)}
  38. @itemdef{__WXOSX_MAC__, Mac OS X (Carbon or Cocoa)}
  39. @itemdef{__WXOSX_OR_COCOA__, Any Mac OS X port (wxOSX-Carbon, wxOSX-Cocoa or
  40. wxCocoa)}
  41. @itemdef{__WXPM__, OS/2 native Presentation Manager}
  42. @itemdef{__WXSTUBS__, Stubbed version ('template' wxWin implementation)}
  43. @itemdef{__WXXT__, Xt; mutually exclusive with WX_MOTIF, not implemented in wxWidgets 2.x}
  44. @itemdef{__WXX11__, wxX11 (__WXUNIVERSAL__ will be also defined)}
  45. @itemdef{__WXWINE__, WINE (i.e. WIN32 on Unix)}
  46. @itemdef{__WXUNIVERSAL__, wxUniversal port, always defined in addition
  47. to one of the symbols above so this should be tested first.}
  48. @itemdef{__X__, any X11-based GUI toolkit except GTK+}
  49. @endDefList
  50. There are two wxWidgets ports to Mac OS X. One of them, wxOSX is the successor of the
  51. venerable wxMac, it currently exists in three versions: Carbon and Cocoa for the
  52. desktop and a very early iPhone port. And there is the Cocoa port named wxCocoa
  53. which has not been updated very actively since beginning 2008. To summarize:
  54. @li If you want to test for wxOSX on the desktop, use
  55. @c __WXOSX_MAC__.
  56. @li If you want to test for wxOSX on the iPhone, use
  57. @c __WXOSX_IPHONE__.
  58. @li If you want to test for any GUI Mac port under OS X, use
  59. @c __WXOSX_OR_COCOA__.
  60. @li If you want to test for any port under Mac OS X, including, for
  61. example, wxGTK and also wxBase, use @c __DARWIN__ (see below).
  62. The convention is to use the @c __WX prefix for these
  63. symbols, although this has not always been followed.
  64. @section page_cppconst_os Operating Systems
  65. @beginDefList
  66. @itemdef{__APPLE__, any Mac OS version}
  67. @itemdef{__AIX__, AIX}
  68. @itemdef{__BSD__, Any *BSD system}
  69. @itemdef{__CYGWIN__, Cygwin: Unix on Win32}
  70. @itemdef{__DARWIN__, Mac OS X (with BSD C library), using any port (see also @c __WXOSX__)}
  71. @itemdef{__DATA_GENERAL__, DG-UX}
  72. @itemdef{__FREEBSD__, FreeBSD}
  73. @itemdef{__HPUX__, HP-UX (Unix)}
  74. @itemdef{__GNU__, GNU Hurd}
  75. @itemdef{__LINUX__, Linux}
  76. @itemdef{__MACH__, Mach-O Architecture (Mac OS X only builds)}
  77. @itemdef{__OSF__, OSF/1}
  78. @itemdef{__QNX__, QNX Neutrino RTOS}
  79. @itemdef{__SGI__, IRIX}
  80. @itemdef{__SOLARIS__, Solaris}
  81. @itemdef{__SUN__, Any Sun}
  82. @itemdef{__SUNOS__, Sun OS}
  83. @itemdef{__SVR4__, SystemV R4}
  84. @itemdef{__SYSV__, SystemV generic}
  85. @itemdef{__ULTRIX__, Ultrix}
  86. @itemdef{__UNIX__, any Unix}
  87. @itemdef{__UNIX_LIKE__, Unix, BeOS or VMS}
  88. @itemdef{__VMS__, VMS}
  89. @itemdef{__WINDOWS__, Any Windows platform, using any port (see also @c __WXMSW__)}
  90. @itemdef{__WIN16__, Win16 API (not supported since wxWidgets 2.6)}
  91. @itemdef{__WIN32__, Win32 API}
  92. @itemdef{__WIN64__, Win64 (mostly same as Win32 but data type sizes are different)}
  93. @itemdef{__WINE__, Wine}
  94. @itemdef{_WIN32_WCE, Windows CE version}
  95. @endDefList
  96. @section page_cppconst_cpu Hardware Architectures (CPU)
  97. Note that not all of these symbols are always defined, it depends on the
  98. compiler used.
  99. @beginDefList
  100. @itemdef{__ALPHA__, DEC Alpha architecture}
  101. @itemdef{__INTEL__, Intel i386 or compatible}
  102. @itemdef{__IA64__, Intel 64 bit architecture}
  103. @itemdef{__POWERPC__, Motorola Power PC}
  104. @endDefList
  105. @section page_cppconst_hardware Hardware Type
  106. @beginDefList
  107. @itemdef{__SMARTPHONE__, Generic mobile devices with phone buttons and a small display}
  108. @itemdef{__PDA__, Personal digital assistant, usually with touch screen}
  109. @itemdef{__HANDHELD__, Small but powerful computer, usually with a keyboard}
  110. @itemdef{__POCKETPC__, Microsoft-powered PocketPC devices with touch-screen}
  111. @itemdef{__WINCE_STANDARDSDK__, Microsoft-powered Windows CE devices, for generic Windows CE applications}
  112. @itemdef{__WINCE_NET__, Microsoft-powered Windows CE .NET devices (_WIN32_WCE is 400 or greater)}
  113. @itemdef{WIN32_PLATFORM_WFSP, Microsoft-powered smartphone}
  114. @endDefList
  115. @section page_cppconst_compiler Compilers
  116. @beginDefList
  117. @itemdef{__BORLANDC__, Borland C++. The value of the macro corresponds
  118. to the compiler version: 500 is 5.0.}
  119. @itemdef{__DJGPP__, DJGPP}
  120. @itemdef{__DIGITALMARS__, Digital Mars}
  121. @itemdef{__EVC4__, Embedded Visual C++ 4 (can be only used for building wxWinCE)}
  122. @itemdef{__GNUG__, Gnu C++ on any platform, see also wxCHECK_GCC_VERSION}
  123. @itemdef{__GNUWIN32__, Gnu-Win32 compiler, see also wxCHECK_W32API_VERSION}
  124. @itemdef{__INTELC__, Intel C++ compiler}
  125. @itemdef{__MINGW32__, Either MinGW32 or MinGW-w64 in either 32 or 64 bits}
  126. @itemdef{__MINGW32_TOOLCHAIN, MinGW32 only (32 bits only right now)}
  127. @itemdef{__MINGW64__, MinGW-w64 in 64 bit builds}
  128. @itemdef{__MINGW64_TOOLCHAIN__, MinGW-w64 in either 32 or 64 bit builds}
  129. @itemdef{__SUNCC__, Sun CC, see also wxCHECK_SUNCC_VERSION}
  130. @itemdef{__SYMANTECC__, Symantec C++}
  131. @itemdef{__VISAGECPP__, IBM Visual Age (OS/2)}
  132. @itemdef{__VISUALC__, Microsoft Visual C++, see also ::wxCHECK_VISUALC_VERSION.
  133. The value of this macro corresponds to the compiler version:
  134. @c 1020 for @c 4.2 (the first supported version), @c 1100 for
  135. @c 5.0, @c 1200 for @c 6.0 and so on. For convenience, the symbols
  136. __VISUALCn__ are also defined for each major compiler version from
  137. 5 to 12, i.e. you can use tests such @ifdef_ __VISUALC7__ to test
  138. for compiler version being precisely 7.}
  139. @itemdef{__XLC__, AIX compiler}
  140. @itemdef{__WATCOMC__, Watcom C++. The value of this macro corresponds to
  141. the compiler version, @c 1100 is @c 11.0 and @c 1200 is OpenWatcom.}
  142. @endDefList
  143. @section page_cppconst_featuretests Feature Tests
  144. Some library features may not be always available even if they were selected
  145. by the user. To make it possible to check if this is the case, the library
  146. predefines the symbols in the form @c wxHAS_FEATURE. Unlike
  147. @c wxUSE_FEATURE symbols which are defined by the library user (directly
  148. in @c setup.h or by running configure script) and which must be always
  149. defined as either 0 or 1, the @c wxHAS symbols are only defined if
  150. the corresponding feature is available and not defined at all otherwise.
  151. Currently the following symbols exist:
  152. @beginDefList
  153. @itemdef{wxHAS_3STATE_CHECKBOX, Defined if wxCheckBox supports wxCHK_3STATE
  154. flag, i.e. is capable of showing three states and not only the usual two.
  155. Currently defined for almost all ports.}
  156. @itemdef{wxHAS_ATOMIC_OPS, Defined if wxAtomicInc() and wxAtomicDec() functions
  157. have an efficient (CPU-specific) implementation. Notice that the functions
  158. themselves are always available but can be prohibitively slow to use when
  159. implemented in a generic way, using a critical section.}
  160. @itemdef{wxHAS_BITMAPTOGGLEBUTTON, Defined in @c wx/tglbtn.h if
  161. wxBitmapToggleButton class is available in addition to wxToggleButton.}
  162. @itemdef{wxHAS_CONFIG_TEMPLATE_RW, Defined if the currently used compiler
  163. supports template Read() and Write() methods in wxConfig.}
  164. @itemdef{wxHAS_LARGE_FILES, Defined if wxFile supports files more than 4GB in
  165. size (notice that you must include @c wx/filefn.h before testing for this
  166. symbol).}
  167. @itemdef{wxHAS_LARGE_FFILES, Defined if wxFFile supports files more than 4GB in
  168. size (notice that you must include @c wx/filefn.h before testing for this
  169. symbol).}
  170. @itemdef{wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG, Defined if compiler supports a
  171. 64 bit integer type (available as @c wxLongLong_t) and this type is
  172. different from long. Notice that, provided wxUSE_LONGLONG is not turned
  173. off, some 64 bit type is always available to wxWidgets programs and this
  174. symbol only indicates a presence of such primitive type. It is useful to
  175. decide whether some function should be overloaded for both
  176. <code>long</code> and <code>long long</code> types.}
  177. @itemdef{wxHAS_MULTIPLE_FILEDLG_FILTERS, Defined if wxFileDialog supports multiple ('|'-separated) filters.}
  178. @itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if <a href="http://en.wikipedia.org/wiki/Resource_(Windows)">
  179. Windows resource files</a> or OS/2 resource files are available on the current platform.}
  180. @itemdef{wxHAS_POWER_EVENTS, Defined if wxPowerEvent are ever generated on the current platform.}
  181. @itemdef{wxHAS_RADIO_MENU_ITEMS,
  182. Defined if the current port supports radio menu items (see wxMenu::AppendRadioItem).}
  183. @itemdef{wxHAS_RAW_BITMAP, Defined if direct access to bitmap data using the classes in @c wx/rawbmp.h is supported.}
  184. @itemdef{wxHAS_RAW_KEY_CODES, Defined if raw key codes (see wxKeyEvent::GetRawKeyCode are supported.}
  185. @itemdef{wxHAS_REGEX_ADVANCED, Defined if advanced syntax is available in wxRegEx.}
  186. @itemdef{wxHAS_TASK_BAR_ICON, Defined if wxTaskBarIcon is available on the current platform.}
  187. @endDefList
  188. @section page_cppconst_msvc_setup_h Library Selection for MSVC
  189. Microsoft Visual C++ users may use the special @c wx/setup.h file for this
  190. compiler in @c include/msvc subdirectory. This file implicitly links in all the
  191. wxWidgets libraries using MSVC-specific pragmas which usually is much more
  192. convenient than manually specifying the libraries list in all of the project
  193. configurations. However sometimes linking with all the libraries is not
  194. desirable, for example because some of them were not built and this is where
  195. the symbols in this section can be helpful: defining them allows to not link
  196. with the corresponding library. The following symbols are honoured:
  197. - wxNO_ADV_LIB
  198. - wxNO_AUI_LIB
  199. - wxNO_HTML_LIB
  200. - wxNO_MEDIA_LIB
  201. - wxNO_NET_LIB
  202. - wxNO_PROPGRID_LIB
  203. - wxNO_QA_LIB
  204. - wxNO_RICHTEXT_LIB
  205. - wxNO_WEBVIEW_LIB
  206. - wxNO_XML_LIB
  207. - wxNO_REGEX_LIB
  208. - wxNO_EXPAT_LIB
  209. - wxNO_JPEG_LIB
  210. - wxNO_PNG_LIB
  211. - wxNO_TIFF_LIB
  212. - wxNO_ZLIB_LIB
  213. Notice that the base library is always included and the core is always included
  214. for the GUI applications (i.e. those which don't define @c wxUSE_GUI as 0).
  215. If the makefiles have been used to build the libraries from source and the @c CFG
  216. variable has been set to specify a different output path for that particular
  217. configuration of build then the @c wxCFG preprocessor symbol should be set in
  218. the project that uses wxWidgets to the same value as the @c CFG variable in
  219. order for the correct @c wx/setup.h file to automatically be included for that
  220. configuration.
  221. @section page_cppconst_miscellaneous Miscellaneous
  222. @beginDefList
  223. @itemdef{__WXWINDOWS__,
  224. always defined in wxWidgets applications, see also wxCHECK_VERSION}
  225. @itemdef{wxDEBUG_LEVEL, defined as 1 by default, may be pre-defined as 0 before
  226. including wxWidgets headers to disable generation of any code at all
  227. for the assertion macros, see @ref overview_debugging}
  228. @itemdef{__WXDEBUG__, defined if wxDEBUG_LEVEL is 1 or more, undefined otherwise}
  229. @itemdef{wxUSE_XXX,
  230. if defined as 1, feature XXX is active, see the
  231. @ref page_wxusedef (the symbols of this form are always defined,
  232. use @if_ and not @ifdef_ to test for them)}
  233. @itemdef{WX_PRECOMP,
  234. is defined if precompiled headers (PCH) are in use. In
  235. this case, @c wx/wxprec.h includes @c wx/wx.h which, in turn,
  236. includes a number of wxWidgets headers thus making it unnecessary to include
  237. them explicitly. However if this is not defined, you do need to include them
  238. and so the usual idiom which allows to support both cases is to first include
  239. @c wx/wxprec.h} and then, inside @ifndef_ WX_PRECOMP, individual
  240. headers you need.}
  241. @itemdef{_UNICODE and UNICODE, both are defined if wxUSE_UNICODE is set to @c 1}
  242. @itemdef{wxUSE_GUI,
  243. this particular feature test macro is defined to 1
  244. when compiling or using the library with the GUI features activated,
  245. if it is defined as @c 0, only wxBase is available.}
  246. @itemdef{wxUSE_BASE,
  247. only used by wxWidgets internally (defined as 1 when
  248. building wxBase code, either as a standalone library or as part of the
  249. monolithic wxWidgets library, defined as 0 when building GUI library only)}
  250. @itemdef{wxNO_RTTI, is defined if the compiler RTTI support has been switched off}
  251. @itemdef{wxNO_EXCEPTIONS,
  252. is defined if the compiler support for C++ exceptions has been switched off}
  253. @itemdef{wxNO_THREADS,
  254. if this macro is defined, the compilation options
  255. don't include compiler flags needed for multithreaded code generation. This
  256. implies that wxUSE_THREADS is 0 and also that other (non-wx-based) threading
  257. packages cannot be used neither.}
  258. @itemdef{WXMAKINGDLL_XXX,
  259. used internally and defined when building the
  260. library @c XXX as a DLL; when a monolithic wxWidgets build is used only a
  261. single @c WXMAKINGDLL symbol is defined}
  262. @itemdef{WXUSINGDLL,
  263. defined when compiling code which uses wxWidgets as a DLL/shared library}
  264. @itemdef{WXBUILDING,
  265. defined when building wxWidgets itself, whether as a static or shared library}
  266. @endDefList
  267. */