summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/win
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-08-17 14:28:27 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-08-17 14:28:27 (GMT)
commitcaf7505edc872e1a6dc25b70176227b1d7754e93 (patch)
tree2b7751bb1fe4b67866e2fd23ea2d24e1d01383b2 /Mac/Modules/win
parent2f21246c9643e820a3a9a161d6913771370334fa (diff)
downloadcpython-caf7505edc872e1a6dc25b70176227b1d7754e93.zip
cpython-caf7505edc872e1a6dc25b70176227b1d7754e93.tar.gz
cpython-caf7505edc872e1a6dc25b70176227b1d7754e93.tar.bz2
Added WhichWindow function to obtain window object given WindowPtr (as
returned by event routines)
Diffstat (limited to 'Mac/Modules/win')
-rw-r--r--Mac/Modules/win/winsupport.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index 6f085f7..1f07828 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -97,11 +97,28 @@ functions = []
methods = []
execfile(INPUTFILE)
+# Add a manual routine for converting integer WindowPtr's (as returned by
+# various event routines) to a WindowObject.
+whichwin_body = """
+long ptr;
+
+if ( !PyArg_ParseTuple(_args, "i", &ptr) )
+ return NULL;
+return WinObj_WhichWindow((WindowPtr)ptr);
+"""
+
+f = ManualGenerator("WhichWindow", whichwin_body)
+f.docstring = lambda : "Resolve an integer WindowPtr address to a Window object"
+
+functions.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)
for f in methods: object.add(f)
+
+
# generate output (open the output file as late as possible)
SetOutputFileName(OUTPUTFILE)
module.generate()