]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/defs.h
media proj
[wxWidgets.git] / include / wx / defs.h
index ea656185723e6d77b921ebd15286c7dc74c6e964..a5d6fecb4e8f4034f9d411e462d5b7ab92d44a37 100644 (file)
 #ifndef _WX_DEFS_H_
 #define _WX_DEFS_H_
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma interface "defs.h"
-#endif
-
 /*  ---------------------------------------------------------------------------- */
 /*  compiler and OS identification */
 /*  ---------------------------------------------------------------------------- */
@@ -66,7 +62,7 @@
 
 /*  suppress some Visual C++ warnings */
 #ifdef __VISUALC__
-    /*  the only "real" warning here is 4244 but there areust too many of them */
+    /*  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:4201)    /*  nonstandard extension used: nameless struct/union */
 #   pragma warning(disable:4244)    /*  conversion from double to float */
 #endif
 #endif /*  __VISUALC__ */
 
-/*  suppress some Watcom C++ warnings */
-#ifdef __WATCOMC__
-#   pragma warning 849 9            /*  Disable 'virtual function hidden' */
-#   pragma warning 549 9            /*  Disable 'operand contains compiler generated information' */
-#endif /*  __VISUALC__ */
-
 /*  suppress some Salford C++ warnings */
 #ifdef __SALFORDC__
 #   pragma suppress 353             /*  Possible nested comments */
@@ -483,7 +473,18 @@ typedef int wxWindowID;
 /*  appending the current line number to the given identifier to reduce the */
 /*  probability of the conflict (it may still happen if this is used in the */
 /*  headers, hence you should avoid doing it or provide unique prefixes then) */
-#define wxCONCAT_LINE(text)         wxCONCAT(text, __LINE__)
+#if defined(__VISUALC__) && (__VISUALC__ >= 1300)
+    /*
+       __LINE__ handling is completely broken in VC++ when using "Edit and
+       Continue" (/ZI option) and results in preprocessor errors if we use it
+       inside the macros. Luckily VC7 has another standard macro which can be
+       used like this and is even better than __LINE__ because it is globally
+       unique.
+     */
+#   define wxCONCAT_LINE(text)         wxCONCAT(text, __COUNTER__)
+#else /* normal compilers */
+#   define wxCONCAT_LINE(text)         wxCONCAT(text, __LINE__)
+#endif
 #define wxMAKE_UNIQUE_NAME(text)    wxCONCAT_LINE(text)
 
 /*  symbolic constant used by all Find()-like functions returning positive */
@@ -785,8 +786,8 @@ typedef wxUint32 wxDword;
 #endif
 
 #ifdef __cplusplus
-/* And also define a simple function to cast pointer to it. */
-inline wxUIntPtr wxPtrToUInt(void *p)
+/* And also define a couple of simple functions to cast pointer to/from it. */
+inline wxUIntPtr wxPtrToUInt(const void *p)
 {
     /*
        VC++ 7.1 gives warnings about casts such as below even when they're
@@ -803,6 +804,19 @@ inline wxUIntPtr wxPtrToUInt(void *p)
     #pragma warning(default: 4311)
 #endif
 }
+
+inline void *wxUIntToPtr(wxUIntPtr p)
+{
+#ifdef __VISUALC__
+    #pragma warning(disable: 4312) /* conversion to type of greater size */
+#endif
+
+    return wx_reinterpret_cast(void *, p);
+
+#ifdef __VISUALC__
+    #pragma warning(default: 4312)
+#endif
+}
 #endif /*__cplusplus*/
 
 
@@ -872,6 +886,19 @@ inline wxUIntPtr wxPtrToUInt(void *p)
 #endif
 
 
+/* 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 */
+#ifndef HAVE_SSIZE_T
+    #if SIZEOF_SIZE_T == 4
+        typedef wxInt32 ssize_t;
+    #elif SIZEOF_SIZE_T == 8
+        typedef wxInt64 ssize_t
+    #else
+        #error "error defining ssize_t, size_t is not 4 or 8 bytes"
+    #endif
+#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 */
@@ -1054,12 +1081,6 @@ typedef float wxFloat32;
     #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 */
 /*  ---------------------------------------------------------------------------- */
@@ -1866,7 +1887,10 @@ enum wxKeyCode
     WXK_SPACE   =    32,
     WXK_DELETE  =    127,
 
-    WXK_START   = 300,
+    /* These are, by design, not compatable with unicode characters.
+       If you want to get a unicode character from a key event, use
+       wxKeyEvent::GetUnicodeKey instead.                           */
+    WXK_START   = 300, 
     WXK_LBUTTON,
     WXK_RBUTTON,
     WXK_CANCEL,