-/* typedef WindowPtr WXHWND; */
-/* typedef Handle WXHANDLE; */
-/* typedef CIconHandle WXHICON; */
-/* typedef unsigned long WXHFONT; */
-/* typedef MenuHandle WXHMENU; */
-/* typedef unsigned long WXHPEN; */
-/* typedef unsigned long WXHBRUSH; */
-/* typedef unsigned long WXHPALETTE; */
-/* typedef CursHandle WXHCURSOR; */
-/* typedef RgnHandle WXHRGN; */
-/* typedef unsigned long WXHACCEL; */
-/* typedef unsigned long WXHINSTANCE; */
-/* typedef unsigned long WXHIMAGELIST; */
-/* typedef unsigned long WXHGLOBAL; */
-/* typedef GrafPtr WXHDC; */
-/* typedef unsigned int WXWPARAM; */
-/* typedef long WXLPARAM; */
-/* typedef void * WXRGNDATA; */
-/* typedef void * WXMSG; */
-/* typedef unsigned long WXHCONV; */
-/* typedef unsigned long WXHKEY; */
-/* typedef void * WXDRAWITEMSTRUCT; */
-/* typedef void * WXMEASUREITEMSTRUCT; */
-/* typedef void * WXLPCREATESTRUCT; */
-/* typedef int (*WXFARPROC)(); */
-
-/* typedef WindowPtr WXWindow; */
-/* typedef ControlHandle WXWidget; */
-
-#endif
-
-#ifdef __WXCOCOA__
+/*
+ * core frameworks
+ */
+
+typedef const void * CFTypeRef;
+
+typedef const struct __CFString * CFStringRef;
+typedef struct __CFString * CFMutableStringRef;
+
+typedef struct __CFRunLoopSource * CFRunLoopSourceRef;
+
+#define DECLARE_WXMAC_OPAQUE_CGREF( name ) typedef struct name* name##Ref;
+
+DECLARE_WXMAC_OPAQUE_CGREF( CGColor )
+DECLARE_WXMAC_OPAQUE_CGREF( CGImage )
+DECLARE_WXMAC_OPAQUE_CGREF( CGContext )
+
+typedef CGColorRef WXCOLORREF;
+typedef CGImageRef WXCGIMAGEREF;
+typedef CGContextRef WXHDC;
+
+/*
+ * carbon
+ */
+
+typedef const struct __HIShape * HIShapeRef;
+typedef struct __HIShape * HIMutableShapeRef;
+
+#define DECLARE_WXMAC_OPAQUE_REF( name ) typedef struct Opaque##name* name;
+
+DECLARE_WXMAC_OPAQUE_REF( PasteboardRef )
+DECLARE_WXMAC_OPAQUE_REF( IconRef )
+
+typedef IconRef WXHICON ;
+typedef HIShapeRef WXHRGN;
+
+#endif
+
+#if defined( __WXCOCOA__ ) || defined(__WXMAC__)