Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit caf7505

Browse files
committed
Added WhichWindow function to obtain window object given WindowPtr (as
returned by event routines)
1 parent 2f21246 commit caf7505

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Mac/Modules/win/winsupport.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,28 @@ def outputFreeIt(self, itselfname):
9797
methods = []
9898
execfile(INPUTFILE)
9999

100+
# Add a manual routine for converting integer WindowPtr's (as returned by
101+
# various event routines) to a WindowObject.
102+
whichwin_body = """
103+
long ptr;
104+
105+
if ( !PyArg_ParseTuple(_args, "i", &ptr) )
106+
return NULL;
107+
return WinObj_WhichWindow((WindowPtr)ptr);
108+
"""
109+
110+
f = ManualGenerator("WhichWindow", whichwin_body)
111+
f.docstring = lambda : "Resolve an integer WindowPtr address to a Window object"
112+
113+
functions.append(f)
114+
100115
# add the populated lists to the generator groups
101116
# (in a different wordl the scan program would generate this)
102117
for f in functions: module.add(f)
103118
for f in methods: object.add(f)
104119

120+
121+
105122
# generate output (open the output file as late as possible)
106123
SetOutputFileName(OUTPUTFILE)
107124
module.generate()

0 commit comments

Comments
 (0)