]> git.saurik.com Git - wxWidgets.git/commitdiff
Separated the Objective-C to C++ association code into the new header
authorDavid Elliott <dfe@tgwbd.org>
Sat, 19 Apr 2003 17:51:50 +0000 (17:51 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Sat, 19 Apr 2003 17:51:50 +0000 (17:51 +0000)
ObjcAssociate.h.  That leaves ObjcPose.h for its original purpose and
avoids including it from any header files.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20286 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

distrib/msw/tmake/filelist.txt
include/wx/cocoa/NSBox.h
include/wx/cocoa/NSButton.h
include/wx/cocoa/NSControl.h
include/wx/cocoa/NSMenu.h
include/wx/cocoa/NSPanel.h
include/wx/cocoa/NSTextField.h
include/wx/cocoa/NSView.h
include/wx/cocoa/NSWindow.h
include/wx/cocoa/ObjcAssociate.h [new file with mode: 0644]
include/wx/cocoa/ObjcPose.h

index 0e432db71cc76e75689abf05ff620b0c74317b64..e11f3d5da552714ea3fa64f3e3750bff4a008bd0 100644 (file)
@@ -1197,6 +1197,7 @@ NSPanel.h CocoaH
 NSTextField.h  CocoaH
 NSView.h       CocoaH
 NSWindow.h     CocoaH
+ObjcAssociate.h        CocoaH
 ObjcPose.h     CocoaH
 # wx implementations
 app.h  CocoaH
index a3425579d5383d31cebabbbbc9373f5d90de4cfb..e0271570b227ce955ea7161be85964809795c5da 100644 (file)
@@ -13,7 +13,7 @@
 #define __WX_COCOA_NSBOX_H__
 
 #include "wx/hashmap.h"
-#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/ObjcAssociate.h"
 
 WX_DECLARE_OBJC_HASHMAP(NSBox);
 class wxCocoaNSBox
index a6f9b2f57f7d41933a2ccca4c8597152fad70050..7e8f8add03912101abce3bdf4227c4d854eaf6b8 100644 (file)
@@ -13,7 +13,7 @@
 #define __WX_COCOA_NSBUTTON_H__
 
 #include "wx/hashmap.h"
-#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/ObjcAssociate.h"
 
 WX_DECLARE_OBJC_HASHMAP(NSButton);
 
index b821ca85bad3d4b3322f17264775399bb1490d6c..36233401c239186fdb848a1f703841b296d53919 100644 (file)
@@ -13,7 +13,7 @@
 #define __WX_COCOA_NSCONTROL_H__
 
 #include "wx/hashmap.h"
-#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/ObjcAssociate.h"
 
 WX_DECLARE_OBJC_HASHMAP(NSControl);
 class wxCocoaNSControl
index 2b43c336d27edf76554697055ee0376e72d78fc9..4e9043f61b2424d2275403bd5828df592e76a2d1 100644 (file)
@@ -13,7 +13,7 @@
 #define __WX_COCOA_NSMENU_H__
 
 #include "wx/hashmap.h"
-#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/ObjcAssociate.h"
 
 WX_DECLARE_OBJC_HASHMAP(NSMenu);
 
index 94940efc02bda239ddab1c7a9f830df6f32311ec..2626566d121f0f4feeebcd7f13e9b624754ff7be 100644 (file)
@@ -13,7 +13,7 @@
 #define __WX_COCOA_NSPANEL_H__
 
 #include "wx/hashmap.h"
-#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/ObjcAssociate.h"
 
 WX_DECLARE_OBJC_HASHMAP(NSPanel);
 
index 87e04ba8fd4b6cdaa6353f59a18d4f898a456d4d..10b82449408f898b16ebf02e9c6525c2ef56e0dd 100644 (file)
@@ -13,7 +13,7 @@
 #define __WX_COCOA_NSTEXTFIELD_H__
 
 #include "wx/hashmap.h"
-#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/ObjcAssociate.h"
 
 WX_DECLARE_OBJC_HASHMAP(NSTextField);
 class wxCocoaNSTextField
index db6eb26c38c73f9844e72c7b3326b55fea48ea64..c6e04939161cd17d77310ec7eacc9ee2f43e8e73 100644 (file)
@@ -13,7 +13,7 @@
 #define __WX_COCOA_NSVIEW_H__
 
 #include "wx/hashmap.h"
-#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/ObjcAssociate.h"
 
 typedef struct _NSRect NSRect;
 
index c8ca32b1ae690915abe9d7acfaa7d944dc151aa9..15a0ac79969bb6905f0be2c19033410f56d8ee55 100644 (file)
@@ -13,7 +13,7 @@
 #define __WX_COCOA_NSWINDOW_H__
 
 #include "wx/hashmap.h"
-#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/ObjcAssociate.h"
 
 WX_DECLARE_OBJC_HASHMAP(NSWindow);
 
diff --git a/include/wx/cocoa/ObjcAssociate.h b/include/wx/cocoa/ObjcAssociate.h
new file mode 100644 (file)
index 0000000..4a46014
--- /dev/null
@@ -0,0 +1,79 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/cocoa/ObjcAssociate.h
+// Purpose:     Associates an Objective-C class with a C++ class
+// Author:      David Elliott
+// Modified by: 
+// Created:     2002/12/03
+// RCS-ID:      $Id:
+// Copyright:   (c) 2002 David Elliott <dfe@cox.net>
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WX_COCOA_OBJC_ASSOCIATE_H__
+#define __WX_COCOA_OBJC_ASSOCIATE_H__
+
+/*-------------------------------------------------------------------------
+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_OBJC_ASSOCIATE_H__
+
index 72ee4903f18c8727d76ce898c41031fab08fb1c5..b5e53c0ab6c32dbc54e78f0504609bd6949e60b8 100644 (file)
@@ -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__