summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/ibcarbon/IBCarbonsupport.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-08-04 21:34:24 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-08-04 21:34:24 (GMT)
commit0c069924e5e2a1bc254355a592cd0bdac28d316f (patch)
treec59fcb3bd5ead8658d3256f56f3c212a96fe2c13 /Mac/Modules/ibcarbon/IBCarbonsupport.py
parent84a016417a9f334a15a5ee306069f696138b4a7c (diff)
downloadcpython-0c069924e5e2a1bc254355a592cd0bdac28d316f.zip
cpython-0c069924e5e2a1bc254355a592cd0bdac28d316f.tar.gz
cpython-0c069924e5e2a1bc254355a592cd0bdac28d316f.tar.bz2
Donovan Preston's interface to IBCarbon, allowing you to use Interface
Builder carbon NIB files from Python. As-is, I may need to twiddle a few things as he donated this long ago. Donovan is now one of the four people in the world who know how to drive bgen!
Diffstat (limited to 'Mac/Modules/ibcarbon/IBCarbonsupport.py')
-rw-r--r--Mac/Modules/ibcarbon/IBCarbonsupport.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/Mac/Modules/ibcarbon/IBCarbonsupport.py b/Mac/Modules/ibcarbon/IBCarbonsupport.py
new file mode 100644
index 0000000..9890c3a
--- /dev/null
+++ b/Mac/Modules/ibcarbon/IBCarbonsupport.py
@@ -0,0 +1,59 @@
+# IBCarbonsupport.py
+
+from macsupport import *
+
+CFStringRef = OpaqueByValueType('CFStringRef', 'CFStringRefObj')
+IBNibRef = OpaqueByValueType('IBNibRef', 'IBNibRefObj')
+#CFBundleRef = OpaqueByValueType('CFBundleRef')
+
+IBCarbonFunction = OSErrFunctionGenerator
+IBCarbonMethod = OSErrMethodGenerator
+
+includestuff = """
+#ifdef WITHOUT_FRAMEWORKS
+#include <IBCarbonRuntime.h>
+#else
+#include <Carbon/Carbon.h>
+#endif /* WITHOUT_FRAMEWORKS */
+#include "macglue.h"
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *);
+//#define CFStringRefObj_Convert _CFStringRefObj_Convert
+#endif
+
+//extern int CFBundleRefObj_Convert(PyObject *, CFBundleRef *); // need to wrap CFBundle
+
+"""
+
+initstuff = """
+
+"""
+
+module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff)
+
+class CFReleaserObject(GlobalObjectDefinition):
+ def outputFreeIt(self, name):
+ Output("CFRelease(%s);" % name)
+
+class CFNibDesc(GlobalObjectDefinition):
+ def outputFreeIt(self, name):
+ Output("DisposeNibReference(%s);" % name)
+
+#cfstringobject = CFReleaserObject("CFStringRef")
+#module.addobject(cfstringobject)
+#cfbundleobject = CFReleaserObject("CFBundleRef")
+#module.addobject(cfbundleobject)
+ibnibobject = CFNibDesc("IBNibRef", "IBNibRefObj")
+module.addobject(ibnibobject)
+
+functions = []
+methods = []
+
+execfile('IBCarbongen.py')
+
+for f in functions: module.add(f)
+for m in methods: ibnibobject.add(m)
+
+SetOutputFileName('_IBCarbon.c')
+module.generate()