/**
-* 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)
#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 WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param)
#endif
+/* some arguments are not used in unicode mode */
+#if wxUSE_UNICODE
+ #define WXUNUSED_IN_UNICODE(param) WXUNUSED(param)
+#else
+ #define WXUNUSED_IN_UNICODE(param) param
+#endif
+
+/* some arguments are not used in WinCE build */
+#ifdef __WXWINCE__
+ #define WXUNUSED_IN_WINCE(param) WXUNUSED(param)
+#else
+ #define WXUNUSED_IN_WINCE(param) param
+#endif
+
/* some compilers give warning about a possibly unused variable if it is */
/* initialized in both branches of if/else and shut up if it is initialized */
/* when declared, but other compilers then give warnings about unused variable */
#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 };
/* define fixed length types */
/* ---------------------------------------------------------------------------- */
+#if defined(__WXPALMOS__) || defined(__MINGW32__)
+ #include <sys/types.h>
+#endif
+
/* chars are always one byte (by definition), shorts are always two (in */
/* practice) */
/*
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*/
#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 wxLongLongFmtSpec _T("L")
+#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__)))
#define wxLongLong_t __int64
#define wxLongLongSuffix i64
- #define wxLongLongFmtSpec _T("Ld")
+ #define wxLongLongFmtSpec _T("L")
#elif defined(__DIGITALMARS__)
#define wxLongLong_t __int64
#define wxLongLongSuffix LL
#define wxLongLongFmtSpec _T("ll")
+#elif defined(__MINGW32__)
+ #define wxLongLong_t long long
+ #define wxLongLongSuffix ll
+ #define wxLongLongFmtSpec _T("I64")
#elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \
- defined(__MINGW32__) || \
defined(__GNUC__) || \
defined(__CYGWIN__) || \
defined(__WXMICROWIN__) || \
/* Make sure ssize_t is defined (a signed type the same size as size_t) */
/* HAVE_SSIZE_T should be defined for compiliers that already have it */
#ifdef __MINGW32__
- #include <sys/types.h>
#if defined(_SSIZE_T_) && !defined(HAVE_SSIZE_T)
#define HAVE_SSIZE_T
#endif
#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;
/* standard IDs */
/* ---------------------------------------------------------------------------- */
-/* any id: means that we don't care about the id, whether when installing an */
-/* event handler or when creating a new window */
+/* Standard menu IDs */
enum
{
- wxID_ANY = -1
-};
+ /* no id matches this one when compared to it */
+ wxID_NONE = -3,
-/* id for a separator line in the menu (invalid for normal item) */
-enum
-{
- wxID_SEPARATOR = -2
-};
+ /* id for a separator line in the menu (invalid for normal item) */
+ wxID_SEPARATOR = -2,
-/* Standard menu IDs */
-enum
-{
+ /* any id: means that we don't care about the id, whether when installing
+ * an event handler or when creating a new window */
+ wxID_ANY = -1,
+
+
+ /* all predefined ids are between wxID_LOWEST and wxID_HIGHEST */
wxID_LOWEST = 4999,
wxID_OPEN,
#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 */
wxTOOL_RIGHT
};
-/* the values of the format constants should be the same as correspondign */
+/* the values of the format constants should be the same as corresponding */
/* CF_XXX constants in Windows API */
enum wxDataFormatId
{
NASTY HACK because the gethostname in sys/unistd.h which the gnu
stl includes and wx builds with by default clash with each other
(windows version 2nd param is int, sys/unistd.h version is unsigned
- int).
+ int).
*/
# define gethostname gethostnameHACK
# include <unistd.h>
#if defined(__WXPALMOS__)
+typedef void * WXHWND;
typedef void * WXHANDLE;
typedef void * WXHICON;
typedef void * WXHFONT;
typedef unsigned long WXCOLORREF;
typedef struct tagMSG WXMSG;
-typedef WinHandle WXWINHANDLE;
+typedef WXHWND WXWINHANDLE; /* WinHandle of PalmOS */
typedef WXWINHANDLE WXWidget;
+typedef void * WXFORMPTR;
+typedef void * WXEVENTPTR;
+typedef void * WXRECTANGLEPTR;
+
#endif /* __WXPALMOS__ */
-#if defined(__WXMSW__)
+/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
+#if defined(__WIN32__)
/* the keywords needed for WinMain() declaration */
#ifndef WXFAR
typedef long WXLRESULT;
#endif
-#if !defined(__WIN32__) || defined(__GNUWIN32__) || defined(__WXMICROWIN__)
+#if defined(__GNUWIN32__) || defined(__WXMICROWIN__)
typedef int (*WXFARPROC)();
#else
typedef int (__stdcall *WXFARPROC)();
#endif
-#endif /* __WXMSW__ */
+#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 */