]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/cocoa/ObjcPose.h
Updated version to 2.5.5
[wxWidgets.git] / include / wx / cocoa / ObjcPose.h
index b5e53c0ab6c32dbc54e78f0504609bd6949e60b8..6bfdf45f4b8657c3c54a5093ac5ad19e75d2394c 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2002/12/03
 // RCS-ID:      $Id:
 // Copyright:   (c) 2002 David Elliott <dfe@cox.net>
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef __WX_COCOA_PRIVATE_POSER_H__
@@ -17,19 +17,18 @@ Objective-C Poser class initialization
 -------------------------------------------------------------------------*/
 #ifdef __OBJC__
 #import <objc/objc-class.h>
+#import <Foundation/NSObjCRuntime.h>
 
 class wxPoseAsInitializer
 {
 public:
-       wxPoseAsInitializer(Class poser)
-       : m_poser(poser)
-       , m_next(sm_first)
+       wxPoseAsInitializer()
+       : m_next(sm_first)
        {
                sm_first = this;
        }
-       ~wxPoseAsInitializer()
+       virtual ~wxPoseAsInitializer()
        {
-               class_poseAs(m_poser,m_poser->super_class);
                sm_first = m_next;
        }
        static void InitializePosers()
@@ -40,7 +39,6 @@ public:
                }
        };
 protected:
-       Class m_poser;
        wxPoseAsInitializer *m_next;
        static wxPoseAsInitializer *sm_first;
 };
@@ -52,7 +50,15 @@ public:
 };
 
 #define WX_IMPLEMENT_POSER(poser) \
-wxDummyForPoseAsInitializer wxDummyPoseAsInitializerFor##poser(new wxPoseAsInitializer([poser class]))
+class wxPoseAsInitializerFor##poser: public wxPoseAsInitializer \
+{ \
+protected: \
+    virtual ~wxPoseAsInitializerFor##poser() \
+    { \
+        class_poseAs([poser class],[poser superclass]); \
+    } \
+}; \
+wxDummyForPoseAsInitializer wxDummyPoseAsInitializerFor##poser(new wxPoseAsInitializerFor##poser)
 
 #else // __OBJC__
 #warning "Objective-C++ Only!"