]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added WhichWindow function to obtain window object given WindowPtr (as
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 17 Aug 1995 14:28:27 +0000 (14:28 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 17 Aug 1995 14:28:27 +0000 (14:28 +0000)
returned by event routines)

Mac/Modules/win/winsupport.py

index 6f085f74b41f3d6be46144e821e5a845f11d9dc0..1f0782862a00801efa61ae110b8ccf223158792b 100644 (file)
@@ -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()