]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/defs.h
Implemented wxMenuBar::Insert and wxMenu::Insert.
[wxWidgets.git] / include / wx / defs.h
index ba94f1e06622f5f79874cd570d106a01ed8da9fa..0e06ffcb0f2d0c09819c5bc59ea4db994d7b9c54 100644 (file)
@@ -292,6 +292,29 @@ typedef int wxWindowID;
     #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)
 
@@ -837,29 +860,43 @@ inline wxUIntPtr wxPtrToUInt(const void *p)
     /*
        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*/
@@ -1616,10 +1653,8 @@ enum wxBackgroundStyle
 /*  Standard menu IDs */
 enum
 {
-#if wxABI_VERSION >= 20602
     /* no id matches this one when compared to it */
     wxID_NONE = -3,
-#endif
 
     /*  id for a separator line in the menu (invalid for normal item) */
     wxID_SEPARATOR = -2,
@@ -1801,11 +1836,8 @@ enum wxHitTest
 #define wxSIZE_ALLOW_MINUS_ONE  0x0004
 /*  Don't do parent client adjustments (for implementation only) */
 #define wxSIZE_NO_ADJUSTMENTS   0x0008
-
-#if wxABI_VERSION >= 20602
 /*  Change the window position even if it seems to be already correct */
 #define wxSIZE_FORCE            0x0010
-#endif // 2.6.2+
 
 /*  ---------------------------------------------------------------------------- */
 /*  GDI descriptions */