This commit was manufactured by cvs2svn to create tag 'r221c2'.
[python/dscho.git] / Mac / Modules / win / _Winmodule.c
blob80e4040894488851cb2c63f36cda53ab2d99b174
2 /* ========================== Module _Win =========================== */
4 #include "Python.h"
8 #ifdef _WIN32
9 #include "pywintoolbox.h"
10 #else
11 #include "macglue.h"
12 #include "pymactoolbox.h"
13 #endif
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)
23 #ifdef WITHOUT_FRAMEWORKS
24 #include <Windows.h>
25 #else
26 #include <Carbon/Carbon.h>
27 #endif
29 #ifdef USE_TOOLBOX_OBJECT_GLUE
30 extern PyObject *_WinObj_New(WindowRef);
31 extern PyObject *_WinObj_WhichWindow(WindowRef);
32 extern int _WinObj_Convert(PyObject *, WindowRef *);
34 #define WinObj_New _WinObj_New
35 #define WinObj_WhichWindow _WinObj_WhichWindow
36 #define WinObj_Convert _WinObj_Convert
37 #endif
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
55 /* Function to dispose a window, with a "normal" calling sequence */
56 static void
57 PyMac_AutoDisposeWindow(WindowPtr w)
59 DisposeWindow(w);
62 static PyObject *Win_Error;
64 /* ----------------------- Object type Window ----------------------- */
66 PyTypeObject Window_Type;
68 #define WinObj_Check(x) ((x)->ob_type == &Window_Type)
70 typedef struct WindowObject {
71 PyObject_HEAD
72 WindowPtr ob_itself;
73 void (*ob_freeit)(WindowPtr ptr);
74 } WindowObject;
76 PyObject *WinObj_New(WindowPtr itself)
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)
86 SetWRefCon(itself, (long)it);
87 it->ob_freeit = PyMac_AutoDisposeWindow;
89 return (PyObject *)it;
91 int WinObj_Convert(PyObject *v, WindowPtr *p_itself)
94 if (v == Py_None) { *p_itself = NULL; return 1; }
95 if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
98 DialogRef dlg;
99 if (DlgObj_Convert(v, &dlg) && dlg) {
100 *p_itself = GetDialogWindow(dlg);
101 return 1;
103 PyErr_Clear();
105 if (!WinObj_Check(v))
107 PyErr_SetString(PyExc_TypeError, "Window required");
108 return 0;
110 *p_itself = ((WindowObject *)v)->ob_itself;
111 return 1;
114 static void WinObj_dealloc(WindowObject *self)
116 if (self->ob_freeit && self->ob_itself)
118 SetWRefCon(self->ob_itself, 0);
119 self->ob_freeit(self->ob_itself);
121 self->ob_itself = NULL;
122 self->ob_freeit = NULL;
123 PyMem_DEL(self);
126 static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args)
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;
144 static PyObject *WinObj_CloneWindow(WindowObject *_self, PyObject *_args)
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;
160 #if !TARGET_API_MAC_OS8
162 static PyObject *WinObj_GetWindowRetainCount(WindowObject *_self, PyObject *_args)
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;
176 #endif
178 #if !TARGET_API_MAC_OS8
180 static PyObject *WinObj_RetainWindow(WindowObject *_self, PyObject *_args)
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;
195 #endif
197 #if !TARGET_API_MAC_OS8
199 static PyObject *WinObj_ReleaseWindow(WindowObject *_self, PyObject *_args)
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;
214 #endif
216 #if !TARGET_API_MAC_OS8
218 static PyObject *WinObj_ReshapeCustomWindow(WindowObject *_self, PyObject *_args)
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;
233 #endif
235 static PyObject *WinObj_GetWindowWidgetHilite(WindowObject *_self, PyObject *_args)
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;
253 static PyObject *WinObj_GetWindowClass(WindowObject *_self, PyObject *_args)
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;
271 static PyObject *WinObj_GetWindowAttributes(WindowObject *_self, PyObject *_args)
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;
289 #if !TARGET_API_MAC_OS8
291 static PyObject *WinObj_ChangeWindowAttributes(WindowObject *_self, PyObject *_args)
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;
312 #endif
314 #if !TARGET_API_MAC_OS8
316 static PyObject *WinObj_SetWindowClass(WindowObject *_self, PyObject *_args)
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;
334 #endif
336 #if !TARGET_API_MAC_OS8
338 static PyObject *WinObj_SetWindowModality(WindowObject *_self, PyObject *_args)
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;
359 #endif
361 #if !TARGET_API_MAC_OS8
363 static PyObject *WinObj_GetWindowModality(WindowObject *_self, PyObject *_args)
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;
383 #endif
385 #if !TARGET_API_MAC_CARBON
387 static PyObject *WinObj_SetWinColor(WindowObject *_self, PyObject *_args)
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;
403 #endif
405 static PyObject *WinObj_SetWindowContentColor(WindowObject *_self, PyObject *_args)
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;
424 static PyObject *WinObj_GetWindowContentColor(WindowObject *_self, PyObject *_args)
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;
442 static PyObject *WinObj_GetWindowContentPattern(WindowObject *_self, PyObject *_args)
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;
461 static PyObject *WinObj_SetWindowContentPattern(WindowObject *_self, PyObject *_args)
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;
480 #if !TARGET_API_MAC_OS8
482 static PyObject *WinObj_ScrollWindowRect(WindowObject *_self, PyObject *_args)
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;
512 #endif
514 #if !TARGET_API_MAC_OS8
516 static PyObject *WinObj_ScrollWindowRegion(WindowObject *_self, PyObject *_args)
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;
546 #endif
548 static PyObject *WinObj_ClipAbove(WindowObject *_self, PyObject *_args)
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;
562 #if !TARGET_API_MAC_CARBON
564 static PyObject *WinObj_SaveOld(WindowObject *_self, PyObject *_args)
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;
577 #endif
579 #if !TARGET_API_MAC_CARBON
581 static PyObject *WinObj_DrawNew(WindowObject *_self, PyObject *_args)
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;
597 #endif
599 static PyObject *WinObj_PaintOne(WindowObject *_self, PyObject *_args)
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;
616 static PyObject *WinObj_PaintBehind(WindowObject *_self, PyObject *_args)
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;
633 static PyObject *WinObj_CalcVis(WindowObject *_self, PyObject *_args)
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;
647 static PyObject *WinObj_CalcVisBehind(WindowObject *_self, PyObject *_args)
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;
664 static PyObject *WinObj_BringToFront(WindowObject *_self, PyObject *_args)
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;
678 static PyObject *WinObj_SendBehind(WindowObject *_self, PyObject *_args)
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;
695 static PyObject *WinObj_SelectWindow(WindowObject *_self, PyObject *_args)
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;
709 #if !TARGET_API_MAC_OS8
711 static PyObject *WinObj_GetNextWindowOfClass(WindowObject *_self, PyObject *_args)
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;
731 #endif
733 #if !TARGET_API_MAC_OS8
735 static PyObject *WinObj_SetWindowAlternateTitle(WindowObject *_self, PyObject *_args)
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;
753 #endif
755 #if !TARGET_API_MAC_OS8
757 static PyObject *WinObj_CopyWindowAlternateTitle(WindowObject *_self, PyObject *_args)
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;
774 #endif
776 #if !TARGET_API_MAC_CARBON
778 static PyObject *WinObj_IsValidWindowPtr(WindowObject *_self, PyObject *_args)
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;
792 #endif
794 static PyObject *WinObj_HiliteWindow(WindowObject *_self, PyObject *_args)
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;
811 static PyObject *WinObj_SetWRefCon(WindowObject *_self, PyObject *_args)
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;
828 static PyObject *WinObj_GetWRefCon(WindowObject *_self, PyObject *_args)
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;
843 static PyObject *WinObj_SetWindowPic(WindowObject *_self, PyObject *_args)
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;
860 static PyObject *WinObj_GetWindowPic(WindowObject *_self, PyObject *_args)
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;
875 static PyObject *WinObj_GetWVariant(WindowObject *_self, PyObject *_args)
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;
890 static PyObject *WinObj_GetWindowFeatures(WindowObject *_self, PyObject *_args)
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;
908 static PyObject *WinObj_GetWindowRegion(WindowObject *_self, PyObject *_args)
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;
930 static PyObject *WinObj_GetWindowStructureWidths(WindowObject *_self, PyObject *_args)
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;
948 static PyObject *WinObj_BeginUpdate(WindowObject *_self, PyObject *_args)
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;
962 static PyObject *WinObj_EndUpdate(WindowObject *_self, PyObject *_args)
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;
976 static PyObject *WinObj_InvalWindowRgn(WindowObject *_self, PyObject *_args)
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;
995 static PyObject *WinObj_InvalWindowRect(WindowObject *_self, PyObject *_args)
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;
1014 static PyObject *WinObj_ValidWindowRgn(WindowObject *_self, PyObject *_args)
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;
1033 static PyObject *WinObj_ValidWindowRect(WindowObject *_self, PyObject *_args)
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;
1052 static PyObject *WinObj_DrawGrowIcon(WindowObject *_self, PyObject *_args)
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;
1066 static PyObject *WinObj_SetWTitle(WindowObject *_self, PyObject *_args)
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;
1083 static PyObject *WinObj_GetWTitle(WindowObject *_self, PyObject *_args)
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;
1099 #if !TARGET_API_MAC_OS8
1101 static PyObject *WinObj_SetWindowTitleWithCFString(WindowObject *_self, PyObject *_args)
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;
1119 #endif
1121 #if !TARGET_API_MAC_OS8
1123 static PyObject *WinObj_CopyWindowTitleAsCFString(WindowObject *_self, PyObject *_args)
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;
1140 #endif
1142 static PyObject *WinObj_SetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
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;
1161 static PyObject *WinObj_GetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
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;
1179 static PyObject *WinObj_SetWindowProxyAlias(WindowObject *_self, PyObject *_args)
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;
1198 static PyObject *WinObj_GetWindowProxyAlias(WindowObject *_self, PyObject *_args)
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;
1216 static PyObject *WinObj_SetWindowProxyCreatorAndType(WindowObject *_self, PyObject *_args)
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;
1241 static PyObject *WinObj_GetWindowProxyIcon(WindowObject *_self, PyObject *_args)
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;
1259 static PyObject *WinObj_SetWindowProxyIcon(WindowObject *_self, PyObject *_args)
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;
1278 static PyObject *WinObj_RemoveWindowProxy(WindowObject *_self, PyObject *_args)
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;
1294 static PyObject *WinObj_BeginWindowProxyDrag(WindowObject *_self, PyObject *_args)
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;
1315 static PyObject *WinObj_EndWindowProxyDrag(WindowObject *_self, PyObject *_args)
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;
1334 static PyObject *WinObj_TrackWindowProxyFromExistingDrag(WindowObject *_self, PyObject *_args)
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;
1359 static PyObject *WinObj_TrackWindowProxyDrag(WindowObject *_self, PyObject *_args)
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;
1378 static PyObject *WinObj_IsWindowModified(WindowObject *_self, PyObject *_args)
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;
1393 static PyObject *WinObj_SetWindowModified(WindowObject *_self, PyObject *_args)
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;
1412 static PyObject *WinObj_IsWindowPathSelectClick(WindowObject *_self, PyObject *_args)
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;
1430 static PyObject *WinObj_WindowPathSelect(WindowObject *_self, PyObject *_args)
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;
1451 static PyObject *WinObj_HiliteWindowFrameForDrag(WindowObject *_self, PyObject *_args)
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;
1470 static PyObject *WinObj_TransitionWindow(WindowObject *_self, PyObject *_args)
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;
1495 #if TARGET_API_MAC_OSX
1497 static PyObject *WinObj_TransitionWindowAndParent(WindowObject *_self, PyObject *_args)
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;
1524 #endif
1526 static PyObject *WinObj_MacMoveWindow(WindowObject *_self, PyObject *_args)
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;
1549 static PyObject *WinObj_SizeWindow(WindowObject *_self, PyObject *_args)
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",
1561 &fUpdate))
1562 return NULL;
1563 SizeWindow(_self->ob_itself,
1566 fUpdate);
1567 Py_INCREF(Py_None);
1568 _res = Py_None;
1569 return _res;
1572 static PyObject *WinObj_GrowWindow(WindowObject *_self, PyObject *_args)
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;
1593 static PyObject *WinObj_DragWindow(WindowObject *_self, PyObject *_args)
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;
1613 static PyObject *WinObj_ZoomWindow(WindowObject *_self, PyObject *_args)
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;
1633 static PyObject *WinObj_IsWindowCollapsable(WindowObject *_self, PyObject *_args)
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;
1648 static PyObject *WinObj_IsWindowCollapsed(WindowObject *_self, PyObject *_args)
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;
1663 static PyObject *WinObj_CollapseWindow(WindowObject *_self, PyObject *_args)
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;
1682 static PyObject *WinObj_GetWindowBounds(WindowObject *_self, PyObject *_args)
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;
1703 static PyObject *WinObj_ResizeWindow(WindowObject *_self, PyObject *_args)
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;
1727 static PyObject *WinObj_SetWindowBounds(WindowObject *_self, PyObject *_args)
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;
1749 static PyObject *WinObj_RepositionWindow(WindowObject *_self, PyObject *_args)
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;
1771 static PyObject *WinObj_MoveWindowStructure(WindowObject *_self, PyObject *_args)
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;
1793 static PyObject *WinObj_IsWindowInStandardState(WindowObject *_self, PyObject *_args)
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;
1814 static PyObject *WinObj_ZoomWindowIdeal(WindowObject *_self, PyObject *_args)
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;
1835 static PyObject *WinObj_GetWindowIdealUserState(WindowObject *_self, PyObject *_args)
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;
1853 static PyObject *WinObj_SetWindowIdealUserState(WindowObject *_self, PyObject *_args)
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;
1872 #if !TARGET_API_MAC_OS8
1874 static PyObject *WinObj_GetWindowGreatestAreaDevice(WindowObject *_self, PyObject *_args)
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;
1897 #endif
1899 #if !TARGET_API_MAC_OS8
1901 static PyObject *WinObj_ConstrainWindowToScreen(WindowObject *_self, PyObject *_args)
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;
1927 #endif
1929 static PyObject *WinObj_HideWindow(WindowObject *_self, PyObject *_args)
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;
1943 static PyObject *WinObj_MacShowWindow(WindowObject *_self, PyObject *_args)
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;
1957 static PyObject *WinObj_ShowHide(WindowObject *_self, PyObject *_args)
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;
1974 static PyObject *WinObj_MacIsWindowVisible(WindowObject *_self, PyObject *_args)
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;
1989 #if !TARGET_API_MAC_OS8
1991 static PyObject *WinObj_ShowSheetWindow(WindowObject *_self, PyObject *_args)
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;
2009 #endif
2011 #if !TARGET_API_MAC_OS8
2013 static PyObject *WinObj_HideSheetWindow(WindowObject *_self, PyObject *_args)
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;
2028 #endif
2030 #if !TARGET_API_MAC_OS8
2032 static PyObject *WinObj_GetSheetWindowParent(WindowObject *_self, PyObject *_args)
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;
2049 #endif
2051 #if !TARGET_API_MAC_OS8
2053 static PyObject *WinObj_GetWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
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;
2076 #endif
2078 #if !TARGET_API_MAC_OS8
2080 static PyObject *WinObj_ChangeWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
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;
2107 #endif
2109 static PyObject *WinObj_TrackBox(WindowObject *_self, PyObject *_args)
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;
2130 static PyObject *WinObj_TrackGoAway(WindowObject *_self, PyObject *_args)
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;
2148 #if !TARGET_API_MAC_CARBON
2150 static PyObject *WinObj_GetAuxWin(WindowObject *_self, PyObject *_args)
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;
2167 #endif
2169 #if !TARGET_API_MAC_CARBON
2171 static PyObject *WinObj_GetWindowGoAwayFlag(WindowObject *_self, PyObject *_args)
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;
2185 #endif
2187 #if !TARGET_API_MAC_CARBON
2189 static PyObject *WinObj_GetWindowSpareFlag(WindowObject *_self, PyObject *_args)
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;
2203 #endif
2205 static PyObject *WinObj_GetWindowPort(WindowObject *_self, PyObject *_args)
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;
2220 static PyObject *WinObj_GetWindowKind(WindowObject *_self, PyObject *_args)
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;
2235 static PyObject *WinObj_IsWindowHilited(WindowObject *_self, PyObject *_args)
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;
2250 #if !TARGET_API_MAC_OS8
2252 static PyObject *WinObj_IsWindowUpdatePending(WindowObject *_self, PyObject *_args)
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;
2266 #endif
2268 static PyObject *WinObj_MacGetNextWindow(WindowObject *_self, PyObject *_args)
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;
2283 static PyObject *WinObj_GetWindowStandardState(WindowObject *_self, PyObject *_args)
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;
2299 static PyObject *WinObj_GetWindowUserState(WindowObject *_self, PyObject *_args)
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;
2315 static PyObject *WinObj_SetWindowKind(WindowObject *_self, PyObject *_args)
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;
2332 static PyObject *WinObj_SetWindowStandardState(WindowObject *_self, PyObject *_args)
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;
2349 static PyObject *WinObj_SetWindowUserState(WindowObject *_self, PyObject *_args)
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;
2366 static PyObject *WinObj_SetPortWindowPort(WindowObject *_self, PyObject *_args)
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;
2380 static PyObject *WinObj_GetWindowPortBounds(WindowObject *_self, PyObject *_args)
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;
2396 static PyObject *WinObj_IsWindowVisible(WindowObject *_self, PyObject *_args)
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;
2411 #if !TARGET_API_MAC_CARBON
2413 static PyObject *WinObj_GetWindowZoomFlag(WindowObject *_self, PyObject *_args)
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;
2427 #endif
2429 static PyObject *WinObj_GetWindowStructureRgn(WindowObject *_self, PyObject *_args)
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,
2441 Py_INCREF(Py_None);
2442 _res = Py_None;
2443 return _res;
2446 static PyObject *WinObj_GetWindowContentRgn(WindowObject *_self, PyObject *_args)
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,
2458 Py_INCREF(Py_None);
2459 _res = Py_None;
2460 return _res;
2463 static PyObject *WinObj_GetWindowUpdateRgn(WindowObject *_self, PyObject *_args)
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,
2475 Py_INCREF(Py_None);
2476 _res = Py_None;
2477 return _res;
2480 #if !TARGET_API_MAC_CARBON
2482 static PyObject *WinObj_GetWindowTitleWidth(WindowObject *_self, PyObject *_args)
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;
2496 #endif
2498 static PyObject *WinObj_GetNextWindow(WindowObject *_self, PyObject *_args)
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;
2513 #if !TARGET_API_MAC_CARBON
2515 static PyObject *WinObj_CloseWindow(WindowObject *_self, PyObject *_args)
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;
2528 #endif
2530 static PyObject *WinObj_MoveWindow(WindowObject *_self, PyObject *_args)
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;
2553 static PyObject *WinObj_ShowWindow(WindowObject *_self, PyObject *_args)
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;
2567 static PyMethodDef WinObj_methods[] = {
2568 {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1,
2569 "() -> (UInt32 outCount)"},
2570 {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1,
2571 "() -> None"},
2573 #if !TARGET_API_MAC_OS8
2574 {"GetWindowRetainCount", (PyCFunction)WinObj_GetWindowRetainCount, 1,
2575 "() -> (ItemCount _rv)"},
2576 #endif
2578 #if !TARGET_API_MAC_OS8
2579 {"RetainWindow", (PyCFunction)WinObj_RetainWindow, 1,
2580 "() -> None"},
2581 #endif
2583 #if !TARGET_API_MAC_OS8
2584 {"ReleaseWindow", (PyCFunction)WinObj_ReleaseWindow, 1,
2585 "() -> None"},
2586 #endif
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)"},
2599 #if !TARGET_API_MAC_OS8
2600 {"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1,
2601 "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"},
2602 #endif
2604 #if !TARGET_API_MAC_OS8
2605 {"SetWindowClass", (PyCFunction)WinObj_SetWindowClass, 1,
2606 "(WindowClass inWindowClass) -> None"},
2607 #endif
2609 #if !TARGET_API_MAC_OS8
2610 {"SetWindowModality", (PyCFunction)WinObj_SetWindowModality, 1,
2611 "(WindowModality inModalKind, WindowPtr inUnavailableWindow) -> None"},
2612 #endif
2614 #if !TARGET_API_MAC_OS8
2615 {"GetWindowModality", (PyCFunction)WinObj_GetWindowModality, 1,
2616 "() -> (WindowModality outModalKind, WindowPtr outUnavailableWindow)"},
2617 #endif
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"},
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
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"},
2644 #if !TARGET_API_MAC_CARBON
2645 {"SaveOld", (PyCFunction)WinObj_SaveOld, 1,
2646 "() -> None"},
2647 #endif
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"},
2668 #if !TARGET_API_MAC_OS8
2669 {"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1,
2670 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
2671 #endif
2673 #if !TARGET_API_MAC_OS8
2674 {"SetWindowAlternateTitle", (PyCFunction)WinObj_SetWindowAlternateTitle, 1,
2675 "(CFStringRef inTitle) -> None"},
2676 #endif
2678 #if !TARGET_API_MAC_OS8
2679 {"CopyWindowAlternateTitle", (PyCFunction)WinObj_CopyWindowAlternateTitle, 1,
2680 "() -> (CFStringRef outTitle)"},
2681 #endif
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)"},
2724 #if !TARGET_API_MAC_OS8
2725 {"SetWindowTitleWithCFString", (PyCFunction)WinObj_SetWindowTitleWithCFString, 1,
2726 "(CFStringRef inString) -> None"},
2727 #endif
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"},
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"},
2809 #if !TARGET_API_MAC_OS8
2810 {"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1,
2811 "(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)"},
2812 #endif
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)"},
2827 #if !TARGET_API_MAC_OS8
2828 {"ShowSheetWindow", (PyCFunction)WinObj_ShowSheetWindow, 1,
2829 "(WindowPtr inParentWindow) -> None"},
2830 #endif
2832 #if !TARGET_API_MAC_OS8
2833 {"HideSheetWindow", (PyCFunction)WinObj_HideSheetWindow, 1,
2834 "() -> None"},
2835 #endif
2837 #if !TARGET_API_MAC_OS8
2838 {"GetSheetWindowParent", (PyCFunction)WinObj_GetSheetWindowParent, 1,
2839 "() -> (WindowPtr outParentWindow)"},
2840 #endif
2842 #if !TARGET_API_MAC_OS8
2843 {"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1,
2844 "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
2845 #endif
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)"},
2856 #if !TARGET_API_MAC_CARBON
2857 {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1,
2858 "() -> (Boolean _rv, AuxWinHandle awHndl)"},
2859 #endif
2861 #if !TARGET_API_MAC_CARBON
2862 {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1,
2863 "() -> (Boolean _rv)"},
2864 #endif
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)"},
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)"},
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"},
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)"},
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}
2929 PyMethodChain WinObj_chain = { WinObj_methods, NULL };
2931 static PyObject *WinObj_getattr(WindowObject *self, char *name)
2933 return Py_FindMethodInChain(&WinObj_chain, (PyObject *)self, name);
2936 #define WinObj_setattr NULL
2938 static int WinObj_compare(WindowObject *self, WindowObject *other)
2940 if ( self->ob_itself > other->ob_itself ) return 1;
2941 if ( self->ob_itself < other->ob_itself ) return -1;
2942 return 0;
2945 static PyObject * WinObj_repr(WindowObject *self)
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);
2952 static int WinObj_hash(WindowObject *self)
2954 return (int)self->ob_itself;
2957 PyTypeObject 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*/
2976 /* --------------------- End object type Window --------------------- */
2979 static PyObject *Win_GetNewCWindow(PyObject *_self, PyObject *_args)
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;
3000 static PyObject *Win_NewWindow(PyObject *_self, PyObject *_args)
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;
3036 static PyObject *Win_GetNewWindow(PyObject *_self, PyObject *_args)
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;
3057 static PyObject *Win_NewCWindow(PyObject *_self, PyObject *_args)
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;
3093 static PyObject *Win_CreateNewWindow(PyObject *_self, PyObject *_args)
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;
3119 static PyObject *Win_CreateWindowFromResource(PyObject *_self, PyObject *_args)
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;
3139 static PyObject *Win_ShowFloatingWindows(PyObject *_self, PyObject *_args)
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;
3155 static PyObject *Win_HideFloatingWindows(PyObject *_self, PyObject *_args)
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;
3171 static PyObject *Win_AreFloatingWindowsVisible(PyObject *_self, PyObject *_args)
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;
3186 #if !TARGET_API_MAC_CARBON
3188 static PyObject *Win_SetDeskCPat(PyObject *_self, PyObject *_args)
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;
3203 #endif
3205 static PyObject *Win_CheckUpdate(PyObject *_self, PyObject *_args)
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;
3222 static PyObject *Win_MacFindWindow(PyObject *_self, PyObject *_args)
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;
3242 static PyObject *Win_FrontWindow(PyObject *_self, PyObject *_args)
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;
3257 static PyObject *Win_FrontNonFloatingWindow(PyObject *_self, PyObject *_args)
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;
3272 #if !TARGET_API_MAC_OS8
3274 static PyObject *Win_GetFrontWindowOfClass(PyObject *_self, PyObject *_args)
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;
3293 #endif
3295 #if !TARGET_API_MAC_OS8
3297 static PyObject *Win_FindWindowOfClass(PyObject *_self, PyObject *_args)
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;
3322 #endif
3324 #if !TARGET_API_MAC_OS8
3326 static PyObject *Win_CreateStandardWindowMenu(PyObject *_self, PyObject *_args)
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;
3345 #endif
3347 #if !TARGET_API_MAC_CARBON
3349 static PyObject *Win_InitWindows(PyObject *_self, PyObject *_args)
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;
3362 #endif
3364 #if !TARGET_API_MAC_CARBON
3366 static PyObject *Win_GetWMgrPort(PyObject *_self, PyObject *_args)
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;
3380 #endif
3382 #if !TARGET_API_MAC_CARBON
3384 static PyObject *Win_GetCWMgrPort(PyObject *_self, PyObject *_args)
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;
3398 #endif
3400 #if !TARGET_API_MAC_CARBON
3402 static PyObject *Win_InitFloatingWindows(PyObject *_self, PyObject *_args)
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;
3417 #endif
3419 #if !TARGET_API_MAC_CARBON
3421 static PyObject *Win_InvalRect(PyObject *_self, PyObject *_args)
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;
3436 #endif
3438 #if !TARGET_API_MAC_CARBON
3440 static PyObject *Win_InvalRgn(PyObject *_self, PyObject *_args)
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;
3455 #endif
3457 #if !TARGET_API_MAC_CARBON
3459 static PyObject *Win_ValidRect(PyObject *_self, PyObject *_args)
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;
3474 #endif
3476 #if !TARGET_API_MAC_CARBON
3478 static PyObject *Win_ValidRgn(PyObject *_self, PyObject *_args)
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;
3493 #endif
3495 static PyObject *Win_CollapseAllWindows(PyObject *_self, PyObject *_args)
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;
3513 #if !TARGET_API_MAC_OS8
3515 static PyObject *Win_GetAvailableWindowPositioningBounds(PyObject *_self, PyObject *_args)
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;
3534 #endif
3536 #if !TARGET_API_MAC_OS8
3538 static PyObject *Win_DisableScreenUpdates(PyObject *_self, PyObject *_args)
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;
3553 #endif
3555 #if !TARGET_API_MAC_OS8
3557 static PyObject *Win_EnableScreenUpdates(PyObject *_self, PyObject *_args)
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;
3572 #endif
3574 static PyObject *Win_PinRect(PyObject *_self, PyObject *_args)
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;
3594 static PyObject *Win_GetGrayRgn(PyObject *_self, PyObject *_args)
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;
3609 static PyObject *Win_GetWindowFromPort(PyObject *_self, PyObject *_args)
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;
3626 static PyObject *Win_WhichWindow(PyObject *_self, PyObject *_args)
3628 PyObject *_res = NULL;
3630 long ptr;
3632 if ( !PyArg_ParseTuple(_args, "i", &ptr) )
3633 return NULL;
3634 _res = WinObj_WhichWindow((WindowPtr)ptr);
3635 return _res;
3639 static PyObject *Win_FindWindow(PyObject *_self, PyObject *_args)
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;
3659 static 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)"},
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)"},
3692 #if !TARGET_API_MAC_OS8
3693 {"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1,
3694 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
3695 #endif
3697 #if !TARGET_API_MAC_OS8
3698 {"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1,
3699 "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"},
3700 #endif
3702 #if !TARGET_API_MAC_OS8
3703 {"CreateStandardWindowMenu", (PyCFunction)Win_CreateStandardWindowMenu, 1,
3704 "(OptionBits inOptions) -> (MenuHandle outMenu)"},
3705 #endif
3707 #if !TARGET_API_MAC_CARBON
3708 {"InitWindows", (PyCFunction)Win_InitWindows, 1,
3709 "() -> None"},
3710 #endif
3712 #if !TARGET_API_MAC_CARBON
3713 {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1,
3714 "() -> (GrafPtr wPort)"},
3715 #endif
3717 #if !TARGET_API_MAC_CARBON
3718 {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1,
3719 "() -> (CGrafPtr wMgrCPort)"},
3720 #endif
3722 #if !TARGET_API_MAC_CARBON
3723 {"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1,
3724 "() -> None"},
3725 #endif
3727 #if !TARGET_API_MAC_CARBON
3728 {"InvalRect", (PyCFunction)Win_InvalRect, 1,
3729 "(Rect badRect) -> None"},
3730 #endif
3732 #if !TARGET_API_MAC_CARBON
3733 {"InvalRgn", (PyCFunction)Win_InvalRgn, 1,
3734 "(RgnHandle badRgn) -> None"},
3735 #endif
3737 #if !TARGET_API_MAC_CARBON
3738 {"ValidRect", (PyCFunction)Win_ValidRect, 1,
3739 "(Rect goodRect) -> None"},
3740 #endif
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"},
3749 #if !TARGET_API_MAC_OS8
3750 {"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1,
3751 "(GDHandle inDevice) -> (Rect availableRect)"},
3752 #endif
3754 #if !TARGET_API_MAC_OS8
3755 {"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1,
3756 "() -> None"},
3757 #endif
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}
3778 /* Return the object corresponding to the window, or NULL */
3780 PyObject *
3781 WinObj_WhichWindow(WindowPtr w)
3783 PyObject *it;
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);
3797 return it;
3801 void init_Win(void)
3803 PyObject *m;
3804 PyObject *d;
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);
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");
3825 /* ======================== End module _Win ========================= */