_Winmodule.c revision 033b79c483566661eda1a87a11f19619d1ff4046
1
2/* ========================== Module _Win =========================== */
3
4#include "Python.h"
5
6
7
8#ifdef _WIN32
9#include "pywintoolbox.h"
10#else
11#include "macglue.h"
12#include "pymactoolbox.h"
13#endif
14
15/* Macro to test whether a weak-loaded CFM function exists */
16#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
17    	PyErr_SetString(PyExc_NotImplementedError, \
18    	"Not available in this shared library/OS version"); \
19    	return NULL; \
20    }} while(0)
21
22
23#ifdef WITHOUT_FRAMEWORKS
24#include <Windows.h>
25#else
26#include <Carbon/Carbon.h>
27#endif
28
29#ifdef USE_TOOLBOX_OBJECT_GLUE
30extern PyObject *_WinObj_New(WindowRef);
31extern PyObject *_WinObj_WhichWindow(WindowRef);
32extern int _WinObj_Convert(PyObject *, WindowRef *);
33
34#define WinObj_New _WinObj_New
35#define WinObj_WhichWindow _WinObj_WhichWindow
36#define WinObj_Convert _WinObj_Convert
37#endif
38
39#if !ACCESSOR_CALLS_ARE_FUNCTIONS  && UNIVERSAL_INTERFACES_VERSION < 0x340
40/* Carbon calls that we emulate in classic mode */
41#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
42#define GetWindowFromPort(port) ((WindowRef)(port))
43#define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect)
44#endif
45#if !ACCESSOR_CALLS_ARE_FUNCTIONS
46#define IsPointerValid(p) (((long)p&3) == 0)
47#endif
48#if ACCESSOR_CALLS_ARE_FUNCTIONS
49/* Classic calls that we emulate in carbon mode */
50#define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
51#define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
52#define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
53#endif
54
55/* Function to dispose a window, with a "normal" calling sequence */
56static void
57PyMac_AutoDisposeWindow(WindowPtr w)
58{
59	DisposeWindow(w);
60}
61
62static PyObject *Win_Error;
63
64/* ----------------------- Object type Window ----------------------- */
65
66PyTypeObject Window_Type;
67
68#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
69
70typedef struct WindowObject {
71	PyObject_HEAD
72	WindowPtr ob_itself;
73	void (*ob_freeit)(WindowPtr ptr);
74} WindowObject;
75
76PyObject *WinObj_New(WindowPtr itself)
77{
78	WindowObject *it;
79	if (itself == NULL) return PyMac_Error(resNotFound);
80	it = PyObject_NEW(WindowObject, &Window_Type);
81	if (it == NULL) return NULL;
82	it->ob_itself = itself;
83	it->ob_freeit = NULL;
84	if (GetWRefCon(itself) == 0)
85	{
86		SetWRefCon(itself, (long)it);
87		it->ob_freeit = PyMac_AutoDisposeWindow;
88	}
89	return (PyObject *)it;
90}
91int WinObj_Convert(PyObject *v, WindowPtr *p_itself)
92{
93
94	if (v == Py_None) { *p_itself = NULL; return 1; }
95	if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
96
97	{
98		DialogRef dlg;
99		if (DlgObj_Convert(v, &dlg) && dlg) {
100			*p_itself = GetDialogWindow(dlg);
101			return 1;
102		}
103		PyErr_Clear();
104	}
105	if (!WinObj_Check(v))
106	{
107		PyErr_SetString(PyExc_TypeError, "Window required");
108		return 0;
109	}
110	*p_itself = ((WindowObject *)v)->ob_itself;
111	return 1;
112}
113
114static void WinObj_dealloc(WindowObject *self)
115{
116	if (self->ob_freeit && self->ob_itself)
117	{
118		SetWRefCon(self->ob_itself, 0);
119		self->ob_freeit(self->ob_itself);
120	}
121	self->ob_itself = NULL;
122	self->ob_freeit = NULL;
123	PyObject_Del(self);
124}
125
126static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args)
127{
128	PyObject *_res = NULL;
129	OSStatus _err;
130	UInt32 outCount;
131#ifndef GetWindowOwnerCount
132	PyMac_PRECHECK(GetWindowOwnerCount);
133#endif
134	if (!PyArg_ParseTuple(_args, ""))
135		return NULL;
136	_err = GetWindowOwnerCount(_self->ob_itself,
137	                           &outCount);
138	if (_err != noErr) return PyMac_Error(_err);
139	_res = Py_BuildValue("l",
140	                     outCount);
141	return _res;
142}
143
144static PyObject *WinObj_CloneWindow(WindowObject *_self, PyObject *_args)
145{
146	PyObject *_res = NULL;
147	OSStatus _err;
148#ifndef CloneWindow
149	PyMac_PRECHECK(CloneWindow);
150#endif
151	if (!PyArg_ParseTuple(_args, ""))
152		return NULL;
153	_err = CloneWindow(_self->ob_itself);
154	if (_err != noErr) return PyMac_Error(_err);
155	Py_INCREF(Py_None);
156	_res = Py_None;
157	return _res;
158}
159
160#if !TARGET_API_MAC_OS8
161
162static PyObject *WinObj_GetWindowRetainCount(WindowObject *_self, PyObject *_args)
163{
164	PyObject *_res = NULL;
165	ItemCount _rv;
166#ifndef GetWindowRetainCount
167	PyMac_PRECHECK(GetWindowRetainCount);
168#endif
169	if (!PyArg_ParseTuple(_args, ""))
170		return NULL;
171	_rv = GetWindowRetainCount(_self->ob_itself);
172	_res = Py_BuildValue("l",
173	                     _rv);
174	return _res;
175}
176#endif
177
178#if !TARGET_API_MAC_OS8
179
180static PyObject *WinObj_RetainWindow(WindowObject *_self, PyObject *_args)
181{
182	PyObject *_res = NULL;
183	OSStatus _err;
184#ifndef RetainWindow
185	PyMac_PRECHECK(RetainWindow);
186#endif
187	if (!PyArg_ParseTuple(_args, ""))
188		return NULL;
189	_err = RetainWindow(_self->ob_itself);
190	if (_err != noErr) return PyMac_Error(_err);
191	Py_INCREF(Py_None);
192	_res = Py_None;
193	return _res;
194}
195#endif
196
197#if !TARGET_API_MAC_OS8
198
199static PyObject *WinObj_ReleaseWindow(WindowObject *_self, PyObject *_args)
200{
201	PyObject *_res = NULL;
202	OSStatus _err;
203#ifndef ReleaseWindow
204	PyMac_PRECHECK(ReleaseWindow);
205#endif
206	if (!PyArg_ParseTuple(_args, ""))
207		return NULL;
208	_err = ReleaseWindow(_self->ob_itself);
209	if (_err != noErr) return PyMac_Error(_err);
210	Py_INCREF(Py_None);
211	_res = Py_None;
212	return _res;
213}
214#endif
215
216#if !TARGET_API_MAC_OS8
217
218static PyObject *WinObj_ReshapeCustomWindow(WindowObject *_self, PyObject *_args)
219{
220	PyObject *_res = NULL;
221	OSStatus _err;
222#ifndef ReshapeCustomWindow
223	PyMac_PRECHECK(ReshapeCustomWindow);
224#endif
225	if (!PyArg_ParseTuple(_args, ""))
226		return NULL;
227	_err = ReshapeCustomWindow(_self->ob_itself);
228	if (_err != noErr) return PyMac_Error(_err);
229	Py_INCREF(Py_None);
230	_res = Py_None;
231	return _res;
232}
233#endif
234
235static PyObject *WinObj_GetWindowWidgetHilite(WindowObject *_self, PyObject *_args)
236{
237	PyObject *_res = NULL;
238	OSStatus _err;
239	WindowDefPartCode outHilite;
240#ifndef GetWindowWidgetHilite
241	PyMac_PRECHECK(GetWindowWidgetHilite);
242#endif
243	if (!PyArg_ParseTuple(_args, ""))
244		return NULL;
245	_err = GetWindowWidgetHilite(_self->ob_itself,
246	                             &outHilite);
247	if (_err != noErr) return PyMac_Error(_err);
248	_res = Py_BuildValue("h",
249	                     outHilite);
250	return _res;
251}
252
253static PyObject *WinObj_GetWindowClass(WindowObject *_self, PyObject *_args)
254{
255	PyObject *_res = NULL;
256	OSStatus _err;
257	WindowClass outClass;
258#ifndef GetWindowClass
259	PyMac_PRECHECK(GetWindowClass);
260#endif
261	if (!PyArg_ParseTuple(_args, ""))
262		return NULL;
263	_err = GetWindowClass(_self->ob_itself,
264	                      &outClass);
265	if (_err != noErr) return PyMac_Error(_err);
266	_res = Py_BuildValue("l",
267	                     outClass);
268	return _res;
269}
270
271static PyObject *WinObj_GetWindowAttributes(WindowObject *_self, PyObject *_args)
272{
273	PyObject *_res = NULL;
274	OSStatus _err;
275	WindowAttributes outAttributes;
276#ifndef GetWindowAttributes
277	PyMac_PRECHECK(GetWindowAttributes);
278#endif
279	if (!PyArg_ParseTuple(_args, ""))
280		return NULL;
281	_err = GetWindowAttributes(_self->ob_itself,
282	                           &outAttributes);
283	if (_err != noErr) return PyMac_Error(_err);
284	_res = Py_BuildValue("l",
285	                     outAttributes);
286	return _res;
287}
288
289#if !TARGET_API_MAC_OS8
290
291static PyObject *WinObj_ChangeWindowAttributes(WindowObject *_self, PyObject *_args)
292{
293	PyObject *_res = NULL;
294	OSStatus _err;
295	WindowAttributes setTheseAttributes;
296	WindowAttributes clearTheseAttributes;
297#ifndef ChangeWindowAttributes
298	PyMac_PRECHECK(ChangeWindowAttributes);
299#endif
300	if (!PyArg_ParseTuple(_args, "ll",
301	                      &setTheseAttributes,
302	                      &clearTheseAttributes))
303		return NULL;
304	_err = ChangeWindowAttributes(_self->ob_itself,
305	                              setTheseAttributes,
306	                              clearTheseAttributes);
307	if (_err != noErr) return PyMac_Error(_err);
308	Py_INCREF(Py_None);
309	_res = Py_None;
310	return _res;
311}
312#endif
313
314#if !TARGET_API_MAC_OS8
315
316static PyObject *WinObj_SetWindowClass(WindowObject *_self, PyObject *_args)
317{
318	PyObject *_res = NULL;
319	OSStatus _err;
320	WindowClass inWindowClass;
321#ifndef SetWindowClass
322	PyMac_PRECHECK(SetWindowClass);
323#endif
324	if (!PyArg_ParseTuple(_args, "l",
325	                      &inWindowClass))
326		return NULL;
327	_err = SetWindowClass(_self->ob_itself,
328	                      inWindowClass);
329	if (_err != noErr) return PyMac_Error(_err);
330	Py_INCREF(Py_None);
331	_res = Py_None;
332	return _res;
333}
334#endif
335
336#if !TARGET_API_MAC_OS8
337
338static PyObject *WinObj_SetWindowModality(WindowObject *_self, PyObject *_args)
339{
340	PyObject *_res = NULL;
341	OSStatus _err;
342	WindowModality inModalKind;
343	WindowPtr inUnavailableWindow;
344#ifndef SetWindowModality
345	PyMac_PRECHECK(SetWindowModality);
346#endif
347	if (!PyArg_ParseTuple(_args, "lO&",
348	                      &inModalKind,
349	                      WinObj_Convert, &inUnavailableWindow))
350		return NULL;
351	_err = SetWindowModality(_self->ob_itself,
352	                         inModalKind,
353	                         inUnavailableWindow);
354	if (_err != noErr) return PyMac_Error(_err);
355	Py_INCREF(Py_None);
356	_res = Py_None;
357	return _res;
358}
359#endif
360
361#if !TARGET_API_MAC_OS8
362
363static PyObject *WinObj_GetWindowModality(WindowObject *_self, PyObject *_args)
364{
365	PyObject *_res = NULL;
366	OSStatus _err;
367	WindowModality outModalKind;
368	WindowPtr outUnavailableWindow;
369#ifndef GetWindowModality
370	PyMac_PRECHECK(GetWindowModality);
371#endif
372	if (!PyArg_ParseTuple(_args, ""))
373		return NULL;
374	_err = GetWindowModality(_self->ob_itself,
375	                         &outModalKind,
376	                         &outUnavailableWindow);
377	if (_err != noErr) return PyMac_Error(_err);
378	_res = Py_BuildValue("lO&",
379	                     outModalKind,
380	                     WinObj_WhichWindow, outUnavailableWindow);
381	return _res;
382}
383#endif
384
385#if !TARGET_API_MAC_CARBON
386
387static PyObject *WinObj_SetWinColor(WindowObject *_self, PyObject *_args)
388{
389	PyObject *_res = NULL;
390	WCTabHandle newColorTable;
391#ifndef SetWinColor
392	PyMac_PRECHECK(SetWinColor);
393#endif
394	if (!PyArg_ParseTuple(_args, "O&",
395	                      ResObj_Convert, &newColorTable))
396		return NULL;
397	SetWinColor(_self->ob_itself,
398	            newColorTable);
399	Py_INCREF(Py_None);
400	_res = Py_None;
401	return _res;
402}
403#endif
404
405static PyObject *WinObj_SetWindowContentColor(WindowObject *_self, PyObject *_args)
406{
407	PyObject *_res = NULL;
408	OSStatus _err;
409	RGBColor color;
410#ifndef SetWindowContentColor
411	PyMac_PRECHECK(SetWindowContentColor);
412#endif
413	if (!PyArg_ParseTuple(_args, "O&",
414	                      QdRGB_Convert, &color))
415		return NULL;
416	_err = SetWindowContentColor(_self->ob_itself,
417	                             &color);
418	if (_err != noErr) return PyMac_Error(_err);
419	Py_INCREF(Py_None);
420	_res = Py_None;
421	return _res;
422}
423
424static PyObject *WinObj_GetWindowContentColor(WindowObject *_self, PyObject *_args)
425{
426	PyObject *_res = NULL;
427	OSStatus _err;
428	RGBColor color;
429#ifndef GetWindowContentColor
430	PyMac_PRECHECK(GetWindowContentColor);
431#endif
432	if (!PyArg_ParseTuple(_args, ""))
433		return NULL;
434	_err = GetWindowContentColor(_self->ob_itself,
435	                             &color);
436	if (_err != noErr) return PyMac_Error(_err);
437	_res = Py_BuildValue("O&",
438	                     QdRGB_New, &color);
439	return _res;
440}
441
442static PyObject *WinObj_GetWindowContentPattern(WindowObject *_self, PyObject *_args)
443{
444	PyObject *_res = NULL;
445	OSStatus _err;
446	PixPatHandle outPixPat;
447#ifndef GetWindowContentPattern
448	PyMac_PRECHECK(GetWindowContentPattern);
449#endif
450	if (!PyArg_ParseTuple(_args, "O&",
451	                      ResObj_Convert, &outPixPat))
452		return NULL;
453	_err = GetWindowContentPattern(_self->ob_itself,
454	                               outPixPat);
455	if (_err != noErr) return PyMac_Error(_err);
456	Py_INCREF(Py_None);
457	_res = Py_None;
458	return _res;
459}
460
461static PyObject *WinObj_SetWindowContentPattern(WindowObject *_self, PyObject *_args)
462{
463	PyObject *_res = NULL;
464	OSStatus _err;
465	PixPatHandle pixPat;
466#ifndef SetWindowContentPattern
467	PyMac_PRECHECK(SetWindowContentPattern);
468#endif
469	if (!PyArg_ParseTuple(_args, "O&",
470	                      ResObj_Convert, &pixPat))
471		return NULL;
472	_err = SetWindowContentPattern(_self->ob_itself,
473	                               pixPat);
474	if (_err != noErr) return PyMac_Error(_err);
475	Py_INCREF(Py_None);
476	_res = Py_None;
477	return _res;
478}
479
480#if !TARGET_API_MAC_OS8
481
482static PyObject *WinObj_ScrollWindowRect(WindowObject *_self, PyObject *_args)
483{
484	PyObject *_res = NULL;
485	OSStatus _err;
486	Rect inScrollRect;
487	SInt16 inHPixels;
488	SInt16 inVPixels;
489	ScrollWindowOptions inOptions;
490	RgnHandle outExposedRgn;
491#ifndef ScrollWindowRect
492	PyMac_PRECHECK(ScrollWindowRect);
493#endif
494	if (!PyArg_ParseTuple(_args, "O&hhlO&",
495	                      PyMac_GetRect, &inScrollRect,
496	                      &inHPixels,
497	                      &inVPixels,
498	                      &inOptions,
499	                      ResObj_Convert, &outExposedRgn))
500		return NULL;
501	_err = ScrollWindowRect(_self->ob_itself,
502	                        &inScrollRect,
503	                        inHPixels,
504	                        inVPixels,
505	                        inOptions,
506	                        outExposedRgn);
507	if (_err != noErr) return PyMac_Error(_err);
508	Py_INCREF(Py_None);
509	_res = Py_None;
510	return _res;
511}
512#endif
513
514#if !TARGET_API_MAC_OS8
515
516static PyObject *WinObj_ScrollWindowRegion(WindowObject *_self, PyObject *_args)
517{
518	PyObject *_res = NULL;
519	OSStatus _err;
520	RgnHandle inScrollRgn;
521	SInt16 inHPixels;
522	SInt16 inVPixels;
523	ScrollWindowOptions inOptions;
524	RgnHandle outExposedRgn;
525#ifndef ScrollWindowRegion
526	PyMac_PRECHECK(ScrollWindowRegion);
527#endif
528	if (!PyArg_ParseTuple(_args, "O&hhlO&",
529	                      ResObj_Convert, &inScrollRgn,
530	                      &inHPixels,
531	                      &inVPixels,
532	                      &inOptions,
533	                      ResObj_Convert, &outExposedRgn))
534		return NULL;
535	_err = ScrollWindowRegion(_self->ob_itself,
536	                          inScrollRgn,
537	                          inHPixels,
538	                          inVPixels,
539	                          inOptions,
540	                          outExposedRgn);
541	if (_err != noErr) return PyMac_Error(_err);
542	Py_INCREF(Py_None);
543	_res = Py_None;
544	return _res;
545}
546#endif
547
548static PyObject *WinObj_ClipAbove(WindowObject *_self, PyObject *_args)
549{
550	PyObject *_res = NULL;
551#ifndef ClipAbove
552	PyMac_PRECHECK(ClipAbove);
553#endif
554	if (!PyArg_ParseTuple(_args, ""))
555		return NULL;
556	ClipAbove(_self->ob_itself);
557	Py_INCREF(Py_None);
558	_res = Py_None;
559	return _res;
560}
561
562#if !TARGET_API_MAC_CARBON
563
564static PyObject *WinObj_SaveOld(WindowObject *_self, PyObject *_args)
565{
566	PyObject *_res = NULL;
567#ifndef SaveOld
568	PyMac_PRECHECK(SaveOld);
569#endif
570	if (!PyArg_ParseTuple(_args, ""))
571		return NULL;
572	SaveOld(_self->ob_itself);
573	Py_INCREF(Py_None);
574	_res = Py_None;
575	return _res;
576}
577#endif
578
579#if !TARGET_API_MAC_CARBON
580
581static PyObject *WinObj_DrawNew(WindowObject *_self, PyObject *_args)
582{
583	PyObject *_res = NULL;
584	Boolean update;
585#ifndef DrawNew
586	PyMac_PRECHECK(DrawNew);
587#endif
588	if (!PyArg_ParseTuple(_args, "b",
589	                      &update))
590		return NULL;
591	DrawNew(_self->ob_itself,
592	        update);
593	Py_INCREF(Py_None);
594	_res = Py_None;
595	return _res;
596}
597#endif
598
599static PyObject *WinObj_PaintOne(WindowObject *_self, PyObject *_args)
600{
601	PyObject *_res = NULL;
602	RgnHandle clobberedRgn;
603#ifndef PaintOne
604	PyMac_PRECHECK(PaintOne);
605#endif
606	if (!PyArg_ParseTuple(_args, "O&",
607	                      ResObj_Convert, &clobberedRgn))
608		return NULL;
609	PaintOne(_self->ob_itself,
610	         clobberedRgn);
611	Py_INCREF(Py_None);
612	_res = Py_None;
613	return _res;
614}
615
616static PyObject *WinObj_PaintBehind(WindowObject *_self, PyObject *_args)
617{
618	PyObject *_res = NULL;
619	RgnHandle clobberedRgn;
620#ifndef PaintBehind
621	PyMac_PRECHECK(PaintBehind);
622#endif
623	if (!PyArg_ParseTuple(_args, "O&",
624	                      ResObj_Convert, &clobberedRgn))
625		return NULL;
626	PaintBehind(_self->ob_itself,
627	            clobberedRgn);
628	Py_INCREF(Py_None);
629	_res = Py_None;
630	return _res;
631}
632
633static PyObject *WinObj_CalcVis(WindowObject *_self, PyObject *_args)
634{
635	PyObject *_res = NULL;
636#ifndef CalcVis
637	PyMac_PRECHECK(CalcVis);
638#endif
639	if (!PyArg_ParseTuple(_args, ""))
640		return NULL;
641	CalcVis(_self->ob_itself);
642	Py_INCREF(Py_None);
643	_res = Py_None;
644	return _res;
645}
646
647static PyObject *WinObj_CalcVisBehind(WindowObject *_self, PyObject *_args)
648{
649	PyObject *_res = NULL;
650	RgnHandle clobberedRgn;
651#ifndef CalcVisBehind
652	PyMac_PRECHECK(CalcVisBehind);
653#endif
654	if (!PyArg_ParseTuple(_args, "O&",
655	                      ResObj_Convert, &clobberedRgn))
656		return NULL;
657	CalcVisBehind(_self->ob_itself,
658	              clobberedRgn);
659	Py_INCREF(Py_None);
660	_res = Py_None;
661	return _res;
662}
663
664static PyObject *WinObj_BringToFront(WindowObject *_self, PyObject *_args)
665{
666	PyObject *_res = NULL;
667#ifndef BringToFront
668	PyMac_PRECHECK(BringToFront);
669#endif
670	if (!PyArg_ParseTuple(_args, ""))
671		return NULL;
672	BringToFront(_self->ob_itself);
673	Py_INCREF(Py_None);
674	_res = Py_None;
675	return _res;
676}
677
678static PyObject *WinObj_SendBehind(WindowObject *_self, PyObject *_args)
679{
680	PyObject *_res = NULL;
681	WindowPtr behindWindow;
682#ifndef SendBehind
683	PyMac_PRECHECK(SendBehind);
684#endif
685	if (!PyArg_ParseTuple(_args, "O&",
686	                      WinObj_Convert, &behindWindow))
687		return NULL;
688	SendBehind(_self->ob_itself,
689	           behindWindow);
690	Py_INCREF(Py_None);
691	_res = Py_None;
692	return _res;
693}
694
695static PyObject *WinObj_SelectWindow(WindowObject *_self, PyObject *_args)
696{
697	PyObject *_res = NULL;
698#ifndef SelectWindow
699	PyMac_PRECHECK(SelectWindow);
700#endif
701	if (!PyArg_ParseTuple(_args, ""))
702		return NULL;
703	SelectWindow(_self->ob_itself);
704	Py_INCREF(Py_None);
705	_res = Py_None;
706	return _res;
707}
708
709#if !TARGET_API_MAC_OS8
710
711static PyObject *WinObj_GetNextWindowOfClass(WindowObject *_self, PyObject *_args)
712{
713	PyObject *_res = NULL;
714	WindowPtr _rv;
715	WindowClass inWindowClass;
716	Boolean mustBeVisible;
717#ifndef GetNextWindowOfClass
718	PyMac_PRECHECK(GetNextWindowOfClass);
719#endif
720	if (!PyArg_ParseTuple(_args, "lb",
721	                      &inWindowClass,
722	                      &mustBeVisible))
723		return NULL;
724	_rv = GetNextWindowOfClass(_self->ob_itself,
725	                           inWindowClass,
726	                           mustBeVisible);
727	_res = Py_BuildValue("O&",
728	                     WinObj_New, _rv);
729	return _res;
730}
731#endif
732
733#if !TARGET_API_MAC_OS8
734
735static PyObject *WinObj_SetWindowAlternateTitle(WindowObject *_self, PyObject *_args)
736{
737	PyObject *_res = NULL;
738	OSStatus _err;
739	CFStringRef inTitle;
740#ifndef SetWindowAlternateTitle
741	PyMac_PRECHECK(SetWindowAlternateTitle);
742#endif
743	if (!PyArg_ParseTuple(_args, "O&",
744	                      CFStringRefObj_Convert, &inTitle))
745		return NULL;
746	_err = SetWindowAlternateTitle(_self->ob_itself,
747	                               inTitle);
748	if (_err != noErr) return PyMac_Error(_err);
749	Py_INCREF(Py_None);
750	_res = Py_None;
751	return _res;
752}
753#endif
754
755#if !TARGET_API_MAC_OS8
756
757static PyObject *WinObj_CopyWindowAlternateTitle(WindowObject *_self, PyObject *_args)
758{
759	PyObject *_res = NULL;
760	OSStatus _err;
761	CFStringRef outTitle;
762#ifndef CopyWindowAlternateTitle
763	PyMac_PRECHECK(CopyWindowAlternateTitle);
764#endif
765	if (!PyArg_ParseTuple(_args, ""))
766		return NULL;
767	_err = CopyWindowAlternateTitle(_self->ob_itself,
768	                                &outTitle);
769	if (_err != noErr) return PyMac_Error(_err);
770	_res = Py_BuildValue("O&",
771	                     CFStringRefObj_New, outTitle);
772	return _res;
773}
774#endif
775
776#if !TARGET_API_MAC_CARBON
777
778static PyObject *WinObj_IsValidWindowPtr(WindowObject *_self, PyObject *_args)
779{
780	PyObject *_res = NULL;
781	Boolean _rv;
782#ifndef IsValidWindowPtr
783	PyMac_PRECHECK(IsValidWindowPtr);
784#endif
785	if (!PyArg_ParseTuple(_args, ""))
786		return NULL;
787	_rv = IsValidWindowPtr(_self->ob_itself);
788	_res = Py_BuildValue("b",
789	                     _rv);
790	return _res;
791}
792#endif
793
794static PyObject *WinObj_HiliteWindow(WindowObject *_self, PyObject *_args)
795{
796	PyObject *_res = NULL;
797	Boolean fHilite;
798#ifndef HiliteWindow
799	PyMac_PRECHECK(HiliteWindow);
800#endif
801	if (!PyArg_ParseTuple(_args, "b",
802	                      &fHilite))
803		return NULL;
804	HiliteWindow(_self->ob_itself,
805	             fHilite);
806	Py_INCREF(Py_None);
807	_res = Py_None;
808	return _res;
809}
810
811static PyObject *WinObj_SetWRefCon(WindowObject *_self, PyObject *_args)
812{
813	PyObject *_res = NULL;
814	long data;
815#ifndef SetWRefCon
816	PyMac_PRECHECK(SetWRefCon);
817#endif
818	if (!PyArg_ParseTuple(_args, "l",
819	                      &data))
820		return NULL;
821	SetWRefCon(_self->ob_itself,
822	           data);
823	Py_INCREF(Py_None);
824	_res = Py_None;
825	return _res;
826}
827
828static PyObject *WinObj_GetWRefCon(WindowObject *_self, PyObject *_args)
829{
830	PyObject *_res = NULL;
831	long _rv;
832#ifndef GetWRefCon
833	PyMac_PRECHECK(GetWRefCon);
834#endif
835	if (!PyArg_ParseTuple(_args, ""))
836		return NULL;
837	_rv = GetWRefCon(_self->ob_itself);
838	_res = Py_BuildValue("l",
839	                     _rv);
840	return _res;
841}
842
843static PyObject *WinObj_SetWindowPic(WindowObject *_self, PyObject *_args)
844{
845	PyObject *_res = NULL;
846	PicHandle pic;
847#ifndef SetWindowPic
848	PyMac_PRECHECK(SetWindowPic);
849#endif
850	if (!PyArg_ParseTuple(_args, "O&",
851	                      ResObj_Convert, &pic))
852		return NULL;
853	SetWindowPic(_self->ob_itself,
854	             pic);
855	Py_INCREF(Py_None);
856	_res = Py_None;
857	return _res;
858}
859
860static PyObject *WinObj_GetWindowPic(WindowObject *_self, PyObject *_args)
861{
862	PyObject *_res = NULL;
863	PicHandle _rv;
864#ifndef GetWindowPic
865	PyMac_PRECHECK(GetWindowPic);
866#endif
867	if (!PyArg_ParseTuple(_args, ""))
868		return NULL;
869	_rv = GetWindowPic(_self->ob_itself);
870	_res = Py_BuildValue("O&",
871	                     ResObj_New, _rv);
872	return _res;
873}
874
875static PyObject *WinObj_GetWVariant(WindowObject *_self, PyObject *_args)
876{
877	PyObject *_res = NULL;
878	short _rv;
879#ifndef GetWVariant
880	PyMac_PRECHECK(GetWVariant);
881#endif
882	if (!PyArg_ParseTuple(_args, ""))
883		return NULL;
884	_rv = GetWVariant(_self->ob_itself);
885	_res = Py_BuildValue("h",
886	                     _rv);
887	return _res;
888}
889
890static PyObject *WinObj_GetWindowFeatures(WindowObject *_self, PyObject *_args)
891{
892	PyObject *_res = NULL;
893	OSStatus _err;
894	UInt32 outFeatures;
895#ifndef GetWindowFeatures
896	PyMac_PRECHECK(GetWindowFeatures);
897#endif
898	if (!PyArg_ParseTuple(_args, ""))
899		return NULL;
900	_err = GetWindowFeatures(_self->ob_itself,
901	                         &outFeatures);
902	if (_err != noErr) return PyMac_Error(_err);
903	_res = Py_BuildValue("l",
904	                     outFeatures);
905	return _res;
906}
907
908static PyObject *WinObj_GetWindowRegion(WindowObject *_self, PyObject *_args)
909{
910	PyObject *_res = NULL;
911	OSStatus _err;
912	WindowRegionCode inRegionCode;
913	RgnHandle ioWinRgn;
914#ifndef GetWindowRegion
915	PyMac_PRECHECK(GetWindowRegion);
916#endif
917	if (!PyArg_ParseTuple(_args, "HO&",
918	                      &inRegionCode,
919	                      ResObj_Convert, &ioWinRgn))
920		return NULL;
921	_err = GetWindowRegion(_self->ob_itself,
922	                       inRegionCode,
923	                       ioWinRgn);
924	if (_err != noErr) return PyMac_Error(_err);
925	Py_INCREF(Py_None);
926	_res = Py_None;
927	return _res;
928}
929
930static PyObject *WinObj_GetWindowStructureWidths(WindowObject *_self, PyObject *_args)
931{
932	PyObject *_res = NULL;
933	OSStatus _err;
934	Rect outRect;
935#ifndef GetWindowStructureWidths
936	PyMac_PRECHECK(GetWindowStructureWidths);
937#endif
938	if (!PyArg_ParseTuple(_args, ""))
939		return NULL;
940	_err = GetWindowStructureWidths(_self->ob_itself,
941	                                &outRect);
942	if (_err != noErr) return PyMac_Error(_err);
943	_res = Py_BuildValue("O&",
944	                     PyMac_BuildRect, &outRect);
945	return _res;
946}
947
948static PyObject *WinObj_BeginUpdate(WindowObject *_self, PyObject *_args)
949{
950	PyObject *_res = NULL;
951#ifndef BeginUpdate
952	PyMac_PRECHECK(BeginUpdate);
953#endif
954	if (!PyArg_ParseTuple(_args, ""))
955		return NULL;
956	BeginUpdate(_self->ob_itself);
957	Py_INCREF(Py_None);
958	_res = Py_None;
959	return _res;
960}
961
962static PyObject *WinObj_EndUpdate(WindowObject *_self, PyObject *_args)
963{
964	PyObject *_res = NULL;
965#ifndef EndUpdate
966	PyMac_PRECHECK(EndUpdate);
967#endif
968	if (!PyArg_ParseTuple(_args, ""))
969		return NULL;
970	EndUpdate(_self->ob_itself);
971	Py_INCREF(Py_None);
972	_res = Py_None;
973	return _res;
974}
975
976static PyObject *WinObj_InvalWindowRgn(WindowObject *_self, PyObject *_args)
977{
978	PyObject *_res = NULL;
979	OSStatus _err;
980	RgnHandle region;
981#ifndef InvalWindowRgn
982	PyMac_PRECHECK(InvalWindowRgn);
983#endif
984	if (!PyArg_ParseTuple(_args, "O&",
985	                      ResObj_Convert, &region))
986		return NULL;
987	_err = InvalWindowRgn(_self->ob_itself,
988	                      region);
989	if (_err != noErr) return PyMac_Error(_err);
990	Py_INCREF(Py_None);
991	_res = Py_None;
992	return _res;
993}
994
995static PyObject *WinObj_InvalWindowRect(WindowObject *_self, PyObject *_args)
996{
997	PyObject *_res = NULL;
998	OSStatus _err;
999	Rect bounds;
1000#ifndef InvalWindowRect
1001	PyMac_PRECHECK(InvalWindowRect);
1002#endif
1003	if (!PyArg_ParseTuple(_args, "O&",
1004	                      PyMac_GetRect, &bounds))
1005		return NULL;
1006	_err = InvalWindowRect(_self->ob_itself,
1007	                       &bounds);
1008	if (_err != noErr) return PyMac_Error(_err);
1009	Py_INCREF(Py_None);
1010	_res = Py_None;
1011	return _res;
1012}
1013
1014static PyObject *WinObj_ValidWindowRgn(WindowObject *_self, PyObject *_args)
1015{
1016	PyObject *_res = NULL;
1017	OSStatus _err;
1018	RgnHandle region;
1019#ifndef ValidWindowRgn
1020	PyMac_PRECHECK(ValidWindowRgn);
1021#endif
1022	if (!PyArg_ParseTuple(_args, "O&",
1023	                      ResObj_Convert, &region))
1024		return NULL;
1025	_err = ValidWindowRgn(_self->ob_itself,
1026	                      region);
1027	if (_err != noErr) return PyMac_Error(_err);
1028	Py_INCREF(Py_None);
1029	_res = Py_None;
1030	return _res;
1031}
1032
1033static PyObject *WinObj_ValidWindowRect(WindowObject *_self, PyObject *_args)
1034{
1035	PyObject *_res = NULL;
1036	OSStatus _err;
1037	Rect bounds;
1038#ifndef ValidWindowRect
1039	PyMac_PRECHECK(ValidWindowRect);
1040#endif
1041	if (!PyArg_ParseTuple(_args, "O&",
1042	                      PyMac_GetRect, &bounds))
1043		return NULL;
1044	_err = ValidWindowRect(_self->ob_itself,
1045	                       &bounds);
1046	if (_err != noErr) return PyMac_Error(_err);
1047	Py_INCREF(Py_None);
1048	_res = Py_None;
1049	return _res;
1050}
1051
1052static PyObject *WinObj_DrawGrowIcon(WindowObject *_self, PyObject *_args)
1053{
1054	PyObject *_res = NULL;
1055#ifndef DrawGrowIcon
1056	PyMac_PRECHECK(DrawGrowIcon);
1057#endif
1058	if (!PyArg_ParseTuple(_args, ""))
1059		return NULL;
1060	DrawGrowIcon(_self->ob_itself);
1061	Py_INCREF(Py_None);
1062	_res = Py_None;
1063	return _res;
1064}
1065
1066static PyObject *WinObj_SetWTitle(WindowObject *_self, PyObject *_args)
1067{
1068	PyObject *_res = NULL;
1069	Str255 title;
1070#ifndef SetWTitle
1071	PyMac_PRECHECK(SetWTitle);
1072#endif
1073	if (!PyArg_ParseTuple(_args, "O&",
1074	                      PyMac_GetStr255, title))
1075		return NULL;
1076	SetWTitle(_self->ob_itself,
1077	          title);
1078	Py_INCREF(Py_None);
1079	_res = Py_None;
1080	return _res;
1081}
1082
1083static PyObject *WinObj_GetWTitle(WindowObject *_self, PyObject *_args)
1084{
1085	PyObject *_res = NULL;
1086	Str255 title;
1087#ifndef GetWTitle
1088	PyMac_PRECHECK(GetWTitle);
1089#endif
1090	if (!PyArg_ParseTuple(_args, ""))
1091		return NULL;
1092	GetWTitle(_self->ob_itself,
1093	          title);
1094	_res = Py_BuildValue("O&",
1095	                     PyMac_BuildStr255, title);
1096	return _res;
1097}
1098
1099#if !TARGET_API_MAC_OS8
1100
1101static PyObject *WinObj_SetWindowTitleWithCFString(WindowObject *_self, PyObject *_args)
1102{
1103	PyObject *_res = NULL;
1104	OSStatus _err;
1105	CFStringRef inString;
1106#ifndef SetWindowTitleWithCFString
1107	PyMac_PRECHECK(SetWindowTitleWithCFString);
1108#endif
1109	if (!PyArg_ParseTuple(_args, "O&",
1110	                      CFStringRefObj_Convert, &inString))
1111		return NULL;
1112	_err = SetWindowTitleWithCFString(_self->ob_itself,
1113	                                  inString);
1114	if (_err != noErr) return PyMac_Error(_err);
1115	Py_INCREF(Py_None);
1116	_res = Py_None;
1117	return _res;
1118}
1119#endif
1120
1121#if !TARGET_API_MAC_OS8
1122
1123static PyObject *WinObj_CopyWindowTitleAsCFString(WindowObject *_self, PyObject *_args)
1124{
1125	PyObject *_res = NULL;
1126	OSStatus _err;
1127	CFStringRef outString;
1128#ifndef CopyWindowTitleAsCFString
1129	PyMac_PRECHECK(CopyWindowTitleAsCFString);
1130#endif
1131	if (!PyArg_ParseTuple(_args, ""))
1132		return NULL;
1133	_err = CopyWindowTitleAsCFString(_self->ob_itself,
1134	                                 &outString);
1135	if (_err != noErr) return PyMac_Error(_err);
1136	_res = Py_BuildValue("O&",
1137	                     CFStringRefObj_New, outString);
1138	return _res;
1139}
1140#endif
1141
1142static PyObject *WinObj_SetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
1143{
1144	PyObject *_res = NULL;
1145	OSStatus _err;
1146	FSSpec inFile;
1147#ifndef SetWindowProxyFSSpec
1148	PyMac_PRECHECK(SetWindowProxyFSSpec);
1149#endif
1150	if (!PyArg_ParseTuple(_args, "O&",
1151	                      PyMac_GetFSSpec, &inFile))
1152		return NULL;
1153	_err = SetWindowProxyFSSpec(_self->ob_itself,
1154	                            &inFile);
1155	if (_err != noErr) return PyMac_Error(_err);
1156	Py_INCREF(Py_None);
1157	_res = Py_None;
1158	return _res;
1159}
1160
1161static PyObject *WinObj_GetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
1162{
1163	PyObject *_res = NULL;
1164	OSStatus _err;
1165	FSSpec outFile;
1166#ifndef GetWindowProxyFSSpec
1167	PyMac_PRECHECK(GetWindowProxyFSSpec);
1168#endif
1169	if (!PyArg_ParseTuple(_args, ""))
1170		return NULL;
1171	_err = GetWindowProxyFSSpec(_self->ob_itself,
1172	                            &outFile);
1173	if (_err != noErr) return PyMac_Error(_err);
1174	_res = Py_BuildValue("O&",
1175	                     PyMac_BuildFSSpec, &outFile);
1176	return _res;
1177}
1178
1179static PyObject *WinObj_SetWindowProxyAlias(WindowObject *_self, PyObject *_args)
1180{
1181	PyObject *_res = NULL;
1182	OSStatus _err;
1183	AliasHandle alias;
1184#ifndef SetWindowProxyAlias
1185	PyMac_PRECHECK(SetWindowProxyAlias);
1186#endif
1187	if (!PyArg_ParseTuple(_args, "O&",
1188	                      ResObj_Convert, &alias))
1189		return NULL;
1190	_err = SetWindowProxyAlias(_self->ob_itself,
1191	                           alias);
1192	if (_err != noErr) return PyMac_Error(_err);
1193	Py_INCREF(Py_None);
1194	_res = Py_None;
1195	return _res;
1196}
1197
1198static PyObject *WinObj_GetWindowProxyAlias(WindowObject *_self, PyObject *_args)
1199{
1200	PyObject *_res = NULL;
1201	OSStatus _err;
1202	AliasHandle alias;
1203#ifndef GetWindowProxyAlias
1204	PyMac_PRECHECK(GetWindowProxyAlias);
1205#endif
1206	if (!PyArg_ParseTuple(_args, ""))
1207		return NULL;
1208	_err = GetWindowProxyAlias(_self->ob_itself,
1209	                           &alias);
1210	if (_err != noErr) return PyMac_Error(_err);
1211	_res = Py_BuildValue("O&",
1212	                     ResObj_New, alias);
1213	return _res;
1214}
1215
1216static PyObject *WinObj_SetWindowProxyCreatorAndType(WindowObject *_self, PyObject *_args)
1217{
1218	PyObject *_res = NULL;
1219	OSStatus _err;
1220	OSType fileCreator;
1221	OSType fileType;
1222	SInt16 vRefNum;
1223#ifndef SetWindowProxyCreatorAndType
1224	PyMac_PRECHECK(SetWindowProxyCreatorAndType);
1225#endif
1226	if (!PyArg_ParseTuple(_args, "O&O&h",
1227	                      PyMac_GetOSType, &fileCreator,
1228	                      PyMac_GetOSType, &fileType,
1229	                      &vRefNum))
1230		return NULL;
1231	_err = SetWindowProxyCreatorAndType(_self->ob_itself,
1232	                                    fileCreator,
1233	                                    fileType,
1234	                                    vRefNum);
1235	if (_err != noErr) return PyMac_Error(_err);
1236	Py_INCREF(Py_None);
1237	_res = Py_None;
1238	return _res;
1239}
1240
1241static PyObject *WinObj_GetWindowProxyIcon(WindowObject *_self, PyObject *_args)
1242{
1243	PyObject *_res = NULL;
1244	OSStatus _err;
1245	IconRef outIcon;
1246#ifndef GetWindowProxyIcon
1247	PyMac_PRECHECK(GetWindowProxyIcon);
1248#endif
1249	if (!PyArg_ParseTuple(_args, ""))
1250		return NULL;
1251	_err = GetWindowProxyIcon(_self->ob_itself,
1252	                          &outIcon);
1253	if (_err != noErr) return PyMac_Error(_err);
1254	_res = Py_BuildValue("O&",
1255	                     ResObj_New, outIcon);
1256	return _res;
1257}
1258
1259static PyObject *WinObj_SetWindowProxyIcon(WindowObject *_self, PyObject *_args)
1260{
1261	PyObject *_res = NULL;
1262	OSStatus _err;
1263	IconRef icon;
1264#ifndef SetWindowProxyIcon
1265	PyMac_PRECHECK(SetWindowProxyIcon);
1266#endif
1267	if (!PyArg_ParseTuple(_args, "O&",
1268	                      ResObj_Convert, &icon))
1269		return NULL;
1270	_err = SetWindowProxyIcon(_self->ob_itself,
1271	                          icon);
1272	if (_err != noErr) return PyMac_Error(_err);
1273	Py_INCREF(Py_None);
1274	_res = Py_None;
1275	return _res;
1276}
1277
1278static PyObject *WinObj_RemoveWindowProxy(WindowObject *_self, PyObject *_args)
1279{
1280	PyObject *_res = NULL;
1281	OSStatus _err;
1282#ifndef RemoveWindowProxy
1283	PyMac_PRECHECK(RemoveWindowProxy);
1284#endif
1285	if (!PyArg_ParseTuple(_args, ""))
1286		return NULL;
1287	_err = RemoveWindowProxy(_self->ob_itself);
1288	if (_err != noErr) return PyMac_Error(_err);
1289	Py_INCREF(Py_None);
1290	_res = Py_None;
1291	return _res;
1292}
1293
1294static PyObject *WinObj_BeginWindowProxyDrag(WindowObject *_self, PyObject *_args)
1295{
1296	PyObject *_res = NULL;
1297	OSStatus _err;
1298	DragReference outNewDrag;
1299	RgnHandle outDragOutlineRgn;
1300#ifndef BeginWindowProxyDrag
1301	PyMac_PRECHECK(BeginWindowProxyDrag);
1302#endif
1303	if (!PyArg_ParseTuple(_args, "O&",
1304	                      ResObj_Convert, &outDragOutlineRgn))
1305		return NULL;
1306	_err = BeginWindowProxyDrag(_self->ob_itself,
1307	                            &outNewDrag,
1308	                            outDragOutlineRgn);
1309	if (_err != noErr) return PyMac_Error(_err);
1310	_res = Py_BuildValue("O&",
1311	                     DragObj_New, outNewDrag);
1312	return _res;
1313}
1314
1315static PyObject *WinObj_EndWindowProxyDrag(WindowObject *_self, PyObject *_args)
1316{
1317	PyObject *_res = NULL;
1318	OSStatus _err;
1319	DragReference theDrag;
1320#ifndef EndWindowProxyDrag
1321	PyMac_PRECHECK(EndWindowProxyDrag);
1322#endif
1323	if (!PyArg_ParseTuple(_args, "O&",
1324	                      DragObj_Convert, &theDrag))
1325		return NULL;
1326	_err = EndWindowProxyDrag(_self->ob_itself,
1327	                          theDrag);
1328	if (_err != noErr) return PyMac_Error(_err);
1329	Py_INCREF(Py_None);
1330	_res = Py_None;
1331	return _res;
1332}
1333
1334static PyObject *WinObj_TrackWindowProxyFromExistingDrag(WindowObject *_self, PyObject *_args)
1335{
1336	PyObject *_res = NULL;
1337	OSStatus _err;
1338	Point startPt;
1339	DragReference drag;
1340	RgnHandle inDragOutlineRgn;
1341#ifndef TrackWindowProxyFromExistingDrag
1342	PyMac_PRECHECK(TrackWindowProxyFromExistingDrag);
1343#endif
1344	if (!PyArg_ParseTuple(_args, "O&O&O&",
1345	                      PyMac_GetPoint, &startPt,
1346	                      DragObj_Convert, &drag,
1347	                      ResObj_Convert, &inDragOutlineRgn))
1348		return NULL;
1349	_err = TrackWindowProxyFromExistingDrag(_self->ob_itself,
1350	                                        startPt,
1351	                                        drag,
1352	                                        inDragOutlineRgn);
1353	if (_err != noErr) return PyMac_Error(_err);
1354	Py_INCREF(Py_None);
1355	_res = Py_None;
1356	return _res;
1357}
1358
1359static PyObject *WinObj_TrackWindowProxyDrag(WindowObject *_self, PyObject *_args)
1360{
1361	PyObject *_res = NULL;
1362	OSStatus _err;
1363	Point startPt;
1364#ifndef TrackWindowProxyDrag
1365	PyMac_PRECHECK(TrackWindowProxyDrag);
1366#endif
1367	if (!PyArg_ParseTuple(_args, "O&",
1368	                      PyMac_GetPoint, &startPt))
1369		return NULL;
1370	_err = TrackWindowProxyDrag(_self->ob_itself,
1371	                            startPt);
1372	if (_err != noErr) return PyMac_Error(_err);
1373	Py_INCREF(Py_None);
1374	_res = Py_None;
1375	return _res;
1376}
1377
1378static PyObject *WinObj_IsWindowModified(WindowObject *_self, PyObject *_args)
1379{
1380	PyObject *_res = NULL;
1381	Boolean _rv;
1382#ifndef IsWindowModified
1383	PyMac_PRECHECK(IsWindowModified);
1384#endif
1385	if (!PyArg_ParseTuple(_args, ""))
1386		return NULL;
1387	_rv = IsWindowModified(_self->ob_itself);
1388	_res = Py_BuildValue("b",
1389	                     _rv);
1390	return _res;
1391}
1392
1393static PyObject *WinObj_SetWindowModified(WindowObject *_self, PyObject *_args)
1394{
1395	PyObject *_res = NULL;
1396	OSStatus _err;
1397	Boolean modified;
1398#ifndef SetWindowModified
1399	PyMac_PRECHECK(SetWindowModified);
1400#endif
1401	if (!PyArg_ParseTuple(_args, "b",
1402	                      &modified))
1403		return NULL;
1404	_err = SetWindowModified(_self->ob_itself,
1405	                         modified);
1406	if (_err != noErr) return PyMac_Error(_err);
1407	Py_INCREF(Py_None);
1408	_res = Py_None;
1409	return _res;
1410}
1411
1412static PyObject *WinObj_IsWindowPathSelectClick(WindowObject *_self, PyObject *_args)
1413{
1414	PyObject *_res = NULL;
1415	Boolean _rv;
1416	EventRecord event;
1417#ifndef IsWindowPathSelectClick
1418	PyMac_PRECHECK(IsWindowPathSelectClick);
1419#endif
1420	if (!PyArg_ParseTuple(_args, "O&",
1421	                      PyMac_GetEventRecord, &event))
1422		return NULL;
1423	_rv = IsWindowPathSelectClick(_self->ob_itself,
1424	                              &event);
1425	_res = Py_BuildValue("b",
1426	                     _rv);
1427	return _res;
1428}
1429
1430static PyObject *WinObj_WindowPathSelect(WindowObject *_self, PyObject *_args)
1431{
1432	PyObject *_res = NULL;
1433	OSStatus _err;
1434	MenuHandle menu;
1435	SInt32 outMenuResult;
1436#ifndef WindowPathSelect
1437	PyMac_PRECHECK(WindowPathSelect);
1438#endif
1439	if (!PyArg_ParseTuple(_args, "O&",
1440	                      MenuObj_Convert, &menu))
1441		return NULL;
1442	_err = WindowPathSelect(_self->ob_itself,
1443	                        menu,
1444	                        &outMenuResult);
1445	if (_err != noErr) return PyMac_Error(_err);
1446	_res = Py_BuildValue("l",
1447	                     outMenuResult);
1448	return _res;
1449}
1450
1451static PyObject *WinObj_HiliteWindowFrameForDrag(WindowObject *_self, PyObject *_args)
1452{
1453	PyObject *_res = NULL;
1454	OSStatus _err;
1455	Boolean hilited;
1456#ifndef HiliteWindowFrameForDrag
1457	PyMac_PRECHECK(HiliteWindowFrameForDrag);
1458#endif
1459	if (!PyArg_ParseTuple(_args, "b",
1460	                      &hilited))
1461		return NULL;
1462	_err = HiliteWindowFrameForDrag(_self->ob_itself,
1463	                                hilited);
1464	if (_err != noErr) return PyMac_Error(_err);
1465	Py_INCREF(Py_None);
1466	_res = Py_None;
1467	return _res;
1468}
1469
1470static PyObject *WinObj_TransitionWindow(WindowObject *_self, PyObject *_args)
1471{
1472	PyObject *_res = NULL;
1473	OSStatus _err;
1474	WindowTransitionEffect effect;
1475	WindowTransitionAction action;
1476	Rect rect;
1477#ifndef TransitionWindow
1478	PyMac_PRECHECK(TransitionWindow);
1479#endif
1480	if (!PyArg_ParseTuple(_args, "llO&",
1481	                      &effect,
1482	                      &action,
1483	                      PyMac_GetRect, &rect))
1484		return NULL;
1485	_err = TransitionWindow(_self->ob_itself,
1486	                        effect,
1487	                        action,
1488	                        &rect);
1489	if (_err != noErr) return PyMac_Error(_err);
1490	Py_INCREF(Py_None);
1491	_res = Py_None;
1492	return _res;
1493}
1494
1495#if TARGET_API_MAC_OSX
1496
1497static PyObject *WinObj_TransitionWindowAndParent(WindowObject *_self, PyObject *_args)
1498{
1499	PyObject *_res = NULL;
1500	OSStatus _err;
1501	WindowPtr parentWindow;
1502	WindowTransitionEffect effect;
1503	WindowTransitionAction action;
1504	Rect rect;
1505#ifndef TransitionWindowAndParent
1506	PyMac_PRECHECK(TransitionWindowAndParent);
1507#endif
1508	if (!PyArg_ParseTuple(_args, "O&llO&",
1509	                      WinObj_Convert, &parentWindow,
1510	                      &effect,
1511	                      &action,
1512	                      PyMac_GetRect, &rect))
1513		return NULL;
1514	_err = TransitionWindowAndParent(_self->ob_itself,
1515	                                 parentWindow,
1516	                                 effect,
1517	                                 action,
1518	                                 &rect);
1519	if (_err != noErr) return PyMac_Error(_err);
1520	Py_INCREF(Py_None);
1521	_res = Py_None;
1522	return _res;
1523}
1524#endif
1525
1526static PyObject *WinObj_MacMoveWindow(WindowObject *_self, PyObject *_args)
1527{
1528	PyObject *_res = NULL;
1529	short hGlobal;
1530	short vGlobal;
1531	Boolean front;
1532#ifndef MacMoveWindow
1533	PyMac_PRECHECK(MacMoveWindow);
1534#endif
1535	if (!PyArg_ParseTuple(_args, "hhb",
1536	                      &hGlobal,
1537	                      &vGlobal,
1538	                      &front))
1539		return NULL;
1540	MacMoveWindow(_self->ob_itself,
1541	              hGlobal,
1542	              vGlobal,
1543	              front);
1544	Py_INCREF(Py_None);
1545	_res = Py_None;
1546	return _res;
1547}
1548
1549static PyObject *WinObj_SizeWindow(WindowObject *_self, PyObject *_args)
1550{
1551	PyObject *_res = NULL;
1552	short w;
1553	short h;
1554	Boolean fUpdate;
1555#ifndef SizeWindow
1556	PyMac_PRECHECK(SizeWindow);
1557#endif
1558	if (!PyArg_ParseTuple(_args, "hhb",
1559	                      &w,
1560	                      &h,
1561	                      &fUpdate))
1562		return NULL;
1563	SizeWindow(_self->ob_itself,
1564	           w,
1565	           h,
1566	           fUpdate);
1567	Py_INCREF(Py_None);
1568	_res = Py_None;
1569	return _res;
1570}
1571
1572static PyObject *WinObj_GrowWindow(WindowObject *_self, PyObject *_args)
1573{
1574	PyObject *_res = NULL;
1575	long _rv;
1576	Point startPt;
1577	Rect bBox;
1578#ifndef GrowWindow
1579	PyMac_PRECHECK(GrowWindow);
1580#endif
1581	if (!PyArg_ParseTuple(_args, "O&O&",
1582	                      PyMac_GetPoint, &startPt,
1583	                      PyMac_GetRect, &bBox))
1584		return NULL;
1585	_rv = GrowWindow(_self->ob_itself,
1586	                 startPt,
1587	                 &bBox);
1588	_res = Py_BuildValue("l",
1589	                     _rv);
1590	return _res;
1591}
1592
1593static PyObject *WinObj_DragWindow(WindowObject *_self, PyObject *_args)
1594{
1595	PyObject *_res = NULL;
1596	Point startPt;
1597	Rect boundsRect;
1598#ifndef DragWindow
1599	PyMac_PRECHECK(DragWindow);
1600#endif
1601	if (!PyArg_ParseTuple(_args, "O&O&",
1602	                      PyMac_GetPoint, &startPt,
1603	                      PyMac_GetRect, &boundsRect))
1604		return NULL;
1605	DragWindow(_self->ob_itself,
1606	           startPt,
1607	           &boundsRect);
1608	Py_INCREF(Py_None);
1609	_res = Py_None;
1610	return _res;
1611}
1612
1613static PyObject *WinObj_ZoomWindow(WindowObject *_self, PyObject *_args)
1614{
1615	PyObject *_res = NULL;
1616	WindowPartCode partCode;
1617	Boolean front;
1618#ifndef ZoomWindow
1619	PyMac_PRECHECK(ZoomWindow);
1620#endif
1621	if (!PyArg_ParseTuple(_args, "hb",
1622	                      &partCode,
1623	                      &front))
1624		return NULL;
1625	ZoomWindow(_self->ob_itself,
1626	           partCode,
1627	           front);
1628	Py_INCREF(Py_None);
1629	_res = Py_None;
1630	return _res;
1631}
1632
1633static PyObject *WinObj_IsWindowCollapsable(WindowObject *_self, PyObject *_args)
1634{
1635	PyObject *_res = NULL;
1636	Boolean _rv;
1637#ifndef IsWindowCollapsable
1638	PyMac_PRECHECK(IsWindowCollapsable);
1639#endif
1640	if (!PyArg_ParseTuple(_args, ""))
1641		return NULL;
1642	_rv = IsWindowCollapsable(_self->ob_itself);
1643	_res = Py_BuildValue("b",
1644	                     _rv);
1645	return _res;
1646}
1647
1648static PyObject *WinObj_IsWindowCollapsed(WindowObject *_self, PyObject *_args)
1649{
1650	PyObject *_res = NULL;
1651	Boolean _rv;
1652#ifndef IsWindowCollapsed
1653	PyMac_PRECHECK(IsWindowCollapsed);
1654#endif
1655	if (!PyArg_ParseTuple(_args, ""))
1656		return NULL;
1657	_rv = IsWindowCollapsed(_self->ob_itself);
1658	_res = Py_BuildValue("b",
1659	                     _rv);
1660	return _res;
1661}
1662
1663static PyObject *WinObj_CollapseWindow(WindowObject *_self, PyObject *_args)
1664{
1665	PyObject *_res = NULL;
1666	OSStatus _err;
1667	Boolean collapse;
1668#ifndef CollapseWindow
1669	PyMac_PRECHECK(CollapseWindow);
1670#endif
1671	if (!PyArg_ParseTuple(_args, "b",
1672	                      &collapse))
1673		return NULL;
1674	_err = CollapseWindow(_self->ob_itself,
1675	                      collapse);
1676	if (_err != noErr) return PyMac_Error(_err);
1677	Py_INCREF(Py_None);
1678	_res = Py_None;
1679	return _res;
1680}
1681
1682static PyObject *WinObj_GetWindowBounds(WindowObject *_self, PyObject *_args)
1683{
1684	PyObject *_res = NULL;
1685	OSStatus _err;
1686	WindowRegionCode regionCode;
1687	Rect globalBounds;
1688#ifndef GetWindowBounds
1689	PyMac_PRECHECK(GetWindowBounds);
1690#endif
1691	if (!PyArg_ParseTuple(_args, "H",
1692	                      &regionCode))
1693		return NULL;
1694	_err = GetWindowBounds(_self->ob_itself,
1695	                       regionCode,
1696	                       &globalBounds);
1697	if (_err != noErr) return PyMac_Error(_err);
1698	_res = Py_BuildValue("O&",
1699	                     PyMac_BuildRect, &globalBounds);
1700	return _res;
1701}
1702
1703static PyObject *WinObj_ResizeWindow(WindowObject *_self, PyObject *_args)
1704{
1705	PyObject *_res = NULL;
1706	Boolean _rv;
1707	Point startPoint;
1708	Rect sizeConstraints;
1709	Rect newContentRect;
1710#ifndef ResizeWindow
1711	PyMac_PRECHECK(ResizeWindow);
1712#endif
1713	if (!PyArg_ParseTuple(_args, "O&O&",
1714	                      PyMac_GetPoint, &startPoint,
1715	                      PyMac_GetRect, &sizeConstraints))
1716		return NULL;
1717	_rv = ResizeWindow(_self->ob_itself,
1718	                   startPoint,
1719	                   &sizeConstraints,
1720	                   &newContentRect);
1721	_res = Py_BuildValue("bO&",
1722	                     _rv,
1723	                     PyMac_BuildRect, &newContentRect);
1724	return _res;
1725}
1726
1727static PyObject *WinObj_SetWindowBounds(WindowObject *_self, PyObject *_args)
1728{
1729	PyObject *_res = NULL;
1730	OSStatus _err;
1731	WindowRegionCode regionCode;
1732	Rect globalBounds;
1733#ifndef SetWindowBounds
1734	PyMac_PRECHECK(SetWindowBounds);
1735#endif
1736	if (!PyArg_ParseTuple(_args, "HO&",
1737	                      &regionCode,
1738	                      PyMac_GetRect, &globalBounds))
1739		return NULL;
1740	_err = SetWindowBounds(_self->ob_itself,
1741	                       regionCode,
1742	                       &globalBounds);
1743	if (_err != noErr) return PyMac_Error(_err);
1744	Py_INCREF(Py_None);
1745	_res = Py_None;
1746	return _res;
1747}
1748
1749static PyObject *WinObj_RepositionWindow(WindowObject *_self, PyObject *_args)
1750{
1751	PyObject *_res = NULL;
1752	OSStatus _err;
1753	WindowPtr parentWindow;
1754	WindowPositionMethod method;
1755#ifndef RepositionWindow
1756	PyMac_PRECHECK(RepositionWindow);
1757#endif
1758	if (!PyArg_ParseTuple(_args, "O&l",
1759	                      WinObj_Convert, &parentWindow,
1760	                      &method))
1761		return NULL;
1762	_err = RepositionWindow(_self->ob_itself,
1763	                        parentWindow,
1764	                        method);
1765	if (_err != noErr) return PyMac_Error(_err);
1766	Py_INCREF(Py_None);
1767	_res = Py_None;
1768	return _res;
1769}
1770
1771static PyObject *WinObj_MoveWindowStructure(WindowObject *_self, PyObject *_args)
1772{
1773	PyObject *_res = NULL;
1774	OSStatus _err;
1775	short hGlobal;
1776	short vGlobal;
1777#ifndef MoveWindowStructure
1778	PyMac_PRECHECK(MoveWindowStructure);
1779#endif
1780	if (!PyArg_ParseTuple(_args, "hh",
1781	                      &hGlobal,
1782	                      &vGlobal))
1783		return NULL;
1784	_err = MoveWindowStructure(_self->ob_itself,
1785	                           hGlobal,
1786	                           vGlobal);
1787	if (_err != noErr) return PyMac_Error(_err);
1788	Py_INCREF(Py_None);
1789	_res = Py_None;
1790	return _res;
1791}
1792
1793static PyObject *WinObj_IsWindowInStandardState(WindowObject *_self, PyObject *_args)
1794{
1795	PyObject *_res = NULL;
1796	Boolean _rv;
1797	Point idealSize;
1798	Rect idealStandardState;
1799#ifndef IsWindowInStandardState
1800	PyMac_PRECHECK(IsWindowInStandardState);
1801#endif
1802	if (!PyArg_ParseTuple(_args, ""))
1803		return NULL;
1804	_rv = IsWindowInStandardState(_self->ob_itself,
1805	                              &idealSize,
1806	                              &idealStandardState);
1807	_res = Py_BuildValue("bO&O&",
1808	                     _rv,
1809	                     PyMac_BuildPoint, idealSize,
1810	                     PyMac_BuildRect, &idealStandardState);
1811	return _res;
1812}
1813
1814static PyObject *WinObj_ZoomWindowIdeal(WindowObject *_self, PyObject *_args)
1815{
1816	PyObject *_res = NULL;
1817	OSStatus _err;
1818	WindowPartCode partCode;
1819	Point ioIdealSize;
1820#ifndef ZoomWindowIdeal
1821	PyMac_PRECHECK(ZoomWindowIdeal);
1822#endif
1823	if (!PyArg_ParseTuple(_args, "h",
1824	                      &partCode))
1825		return NULL;
1826	_err = ZoomWindowIdeal(_self->ob_itself,
1827	                       partCode,
1828	                       &ioIdealSize);
1829	if (_err != noErr) return PyMac_Error(_err);
1830	_res = Py_BuildValue("O&",
1831	                     PyMac_BuildPoint, ioIdealSize);
1832	return _res;
1833}
1834
1835static PyObject *WinObj_GetWindowIdealUserState(WindowObject *_self, PyObject *_args)
1836{
1837	PyObject *_res = NULL;
1838	OSStatus _err;
1839	Rect userState;
1840#ifndef GetWindowIdealUserState
1841	PyMac_PRECHECK(GetWindowIdealUserState);
1842#endif
1843	if (!PyArg_ParseTuple(_args, ""))
1844		return NULL;
1845	_err = GetWindowIdealUserState(_self->ob_itself,
1846	                               &userState);
1847	if (_err != noErr) return PyMac_Error(_err);
1848	_res = Py_BuildValue("O&",
1849	                     PyMac_BuildRect, &userState);
1850	return _res;
1851}
1852
1853static PyObject *WinObj_SetWindowIdealUserState(WindowObject *_self, PyObject *_args)
1854{
1855	PyObject *_res = NULL;
1856	OSStatus _err;
1857	Rect userState;
1858#ifndef SetWindowIdealUserState
1859	PyMac_PRECHECK(SetWindowIdealUserState);
1860#endif
1861	if (!PyArg_ParseTuple(_args, "O&",
1862	                      PyMac_GetRect, &userState))
1863		return NULL;
1864	_err = SetWindowIdealUserState(_self->ob_itself,
1865	                               &userState);
1866	if (_err != noErr) return PyMac_Error(_err);
1867	Py_INCREF(Py_None);
1868	_res = Py_None;
1869	return _res;
1870}
1871
1872#if !TARGET_API_MAC_OS8
1873
1874static PyObject *WinObj_GetWindowGreatestAreaDevice(WindowObject *_self, PyObject *_args)
1875{
1876	PyObject *_res = NULL;
1877	OSStatus _err;
1878	WindowRegionCode inRegion;
1879	GDHandle outGreatestDevice;
1880	Rect outGreatestDeviceRect;
1881#ifndef GetWindowGreatestAreaDevice
1882	PyMac_PRECHECK(GetWindowGreatestAreaDevice);
1883#endif
1884	if (!PyArg_ParseTuple(_args, "H",
1885	                      &inRegion))
1886		return NULL;
1887	_err = GetWindowGreatestAreaDevice(_self->ob_itself,
1888	                                   inRegion,
1889	                                   &outGreatestDevice,
1890	                                   &outGreatestDeviceRect);
1891	if (_err != noErr) return PyMac_Error(_err);
1892	_res = Py_BuildValue("O&O&",
1893	                     ResObj_New, outGreatestDevice,
1894	                     PyMac_BuildRect, &outGreatestDeviceRect);
1895	return _res;
1896}
1897#endif
1898
1899#if !TARGET_API_MAC_OS8
1900
1901static PyObject *WinObj_ConstrainWindowToScreen(WindowObject *_self, PyObject *_args)
1902{
1903	PyObject *_res = NULL;
1904	OSStatus _err;
1905	WindowRegionCode inRegionCode;
1906	WindowConstrainOptions inOptions;
1907	Rect inScreenRect;
1908	Rect outStructure;
1909#ifndef ConstrainWindowToScreen
1910	PyMac_PRECHECK(ConstrainWindowToScreen);
1911#endif
1912	if (!PyArg_ParseTuple(_args, "HlO&",
1913	                      &inRegionCode,
1914	                      &inOptions,
1915	                      PyMac_GetRect, &inScreenRect))
1916		return NULL;
1917	_err = ConstrainWindowToScreen(_self->ob_itself,
1918	                               inRegionCode,
1919	                               inOptions,
1920	                               &inScreenRect,
1921	                               &outStructure);
1922	if (_err != noErr) return PyMac_Error(_err);
1923	_res = Py_BuildValue("O&",
1924	                     PyMac_BuildRect, &outStructure);
1925	return _res;
1926}
1927#endif
1928
1929static PyObject *WinObj_HideWindow(WindowObject *_self, PyObject *_args)
1930{
1931	PyObject *_res = NULL;
1932#ifndef HideWindow
1933	PyMac_PRECHECK(HideWindow);
1934#endif
1935	if (!PyArg_ParseTuple(_args, ""))
1936		return NULL;
1937	HideWindow(_self->ob_itself);
1938	Py_INCREF(Py_None);
1939	_res = Py_None;
1940	return _res;
1941}
1942
1943static PyObject *WinObj_MacShowWindow(WindowObject *_self, PyObject *_args)
1944{
1945	PyObject *_res = NULL;
1946#ifndef MacShowWindow
1947	PyMac_PRECHECK(MacShowWindow);
1948#endif
1949	if (!PyArg_ParseTuple(_args, ""))
1950		return NULL;
1951	MacShowWindow(_self->ob_itself);
1952	Py_INCREF(Py_None);
1953	_res = Py_None;
1954	return _res;
1955}
1956
1957static PyObject *WinObj_ShowHide(WindowObject *_self, PyObject *_args)
1958{
1959	PyObject *_res = NULL;
1960	Boolean showFlag;
1961#ifndef ShowHide
1962	PyMac_PRECHECK(ShowHide);
1963#endif
1964	if (!PyArg_ParseTuple(_args, "b",
1965	                      &showFlag))
1966		return NULL;
1967	ShowHide(_self->ob_itself,
1968	         showFlag);
1969	Py_INCREF(Py_None);
1970	_res = Py_None;
1971	return _res;
1972}
1973
1974static PyObject *WinObj_MacIsWindowVisible(WindowObject *_self, PyObject *_args)
1975{
1976	PyObject *_res = NULL;
1977	Boolean _rv;
1978#ifndef MacIsWindowVisible
1979	PyMac_PRECHECK(MacIsWindowVisible);
1980#endif
1981	if (!PyArg_ParseTuple(_args, ""))
1982		return NULL;
1983	_rv = MacIsWindowVisible(_self->ob_itself);
1984	_res = Py_BuildValue("b",
1985	                     _rv);
1986	return _res;
1987}
1988
1989#if !TARGET_API_MAC_OS8
1990
1991static PyObject *WinObj_ShowSheetWindow(WindowObject *_self, PyObject *_args)
1992{
1993	PyObject *_res = NULL;
1994	OSStatus _err;
1995	WindowPtr inParentWindow;
1996#ifndef ShowSheetWindow
1997	PyMac_PRECHECK(ShowSheetWindow);
1998#endif
1999	if (!PyArg_ParseTuple(_args, "O&",
2000	                      WinObj_Convert, &inParentWindow))
2001		return NULL;
2002	_err = ShowSheetWindow(_self->ob_itself,
2003	                       inParentWindow);
2004	if (_err != noErr) return PyMac_Error(_err);
2005	Py_INCREF(Py_None);
2006	_res = Py_None;
2007	return _res;
2008}
2009#endif
2010
2011#if !TARGET_API_MAC_OS8
2012
2013static PyObject *WinObj_HideSheetWindow(WindowObject *_self, PyObject *_args)
2014{
2015	PyObject *_res = NULL;
2016	OSStatus _err;
2017#ifndef HideSheetWindow
2018	PyMac_PRECHECK(HideSheetWindow);
2019#endif
2020	if (!PyArg_ParseTuple(_args, ""))
2021		return NULL;
2022	_err = HideSheetWindow(_self->ob_itself);
2023	if (_err != noErr) return PyMac_Error(_err);
2024	Py_INCREF(Py_None);
2025	_res = Py_None;
2026	return _res;
2027}
2028#endif
2029
2030#if !TARGET_API_MAC_OS8
2031
2032static PyObject *WinObj_GetSheetWindowParent(WindowObject *_self, PyObject *_args)
2033{
2034	PyObject *_res = NULL;
2035	OSStatus _err;
2036	WindowPtr outParentWindow;
2037#ifndef GetSheetWindowParent
2038	PyMac_PRECHECK(GetSheetWindowParent);
2039#endif
2040	if (!PyArg_ParseTuple(_args, ""))
2041		return NULL;
2042	_err = GetSheetWindowParent(_self->ob_itself,
2043	                            &outParentWindow);
2044	if (_err != noErr) return PyMac_Error(_err);
2045	_res = Py_BuildValue("O&",
2046	                     WinObj_WhichWindow, outParentWindow);
2047	return _res;
2048}
2049#endif
2050
2051#if !TARGET_API_MAC_OS8
2052
2053static PyObject *WinObj_GetWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
2054{
2055	PyObject *_res = NULL;
2056	OSStatus _err;
2057	OSType propertyCreator;
2058	OSType propertyTag;
2059	UInt32 attributes;
2060#ifndef GetWindowPropertyAttributes
2061	PyMac_PRECHECK(GetWindowPropertyAttributes);
2062#endif
2063	if (!PyArg_ParseTuple(_args, "O&O&",
2064	                      PyMac_GetOSType, &propertyCreator,
2065	                      PyMac_GetOSType, &propertyTag))
2066		return NULL;
2067	_err = GetWindowPropertyAttributes(_self->ob_itself,
2068	                                   propertyCreator,
2069	                                   propertyTag,
2070	                                   &attributes);
2071	if (_err != noErr) return PyMac_Error(_err);
2072	_res = Py_BuildValue("l",
2073	                     attributes);
2074	return _res;
2075}
2076#endif
2077
2078#if !TARGET_API_MAC_OS8
2079
2080static PyObject *WinObj_ChangeWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
2081{
2082	PyObject *_res = NULL;
2083	OSStatus _err;
2084	OSType propertyCreator;
2085	OSType propertyTag;
2086	UInt32 attributesToSet;
2087	UInt32 attributesToClear;
2088#ifndef ChangeWindowPropertyAttributes
2089	PyMac_PRECHECK(ChangeWindowPropertyAttributes);
2090#endif
2091	if (!PyArg_ParseTuple(_args, "O&O&ll",
2092	                      PyMac_GetOSType, &propertyCreator,
2093	                      PyMac_GetOSType, &propertyTag,
2094	                      &attributesToSet,
2095	                      &attributesToClear))
2096		return NULL;
2097	_err = ChangeWindowPropertyAttributes(_self->ob_itself,
2098	                                      propertyCreator,
2099	                                      propertyTag,
2100	                                      attributesToSet,
2101	                                      attributesToClear);
2102	if (_err != noErr) return PyMac_Error(_err);
2103	Py_INCREF(Py_None);
2104	_res = Py_None;
2105	return _res;
2106}
2107#endif
2108
2109static PyObject *WinObj_TrackBox(WindowObject *_self, PyObject *_args)
2110{
2111	PyObject *_res = NULL;
2112	Boolean _rv;
2113	Point thePt;
2114	WindowPartCode partCode;
2115#ifndef TrackBox
2116	PyMac_PRECHECK(TrackBox);
2117#endif
2118	if (!PyArg_ParseTuple(_args, "O&h",
2119	                      PyMac_GetPoint, &thePt,
2120	                      &partCode))
2121		return NULL;
2122	_rv = TrackBox(_self->ob_itself,
2123	               thePt,
2124	               partCode);
2125	_res = Py_BuildValue("b",
2126	                     _rv);
2127	return _res;
2128}
2129
2130static PyObject *WinObj_TrackGoAway(WindowObject *_self, PyObject *_args)
2131{
2132	PyObject *_res = NULL;
2133	Boolean _rv;
2134	Point thePt;
2135#ifndef TrackGoAway
2136	PyMac_PRECHECK(TrackGoAway);
2137#endif
2138	if (!PyArg_ParseTuple(_args, "O&",
2139	                      PyMac_GetPoint, &thePt))
2140		return NULL;
2141	_rv = TrackGoAway(_self->ob_itself,
2142	                  thePt);
2143	_res = Py_BuildValue("b",
2144	                     _rv);
2145	return _res;
2146}
2147
2148#if !TARGET_API_MAC_CARBON
2149
2150static PyObject *WinObj_GetAuxWin(WindowObject *_self, PyObject *_args)
2151{
2152	PyObject *_res = NULL;
2153	Boolean _rv;
2154	AuxWinHandle awHndl;
2155#ifndef GetAuxWin
2156	PyMac_PRECHECK(GetAuxWin);
2157#endif
2158	if (!PyArg_ParseTuple(_args, ""))
2159		return NULL;
2160	_rv = GetAuxWin(_self->ob_itself,
2161	                &awHndl);
2162	_res = Py_BuildValue("bO&",
2163	                     _rv,
2164	                     ResObj_New, awHndl);
2165	return _res;
2166}
2167#endif
2168
2169#if !TARGET_API_MAC_CARBON
2170
2171static PyObject *WinObj_GetWindowGoAwayFlag(WindowObject *_self, PyObject *_args)
2172{
2173	PyObject *_res = NULL;
2174	Boolean _rv;
2175#ifndef GetWindowGoAwayFlag
2176	PyMac_PRECHECK(GetWindowGoAwayFlag);
2177#endif
2178	if (!PyArg_ParseTuple(_args, ""))
2179		return NULL;
2180	_rv = GetWindowGoAwayFlag(_self->ob_itself);
2181	_res = Py_BuildValue("b",
2182	                     _rv);
2183	return _res;
2184}
2185#endif
2186
2187#if !TARGET_API_MAC_CARBON
2188
2189static PyObject *WinObj_GetWindowSpareFlag(WindowObject *_self, PyObject *_args)
2190{
2191	PyObject *_res = NULL;
2192	Boolean _rv;
2193#ifndef GetWindowSpareFlag
2194	PyMac_PRECHECK(GetWindowSpareFlag);
2195#endif
2196	if (!PyArg_ParseTuple(_args, ""))
2197		return NULL;
2198	_rv = GetWindowSpareFlag(_self->ob_itself);
2199	_res = Py_BuildValue("b",
2200	                     _rv);
2201	return _res;
2202}
2203#endif
2204
2205static PyObject *WinObj_GetWindowPort(WindowObject *_self, PyObject *_args)
2206{
2207	PyObject *_res = NULL;
2208	CGrafPtr _rv;
2209#ifndef GetWindowPort
2210	PyMac_PRECHECK(GetWindowPort);
2211#endif
2212	if (!PyArg_ParseTuple(_args, ""))
2213		return NULL;
2214	_rv = GetWindowPort(_self->ob_itself);
2215	_res = Py_BuildValue("O&",
2216	                     GrafObj_New, _rv);
2217	return _res;
2218}
2219
2220static PyObject *WinObj_GetWindowKind(WindowObject *_self, PyObject *_args)
2221{
2222	PyObject *_res = NULL;
2223	short _rv;
2224#ifndef GetWindowKind
2225	PyMac_PRECHECK(GetWindowKind);
2226#endif
2227	if (!PyArg_ParseTuple(_args, ""))
2228		return NULL;
2229	_rv = GetWindowKind(_self->ob_itself);
2230	_res = Py_BuildValue("h",
2231	                     _rv);
2232	return _res;
2233}
2234
2235static PyObject *WinObj_IsWindowHilited(WindowObject *_self, PyObject *_args)
2236{
2237	PyObject *_res = NULL;
2238	Boolean _rv;
2239#ifndef IsWindowHilited
2240	PyMac_PRECHECK(IsWindowHilited);
2241#endif
2242	if (!PyArg_ParseTuple(_args, ""))
2243		return NULL;
2244	_rv = IsWindowHilited(_self->ob_itself);
2245	_res = Py_BuildValue("b",
2246	                     _rv);
2247	return _res;
2248}
2249
2250#if !TARGET_API_MAC_OS8
2251
2252static PyObject *WinObj_IsWindowUpdatePending(WindowObject *_self, PyObject *_args)
2253{
2254	PyObject *_res = NULL;
2255	Boolean _rv;
2256#ifndef IsWindowUpdatePending
2257	PyMac_PRECHECK(IsWindowUpdatePending);
2258#endif
2259	if (!PyArg_ParseTuple(_args, ""))
2260		return NULL;
2261	_rv = IsWindowUpdatePending(_self->ob_itself);
2262	_res = Py_BuildValue("b",
2263	                     _rv);
2264	return _res;
2265}
2266#endif
2267
2268static PyObject *WinObj_MacGetNextWindow(WindowObject *_self, PyObject *_args)
2269{
2270	PyObject *_res = NULL;
2271	WindowPtr _rv;
2272#ifndef MacGetNextWindow
2273	PyMac_PRECHECK(MacGetNextWindow);
2274#endif
2275	if (!PyArg_ParseTuple(_args, ""))
2276		return NULL;
2277	_rv = MacGetNextWindow(_self->ob_itself);
2278	_res = Py_BuildValue("O&",
2279	                     WinObj_New, _rv);
2280	return _res;
2281}
2282
2283static PyObject *WinObj_GetWindowStandardState(WindowObject *_self, PyObject *_args)
2284{
2285	PyObject *_res = NULL;
2286	Rect rect;
2287#ifndef GetWindowStandardState
2288	PyMac_PRECHECK(GetWindowStandardState);
2289#endif
2290	if (!PyArg_ParseTuple(_args, ""))
2291		return NULL;
2292	GetWindowStandardState(_self->ob_itself,
2293	                       &rect);
2294	_res = Py_BuildValue("O&",
2295	                     PyMac_BuildRect, &rect);
2296	return _res;
2297}
2298
2299static PyObject *WinObj_GetWindowUserState(WindowObject *_self, PyObject *_args)
2300{
2301	PyObject *_res = NULL;
2302	Rect rect;
2303#ifndef GetWindowUserState
2304	PyMac_PRECHECK(GetWindowUserState);
2305#endif
2306	if (!PyArg_ParseTuple(_args, ""))
2307		return NULL;
2308	GetWindowUserState(_self->ob_itself,
2309	                   &rect);
2310	_res = Py_BuildValue("O&",
2311	                     PyMac_BuildRect, &rect);
2312	return _res;
2313}
2314
2315static PyObject *WinObj_SetWindowKind(WindowObject *_self, PyObject *_args)
2316{
2317	PyObject *_res = NULL;
2318	short kind;
2319#ifndef SetWindowKind
2320	PyMac_PRECHECK(SetWindowKind);
2321#endif
2322	if (!PyArg_ParseTuple(_args, "h",
2323	                      &kind))
2324		return NULL;
2325	SetWindowKind(_self->ob_itself,
2326	              kind);
2327	Py_INCREF(Py_None);
2328	_res = Py_None;
2329	return _res;
2330}
2331
2332static PyObject *WinObj_SetWindowStandardState(WindowObject *_self, PyObject *_args)
2333{
2334	PyObject *_res = NULL;
2335	Rect rect;
2336#ifndef SetWindowStandardState
2337	PyMac_PRECHECK(SetWindowStandardState);
2338#endif
2339	if (!PyArg_ParseTuple(_args, "O&",
2340	                      PyMac_GetRect, &rect))
2341		return NULL;
2342	SetWindowStandardState(_self->ob_itself,
2343	                       &rect);
2344	Py_INCREF(Py_None);
2345	_res = Py_None;
2346	return _res;
2347}
2348
2349static PyObject *WinObj_SetWindowUserState(WindowObject *_self, PyObject *_args)
2350{
2351	PyObject *_res = NULL;
2352	Rect rect;
2353#ifndef SetWindowUserState
2354	PyMac_PRECHECK(SetWindowUserState);
2355#endif
2356	if (!PyArg_ParseTuple(_args, "O&",
2357	                      PyMac_GetRect, &rect))
2358		return NULL;
2359	SetWindowUserState(_self->ob_itself,
2360	                   &rect);
2361	Py_INCREF(Py_None);
2362	_res = Py_None;
2363	return _res;
2364}
2365
2366static PyObject *WinObj_SetPortWindowPort(WindowObject *_self, PyObject *_args)
2367{
2368	PyObject *_res = NULL;
2369#ifndef SetPortWindowPort
2370	PyMac_PRECHECK(SetPortWindowPort);
2371#endif
2372	if (!PyArg_ParseTuple(_args, ""))
2373		return NULL;
2374	SetPortWindowPort(_self->ob_itself);
2375	Py_INCREF(Py_None);
2376	_res = Py_None;
2377	return _res;
2378}
2379
2380static PyObject *WinObj_GetWindowPortBounds(WindowObject *_self, PyObject *_args)
2381{
2382	PyObject *_res = NULL;
2383	Rect bounds;
2384#ifndef GetWindowPortBounds
2385	PyMac_PRECHECK(GetWindowPortBounds);
2386#endif
2387	if (!PyArg_ParseTuple(_args, ""))
2388		return NULL;
2389	GetWindowPortBounds(_self->ob_itself,
2390	                    &bounds);
2391	_res = Py_BuildValue("O&",
2392	                     PyMac_BuildRect, &bounds);
2393	return _res;
2394}
2395
2396static PyObject *WinObj_IsWindowVisible(WindowObject *_self, PyObject *_args)
2397{
2398	PyObject *_res = NULL;
2399	Boolean _rv;
2400#ifndef IsWindowVisible
2401	PyMac_PRECHECK(IsWindowVisible);
2402#endif
2403	if (!PyArg_ParseTuple(_args, ""))
2404		return NULL;
2405	_rv = IsWindowVisible(_self->ob_itself);
2406	_res = Py_BuildValue("b",
2407	                     _rv);
2408	return _res;
2409}
2410
2411#if !TARGET_API_MAC_CARBON
2412
2413static PyObject *WinObj_GetWindowZoomFlag(WindowObject *_self, PyObject *_args)
2414{
2415	PyObject *_res = NULL;
2416	Boolean _rv;
2417#ifndef GetWindowZoomFlag
2418	PyMac_PRECHECK(GetWindowZoomFlag);
2419#endif
2420	if (!PyArg_ParseTuple(_args, ""))
2421		return NULL;
2422	_rv = GetWindowZoomFlag(_self->ob_itself);
2423	_res = Py_BuildValue("b",
2424	                     _rv);
2425	return _res;
2426}
2427#endif
2428
2429static PyObject *WinObj_GetWindowStructureRgn(WindowObject *_self, PyObject *_args)
2430{
2431	PyObject *_res = NULL;
2432	RgnHandle r;
2433#ifndef GetWindowStructureRgn
2434	PyMac_PRECHECK(GetWindowStructureRgn);
2435#endif
2436	if (!PyArg_ParseTuple(_args, "O&",
2437	                      ResObj_Convert, &r))
2438		return NULL;
2439	GetWindowStructureRgn(_self->ob_itself,
2440	                      r);
2441	Py_INCREF(Py_None);
2442	_res = Py_None;
2443	return _res;
2444}
2445
2446static PyObject *WinObj_GetWindowContentRgn(WindowObject *_self, PyObject *_args)
2447{
2448	PyObject *_res = NULL;
2449	RgnHandle r;
2450#ifndef GetWindowContentRgn
2451	PyMac_PRECHECK(GetWindowContentRgn);
2452#endif
2453	if (!PyArg_ParseTuple(_args, "O&",
2454	                      ResObj_Convert, &r))
2455		return NULL;
2456	GetWindowContentRgn(_self->ob_itself,
2457	                    r);
2458	Py_INCREF(Py_None);
2459	_res = Py_None;
2460	return _res;
2461}
2462
2463static PyObject *WinObj_GetWindowUpdateRgn(WindowObject *_self, PyObject *_args)
2464{
2465	PyObject *_res = NULL;
2466	RgnHandle r;
2467#ifndef GetWindowUpdateRgn
2468	PyMac_PRECHECK(GetWindowUpdateRgn);
2469#endif
2470	if (!PyArg_ParseTuple(_args, "O&",
2471	                      ResObj_Convert, &r))
2472		return NULL;
2473	GetWindowUpdateRgn(_self->ob_itself,
2474	                   r);
2475	Py_INCREF(Py_None);
2476	_res = Py_None;
2477	return _res;
2478}
2479
2480#if !TARGET_API_MAC_CARBON
2481
2482static PyObject *WinObj_GetWindowTitleWidth(WindowObject *_self, PyObject *_args)
2483{
2484	PyObject *_res = NULL;
2485	short _rv;
2486#ifndef GetWindowTitleWidth
2487	PyMac_PRECHECK(GetWindowTitleWidth);
2488#endif
2489	if (!PyArg_ParseTuple(_args, ""))
2490		return NULL;
2491	_rv = GetWindowTitleWidth(_self->ob_itself);
2492	_res = Py_BuildValue("h",
2493	                     _rv);
2494	return _res;
2495}
2496#endif
2497
2498static PyObject *WinObj_GetNextWindow(WindowObject *_self, PyObject *_args)
2499{
2500	PyObject *_res = NULL;
2501	WindowPtr _rv;
2502#ifndef GetNextWindow
2503	PyMac_PRECHECK(GetNextWindow);
2504#endif
2505	if (!PyArg_ParseTuple(_args, ""))
2506		return NULL;
2507	_rv = GetNextWindow(_self->ob_itself);
2508	_res = Py_BuildValue("O&",
2509	                     WinObj_WhichWindow, _rv);
2510	return _res;
2511}
2512
2513#if !TARGET_API_MAC_CARBON
2514
2515static PyObject *WinObj_CloseWindow(WindowObject *_self, PyObject *_args)
2516{
2517	PyObject *_res = NULL;
2518#ifndef CloseWindow
2519	PyMac_PRECHECK(CloseWindow);
2520#endif
2521	if (!PyArg_ParseTuple(_args, ""))
2522		return NULL;
2523	CloseWindow(_self->ob_itself);
2524	Py_INCREF(Py_None);
2525	_res = Py_None;
2526	return _res;
2527}
2528#endif
2529
2530static PyObject *WinObj_MoveWindow(WindowObject *_self, PyObject *_args)
2531{
2532	PyObject *_res = NULL;
2533	short hGlobal;
2534	short vGlobal;
2535	Boolean front;
2536#ifndef MoveWindow
2537	PyMac_PRECHECK(MoveWindow);
2538#endif
2539	if (!PyArg_ParseTuple(_args, "hhb",
2540	                      &hGlobal,
2541	                      &vGlobal,
2542	                      &front))
2543		return NULL;
2544	MoveWindow(_self->ob_itself,
2545	           hGlobal,
2546	           vGlobal,
2547	           front);
2548	Py_INCREF(Py_None);
2549	_res = Py_None;
2550	return _res;
2551}
2552
2553static PyObject *WinObj_ShowWindow(WindowObject *_self, PyObject *_args)
2554{
2555	PyObject *_res = NULL;
2556#ifndef ShowWindow
2557	PyMac_PRECHECK(ShowWindow);
2558#endif
2559	if (!PyArg_ParseTuple(_args, ""))
2560		return NULL;
2561	ShowWindow(_self->ob_itself);
2562	Py_INCREF(Py_None);
2563	_res = Py_None;
2564	return _res;
2565}
2566
2567static PyMethodDef WinObj_methods[] = {
2568	{"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1,
2569	 "() -> (UInt32 outCount)"},
2570	{"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1,
2571	 "() -> None"},
2572
2573#if !TARGET_API_MAC_OS8
2574	{"GetWindowRetainCount", (PyCFunction)WinObj_GetWindowRetainCount, 1,
2575	 "() -> (ItemCount _rv)"},
2576#endif
2577
2578#if !TARGET_API_MAC_OS8
2579	{"RetainWindow", (PyCFunction)WinObj_RetainWindow, 1,
2580	 "() -> None"},
2581#endif
2582
2583#if !TARGET_API_MAC_OS8
2584	{"ReleaseWindow", (PyCFunction)WinObj_ReleaseWindow, 1,
2585	 "() -> None"},
2586#endif
2587
2588#if !TARGET_API_MAC_OS8
2589	{"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1,
2590	 "() -> None"},
2591#endif
2592	{"GetWindowWidgetHilite", (PyCFunction)WinObj_GetWindowWidgetHilite, 1,
2593	 "() -> (WindowDefPartCode outHilite)"},
2594	{"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1,
2595	 "() -> (WindowClass outClass)"},
2596	{"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1,
2597	 "() -> (WindowAttributes outAttributes)"},
2598
2599#if !TARGET_API_MAC_OS8
2600	{"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1,
2601	 "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"},
2602#endif
2603
2604#if !TARGET_API_MAC_OS8
2605	{"SetWindowClass", (PyCFunction)WinObj_SetWindowClass, 1,
2606	 "(WindowClass inWindowClass) -> None"},
2607#endif
2608
2609#if !TARGET_API_MAC_OS8
2610	{"SetWindowModality", (PyCFunction)WinObj_SetWindowModality, 1,
2611	 "(WindowModality inModalKind, WindowPtr inUnavailableWindow) -> None"},
2612#endif
2613
2614#if !TARGET_API_MAC_OS8
2615	{"GetWindowModality", (PyCFunction)WinObj_GetWindowModality, 1,
2616	 "() -> (WindowModality outModalKind, WindowPtr outUnavailableWindow)"},
2617#endif
2618
2619#if !TARGET_API_MAC_CARBON
2620	{"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1,
2621	 "(WCTabHandle newColorTable) -> None"},
2622#endif
2623	{"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1,
2624	 "(RGBColor color) -> None"},
2625	{"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1,
2626	 "() -> (RGBColor color)"},
2627	{"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1,
2628	 "(PixPatHandle outPixPat) -> None"},
2629	{"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1,
2630	 "(PixPatHandle pixPat) -> None"},
2631
2632#if !TARGET_API_MAC_OS8
2633	{"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1,
2634	 "(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
2635#endif
2636
2637#if !TARGET_API_MAC_OS8
2638	{"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1,
2639	 "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
2640#endif
2641	{"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
2642	 "() -> None"},
2643
2644#if !TARGET_API_MAC_CARBON
2645	{"SaveOld", (PyCFunction)WinObj_SaveOld, 1,
2646	 "() -> None"},
2647#endif
2648
2649#if !TARGET_API_MAC_CARBON
2650	{"DrawNew", (PyCFunction)WinObj_DrawNew, 1,
2651	 "(Boolean update) -> None"},
2652#endif
2653	{"PaintOne", (PyCFunction)WinObj_PaintOne, 1,
2654	 "(RgnHandle clobberedRgn) -> None"},
2655	{"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1,
2656	 "(RgnHandle clobberedRgn) -> None"},
2657	{"CalcVis", (PyCFunction)WinObj_CalcVis, 1,
2658	 "() -> None"},
2659	{"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1,
2660	 "(RgnHandle clobberedRgn) -> None"},
2661	{"BringToFront", (PyCFunction)WinObj_BringToFront, 1,
2662	 "() -> None"},
2663	{"SendBehind", (PyCFunction)WinObj_SendBehind, 1,
2664	 "(WindowPtr behindWindow) -> None"},
2665	{"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1,
2666	 "() -> None"},
2667
2668#if !TARGET_API_MAC_OS8
2669	{"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1,
2670	 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
2671#endif
2672
2673#if !TARGET_API_MAC_OS8
2674	{"SetWindowAlternateTitle", (PyCFunction)WinObj_SetWindowAlternateTitle, 1,
2675	 "(CFStringRef inTitle) -> None"},
2676#endif
2677
2678#if !TARGET_API_MAC_OS8
2679	{"CopyWindowAlternateTitle", (PyCFunction)WinObj_CopyWindowAlternateTitle, 1,
2680	 "() -> (CFStringRef outTitle)"},
2681#endif
2682
2683#if !TARGET_API_MAC_CARBON
2684	{"IsValidWindowPtr", (PyCFunction)WinObj_IsValidWindowPtr, 1,
2685	 "() -> (Boolean _rv)"},
2686#endif
2687	{"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1,
2688	 "(Boolean fHilite) -> None"},
2689	{"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1,
2690	 "(long data) -> None"},
2691	{"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1,
2692	 "() -> (long _rv)"},
2693	{"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1,
2694	 "(PicHandle pic) -> None"},
2695	{"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1,
2696	 "() -> (PicHandle _rv)"},
2697	{"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1,
2698	 "() -> (short _rv)"},
2699	{"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1,
2700	 "() -> (UInt32 outFeatures)"},
2701	{"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1,
2702	 "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"},
2703	{"GetWindowStructureWidths", (PyCFunction)WinObj_GetWindowStructureWidths, 1,
2704	 "() -> (Rect outRect)"},
2705	{"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1,
2706	 "() -> None"},
2707	{"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1,
2708	 "() -> None"},
2709	{"InvalWindowRgn", (PyCFunction)WinObj_InvalWindowRgn, 1,
2710	 "(RgnHandle region) -> None"},
2711	{"InvalWindowRect", (PyCFunction)WinObj_InvalWindowRect, 1,
2712	 "(Rect bounds) -> None"},
2713	{"ValidWindowRgn", (PyCFunction)WinObj_ValidWindowRgn, 1,
2714	 "(RgnHandle region) -> None"},
2715	{"ValidWindowRect", (PyCFunction)WinObj_ValidWindowRect, 1,
2716	 "(Rect bounds) -> None"},
2717	{"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1,
2718	 "() -> None"},
2719	{"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1,
2720	 "(Str255 title) -> None"},
2721	{"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1,
2722	 "() -> (Str255 title)"},
2723
2724#if !TARGET_API_MAC_OS8
2725	{"SetWindowTitleWithCFString", (PyCFunction)WinObj_SetWindowTitleWithCFString, 1,
2726	 "(CFStringRef inString) -> None"},
2727#endif
2728
2729#if !TARGET_API_MAC_OS8
2730	{"CopyWindowTitleAsCFString", (PyCFunction)WinObj_CopyWindowTitleAsCFString, 1,
2731	 "() -> (CFStringRef outString)"},
2732#endif
2733	{"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1,
2734	 "(FSSpec inFile) -> None"},
2735	{"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1,
2736	 "() -> (FSSpec outFile)"},
2737	{"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1,
2738	 "(AliasHandle alias) -> None"},
2739	{"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1,
2740	 "() -> (AliasHandle alias)"},
2741	{"SetWindowProxyCreatorAndType", (PyCFunction)WinObj_SetWindowProxyCreatorAndType, 1,
2742	 "(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None"},
2743	{"GetWindowProxyIcon", (PyCFunction)WinObj_GetWindowProxyIcon, 1,
2744	 "() -> (IconRef outIcon)"},
2745	{"SetWindowProxyIcon", (PyCFunction)WinObj_SetWindowProxyIcon, 1,
2746	 "(IconRef icon) -> None"},
2747	{"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1,
2748	 "() -> None"},
2749	{"BeginWindowProxyDrag", (PyCFunction)WinObj_BeginWindowProxyDrag, 1,
2750	 "(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)"},
2751	{"EndWindowProxyDrag", (PyCFunction)WinObj_EndWindowProxyDrag, 1,
2752	 "(DragReference theDrag) -> None"},
2753	{"TrackWindowProxyFromExistingDrag", (PyCFunction)WinObj_TrackWindowProxyFromExistingDrag, 1,
2754	 "(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None"},
2755	{"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1,
2756	 "(Point startPt) -> None"},
2757	{"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1,
2758	 "() -> (Boolean _rv)"},
2759	{"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1,
2760	 "(Boolean modified) -> None"},
2761	{"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1,
2762	 "(EventRecord event) -> (Boolean _rv)"},
2763	{"WindowPathSelect", (PyCFunction)WinObj_WindowPathSelect, 1,
2764	 "(MenuHandle menu) -> (SInt32 outMenuResult)"},
2765	{"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1,
2766	 "(Boolean hilited) -> None"},
2767	{"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1,
2768	 "(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"},
2769
2770#if TARGET_API_MAC_OSX
2771	{"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1,
2772	 "(WindowPtr parentWindow, WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"},
2773#endif
2774	{"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1,
2775	 "(short hGlobal, short vGlobal, Boolean front) -> None"},
2776	{"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1,
2777	 "(short w, short h, Boolean fUpdate) -> None"},
2778	{"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1,
2779	 "(Point startPt, Rect bBox) -> (long _rv)"},
2780	{"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
2781	 "(Point startPt, Rect boundsRect) -> None"},
2782	{"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1,
2783	 "(WindowPartCode partCode, Boolean front) -> None"},
2784	{"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1,
2785	 "() -> (Boolean _rv)"},
2786	{"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1,
2787	 "() -> (Boolean _rv)"},
2788	{"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1,
2789	 "(Boolean collapse) -> None"},
2790	{"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1,
2791	 "(WindowRegionCode regionCode) -> (Rect globalBounds)"},
2792	{"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1,
2793	 "(Point startPoint, Rect sizeConstraints) -> (Boolean _rv, Rect newContentRect)"},
2794	{"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1,
2795	 "(WindowRegionCode regionCode, Rect globalBounds) -> None"},
2796	{"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1,
2797	 "(WindowPtr parentWindow, WindowPositionMethod method) -> None"},
2798	{"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1,
2799	 "(short hGlobal, short vGlobal) -> None"},
2800	{"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1,
2801	 "() -> (Boolean _rv, Point idealSize, Rect idealStandardState)"},
2802	{"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1,
2803	 "(WindowPartCode partCode) -> (Point ioIdealSize)"},
2804	{"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1,
2805	 "() -> (Rect userState)"},
2806	{"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1,
2807	 "(Rect userState) -> None"},
2808
2809#if !TARGET_API_MAC_OS8
2810	{"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1,
2811	 "(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)"},
2812#endif
2813
2814#if !TARGET_API_MAC_OS8
2815	{"ConstrainWindowToScreen", (PyCFunction)WinObj_ConstrainWindowToScreen, 1,
2816	 "(WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, Rect inScreenRect) -> (Rect outStructure)"},
2817#endif
2818	{"HideWindow", (PyCFunction)WinObj_HideWindow, 1,
2819	 "() -> None"},
2820	{"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1,
2821	 "() -> None"},
2822	{"ShowHide", (PyCFunction)WinObj_ShowHide, 1,
2823	 "(Boolean showFlag) -> None"},
2824	{"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1,
2825	 "() -> (Boolean _rv)"},
2826
2827#if !TARGET_API_MAC_OS8
2828	{"ShowSheetWindow", (PyCFunction)WinObj_ShowSheetWindow, 1,
2829	 "(WindowPtr inParentWindow) -> None"},
2830#endif
2831
2832#if !TARGET_API_MAC_OS8
2833	{"HideSheetWindow", (PyCFunction)WinObj_HideSheetWindow, 1,
2834	 "() -> None"},
2835#endif
2836
2837#if !TARGET_API_MAC_OS8
2838	{"GetSheetWindowParent", (PyCFunction)WinObj_GetSheetWindowParent, 1,
2839	 "() -> (WindowPtr outParentWindow)"},
2840#endif
2841
2842#if !TARGET_API_MAC_OS8
2843	{"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1,
2844	 "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
2845#endif
2846
2847#if !TARGET_API_MAC_OS8
2848	{"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1,
2849	 "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
2850#endif
2851	{"TrackBox", (PyCFunction)WinObj_TrackBox, 1,
2852	 "(Point thePt, WindowPartCode partCode) -> (Boolean _rv)"},
2853	{"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1,
2854	 "(Point thePt) -> (Boolean _rv)"},
2855
2856#if !TARGET_API_MAC_CARBON
2857	{"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1,
2858	 "() -> (Boolean _rv, AuxWinHandle awHndl)"},
2859#endif
2860
2861#if !TARGET_API_MAC_CARBON
2862	{"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1,
2863	 "() -> (Boolean _rv)"},
2864#endif
2865
2866#if !TARGET_API_MAC_CARBON
2867	{"GetWindowSpareFlag", (PyCFunction)WinObj_GetWindowSpareFlag, 1,
2868	 "() -> (Boolean _rv)"},
2869#endif
2870	{"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1,
2871	 "() -> (CGrafPtr _rv)"},
2872	{"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1,
2873	 "() -> (short _rv)"},
2874	{"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1,
2875	 "() -> (Boolean _rv)"},
2876
2877#if !TARGET_API_MAC_OS8
2878	{"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1,
2879	 "() -> (Boolean _rv)"},
2880#endif
2881	{"MacGetNextWindow", (PyCFunction)WinObj_MacGetNextWindow, 1,
2882	 "() -> (WindowPtr _rv)"},
2883	{"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1,
2884	 "() -> (Rect rect)"},
2885	{"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1,
2886	 "() -> (Rect rect)"},
2887	{"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1,
2888	 "(short kind) -> None"},
2889	{"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1,
2890	 "(Rect rect) -> None"},
2891	{"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
2892	 "(Rect rect) -> None"},
2893	{"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1,
2894	 "() -> None"},
2895	{"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1,
2896	 "() -> (Rect bounds)"},
2897	{"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1,
2898	 "() -> (Boolean _rv)"},
2899
2900#if !TARGET_API_MAC_CARBON
2901	{"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1,
2902	 "() -> (Boolean _rv)"},
2903#endif
2904	{"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1,
2905	 "(RgnHandle r) -> None"},
2906	{"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1,
2907	 "(RgnHandle r) -> None"},
2908	{"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1,
2909	 "(RgnHandle r) -> None"},
2910
2911#if !TARGET_API_MAC_CARBON
2912	{"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1,
2913	 "() -> (short _rv)"},
2914#endif
2915	{"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
2916	 "() -> (WindowPtr _rv)"},
2917
2918#if !TARGET_API_MAC_CARBON
2919	{"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1,
2920	 "() -> None"},
2921#endif
2922	{"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,
2923	 "(short hGlobal, short vGlobal, Boolean front) -> None"},
2924	{"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1,
2925	 "() -> None"},
2926	{NULL, NULL, 0}
2927};
2928
2929PyMethodChain WinObj_chain = { WinObj_methods, NULL };
2930
2931static PyObject *WinObj_getattr(WindowObject *self, char *name)
2932{
2933	return Py_FindMethodInChain(&WinObj_chain, (PyObject *)self, name);
2934}
2935
2936#define WinObj_setattr NULL
2937
2938static int WinObj_compare(WindowObject *self, WindowObject *other)
2939{
2940	if ( self->ob_itself > other->ob_itself ) return 1;
2941	if ( self->ob_itself < other->ob_itself ) return -1;
2942	return 0;
2943}
2944
2945static PyObject * WinObj_repr(WindowObject *self)
2946{
2947	char buf[100];
2948	sprintf(buf, "<Window object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
2949	return PyString_FromString(buf);
2950}
2951
2952static int WinObj_hash(WindowObject *self)
2953{
2954	return (int)self->ob_itself;
2955}
2956
2957PyTypeObject Window_Type = {
2958	PyObject_HEAD_INIT(NULL)
2959	0, /*ob_size*/
2960	"_Win.Window", /*tp_name*/
2961	sizeof(WindowObject), /*tp_basicsize*/
2962	0, /*tp_itemsize*/
2963	/* methods */
2964	(destructor) WinObj_dealloc, /*tp_dealloc*/
2965	0, /*tp_print*/
2966	(getattrfunc) WinObj_getattr, /*tp_getattr*/
2967	(setattrfunc) WinObj_setattr, /*tp_setattr*/
2968	(cmpfunc) WinObj_compare, /*tp_compare*/
2969	(reprfunc) WinObj_repr, /*tp_repr*/
2970	(PyNumberMethods *)0, /* tp_as_number */
2971	(PySequenceMethods *)0, /* tp_as_sequence */
2972	(PyMappingMethods *)0, /* tp_as_mapping */
2973	(hashfunc) WinObj_hash, /*tp_hash*/
2974};
2975
2976/* --------------------- End object type Window --------------------- */
2977
2978
2979static PyObject *Win_GetNewCWindow(PyObject *_self, PyObject *_args)
2980{
2981	PyObject *_res = NULL;
2982	WindowPtr _rv;
2983	short windowID;
2984	WindowPtr behind;
2985#ifndef GetNewCWindow
2986	PyMac_PRECHECK(GetNewCWindow);
2987#endif
2988	if (!PyArg_ParseTuple(_args, "hO&",
2989	                      &windowID,
2990	                      WinObj_Convert, &behind))
2991		return NULL;
2992	_rv = GetNewCWindow(windowID,
2993	                    (void *)0,
2994	                    behind);
2995	_res = Py_BuildValue("O&",
2996	                     WinObj_New, _rv);
2997	return _res;
2998}
2999
3000static PyObject *Win_NewWindow(PyObject *_self, PyObject *_args)
3001{
3002	PyObject *_res = NULL;
3003	WindowPtr _rv;
3004	Rect boundsRect;
3005	Str255 title;
3006	Boolean visible;
3007	short theProc;
3008	WindowPtr behind;
3009	Boolean goAwayFlag;
3010	long refCon;
3011#ifndef NewWindow
3012	PyMac_PRECHECK(NewWindow);
3013#endif
3014	if (!PyArg_ParseTuple(_args, "O&O&bhO&bl",
3015	                      PyMac_GetRect, &boundsRect,
3016	                      PyMac_GetStr255, title,
3017	                      &visible,
3018	                      &theProc,
3019	                      WinObj_Convert, &behind,
3020	                      &goAwayFlag,
3021	                      &refCon))
3022		return NULL;
3023	_rv = NewWindow((void *)0,
3024	                &boundsRect,
3025	                title,
3026	                visible,
3027	                theProc,
3028	                behind,
3029	                goAwayFlag,
3030	                refCon);
3031	_res = Py_BuildValue("O&",
3032	                     WinObj_New, _rv);
3033	return _res;
3034}
3035
3036static PyObject *Win_GetNewWindow(PyObject *_self, PyObject *_args)
3037{
3038	PyObject *_res = NULL;
3039	WindowPtr _rv;
3040	short windowID;
3041	WindowPtr behind;
3042#ifndef GetNewWindow
3043	PyMac_PRECHECK(GetNewWindow);
3044#endif
3045	if (!PyArg_ParseTuple(_args, "hO&",
3046	                      &windowID,
3047	                      WinObj_Convert, &behind))
3048		return NULL;
3049	_rv = GetNewWindow(windowID,
3050	                   (void *)0,
3051	                   behind);
3052	_res = Py_BuildValue("O&",
3053	                     WinObj_New, _rv);
3054	return _res;
3055}
3056
3057static PyObject *Win_NewCWindow(PyObject *_self, PyObject *_args)
3058{
3059	PyObject *_res = NULL;
3060	WindowPtr _rv;
3061	Rect boundsRect;
3062	Str255 title;
3063	Boolean visible;
3064	short procID;
3065	WindowPtr behind;
3066	Boolean goAwayFlag;
3067	long refCon;
3068#ifndef NewCWindow
3069	PyMac_PRECHECK(NewCWindow);
3070#endif
3071	if (!PyArg_ParseTuple(_args, "O&O&bhO&bl",
3072	                      PyMac_GetRect, &boundsRect,
3073	                      PyMac_GetStr255, title,
3074	                      &visible,
3075	                      &procID,
3076	                      WinObj_Convert, &behind,
3077	                      &goAwayFlag,
3078	                      &refCon))
3079		return NULL;
3080	_rv = NewCWindow((void *)0,
3081	                 &boundsRect,
3082	                 title,
3083	                 visible,
3084	                 procID,
3085	                 behind,
3086	                 goAwayFlag,
3087	                 refCon);
3088	_res = Py_BuildValue("O&",
3089	                     WinObj_New, _rv);
3090	return _res;
3091}
3092
3093static PyObject *Win_CreateNewWindow(PyObject *_self, PyObject *_args)
3094{
3095	PyObject *_res = NULL;
3096	OSStatus _err;
3097	WindowClass windowClass;
3098	WindowAttributes attributes;
3099	Rect contentBounds;
3100	WindowPtr outWindow;
3101#ifndef CreateNewWindow
3102	PyMac_PRECHECK(CreateNewWindow);
3103#endif
3104	if (!PyArg_ParseTuple(_args, "llO&",
3105	                      &windowClass,
3106	                      &attributes,
3107	                      PyMac_GetRect, &contentBounds))
3108		return NULL;
3109	_err = CreateNewWindow(windowClass,
3110	                       attributes,
3111	                       &contentBounds,
3112	                       &outWindow);
3113	if (_err != noErr) return PyMac_Error(_err);
3114	_res = Py_BuildValue("O&",
3115	                     WinObj_WhichWindow, outWindow);
3116	return _res;
3117}
3118
3119static PyObject *Win_CreateWindowFromResource(PyObject *_self, PyObject *_args)
3120{
3121	PyObject *_res = NULL;
3122	OSStatus _err;
3123	SInt16 resID;
3124	WindowPtr outWindow;
3125#ifndef CreateWindowFromResource
3126	PyMac_PRECHECK(CreateWindowFromResource);
3127#endif
3128	if (!PyArg_ParseTuple(_args, "h",
3129	                      &resID))
3130		return NULL;
3131	_err = CreateWindowFromResource(resID,
3132	                                &outWindow);
3133	if (_err != noErr) return PyMac_Error(_err);
3134	_res = Py_BuildValue("O&",
3135	                     WinObj_WhichWindow, outWindow);
3136	return _res;
3137}
3138
3139static PyObject *Win_ShowFloatingWindows(PyObject *_self, PyObject *_args)
3140{
3141	PyObject *_res = NULL;
3142	OSStatus _err;
3143#ifndef ShowFloatingWindows
3144	PyMac_PRECHECK(ShowFloatingWindows);
3145#endif
3146	if (!PyArg_ParseTuple(_args, ""))
3147		return NULL;
3148	_err = ShowFloatingWindows();
3149	if (_err != noErr) return PyMac_Error(_err);
3150	Py_INCREF(Py_None);
3151	_res = Py_None;
3152	return _res;
3153}
3154
3155static PyObject *Win_HideFloatingWindows(PyObject *_self, PyObject *_args)
3156{
3157	PyObject *_res = NULL;
3158	OSStatus _err;
3159#ifndef HideFloatingWindows
3160	PyMac_PRECHECK(HideFloatingWindows);
3161#endif
3162	if (!PyArg_ParseTuple(_args, ""))
3163		return NULL;
3164	_err = HideFloatingWindows();
3165	if (_err != noErr) return PyMac_Error(_err);
3166	Py_INCREF(Py_None);
3167	_res = Py_None;
3168	return _res;
3169}
3170
3171static PyObject *Win_AreFloatingWindowsVisible(PyObject *_self, PyObject *_args)
3172{
3173	PyObject *_res = NULL;
3174	Boolean _rv;
3175#ifndef AreFloatingWindowsVisible
3176	PyMac_PRECHECK(AreFloatingWindowsVisible);
3177#endif
3178	if (!PyArg_ParseTuple(_args, ""))
3179		return NULL;
3180	_rv = AreFloatingWindowsVisible();
3181	_res = Py_BuildValue("b",
3182	                     _rv);
3183	return _res;
3184}
3185
3186#if !TARGET_API_MAC_CARBON
3187
3188static PyObject *Win_SetDeskCPat(PyObject *_self, PyObject *_args)
3189{
3190	PyObject *_res = NULL;
3191	PixPatHandle deskPixPat;
3192#ifndef SetDeskCPat
3193	PyMac_PRECHECK(SetDeskCPat);
3194#endif
3195	if (!PyArg_ParseTuple(_args, "O&",
3196	                      ResObj_Convert, &deskPixPat))
3197		return NULL;
3198	SetDeskCPat(deskPixPat);
3199	Py_INCREF(Py_None);
3200	_res = Py_None;
3201	return _res;
3202}
3203#endif
3204
3205static PyObject *Win_CheckUpdate(PyObject *_self, PyObject *_args)
3206{
3207	PyObject *_res = NULL;
3208	Boolean _rv;
3209	EventRecord theEvent;
3210#ifndef CheckUpdate
3211	PyMac_PRECHECK(CheckUpdate);
3212#endif
3213	if (!PyArg_ParseTuple(_args, ""))
3214		return NULL;
3215	_rv = CheckUpdate(&theEvent);
3216	_res = Py_BuildValue("bO&",
3217	                     _rv,
3218	                     PyMac_BuildEventRecord, &theEvent);
3219	return _res;
3220}
3221
3222static PyObject *Win_MacFindWindow(PyObject *_self, PyObject *_args)
3223{
3224	PyObject *_res = NULL;
3225	WindowPartCode _rv;
3226	Point thePoint;
3227	WindowPtr window;
3228#ifndef MacFindWindow
3229	PyMac_PRECHECK(MacFindWindow);
3230#endif
3231	if (!PyArg_ParseTuple(_args, "O&",
3232	                      PyMac_GetPoint, &thePoint))
3233		return NULL;
3234	_rv = MacFindWindow(thePoint,
3235	                    &window);
3236	_res = Py_BuildValue("hO&",
3237	                     _rv,
3238	                     WinObj_WhichWindow, window);
3239	return _res;
3240}
3241
3242static PyObject *Win_FrontWindow(PyObject *_self, PyObject *_args)
3243{
3244	PyObject *_res = NULL;
3245	WindowPtr _rv;
3246#ifndef FrontWindow
3247	PyMac_PRECHECK(FrontWindow);
3248#endif
3249	if (!PyArg_ParseTuple(_args, ""))
3250		return NULL;
3251	_rv = FrontWindow();
3252	_res = Py_BuildValue("O&",
3253	                     WinObj_WhichWindow, _rv);
3254	return _res;
3255}
3256
3257static PyObject *Win_FrontNonFloatingWindow(PyObject *_self, PyObject *_args)
3258{
3259	PyObject *_res = NULL;
3260	WindowPtr _rv;
3261#ifndef FrontNonFloatingWindow
3262	PyMac_PRECHECK(FrontNonFloatingWindow);
3263#endif
3264	if (!PyArg_ParseTuple(_args, ""))
3265		return NULL;
3266	_rv = FrontNonFloatingWindow();
3267	_res = Py_BuildValue("O&",
3268	                     WinObj_WhichWindow, _rv);
3269	return _res;
3270}
3271
3272#if !TARGET_API_MAC_OS8
3273
3274static PyObject *Win_GetFrontWindowOfClass(PyObject *_self, PyObject *_args)
3275{
3276	PyObject *_res = NULL;
3277	WindowPtr _rv;
3278	WindowClass inWindowClass;
3279	Boolean mustBeVisible;
3280#ifndef GetFrontWindowOfClass
3281	PyMac_PRECHECK(GetFrontWindowOfClass);
3282#endif
3283	if (!PyArg_ParseTuple(_args, "lb",
3284	                      &inWindowClass,
3285	                      &mustBeVisible))
3286		return NULL;
3287	_rv = GetFrontWindowOfClass(inWindowClass,
3288	                            mustBeVisible);
3289	_res = Py_BuildValue("O&",
3290	                     WinObj_New, _rv);
3291	return _res;
3292}
3293#endif
3294
3295#if !TARGET_API_MAC_OS8
3296
3297static PyObject *Win_FindWindowOfClass(PyObject *_self, PyObject *_args)
3298{
3299	PyObject *_res = NULL;
3300	OSStatus _err;
3301	Point where;
3302	WindowClass inWindowClass;
3303	WindowPtr outWindow;
3304	WindowPartCode outWindowPart;
3305#ifndef FindWindowOfClass
3306	PyMac_PRECHECK(FindWindowOfClass);
3307#endif
3308	if (!PyArg_ParseTuple(_args, "O&l",
3309	                      PyMac_GetPoint, &where,
3310	                      &inWindowClass))
3311		return NULL;
3312	_err = FindWindowOfClass(&where,
3313	                         inWindowClass,
3314	                         &outWindow,
3315	                         &outWindowPart);
3316	if (_err != noErr) return PyMac_Error(_err);
3317	_res = Py_BuildValue("O&h",
3318	                     WinObj_WhichWindow, outWindow,
3319	                     outWindowPart);
3320	return _res;
3321}
3322#endif
3323
3324#if !TARGET_API_MAC_OS8
3325
3326static PyObject *Win_CreateStandardWindowMenu(PyObject *_self, PyObject *_args)
3327{
3328	PyObject *_res = NULL;
3329	OSStatus _err;
3330	OptionBits inOptions;
3331	MenuHandle outMenu;
3332#ifndef CreateStandardWindowMenu
3333	PyMac_PRECHECK(CreateStandardWindowMenu);
3334#endif
3335	if (!PyArg_ParseTuple(_args, "l",
3336	                      &inOptions))
3337		return NULL;
3338	_err = CreateStandardWindowMenu(inOptions,
3339	                                &outMenu);
3340	if (_err != noErr) return PyMac_Error(_err);
3341	_res = Py_BuildValue("O&",
3342	                     MenuObj_New, outMenu);
3343	return _res;
3344}
3345#endif
3346
3347#if !TARGET_API_MAC_CARBON
3348
3349static PyObject *Win_InitWindows(PyObject *_self, PyObject *_args)
3350{
3351	PyObject *_res = NULL;
3352#ifndef InitWindows
3353	PyMac_PRECHECK(InitWindows);
3354#endif
3355	if (!PyArg_ParseTuple(_args, ""))
3356		return NULL;
3357	InitWindows();
3358	Py_INCREF(Py_None);
3359	_res = Py_None;
3360	return _res;
3361}
3362#endif
3363
3364#if !TARGET_API_MAC_CARBON
3365
3366static PyObject *Win_GetWMgrPort(PyObject *_self, PyObject *_args)
3367{
3368	PyObject *_res = NULL;
3369	GrafPtr wPort;
3370#ifndef GetWMgrPort
3371	PyMac_PRECHECK(GetWMgrPort);
3372#endif
3373	if (!PyArg_ParseTuple(_args, ""))
3374		return NULL;
3375	GetWMgrPort(&wPort);
3376	_res = Py_BuildValue("O&",
3377	                     GrafObj_New, wPort);
3378	return _res;
3379}
3380#endif
3381
3382#if !TARGET_API_MAC_CARBON
3383
3384static PyObject *Win_GetCWMgrPort(PyObject *_self, PyObject *_args)
3385{
3386	PyObject *_res = NULL;
3387	CGrafPtr wMgrCPort;
3388#ifndef GetCWMgrPort
3389	PyMac_PRECHECK(GetCWMgrPort);
3390#endif
3391	if (!PyArg_ParseTuple(_args, ""))
3392		return NULL;
3393	GetCWMgrPort(&wMgrCPort);
3394	_res = Py_BuildValue("O&",
3395	                     GrafObj_New, wMgrCPort);
3396	return _res;
3397}
3398#endif
3399
3400#if !TARGET_API_MAC_CARBON
3401
3402static PyObject *Win_InitFloatingWindows(PyObject *_self, PyObject *_args)
3403{
3404	PyObject *_res = NULL;
3405	OSStatus _err;
3406#ifndef InitFloatingWindows
3407	PyMac_PRECHECK(InitFloatingWindows);
3408#endif
3409	if (!PyArg_ParseTuple(_args, ""))
3410		return NULL;
3411	_err = InitFloatingWindows();
3412	if (_err != noErr) return PyMac_Error(_err);
3413	Py_INCREF(Py_None);
3414	_res = Py_None;
3415	return _res;
3416}
3417#endif
3418
3419#if !TARGET_API_MAC_CARBON
3420
3421static PyObject *Win_InvalRect(PyObject *_self, PyObject *_args)
3422{
3423	PyObject *_res = NULL;
3424	Rect badRect;
3425#ifndef InvalRect
3426	PyMac_PRECHECK(InvalRect);
3427#endif
3428	if (!PyArg_ParseTuple(_args, "O&",
3429	                      PyMac_GetRect, &badRect))
3430		return NULL;
3431	InvalRect(&badRect);
3432	Py_INCREF(Py_None);
3433	_res = Py_None;
3434	return _res;
3435}
3436#endif
3437
3438#if !TARGET_API_MAC_CARBON
3439
3440static PyObject *Win_InvalRgn(PyObject *_self, PyObject *_args)
3441{
3442	PyObject *_res = NULL;
3443	RgnHandle badRgn;
3444#ifndef InvalRgn
3445	PyMac_PRECHECK(InvalRgn);
3446#endif
3447	if (!PyArg_ParseTuple(_args, "O&",
3448	                      ResObj_Convert, &badRgn))
3449		return NULL;
3450	InvalRgn(badRgn);
3451	Py_INCREF(Py_None);
3452	_res = Py_None;
3453	return _res;
3454}
3455#endif
3456
3457#if !TARGET_API_MAC_CARBON
3458
3459static PyObject *Win_ValidRect(PyObject *_self, PyObject *_args)
3460{
3461	PyObject *_res = NULL;
3462	Rect goodRect;
3463#ifndef ValidRect
3464	PyMac_PRECHECK(ValidRect);
3465#endif
3466	if (!PyArg_ParseTuple(_args, "O&",
3467	                      PyMac_GetRect, &goodRect))
3468		return NULL;
3469	ValidRect(&goodRect);
3470	Py_INCREF(Py_None);
3471	_res = Py_None;
3472	return _res;
3473}
3474#endif
3475
3476#if !TARGET_API_MAC_CARBON
3477
3478static PyObject *Win_ValidRgn(PyObject *_self, PyObject *_args)
3479{
3480	PyObject *_res = NULL;
3481	RgnHandle goodRgn;
3482#ifndef ValidRgn
3483	PyMac_PRECHECK(ValidRgn);
3484#endif
3485	if (!PyArg_ParseTuple(_args, "O&",
3486	                      ResObj_Convert, &goodRgn))
3487		return NULL;
3488	ValidRgn(goodRgn);
3489	Py_INCREF(Py_None);
3490	_res = Py_None;
3491	return _res;
3492}
3493#endif
3494
3495static PyObject *Win_CollapseAllWindows(PyObject *_self, PyObject *_args)
3496{
3497	PyObject *_res = NULL;
3498	OSStatus _err;
3499	Boolean collapse;
3500#ifndef CollapseAllWindows
3501	PyMac_PRECHECK(CollapseAllWindows);
3502#endif
3503	if (!PyArg_ParseTuple(_args, "b",
3504	                      &collapse))
3505		return NULL;
3506	_err = CollapseAllWindows(collapse);
3507	if (_err != noErr) return PyMac_Error(_err);
3508	Py_INCREF(Py_None);
3509	_res = Py_None;
3510	return _res;
3511}
3512
3513#if !TARGET_API_MAC_OS8
3514
3515static PyObject *Win_GetAvailableWindowPositioningBounds(PyObject *_self, PyObject *_args)
3516{
3517	PyObject *_res = NULL;
3518	OSStatus _err;
3519	GDHandle inDevice;
3520	Rect availableRect;
3521#ifndef GetAvailableWindowPositioningBounds
3522	PyMac_PRECHECK(GetAvailableWindowPositioningBounds);
3523#endif
3524	if (!PyArg_ParseTuple(_args, "O&",
3525	                      ResObj_Convert, &inDevice))
3526		return NULL;
3527	_err = GetAvailableWindowPositioningBounds(inDevice,
3528	                                           &availableRect);
3529	if (_err != noErr) return PyMac_Error(_err);
3530	_res = Py_BuildValue("O&",
3531	                     PyMac_BuildRect, &availableRect);
3532	return _res;
3533}
3534#endif
3535
3536#if !TARGET_API_MAC_OS8
3537
3538static PyObject *Win_DisableScreenUpdates(PyObject *_self, PyObject *_args)
3539{
3540	PyObject *_res = NULL;
3541	OSStatus _err;
3542#ifndef DisableScreenUpdates
3543	PyMac_PRECHECK(DisableScreenUpdates);
3544#endif
3545	if (!PyArg_ParseTuple(_args, ""))
3546		return NULL;
3547	_err = DisableScreenUpdates();
3548	if (_err != noErr) return PyMac_Error(_err);
3549	Py_INCREF(Py_None);
3550	_res = Py_None;
3551	return _res;
3552}
3553#endif
3554
3555#if !TARGET_API_MAC_OS8
3556
3557static PyObject *Win_EnableScreenUpdates(PyObject *_self, PyObject *_args)
3558{
3559	PyObject *_res = NULL;
3560	OSStatus _err;
3561#ifndef EnableScreenUpdates
3562	PyMac_PRECHECK(EnableScreenUpdates);
3563#endif
3564	if (!PyArg_ParseTuple(_args, ""))
3565		return NULL;
3566	_err = EnableScreenUpdates();
3567	if (_err != noErr) return PyMac_Error(_err);
3568	Py_INCREF(Py_None);
3569	_res = Py_None;
3570	return _res;
3571}
3572#endif
3573
3574static PyObject *Win_PinRect(PyObject *_self, PyObject *_args)
3575{
3576	PyObject *_res = NULL;
3577	long _rv;
3578	Rect theRect;
3579	Point thePt;
3580#ifndef PinRect
3581	PyMac_PRECHECK(PinRect);
3582#endif
3583	if (!PyArg_ParseTuple(_args, "O&O&",
3584	                      PyMac_GetRect, &theRect,
3585	                      PyMac_GetPoint, &thePt))
3586		return NULL;
3587	_rv = PinRect(&theRect,
3588	              thePt);
3589	_res = Py_BuildValue("l",
3590	                     _rv);
3591	return _res;
3592}
3593
3594static PyObject *Win_GetGrayRgn(PyObject *_self, PyObject *_args)
3595{
3596	PyObject *_res = NULL;
3597	RgnHandle _rv;
3598#ifndef GetGrayRgn
3599	PyMac_PRECHECK(GetGrayRgn);
3600#endif
3601	if (!PyArg_ParseTuple(_args, ""))
3602		return NULL;
3603	_rv = GetGrayRgn();
3604	_res = Py_BuildValue("O&",
3605	                     ResObj_New, _rv);
3606	return _res;
3607}
3608
3609static PyObject *Win_GetWindowFromPort(PyObject *_self, PyObject *_args)
3610{
3611	PyObject *_res = NULL;
3612	WindowPtr _rv;
3613	CGrafPtr port;
3614#ifndef GetWindowFromPort
3615	PyMac_PRECHECK(GetWindowFromPort);
3616#endif
3617	if (!PyArg_ParseTuple(_args, "O&",
3618	                      GrafObj_Convert, &port))
3619		return NULL;
3620	_rv = GetWindowFromPort(port);
3621	_res = Py_BuildValue("O&",
3622	                     WinObj_New, _rv);
3623	return _res;
3624}
3625
3626static PyObject *Win_WhichWindow(PyObject *_self, PyObject *_args)
3627{
3628	PyObject *_res = NULL;
3629
3630	long ptr;
3631
3632	if ( !PyArg_ParseTuple(_args, "i", &ptr) )
3633		return NULL;
3634	_res = WinObj_WhichWindow((WindowPtr)ptr);
3635	return _res;
3636
3637}
3638
3639static PyObject *Win_FindWindow(PyObject *_self, PyObject *_args)
3640{
3641	PyObject *_res = NULL;
3642	short _rv;
3643	Point thePoint;
3644	WindowPtr theWindow;
3645#ifndef FindWindow
3646	PyMac_PRECHECK(FindWindow);
3647#endif
3648	if (!PyArg_ParseTuple(_args, "O&",
3649	                      PyMac_GetPoint, &thePoint))
3650		return NULL;
3651	_rv = FindWindow(thePoint,
3652	                 &theWindow);
3653	_res = Py_BuildValue("hO&",
3654	                     _rv,
3655	                     WinObj_WhichWindow, theWindow);
3656	return _res;
3657}
3658
3659static PyMethodDef Win_methods[] = {
3660	{"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1,
3661	 "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
3662	{"NewWindow", (PyCFunction)Win_NewWindow, 1,
3663	 "(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
3664	{"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1,
3665	 "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
3666	{"NewCWindow", (PyCFunction)Win_NewCWindow, 1,
3667	 "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
3668	{"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1,
3669	 "(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)"},
3670	{"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1,
3671	 "(SInt16 resID) -> (WindowPtr outWindow)"},
3672	{"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1,
3673	 "() -> None"},
3674	{"HideFloatingWindows", (PyCFunction)Win_HideFloatingWindows, 1,
3675	 "() -> None"},
3676	{"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1,
3677	 "() -> (Boolean _rv)"},
3678
3679#if !TARGET_API_MAC_CARBON
3680	{"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1,
3681	 "(PixPatHandle deskPixPat) -> None"},
3682#endif
3683	{"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1,
3684	 "() -> (Boolean _rv, EventRecord theEvent)"},
3685	{"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1,
3686	 "(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)"},
3687	{"FrontWindow", (PyCFunction)Win_FrontWindow, 1,
3688	 "() -> (WindowPtr _rv)"},
3689	{"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1,
3690	 "() -> (WindowPtr _rv)"},
3691
3692#if !TARGET_API_MAC_OS8
3693	{"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1,
3694	 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
3695#endif
3696
3697#if !TARGET_API_MAC_OS8
3698	{"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1,
3699	 "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"},
3700#endif
3701
3702#if !TARGET_API_MAC_OS8
3703	{"CreateStandardWindowMenu", (PyCFunction)Win_CreateStandardWindowMenu, 1,
3704	 "(OptionBits inOptions) -> (MenuHandle outMenu)"},
3705#endif
3706
3707#if !TARGET_API_MAC_CARBON
3708	{"InitWindows", (PyCFunction)Win_InitWindows, 1,
3709	 "() -> None"},
3710#endif
3711
3712#if !TARGET_API_MAC_CARBON
3713	{"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1,
3714	 "() -> (GrafPtr wPort)"},
3715#endif
3716
3717#if !TARGET_API_MAC_CARBON
3718	{"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1,
3719	 "() -> (CGrafPtr wMgrCPort)"},
3720#endif
3721
3722#if !TARGET_API_MAC_CARBON
3723	{"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1,
3724	 "() -> None"},
3725#endif
3726
3727#if !TARGET_API_MAC_CARBON
3728	{"InvalRect", (PyCFunction)Win_InvalRect, 1,
3729	 "(Rect badRect) -> None"},
3730#endif
3731
3732#if !TARGET_API_MAC_CARBON
3733	{"InvalRgn", (PyCFunction)Win_InvalRgn, 1,
3734	 "(RgnHandle badRgn) -> None"},
3735#endif
3736
3737#if !TARGET_API_MAC_CARBON
3738	{"ValidRect", (PyCFunction)Win_ValidRect, 1,
3739	 "(Rect goodRect) -> None"},
3740#endif
3741
3742#if !TARGET_API_MAC_CARBON
3743	{"ValidRgn", (PyCFunction)Win_ValidRgn, 1,
3744	 "(RgnHandle goodRgn) -> None"},
3745#endif
3746	{"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1,
3747	 "(Boolean collapse) -> None"},
3748
3749#if !TARGET_API_MAC_OS8
3750	{"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1,
3751	 "(GDHandle inDevice) -> (Rect availableRect)"},
3752#endif
3753
3754#if !TARGET_API_MAC_OS8
3755	{"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1,
3756	 "() -> None"},
3757#endif
3758
3759#if !TARGET_API_MAC_OS8
3760	{"EnableScreenUpdates", (PyCFunction)Win_EnableScreenUpdates, 1,
3761	 "() -> None"},
3762#endif
3763	{"PinRect", (PyCFunction)Win_PinRect, 1,
3764	 "(Rect theRect, Point thePt) -> (long _rv)"},
3765	{"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1,
3766	 "() -> (RgnHandle _rv)"},
3767	{"GetWindowFromPort", (PyCFunction)Win_GetWindowFromPort, 1,
3768	 "(CGrafPtr port) -> (WindowPtr _rv)"},
3769	{"WhichWindow", (PyCFunction)Win_WhichWindow, 1,
3770	 "Resolve an integer WindowPtr address to a Window object"},
3771	{"FindWindow", (PyCFunction)Win_FindWindow, 1,
3772	 "(Point thePoint) -> (short _rv, WindowPtr theWindow)"},
3773	{NULL, NULL, 0}
3774};
3775
3776
3777
3778/* Return the object corresponding to the window, or NULL */
3779
3780PyObject *
3781WinObj_WhichWindow(WindowPtr w)
3782{
3783	PyObject *it;
3784
3785	if (w == NULL) {
3786		it = Py_None;
3787		Py_INCREF(it);
3788	} else {
3789		it = (PyObject *) GetWRefCon(w);
3790		if (it == NULL || !IsPointerValid((Ptr)it) || ((WindowObject *)it)->ob_itself != w || !WinObj_Check(it)) {
3791			it = WinObj_New(w);
3792			((WindowObject *)it)->ob_freeit = NULL;
3793		} else {
3794			Py_INCREF(it);
3795		}
3796	}
3797	return it;
3798}
3799
3800
3801void init_Win(void)
3802{
3803	PyObject *m;
3804	PyObject *d;
3805
3806
3807
3808		PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New);
3809		PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow);
3810		PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
3811
3812
3813	m = Py_InitModule("_Win", Win_methods);
3814	d = PyModule_GetDict(m);
3815	Win_Error = PyMac_GetOSErrException();
3816	if (Win_Error == NULL ||
3817	    PyDict_SetItemString(d, "Error", Win_Error) != 0)
3818		return;
3819	Window_Type.ob_type = &PyType_Type;
3820	Py_INCREF(&Window_Type);
3821	if (PyDict_SetItemString(d, "WindowType", (PyObject *)&Window_Type) != 0)
3822		Py_FatalError("can't initialize WindowType");
3823}
3824
3825/* ======================== End module _Win ========================= */
3826
3827