/**
-* Name: defs.h
+* Name: wx/defs.h
* Purpose: Declarations/definitions common to all wx source files
* Author: Julian Smart and others
* Modified by: Ryan Norton (Converted to C)
#ifdef __VISUALC__
/* the only "real" warning here is 4244 but there are just too many of them */
/* in our code... one day someone should go and fix them but until then... */
+# pragma warning(disable:4097) /* typedef used as class */
# pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */
# pragma warning(disable:4244) /* conversion from double to float */
-# pragma warning(disable:4710) /* function not inlined */
-# pragma warning(disable:4097) /* typedef used as class */
+# pragma warning(disable:4355) /* 'this' used in base member initializer list */
# pragma warning(disable:4511) /* copy ctor couldn't be generated */
# pragma warning(disable:4512) /* operator=() couldn't be generated */
-#ifndef WIN32
-# pragma warning(disable:4135) /* conversion between different integral types */
-# pragma warning(disable:4769) /* assignment of near pointer to long integer */
-/* This one is really annoying, since it occurs for each cast to (HANDLE)... */
-# pragma warning(disable:4305) /* truncation of long to near ptr */
-#endif
+# pragma warning(disable:4710) /* function not inlined */
#endif /* __VISUALC__ */
/* suppress some Salford C++ warnings */
#if defined(__VISUALC__) && (__VISUALC__ >= 1100)
/* VC++ 6.0 and 5.0 have C++ casts (what about earlier versions?) */
#define HAVE_CXX_CASTS
- #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \
- && wxCHECK_GCC_VERSION(2, 95)
- /* GCC 2.95 has C++ casts, what about earlier versions? */
- #define HAVE_CXX_CASTS
+ #elif defined(__MINGW32__) || defined(__CYGWIN32__)
+ #if wxCHECK_GCC_VERSION(2, 95)
+ /* GCC 2.95 has C++ casts, what about earlier versions? */
+ #define HAVE_CXX_CASTS
+ #endif
#endif
#endif /* !HAVE_CXX_CASTS */
#define wx_reinterpret_cast(t, x) ((t)(x))
#endif
+/*
+ This one is a wx invention: like static cast but used when we intentionally
+ truncate from a larger to smaller type, static_cast<> can't be used for it
+ as it results in warnings when using some compilers (SGI mipspro for example)
+ */
+#if defined(__INTELC__) && defined(__cplusplus)
+ template <typename T, typename X>
+ inline T wx_truncate_cast_impl(X x)
+ {
+ #pragma warning(push)
+ /* explicit conversion of a 64-bit integral type to a smaller integral type */
+ #pragma warning(disable: 1683)
+
+ return (T)x;
+
+ #pragma warning(pop)
+ }
+
+ #define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
+#else /* !__INTELC__ */
+ #define wx_truncate_cast(t, x) ((t)(x))
+#endif /* __INTELC__/!__INTELC__ */
+
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) wx_const_cast(className *, obj)
#define except(x) catch(...)
#endif /* Metrowerks */
-#if defined(__WATCOMC__)
+#if defined(__WATCOMC__) && (__WATCOMC__ < 1240)
typedef short mode_t;
#endif
/* ---------------------------------------------------------------------------- */
/* the type for screen and DC coordinates */
-
-#if wxUSE_COMPATIBLE_COORD_TYPES
- /* to ensure compatibility with 2.0, we must use long */
- #define wxCoord long
-#else /* !wxUSE_COMPATIBLE_COORD_TYPES */
- /* other platforms we support have at least 32bit int - quite enough */
- typedef int wxCoord;
-#endif /* wxUSE_COMPATIBLE_COORD_TYPES/!wxUSE_COMPATIBLE_COORD_TYPES */
+typedef int wxCoord;
enum { wxDefaultCoord = -1 };
/*
VC++ 7.1 gives warnings about casts such as below even when they're
explicit with /Wp64 option, suppress them as we really know what we're
- doing here
+ doing here. Same thing with icc with -Wall.
*/
-#ifdef __VISUALC__
- #pragma warning(disable: 4311) /* pointer truncation from '' to '' */
+#if defined(__VISUALC__) || defined(__INTELC__)
+ #pragma warning(push)
+ #ifdef __VISUALC__
+ /* pointer truncation from '' to '' */
+ #pragma warning(disable: 4311)
+ #elif defined(__INTELC__)
+ /* conversion from pointer to same-sized integral type */
+ #pragma warning(disable: 1684)
+ #endif
#endif
return wx_reinterpret_cast(wxUIntPtr, p);
-#ifdef __VISUALC__
- #pragma warning(default: 4311)
+#if defined(__VISUALC__) || defined(__INTELC__)
+ #pragma warning(pop)
#endif
}
inline void *wxUIntToPtr(wxUIntPtr p)
{
-#ifdef __VISUALC__
- #pragma warning(disable: 4312) /* conversion to type of greater size */
+#if defined(__VISUALC__) || defined(__INTELC__)
+ #pragma warning(push)
+ #ifdef __VISUALC__
+ /* conversion to type of greater size */
+ #pragma warning(disable: 4312)
+ #elif defined(__INTELC__)
+ /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
+ #pragma warning(disable: 171)
+ #endif
#endif
return wx_reinterpret_cast(void *, p);
-#ifdef __VISUALC__
- #pragma warning(default: 4312)
+#if defined(__VISUALC__) || defined(__INTELC__)
+ #pragma warning(pop)
#endif
}
#endif /*__cplusplus*/
#if defined(__PALMOS__) && !defined(HAVE_SSIZE_T)
#define HAVE_SSIZE_T
#endif
+#if defined(__WATCOMC__) && __WATCOMC__ > 1230
+ #define HAVE_SSIZE_T
+#endif
#ifndef HAVE_SSIZE_T
#if SIZEOF_SIZE_T == 4
typedef wxInt32 ssize_t;
#define wxSIZE_ALLOW_MINUS_ONE 0x0004
/* Don't do parent client adjustments (for implementation only) */
#define wxSIZE_NO_ADJUSTMENTS 0x0008
+/* Change the window position even if it seems to be already correct */
+#define wxSIZE_FORCE 0x0010
/* ---------------------------------------------------------------------------- */
/* GDI descriptions */
#endif /* __WIN32__ */
+#if defined(__OS2__)
+typedef unsigned long DWORD;
+typedef unsigned short WORD;
+#endif
+
#if defined(__WXPM__) || defined(__EMX__)
#ifdef __WXPM__
/* Stand-ins for OS/2 types, to avoid #including all of os2.h */
typedef unsigned long HINSTANCE;
typedef unsigned long HIMAGELIST;
typedef unsigned long HGLOBAL;
-typedef unsigned long DWORD;
-typedef unsigned short WORD;
#endif /* WXPM || EMX */
#if defined (__WXPM__)
typedef void* WXFont;
typedef void* WXImage;
typedef void* WXFontList;
+typedef void* WXFontSet;
typedef void* WXRendition;
typedef void* WXRenderTable;
typedef void* WXFontType; /* either a XmFontList or XmRenderTable */