X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c75274f93cd2d34607de475adacd6acacf8bb80f..57fbe23f68f9ef92b8ef7e26bd06b399b53e33b2:/include/wx/defs.h diff --git a/include/wx/defs.h b/include/wx/defs.h index 889f1d6482..8eadc9138e 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -156,7 +156,7 @@ #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) // Watcom 11+ supports bool #define HAVE_BOOL - #elif defined(__GNUWIN32__) + #elif defined(__GNUWIN32__) || defined(__MINGW32__) || defined(__CYGWIN__) // Cygwin supports bool #define HAVE_BOOL #elif defined(__VISAGECPP__) @@ -174,35 +174,26 @@ typedef unsigned int bool; #endif // bool -#ifdef __cplusplus - // define boolean constants: don't use true/false here as not all compilers - // support them but also redefine TRUE which could have been defined as 1 - // by previous headers: this would be incorrect as our TRUE is supposed to - // be of type bool, just like true, not int - // - // however if the user code absolutely needs TRUE to be defined in its own - // way, it can predefine WX_TRUE_DEFINED to prevent the redefinition here - #ifdef TRUE - #ifndef WX_TRUE_DEFINED - #undef TRUE - #undef FALSE - #endif - #endif +// deal with TRUE/true stuff: we assume that if the compiler supports bool, it +// supports true/false as well and that, OTOH, if it does _not_ support bool, +// it doesn't support these keywords (this is less sure, in particular VC++ +// 4.x could be a problem here) +#ifndef HAVE_BOOL + #define true ((bool)1) + #define false ((bool)0) +#endif - #ifndef TRUE - #define TRUE ((bool)1) - #define FALSE ((bool)0) - #endif -#else // !__cplusplus - // the definitions above don't work for C sources - #ifndef TRUE - #define TRUE 1 - #endif +// for backwards compatibility, also define TRUE and FALSE +// +// note that these definitions should work both in C++ and C code, so don't +// use true/false below +#ifndef TRUE + #define TRUE 1 +#endif - #ifndef FALSE - #define FALSE 0 - #endif -#endif // C++/!C++ +#ifndef FALSE + #define FALSE 0 +#endif typedef short int WXTYPE; @@ -254,7 +245,7 @@ typedef int wxWindowID; // ---------------------------------------------------------------------------- // stdcall is used for all functions called by Windows under Windows -#if defined(__WINDOWS__) && !defined(__WXWINE__) +#if defined(__WINDOWS__) #if defined(__GNUWIN32__) #define wxSTDCALL __attribute__((stdcall)) #else @@ -391,8 +382,8 @@ class WXDLLEXPORT wxEvent; # endif /* ATTRIBUTE_PRINTF */ #endif -// Macro to issue warning when using deprecated functions with gcc or MSVC7: -#if defined(__GNUC__) +// Macro to issue warning when using deprecated functions with gcc3 or MSVC7: +#if wxCHECK_GCC_VERSION(3, 1) #define wxDEPRECATED(x) x __attribute__ ((deprecated)) #elif defined(__VISUALC__) && (__VISUALC__ >= 1300) #define wxDEPRECATED(x) __declspec(deprecated) x @@ -1833,6 +1824,7 @@ typedef void* WXRECTPTR ; typedef void* WXPOINTPTR ; typedef void* WXHWND ; typedef void* WXEVENTREF ; +typedef void* WXEVENTHANDLERREF ; typedef void* WXAPPLEEVENTREF ; typedef void* WXHDC ; typedef void* WXHMENU ; @@ -1931,7 +1923,7 @@ typedef WXHWND WXWidget; typedef unsigned int WXWPARAM; typedef long WXLPARAM; -#if !defined(__WIN32__) || defined(__GNUWIN32__) || defined(__WXWINE__) || defined(__WXMICROWIN__) +#if !defined(__WIN32__) || defined(__GNUWIN32__) || defined(__WXMICROWIN__) typedef int (*WXFARPROC)(); #else typedef int (__stdcall *WXFARPROC)();