summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/te/tesupport.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1999-12-23 14:32:06 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1999-12-23 14:32:06 (GMT)
commita1a0fef2ea9ece5b16f9e6c37800778c64844e69 (patch)
tree6af31ec1186b5ebe0aed89f5c4159445fff61381 /Mac/Modules/te/tesupport.py
parent7b912120caa517ef4fa65eefc26e63f3dea8009a (diff)
downloadcpython-a1a0fef2ea9ece5b16f9e6c37800778c64844e69.zip
cpython-a1a0fef2ea9ece5b16f9e6c37800778c64844e69.tar.gz
cpython-a1a0fef2ea9ece5b16f9e6c37800778c64844e69.tar.bz2
Unified handle-conversion scheme to
handle = Ctl.as_Resource(ctl) ctl = Ctl.as_Control(handle) and similarly for List, Menu, TE. The old handle.as_Control() methods are still there for backward compatability.
Diffstat (limited to 'Mac/Modules/te/tesupport.py')
-rw-r--r--Mac/Modules/te/tesupport.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Mac/Modules/te/tesupport.py b/Mac/Modules/te/tesupport.py
index 7802ae9..b078649 100644
--- a/Mac/Modules/te/tesupport.py
+++ b/Mac/Modules/te/tesupport.py
@@ -23,7 +23,7 @@ from macsupport import *
# Create the type objects
TEHandle = OpaqueByValueType("TEHandle", "TEObj")
CharsHandle = OpaqueByValueType("CharsHandle", "ResObj")
-##Handle = OpaqueByValueType("Handle", "ResObj")
+Handle = OpaqueByValueType("Handle", "ResObj")
StScrpHandle = OpaqueByValueType("StScrpHandle", "ResObj")
TEStyleHandle = OpaqueByValueType("TEStyleHandle", "ResObj")
RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
@@ -34,6 +34,9 @@ TextStyle_ptr = TextStyle
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#define as_TE(h) ((TEHandle)h)
+#define as_Resource(teh) ((Handle)teh)
+
/* Exported by Qdmodule.c: */
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
@@ -143,6 +146,12 @@ functions = []
methods = []
execfile(INPUTFILE)
+# Converter from/to handle
+f = Function(TEHandle, 'as_TE', (Handle, 'h', InMode))
+functions.append(f)
+f = Method(Handle, 'as_Resource', (TEHandle, 'teh', InMode))
+methods.append(f)
+
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for f in functions: module.add(f)