X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8279e59a6162b9140319b15dbba00cbf415d9403..a4535b9f391bbe8453f70784bc77a06f3426e858:/include/wx/defs.h diff --git a/include/wx/defs.h b/include/wx/defs.h index eff3612016..c8f84b7ef4 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -269,6 +269,8 @@ typedef int wxWindowID; #define HAVE_EXPLICIT #elif defined(__DIGITALMARS__) #define HAVE_EXPLICIT + #elif defined(__WATCOMC__) + #define HAVE_EXPLICIT #endif #endif /* !HAVE_EXPLICIT */ @@ -434,6 +436,12 @@ typedef int wxWindowID; #endif /* va_copy/!va_copy */ #endif /* wxVaCopy */ +#ifndef HAVE_VARIADIC_MACROS + #if wxCHECK_WATCOM_VERSION(1,2) + #define HAVE_VARIADIC_MACROS + #endif +#endif /* HAVE_VARIADIC_MACROS */ + /* ---------------------------------------------------------------------------- */ /* portable calling conventions macros */ @@ -515,6 +523,17 @@ typedef int wxWindowID; #define wxDEPRECATED(x) x #endif +/* + Special variant of the macro above which should be used for the functions + which are deprecated but called by wx itself: this often happens with + deprecated virtual functions which are called by the library. + */ +#ifdef WXBUILDING +# define wxDEPRECATED_BUT_USED_INTERNALLY(x) x +#else +# define wxDEPRECATED_BUT_USED_INTERNALLY(x) wxDEPRECATED(x) +#endif + /* everybody gets the assert and other debug macros */ #include "wx/debug.h" @@ -561,12 +580,20 @@ typedef int wxWindowID; #define wxFOR_ALL_COMPARISONS_3(m, x, y, z) \ m(==,x,y,z) m(!=,x,y,z) m(>=,x,y,z) m(<=,x,y,z) m(>,x,y,z) m(<,x,y,z) +/* + This is only used with wxDEFINE_COMPARISON_REV: it passes both the normal + and the reversed comparison operators to the macro. + */ +#define wxFOR_ALL_COMPARISONS_3_REV(m, x, y, z) \ + m(==,x,y,z,==) m(!=,x,y,z,!=) m(>=,x,y,z,<=) \ + m(<=,x,y,z,>=) m(>,x,y,z,<) m(<,x,y,z,>) + #define wxDEFINE_COMPARISON(op, T1, T2, cmp) \ inline bool operator op(T1 x, T2 y) { return cmp(x, y, op); } -#define wxDEFINE_COMPARISON_REV(op, T1, T2, cmp) \ - inline bool operator op(T2 y, T1 x) { return cmp(x, y, op); } +#define wxDEFINE_COMPARISON_REV(op, T1, T2, cmp, oprev) \ + inline bool operator op(T2 y, T1 x) { return cmp(x, y, oprev); } /* Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given @@ -586,7 +613,7 @@ typedef int wxWindowID; */ #define wxDEFINE_ALL_COMPARISONS(T1, T2, cmp) \ wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp) \ - wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON_REV, T1, T2, cmp) + wxFOR_ALL_COMPARISONS_3_REV(wxDEFINE_COMPARISON_REV, T1, T2, cmp) /* ---------------------------------------------------------------------------- */ /* macros to avoid compiler warnings */ @@ -881,6 +908,14 @@ typedef wxUint16 wxWord; typedef wxUint32 wxDword; +#ifdef LLONG_MAX + #define wxINT64_MAX LLONG_MAX + #define wxINT64_MIN LLONG_MIN +#else + #define wxINT64_MAX wxLL(9223372036854775807) + #define wxINT64_MIN wxLL(-9223372036854775807-1) +#endif + /* Define an integral type big enough to contain all of long, size_t and void *. */ @@ -1093,29 +1128,45 @@ typedef float wxFloat32; typedef double wxFloat64; #endif -#if defined( __WXMAC__ ) && !defined( __POWERPC__ ) - typedef long double wxDouble; -#else - typedef double wxDouble; -#endif +typedef double wxDouble; /* Some (non standard) compilers typedef wchar_t as an existing type instead of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0 for them and to 1 for all the others. */ -#if wxUSE_WCHAR_T +#ifndef wxWCHAR_T_IS_REAL_TYPE /* - VC++ typedefs wchar_t as unsigned short by default, that is unless - /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED is - defined. + VC++ typedefs wchar_t as unsigned short by default until VC8, that is + unless /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED + is defined. */ # if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED) # define wxWCHAR_T_IS_REAL_TYPE 0 # else /* compiler having standard-conforming wchar_t */ # define wxWCHAR_T_IS_REAL_TYPE 1 # endif -#endif /* wxUSE_WCHAR_T */ +#endif /* !defined(wxWCHAR_T_IS_REAL_TYPE) */ + +/* Helper macro for doing something dependent on whether wchar_t is or isn't a + typedef inside another macro. */ +#if wxWCHAR_T_IS_REAL_TYPE + #define wxIF_WCHAR_T_TYPE(x) x +#else /* !wxWCHAR_T_IS_REAL_TYPE */ + #define wxIF_WCHAR_T_TYPE(x) +#endif /* wxWCHAR_T_IS_REAL_TYPE/!wxWCHAR_T_IS_REAL_TYPE */ + +/* + This constant should be used instead of NULL in vararg functions taking + wxChar* arguments: passing NULL (which is the same as 0, unless the compiler + defines it specially, e.g. like gcc does with its __null built-in) doesn't + work in this case as va_arg() wouldn't interpret the integer 0 correctly + when trying to convert it to a pointer on architectures where sizeof(int) is + strictly less than sizeof(void *). + + Examples of places where this must be used include wxFileTypeInfo ctor. + */ +#define wxNullPtr ((void *)NULL) /* ---------------------------------------------------------------------------- */ /* byte ordering related definition and macros */ @@ -1355,7 +1406,8 @@ enum wxBorder wxBORDER_SIMPLE = 0x02000000, wxBORDER_RAISED = 0x04000000, wxBORDER_SUNKEN = 0x08000000, - wxBORDER_DOUBLE = 0x10000000, + wxBORDER_DOUBLE = 0x10000000, /* deprecated */ + wxBORDER_THEME = wxBORDER_DEFAULT, /* a mask to extract border style from the combination of flags */ wxBORDER_MASK = 0x1f200000 @@ -1645,6 +1697,8 @@ enum wxBorder #define wxNO 0x00000008 #define wxYES_NO (wxYES | wxNO) #define wxCANCEL 0x00000010 +#define wxAPPLY 0x00000020 +#define wxCLOSE 0x00000040 #define wxYES_DEFAULT 0x00000000 /* has no effect (default) */ #define wxNO_DEFAULT 0x00000080 @@ -1677,6 +1731,16 @@ enum wxBackgroundStyle wxBG_STYLE_CUSTOM }; +/* + * Key types used by (old style) lists and hashes. + */ +enum wxKeyType +{ + wxKEY_NONE, + wxKEY_INTEGER, + wxKEY_STRING +}; + /* ---------------------------------------------------------------------------- */ /* standard IDs */ /* ---------------------------------------------------------------------------- */ @@ -1826,6 +1890,7 @@ enum wxItemKind wxITEM_NORMAL, wxITEM_CHECK, wxITEM_RADIO, + wxITEM_DROPDOWN, wxITEM_MAX }; @@ -2462,6 +2527,36 @@ typedef void* WXDisplay; #ifdef __WXCOCOA__ +/* Definitions of 32-bit/64-bit types + * These are typedef'd exactly the same way in newer OS X headers so + * redefinition when real headers are included should not be a problem. If + * it is, the types are being defined wrongly here. + * The purpose of these types is so they can be used from public wx headers. + * and also because the older (pre-Leopard) headers don't define them. + */ + +/* NOTE: We don't pollute namespace with CGFLOAT_MIN/MAX/IS_DOUBLE macros + * since they are unlikely to be needed in a public header. + */ +#if defined(__LP64__) && __LP64__ + typedef double CGFloat; +#else + typedef float CGFloat; +#endif + +#if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64) +typedef long NSInteger; +typedef unsigned long NSUInteger; +#else +typedef int NSInteger; +typedef unsigned int NSUInteger; +#endif + +/* Objective-C type declarations. + * These are to be used in public headers in lieu of NSSomething* because + * Objective-C class names are not available in C/C++ code. + */ + /* NOTE: This ought to work with other compilers too, but I'm being cautious */ #if (defined(__GNUC__) && defined(__APPLE__)) || defined(__MWERKS__) /* It's desirable to have type safety for Objective-C(++) code as it does @@ -2812,6 +2907,7 @@ typedef struct _GtkItemFactory GtkItemFactory; typedef struct _GtkSelectionData GtkSelectionData; typedef struct _GtkTextBuffer GtkTextBuffer; typedef struct _GtkRange GtkRange; +typedef struct _GtkCellRenderer GtkCellRenderer; typedef GtkWidget *WXWidget;