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