X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb896a322a2ed53d393ee738765ddd3f72cee004..4a7ec775feb4f125cbeffe641a8e48b0a42848eb:/include/wx/cocoa/ObjcPose.h?ds=sidebyside diff --git a/include/wx/cocoa/ObjcPose.h b/include/wx/cocoa/ObjcPose.h index 72ee4903f1..b5e53c0ab6 100644 --- a/include/wx/cocoa/ObjcPose.h +++ b/include/wx/cocoa/ObjcPose.h @@ -54,70 +54,9 @@ public: #define WX_IMPLEMENT_POSER(poser) \ wxDummyForPoseAsInitializer wxDummyPoseAsInitializerFor##poser(new wxPoseAsInitializer([poser class])) +#else // __OBJC__ +#warning "Objective-C++ Only!" #endif // __OBJC__ -/*------------------------------------------------------------------------- -Basic hashmap stuff, used by everything --------------------------------------------------------------------------*/ -#define WX_DECLARE_OBJC_HASHMAP(ObjcClass) \ -class wxCocoa##ObjcClass; \ -WX_DECLARE_HASH_MAP(WX_##ObjcClass,wxCocoa##ObjcClass*,wxPointerHash,wxPointerEqual,wxCocoa##ObjcClass##Hash) - -#define WX_DECLARE_OBJC_INTERFACE_HASHMAP(ObjcClass) \ -public: \ - static inline wxCocoa##ObjcClass* GetFromCocoa(WX_##ObjcClass cocoaObjcClass) \ - { \ - wxCocoa##ObjcClass##Hash::iterator iter = sm_cocoaHash.find(cocoaObjcClass); \ - if(iter!=sm_cocoaHash.end()) \ - { \ - return iter->second; \ - } \ - return NULL; \ - } \ -protected: \ - static wxCocoa##ObjcClass##Hash sm_cocoaHash; - -#define WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(ObjcClass) \ -wxCocoa##ObjcClass##Hash wxCocoa##ObjcClass::sm_cocoaHash; - - -/*------------------------------------------------------------------------- -The entire interface, including some boilerplate stuff --------------------------------------------------------------------------*/ -#define WX_DECLARE_OBJC_INTERFACE(ObjcClass) \ -WX_DECLARE_OBJC_INTERFACE_HASHMAP(ObjcClass) \ -public: \ - inline void Associate##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ - { \ - sm_cocoaHash.insert(wxCocoa##ObjcClass##Hash::value_type(cocoaObjcClass,this)); \ - } \ - inline void Disassociate##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ - { \ - sm_cocoaHash.erase(cocoaObjcClass); \ - } - -#define WX_IMPLEMENT_OBJC_INTERFACE(ObjcClass) \ -WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(ObjcClass) - -/*------------------------------------------------------------------------- -Stuff to be used by the wxWindows class (not the Cocoa interface) --------------------------------------------------------------------------*/ -#define WX_DECLARE_COCOA_OWNER(ObjcClass,ObjcBase,ObjcRoot) \ -public: \ - inline WX_##ObjcClass Get##ObjcClass() { return (WX_##ObjcClass)m_cocoa##ObjcRoot; } \ - inline const WX_##ObjcClass Get##ObjcClass() const { return (WX_##ObjcClass)m_cocoa##ObjcRoot; } \ -protected: \ - void Set##ObjcClass(WX_##ObjcClass cocoaObjcClass); - -#define WX_IMPLEMENT_COCOA_OWNER(wxClass,ObjcClass,ObjcBase,ObjcRoot) \ -void wxClass::Set##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ -{ \ - if(m_cocoa##ObjcRoot) \ - Disassociate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \ - Set##ObjcBase(cocoaObjcClass); \ - if(m_cocoa##ObjcRoot) \ - Associate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \ -} - #endif // __WX_COCOA_PRIVATE_POSER_H__