]>
Commit | Line | Data |
---|---|---|
fb896a32 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cocoa/ObjcPose.h | |
3 | // Purpose: Macros for initializing poseAs, among other things | |
4 | // Author: David Elliott | |
1c4e8f38 | 5 | // Modified by: |
fb896a32 | 6 | // Created: 2002/12/03 |
1c4e8f38 | 7 | // RCS-ID: $Id$ |
fb896a32 | 8 | // Copyright: (c) 2002 David Elliott <dfe@cox.net> |
65571936 | 9 | // Licence: wxWindows licence |
fb896a32 DE |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __WX_COCOA_PRIVATE_POSER_H__ | |
13 | #define __WX_COCOA_PRIVATE_POSER_H__ | |
14 | ||
15 | /*------------------------------------------------------------------------- | |
16 | Objective-C Poser class initialization | |
17 | -------------------------------------------------------------------------*/ | |
18 | #ifdef __OBJC__ | |
19 | #import <objc/objc-class.h> | |
f910a887 | 20 | #import <Foundation/NSObjCRuntime.h> |
fb896a32 DE |
21 | |
22 | class wxPoseAsInitializer | |
23 | { | |
24 | public: | |
1c4e8f38 WS |
25 | wxPoseAsInitializer() |
26 | : m_next(sm_first) | |
27 | { | |
28 | sm_first = this; | |
29 | } | |
30 | virtual ~wxPoseAsInitializer() | |
31 | { | |
32 | sm_first = m_next; | |
33 | } | |
34 | static void InitializePosers() | |
35 | { | |
36 | while(sm_first) | |
37 | { | |
38 | delete sm_first; | |
39 | } | |
40 | }; | |
fb896a32 | 41 | protected: |
1c4e8f38 WS |
42 | wxPoseAsInitializer *m_next; |
43 | static wxPoseAsInitializer *sm_first; | |
fb896a32 DE |
44 | }; |
45 | ||
46 | class wxDummyForPoseAsInitializer | |
47 | { | |
48 | public: | |
1c4e8f38 | 49 | wxDummyForPoseAsInitializer(void*) {} |
fb896a32 DE |
50 | }; |
51 | ||
52 | #define WX_IMPLEMENT_POSER(poser) \ | |
462bc048 DE |
53 | class wxPoseAsInitializerFor##poser: public wxPoseAsInitializer \ |
54 | { \ | |
55 | protected: \ | |
56 | virtual ~wxPoseAsInitializerFor##poser() \ | |
57 | { \ | |
58 | class_poseAs([poser class],[poser superclass]); \ | |
59 | } \ | |
60 | }; \ | |
61 | wxDummyForPoseAsInitializer wxDummyPoseAsInitializerFor##poser(new wxPoseAsInitializerFor##poser) | |
fb896a32 | 62 | |
e6686511 DE |
63 | #else // __OBJC__ |
64 | #warning "Objective-C++ Only!" | |
fb896a32 DE |
65 | #endif // __OBJC__ |
66 | ||
fb896a32 | 67 | #endif // __WX_COCOA_PRIVATE_POSER_H__ |