]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/defs.h
define wxString::iterator::iterator_category correctly if wxUSE_STD_STRING and not...
[wxWidgets.git] / include / wx / defs.h
index 5440cd9b3c9d5033040c7fbaa97f04fbc281f325..9ed2232e6aaec25c8e14dd1c238f3981cdba10db 100644 (file)
@@ -611,15 +611,33 @@ typedef short int WXTYPE;
 #include <stddef.h>
 #endif
 
-/*  delete pointer if it is not NULL and NULL it afterwards */
-/*  (checking that it's !NULL before passing it to delete is just a */
-/*   a question of style, because delete will do it itself anyhow, but it might */
-/*   be considered as an error by some overzealous debugging implementations of */
-/*   the library, so we do it ourselves) */
-#define wxDELETE(p)      if ( (p) != NULL ) { delete p; p = NULL; }
+#ifdef __cplusplus
+    // delete pointer if it is not NULL and NULL it afterwards
+    template <typename T>
+    inline void wxDELETE(T*& ptr)
+    {
+        typedef char TypeIsCompleteCheck[sizeof(T)];
+
+        if ( ptr != NULL )
+        {
+            delete ptr;
+            ptr = NULL;
+        }
+    }
 
-/*  delete an array and NULL it (see comments above) */
-#define wxDELETEA(p)     if ( (p) ) { delete [] (p); p = NULL; }
+    // delete an array and NULL it (see comments above)
+    template <typename T>
+    inline void wxDELETEA(T*& ptr)
+    {
+        typedef char TypeIsCompleteCheck[sizeof(T)];
+
+        if ( ptr != NULL )
+        {
+            delete [] ptr;
+            ptr = NULL;
+        }
+    }
+#endif /*__cplusplus*/
 
 /*  size of statically declared array */
 #define WXSIZEOF(array)   (sizeof(array)/sizeof(array[0]))
@@ -1101,19 +1119,21 @@ typedef wxUint32 wxDword;
 #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 */
+/* Make sure ssize_t is defined (a signed type the same size as size_t). */
+/* (HAVE_SSIZE_T is not already defined by configure) */
+#ifndef HAVE_SSIZE_T
 #ifdef __MINGW32__
-    #if defined(_SSIZE_T_) && !defined(HAVE_SSIZE_T)
+    #if defined(_SSIZE_T_) || defined(_SSIZE_T_DEFINED)
         #define HAVE_SSIZE_T
     #endif
-#endif
-#if defined(__PALMOS__) && !defined(HAVE_SSIZE_T)
+#elif defined(__PALMOS__)
     #define HAVE_SSIZE_T
-#endif
-#if wxCHECK_WATCOM_VERSION(1,4)
+#elif wxCHECK_WATCOM_VERSION(1,4)
     #define HAVE_SSIZE_T
 #endif
+#endif /* !HAVE_SSIZE_T */
+
+/* If we really don't have ssize_t, provide our own version. */
 #ifdef HAVE_SSIZE_T
     #ifdef __UNIX__
         #include <sys/types.h>
@@ -2026,6 +2046,24 @@ enum
     wxID_ZOOM_OUT,
     wxID_UNDELETE,
     wxID_REVERT_TO_SAVED,
+    wxID_CDROM,
+    wxID_CONVERT,
+    wxID_EXECUTE,
+    wxID_FLOPPY,
+    wxID_HARDDISK,
+    wxID_BOTTOM,
+    wxID_FIRST,
+    wxID_LAST,
+    wxID_TOP,
+    wxID_INFO,
+    wxID_JUMP_TO,
+    wxID_NETWORK,
+    wxID_SELECT_COLOR,
+    wxID_SELECT_FONT,
+    wxID_SORT_ASCENDING,
+    wxID_SORT_DESCENDING,
+    wxID_SPELL_CHECK,
+    wxID_STRIKETHROUGH,
 
     /*  System menu IDs (used by wxUniv): */
     wxID_SYSTEM_MENU = 5200,
@@ -2662,8 +2700,10 @@ typedef unsigned long   WXDWORD;
 typedef unsigned short  WXWORD;
 
 typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ;
+#if wxOSX_USE_CARBON
 typedef WX_OPAQUE_TYPE(ControlRef ) * WXWidget ;
 typedef WX_OPAQUE_TYPE(WindowRef) * WXWindow ;
+#endif
 
 typedef void*       WXDisplay;
 
@@ -2800,15 +2840,33 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage);
 DECLARE_WXCOCOA_OBJC_CLASS(NSThread);
 DECLARE_WXCOCOA_OBJC_CLASS(NSWindow);
 DECLARE_WXCOCOA_OBJC_CLASS(NSView);
-#ifdef __WXMAC__
-// things added for __WXMAC__
-DECLARE_WXCOCOA_OBJC_CLASS(NSString);
-#else
-// things only for __WXCOCOA__
+#ifndef __WXMAC__
 typedef WX_NSView WXWidget; /*  wxWidgets BASE definition */
 #endif
 #endif /*  __WXCOCOA__  || ( __WXMAC__ &__DARWIN__)*/
 
+#ifdef __WXMAC__
+
+DECLARE_WXCOCOA_OBJC_CLASS(NSString);
+
+#if wxOSX_USE_COCOA
+
+typedef WX_NSWindow WXWindow;
+typedef WX_NSView WXWidget;
+
+#elif wxOSX_USE_IPHONE
+
+DECLARE_WXCOCOA_OBJC_CLASS(UIWindow);
+DECLARE_WXCOCOA_OBJC_CLASS(UIView);
+DECLARE_WXCOCOA_OBJC_CLASS(UIFont);
+
+typedef WX_UIWindow WXWindow;
+typedef WX_UIView WXWidget;
+
+#endif
+
+#endif // __WXMAC__
+
 #if defined(__WXPALMOS__)
 
 typedef void *          WXHWND;
@@ -3147,6 +3205,11 @@ typedef const void* WXWidget;
         classname(const classname&);            \
         classname& operator=(const classname&);
 
+#define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg)  \
+    private:                                            \
+        classname(const classname<arg>&);               \
+        classname& operator=(const classname<arg>&);
+
 #define DECLARE_NO_ASSIGN_CLASS(classname)      \
     private:                                    \
         classname& operator=(const classname&);