+
+/* 16bit */
+#ifdef SIZEOF_SHORT
+ #if SIZEOF_SHORT != 2
+ #error "wxWidgets assumes sizeof(short) == 2, please fix the code"
+ #endif
+#else
+ #define SIZEOF_SHORT 2
+#endif
+
+typedef signed short wxInt16;
+typedef unsigned short wxUint16;
+
+typedef wxUint16 wxWord;
+
+/*
+ things are getting more interesting with ints, longs and pointers
+
+ there are several different standard data models described by this table:
+
+ +-----------+----------------------------+
+ |type\model | LP64 ILP64 LLP64 ILP32 LP32|
+ +-----------+----------------------------+
+ |char | 8 8 8 8 8 |
+ |short | 16 16 16 16 16 |
+ |int | 32 64 32 32 16 |
+ |long | 64 64 32 32 32 |
+ |long long | 64 |
+ |void * | 64 64 64 32 32 |
+ +-----------+----------------------------+
+
+ Win16 used LP32 (but we don't support it any longer), Win32 obviously used
+ ILP32 and Win64 uses LLP64 (a.k.a. P64)
+
+ Under Unix LP64 is the most widely used (the only I've ever seen, in fact)
+ */
+
+/* 32bit */
+#ifdef __WINDOWS__
+ /* Win64 uses LLP64 model and so ints and longs have the same size as in */
+ /* Win32 */
+ #if defined(__WIN32__)
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+
+ /* conside that if SIZEOF_INT is defined, all the other ones are too */
+ #ifndef SIZEOF_INT
+ #define SIZEOF_INT 4
+ #define SIZEOF_LONG 4
+ #define SIZEOF_WCHAR_T 2
+
+ /*
+ under Win64 sizeof(size_t) == 8 and so it is neither unsigned
+ int nor unsigned long!
+ */
+ #ifdef __WIN64__
+ #define SIZEOF_SIZE_T 8
+
+ #undef wxSIZE_T_IS_UINT
+ #else /* Win32 */
+ #define SIZEOF_SIZE_T 4
+
+ #define wxSIZE_T_IS_UINT
+ #endif
+ #undef wxSIZE_T_IS_ULONG
+
+ #ifdef __WIN64__
+ #define SIZEOF_VOID_P 8
+ #else /* Win32 */
+ #define SIZEOF_VOID_P 4
+ #endif /* Win64/32 */
+ #endif /* !defined(SIZEOF_INT) */
+ #else
+ #error "Unsupported Windows version"
+ #endif
+#else /* !Windows */
+ /* SIZEOF_XXX are normally defined by configure */
+ #ifdef SIZEOF_INT
+ #if SIZEOF_INT == 8
+ /* must be ILP64 data model, there is normally a special 32 bit */
+ /* type in it but we don't know what it is... */
+ #error "No 32bit int type on this platform"
+ #elif SIZEOF_INT == 4
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+ #elif SIZEOF_INT == 2
+ /* must be LP32 */
+ #if SIZEOF_LONG != 4
+ #error "No 32bit int type on this platform"
+ #endif
+
+ typedef long wxInt32;
+ typedef unsigned long wxUint32;
+ #elif
+ /* wxWidgets is not ready for 128bit systems yet... */
+ #error "Unknown sizeof(int) value, what are you compiling for?"
+ #endif
+ #else /* !defined(SIZEOF_INT) */
+ /* assume default 32bit machine -- what else can we do? */
+ wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes);
+ wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes);
+ wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes);
+
+ #define SIZEOF_INT 4
+ #define SIZEOF_SIZE_T 4
+ #define SIZEOF_VOID_P 4
+
+ typedef int wxInt32;
+ typedef unsigned int wxUint32;
+
+ #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T)
+ #define SIZEOF_WCHAR_T 4
+ #endif
+ #if wxUSE_WCHAR_T && !defined(SIZEOF_WCHAR_T)
+ /* also assume that sizeof(wchar_t) == 2 (under Unix the most */
+ /* common case is 4 but there configure would have defined */
+ /* SIZEOF_WCHAR_T for us) */
+ /* the most common case */
+ wxCOMPILE_TIME_ASSERT( sizeof(wchar_t) == 2,
+ Wchar_tMustBeExactly2Bytes);
+
+ #define SIZEOF_WCHAR_T 2
+ #endif /* wxUSE_WCHAR_T */
+ #endif
+#endif /* Win/!Win */
+
+typedef wxUint32 wxDword;
+
+/*
+ Define an integral type big enough to contain all of long, size_t and void *.
+ */
+#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T
+ /* normal case */
+ typedef unsigned long wxUIntPtr;
+#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P
+ /* Win64 case */
+ typedef size_t wxUIntPtr;
+#else
+ /*
+ This should never happen for the current architectures but if you're
+ using one where it does, please contact wx-dev@lists.wxwidgets.org.
+ */
+ #error "Pointers can't be stored inside integer types."
+#endif
+
+/* 64 bit */
+
+/* NB: we #define and not typedef wxLongLong_t because we want to be able to */
+/* use 'unsigned wxLongLong_t' as well and because we use "#ifdef */
+/* wxLongLong_t" in wx/longlong.h */
+
+/* to avoid compilation problems on 64bit machines with ambiguous method calls */
+/* we will need to define this */
+#undef wxLongLongIsLong
+
+/* first check for generic cases which are long on 64bit machine and "long */
+/* long", then check for specific compilers */
+#if defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
+ #define wxLongLong_t long
+ #define wxLongLongSuffix l
+ #define wxLongLongFmtSpec _T("l")
+ #define wxLongLongIsLong
+#elif (defined(__VISUALC__) && defined(__WIN32__))
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec _T("I64")
+#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520)
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec _T("Ld")
+#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__)))
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix i64
+ #define wxLongLongFmtSpec _T("Ld")
+#elif defined(__DIGITALMARS__)
+ #define wxLongLong_t __int64
+ #define wxLongLongSuffix LL
+ #define wxLongLongFmtSpec _T("ll")
+#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \
+ defined(__MINGW32__) || \
+ defined(__GNUC__) || \
+ defined(__CYGWIN__) || \
+ defined(__WXMICROWIN__) || \
+ (defined(__DJGPP__) && __DJGPP__ >= 2)
+ #define wxLongLong_t long long
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec _T("ll")
+#elif defined(__MWERKS__)
+ #if __option(longlong)
+ #define wxLongLong_t long long
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec _T("ll")
+ #else
+ #error "The 64 bit integer support in CodeWarrior has been disabled."
+ #error "See the documentation on the 'longlong' pragma."
+ #endif
+#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400
+ #define wxLongLong_t long long
+#endif
+
+
+#ifdef wxLongLong_t
+ /* these macros allow to definea 64 bit constants in a portable way */
+ #define wxLL(x) wxCONCAT(x, wxLongLongSuffix)
+ #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix))
+
+ typedef wxLongLong_t wxInt64;
+ typedef unsigned wxLongLong_t wxUint64;
+#endif
+
+
+/* base floating point types */
+/* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits */
+/* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits */
+/* wxDouble: native fastest representation that has at least wxFloat64 */
+/* precision, so use the IEEE types for storage, and this for */
+/* calculations */
+
+typedef float wxFloat32;
+#if (defined( __WXMAC__ ) || defined(__WXCOCOA__)) && defined (__MWERKS__)
+ typedef short double wxFloat64;
+#else
+ typedef double wxFloat64;
+#endif
+
+#if defined( __WXMAC__ ) && !defined( __POWERPC__ )
+ typedef long double wxDouble;
+#else
+ typedef double wxDouble;
+#endif
+
+/* ---------------------------------------------------------------------------- */
+/* byte ordering related definition and macros */
+/* ---------------------------------------------------------------------------- */
+
+/* byte sex */
+
+#define wxBIG_ENDIAN 4321
+#define wxLITTLE_ENDIAN 1234
+#define wxPDP_ENDIAN 3412
+
+#ifdef WORDS_BIGENDIAN
+#define wxBYTE_ORDER wxBIG_ENDIAN
+#else
+#define wxBYTE_ORDER wxLITTLE_ENDIAN
+#endif
+
+/* byte swapping */
+
+#if defined (__MWERKS__) && ( (__MWERKS__ < 0x0900) || macintosh )
+/* assembler versions for these */
+#ifdef __POWERPC__
+ inline wxUint16 wxUINT16_SWAP_ALWAYS( wxUint16 i )
+ {return (__lhbrx( &i , 0 ) );}
+ inline wxInt16 wxINT16_SWAP_ALWAYS( wxInt16 i )
+ {return (__lhbrx( &i , 0 ) );}
+ inline wxUint32 wxUINT32_SWAP_ALWAYS( wxUint32 i )
+ {return (__lwbrx( &i , 0 ) );}
+ inline wxInt32 wxINT32_SWAP_ALWAYS( wxInt32 i )
+ {return (__lwbrx( &i , 0 ) );}
+#else
+ #pragma parameter __D0 wxUINT16_SWAP_ALWAYS(__D0)
+ pascal wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value)
+ = { 0xE158 };
+
+ #pragma parameter __D0 wxINT16_SWAP_ALWAYS(__D0)
+ pascal wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value)
+ = { 0xE158 };
+
+ #pragma parameter __D0 wxUINT32_SWAP_ALWAYS (__D0)
+ pascal wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value)
+ = { 0xE158, 0x4840, 0xE158 };
+
+ #pragma parameter __D0 wxINT32_SWAP_ALWAYS (__D0)
+ pascal wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value)
+ = { 0xE158, 0x4840, 0xE158 };
+
+#endif
+#else /* !MWERKS */
+#define wxUINT16_SWAP_ALWAYS(val) \
+ ((wxUint16) ( \
+ (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \
+ (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8)))
+
+#define wxINT16_SWAP_ALWAYS(val) \
+ ((wxInt16) ( \
+ (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \
+ (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8)))
+
+#define wxUINT32_SWAP_ALWAYS(val) \
+ ((wxUint32) ( \
+ (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \
+ (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \
+ (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \
+ (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24)))
+
+#define wxINT32_SWAP_ALWAYS(val) \
+ ((wxInt32) ( \
+ (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \
+ (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \
+ (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \
+ (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24)))
+#endif
+/* machine specific byte swapping */
+
+#ifdef wxLongLong_t
+ #define wxUINT64_SWAP_ALWAYS(val) \
+ ((wxUint64) ( \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56)))
+
+ #define wxINT64_SWAP_ALWAYS(val) \
+ ((wxInt64) ( \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \
+ (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56)))
+#else /* !wxLongLong_t */
+ #define wxUINT64_SWAP_ALWAYS(val) \
+ ((wxUint64) ( \
+ ((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \
+ ((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \
+ ((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \
+ ((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \
+ ((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \
+ ((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \
+ ((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \
+ ((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56)))
+
+ #define wxINT64_SWAP_ALWAYS(val) \
+ ((wxInt64) ( \
+ ((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \
+ ((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \
+ ((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \
+ ((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \
+ ((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \
+ ((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \
+ ((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \
+ ((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56)))
+#endif /* wxLongLong_t/!wxLongLong_t */
+
+#ifdef WORDS_BIGENDIAN
+ #define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val)
+ #define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val)
+ #define wxUINT16_SWAP_ON_LE(val) (val)
+ #define wxINT16_SWAP_ON_LE(val) (val)
+ #define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val)
+ #define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val)
+ #define wxUINT32_SWAP_ON_LE(val) (val)
+ #define wxINT32_SWAP_ON_LE(val) (val)
+ #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val)
+ #define wxUINT64_SWAP_ON_LE(val) (val)
+#else
+ #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val)
+ #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val)
+ #define wxUINT16_SWAP_ON_BE(val) (val)
+ #define wxINT16_SWAP_ON_BE(val) (val)
+ #define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val)
+ #define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val)
+ #define wxUINT32_SWAP_ON_BE(val) (val)
+ #define wxINT32_SWAP_ON_BE(val) (val)
+ #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val)
+ #define wxUINT64_SWAP_ON_BE(val) (val)
+#endif
+
+/* Macros to convert from unsigned long to void pointer. */
+/* High order truncation occurs if the respective type is not large enough. */
+#define WXPTRULONGSLICE (((wxBYTE_ORDER==wxBIG_ENDIAN)&&(sizeof(void*)==8)&&(sizeof(unsigned long)<8))?1:0)
+#define wxPtrToULong(p) (((unsigned long*)(&(p)))[WXPTRULONGSLICE])
+#define wxULongToPtr(p,n) (p=NULL,wxPtrToULong(p)=(unsigned long)(n),p)
+
+/* ---------------------------------------------------------------------------- */
+/* Geometric flags */
+/* ---------------------------------------------------------------------------- */
+
+enum wxGeometryCentre
+{
+ wxCENTRE = 0x0001,
+ wxCENTER = wxCENTRE
+};
+
+/* centering into frame rather than screen (obsolete) */
+#define wxCENTER_FRAME 0x0000
+/* centre on screen rather than parent */
+#define wxCENTRE_ON_SCREEN 0x0002
+#define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN
+
+enum wxOrientation
+{
+ wxHORIZONTAL = 0x0004,
+ wxVERTICAL = 0x0008,
+
+ wxBOTH = (wxVERTICAL | wxHORIZONTAL)
+};
+
+enum wxDirection
+{
+ wxLEFT = 0x0010,
+ wxRIGHT = 0x0020,
+ wxUP = 0x0040,
+ wxDOWN = 0x0080,
+
+ wxTOP = wxUP,
+ wxBOTTOM = wxDOWN,
+
+ wxNORTH = wxUP,
+ wxSOUTH = wxDOWN,
+ wxWEST = wxLEFT,
+ wxEAST = wxRIGHT,
+
+ wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT)
+};
+
+enum wxAlignment
+{
+ wxALIGN_NOT = 0x0000,
+ wxALIGN_CENTER_HORIZONTAL = 0x0100,
+ wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
+ wxALIGN_LEFT = wxALIGN_NOT,
+ wxALIGN_TOP = wxALIGN_NOT,
+ wxALIGN_RIGHT = 0x0200,
+ wxALIGN_BOTTOM = 0x0400,
+ wxALIGN_CENTER_VERTICAL = 0x0800,
+ wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL,
+
+ wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL),
+ wxALIGN_CENTRE = wxALIGN_CENTER,
+
+ /* a mask to extract alignment from the combination of flags */
+ wxALIGN_MASK = 0x0f00
+};
+
+enum wxStretch
+{
+ wxSTRETCH_NOT = 0x0000,
+ wxSHRINK = 0x1000,
+ wxGROW = 0x2000,
+ wxEXPAND = wxGROW,
+ wxSHAPED = 0x4000,
+ wxFIXED_MINSIZE = 0x8000,
+ wxTILE = 0xc000,
+
+ // for compatibility only, default now, don't use explicitly any more
+#if WXWIN_COMPATIBILITY_2_4
+ wxADJUST_MINSIZE = 0x00100000
+#else
+ wxADJUST_MINSIZE = 0
+#endif
+};
+
+/* border flags: the values are chosen for backwards compatibility */
+enum wxBorder
+{
+ /* this is different from wxBORDER_NONE as by default the controls do have */
+ /* border */
+ wxBORDER_DEFAULT = 0,
+
+ wxBORDER_NONE = 0x00200000,
+ wxBORDER_STATIC = 0x01000000,
+ wxBORDER_SIMPLE = 0x02000000,
+ wxBORDER_RAISED = 0x04000000,
+ wxBORDER_SUNKEN = 0x08000000,
+ wxBORDER_DOUBLE = 0x10000000,
+
+ /* a mask to extract border style from the combination of flags */
+ wxBORDER_MASK = 0x1f200000
+};
+
+/* ---------------------------------------------------------------------------- */
+/* Window style flags */
+/* ---------------------------------------------------------------------------- */