2 /* ========================== Module _Win =========================== */
9 #include "pywintoolbox.h"
12 #include "pymactoolbox.h"
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"); \
23 #ifdef WITHOUT_FRAMEWORKS
26 #include <Carbon/Carbon.h>
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
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)
45 #if !ACCESSOR_CALLS_ARE_FUNCTIONS
46 #define IsPointerValid(p) (((long)p&3) == 0)
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))
55 /* Function to dispose a window, with a "normal" calling sequence */
57 PyMac_AutoDisposeWindow(WindowPtr 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
{
73 void (*ob_freeit
)(WindowPtr ptr
);
76 PyObject
*WinObj_New(WindowPtr itself
)
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
;
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; }
99 if (DlgObj_Convert(v
, &dlg
) && dlg
) {
100 *p_itself
= GetDialogWindow(dlg
);
105 if (!WinObj_Check(v
))
107 PyErr_SetString(PyExc_TypeError
, "Window required");
110 *p_itself
= ((WindowObject
*)v
)->ob_itself
;
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
;
126 static PyObject
*WinObj_GetWindowOwnerCount(WindowObject
*_self
, PyObject
*_args
)
128 PyObject
*_res
= NULL
;
131 #ifndef GetWindowOwnerCount
132 PyMac_PRECHECK(GetWindowOwnerCount
);
134 if (!PyArg_ParseTuple(_args
, ""))
136 _err
= GetWindowOwnerCount(_self
->ob_itself
,
138 if (_err
!= noErr
) return PyMac_Error(_err
);
139 _res
= Py_BuildValue("l",
144 static PyObject
*WinObj_CloneWindow(WindowObject
*_self
, PyObject
*_args
)
146 PyObject
*_res
= NULL
;
149 PyMac_PRECHECK(CloneWindow
);
151 if (!PyArg_ParseTuple(_args
, ""))
153 _err
= CloneWindow(_self
->ob_itself
);
154 if (_err
!= noErr
) return PyMac_Error(_err
);
160 #if !TARGET_API_MAC_OS8
162 static PyObject
*WinObj_GetWindowRetainCount(WindowObject
*_self
, PyObject
*_args
)
164 PyObject
*_res
= NULL
;
166 #ifndef GetWindowRetainCount
167 PyMac_PRECHECK(GetWindowRetainCount
);
169 if (!PyArg_ParseTuple(_args
, ""))
171 _rv
= GetWindowRetainCount(_self
->ob_itself
);
172 _res
= Py_BuildValue("l",
178 #if !TARGET_API_MAC_OS8
180 static PyObject
*WinObj_RetainWindow(WindowObject
*_self
, PyObject
*_args
)
182 PyObject
*_res
= NULL
;
185 PyMac_PRECHECK(RetainWindow
);
187 if (!PyArg_ParseTuple(_args
, ""))
189 _err
= RetainWindow(_self
->ob_itself
);
190 if (_err
!= noErr
) return PyMac_Error(_err
);
197 #if !TARGET_API_MAC_OS8
199 static PyObject
*WinObj_ReleaseWindow(WindowObject
*_self
, PyObject
*_args
)
201 PyObject
*_res
= NULL
;
203 #ifndef ReleaseWindow
204 PyMac_PRECHECK(ReleaseWindow
);
206 if (!PyArg_ParseTuple(_args
, ""))
208 _err
= ReleaseWindow(_self
->ob_itself
);
209 if (_err
!= noErr
) return PyMac_Error(_err
);
216 #if !TARGET_API_MAC_OS8
218 static PyObject
*WinObj_ReshapeCustomWindow(WindowObject
*_self
, PyObject
*_args
)
220 PyObject
*_res
= NULL
;
222 #ifndef ReshapeCustomWindow
223 PyMac_PRECHECK(ReshapeCustomWindow
);
225 if (!PyArg_ParseTuple(_args
, ""))
227 _err
= ReshapeCustomWindow(_self
->ob_itself
);
228 if (_err
!= noErr
) return PyMac_Error(_err
);
235 static PyObject
*WinObj_GetWindowWidgetHilite(WindowObject
*_self
, PyObject
*_args
)
237 PyObject
*_res
= NULL
;
239 WindowDefPartCode outHilite
;
240 #ifndef GetWindowWidgetHilite
241 PyMac_PRECHECK(GetWindowWidgetHilite
);
243 if (!PyArg_ParseTuple(_args
, ""))
245 _err
= GetWindowWidgetHilite(_self
->ob_itself
,
247 if (_err
!= noErr
) return PyMac_Error(_err
);
248 _res
= Py_BuildValue("h",
253 static PyObject
*WinObj_GetWindowClass(WindowObject
*_self
, PyObject
*_args
)
255 PyObject
*_res
= NULL
;
257 WindowClass outClass
;
258 #ifndef GetWindowClass
259 PyMac_PRECHECK(GetWindowClass
);
261 if (!PyArg_ParseTuple(_args
, ""))
263 _err
= GetWindowClass(_self
->ob_itself
,
265 if (_err
!= noErr
) return PyMac_Error(_err
);
266 _res
= Py_BuildValue("l",
271 static PyObject
*WinObj_GetWindowAttributes(WindowObject
*_self
, PyObject
*_args
)
273 PyObject
*_res
= NULL
;
275 WindowAttributes outAttributes
;
276 #ifndef GetWindowAttributes
277 PyMac_PRECHECK(GetWindowAttributes
);
279 if (!PyArg_ParseTuple(_args
, ""))
281 _err
= GetWindowAttributes(_self
->ob_itself
,
283 if (_err
!= noErr
) return PyMac_Error(_err
);
284 _res
= Py_BuildValue("l",
289 #if !TARGET_API_MAC_OS8
291 static PyObject
*WinObj_ChangeWindowAttributes(WindowObject
*_self
, PyObject
*_args
)
293 PyObject
*_res
= NULL
;
295 WindowAttributes setTheseAttributes
;
296 WindowAttributes clearTheseAttributes
;
297 #ifndef ChangeWindowAttributes
298 PyMac_PRECHECK(ChangeWindowAttributes
);
300 if (!PyArg_ParseTuple(_args
, "ll",
302 &clearTheseAttributes
))
304 _err
= ChangeWindowAttributes(_self
->ob_itself
,
306 clearTheseAttributes
);
307 if (_err
!= noErr
) return PyMac_Error(_err
);
314 #if !TARGET_API_MAC_OS8
316 static PyObject
*WinObj_SetWindowClass(WindowObject
*_self
, PyObject
*_args
)
318 PyObject
*_res
= NULL
;
320 WindowClass inWindowClass
;
321 #ifndef SetWindowClass
322 PyMac_PRECHECK(SetWindowClass
);
324 if (!PyArg_ParseTuple(_args
, "l",
327 _err
= SetWindowClass(_self
->ob_itself
,
329 if (_err
!= noErr
) return PyMac_Error(_err
);
336 #if !TARGET_API_MAC_OS8
338 static PyObject
*WinObj_SetWindowModality(WindowObject
*_self
, PyObject
*_args
)
340 PyObject
*_res
= NULL
;
342 WindowModality inModalKind
;
343 WindowPtr inUnavailableWindow
;
344 #ifndef SetWindowModality
345 PyMac_PRECHECK(SetWindowModality
);
347 if (!PyArg_ParseTuple(_args
, "lO&",
349 WinObj_Convert
, &inUnavailableWindow
))
351 _err
= SetWindowModality(_self
->ob_itself
,
353 inUnavailableWindow
);
354 if (_err
!= noErr
) return PyMac_Error(_err
);
361 #if !TARGET_API_MAC_OS8
363 static PyObject
*WinObj_GetWindowModality(WindowObject
*_self
, PyObject
*_args
)
365 PyObject
*_res
= NULL
;
367 WindowModality outModalKind
;
368 WindowPtr outUnavailableWindow
;
369 #ifndef GetWindowModality
370 PyMac_PRECHECK(GetWindowModality
);
372 if (!PyArg_ParseTuple(_args
, ""))
374 _err
= GetWindowModality(_self
->ob_itself
,
376 &outUnavailableWindow
);
377 if (_err
!= noErr
) return PyMac_Error(_err
);
378 _res
= Py_BuildValue("lO&",
380 WinObj_WhichWindow
, outUnavailableWindow
);
385 #if !TARGET_API_MAC_CARBON
387 static PyObject
*WinObj_SetWinColor(WindowObject
*_self
, PyObject
*_args
)
389 PyObject
*_res
= NULL
;
390 WCTabHandle newColorTable
;
392 PyMac_PRECHECK(SetWinColor
);
394 if (!PyArg_ParseTuple(_args
, "O&",
395 ResObj_Convert
, &newColorTable
))
397 SetWinColor(_self
->ob_itself
,
405 static PyObject
*WinObj_SetWindowContentColor(WindowObject
*_self
, PyObject
*_args
)
407 PyObject
*_res
= NULL
;
410 #ifndef SetWindowContentColor
411 PyMac_PRECHECK(SetWindowContentColor
);
413 if (!PyArg_ParseTuple(_args
, "O&",
414 QdRGB_Convert
, &color
))
416 _err
= SetWindowContentColor(_self
->ob_itself
,
418 if (_err
!= noErr
) return PyMac_Error(_err
);
424 static PyObject
*WinObj_GetWindowContentColor(WindowObject
*_self
, PyObject
*_args
)
426 PyObject
*_res
= NULL
;
429 #ifndef GetWindowContentColor
430 PyMac_PRECHECK(GetWindowContentColor
);
432 if (!PyArg_ParseTuple(_args
, ""))
434 _err
= GetWindowContentColor(_self
->ob_itself
,
436 if (_err
!= noErr
) return PyMac_Error(_err
);
437 _res
= Py_BuildValue("O&",
442 static PyObject
*WinObj_GetWindowContentPattern(WindowObject
*_self
, PyObject
*_args
)
444 PyObject
*_res
= NULL
;
446 PixPatHandle outPixPat
;
447 #ifndef GetWindowContentPattern
448 PyMac_PRECHECK(GetWindowContentPattern
);
450 if (!PyArg_ParseTuple(_args
, "O&",
451 ResObj_Convert
, &outPixPat
))
453 _err
= GetWindowContentPattern(_self
->ob_itself
,
455 if (_err
!= noErr
) return PyMac_Error(_err
);
461 static PyObject
*WinObj_SetWindowContentPattern(WindowObject
*_self
, PyObject
*_args
)
463 PyObject
*_res
= NULL
;
466 #ifndef SetWindowContentPattern
467 PyMac_PRECHECK(SetWindowContentPattern
);
469 if (!PyArg_ParseTuple(_args
, "O&",
470 ResObj_Convert
, &pixPat
))
472 _err
= SetWindowContentPattern(_self
->ob_itself
,
474 if (_err
!= noErr
) return PyMac_Error(_err
);
480 #if !TARGET_API_MAC_OS8
482 static PyObject
*WinObj_ScrollWindowRect(WindowObject
*_self
, PyObject
*_args
)
484 PyObject
*_res
= NULL
;
489 ScrollWindowOptions inOptions
;
490 RgnHandle outExposedRgn
;
491 #ifndef ScrollWindowRect
492 PyMac_PRECHECK(ScrollWindowRect
);
494 if (!PyArg_ParseTuple(_args
, "O&hhlO&",
495 PyMac_GetRect
, &inScrollRect
,
499 ResObj_Convert
, &outExposedRgn
))
501 _err
= ScrollWindowRect(_self
->ob_itself
,
507 if (_err
!= noErr
) return PyMac_Error(_err
);
514 #if !TARGET_API_MAC_OS8
516 static PyObject
*WinObj_ScrollWindowRegion(WindowObject
*_self
, PyObject
*_args
)
518 PyObject
*_res
= NULL
;
520 RgnHandle inScrollRgn
;
523 ScrollWindowOptions inOptions
;
524 RgnHandle outExposedRgn
;
525 #ifndef ScrollWindowRegion
526 PyMac_PRECHECK(ScrollWindowRegion
);
528 if (!PyArg_ParseTuple(_args
, "O&hhlO&",
529 ResObj_Convert
, &inScrollRgn
,
533 ResObj_Convert
, &outExposedRgn
))
535 _err
= ScrollWindowRegion(_self
->ob_itself
,
541 if (_err
!= noErr
) return PyMac_Error(_err
);
548 static PyObject
*WinObj_ClipAbove(WindowObject
*_self
, PyObject
*_args
)
550 PyObject
*_res
= NULL
;
552 PyMac_PRECHECK(ClipAbove
);
554 if (!PyArg_ParseTuple(_args
, ""))
556 ClipAbove(_self
->ob_itself
);
562 #if !TARGET_API_MAC_CARBON
564 static PyObject
*WinObj_SaveOld(WindowObject
*_self
, PyObject
*_args
)
566 PyObject
*_res
= NULL
;
568 PyMac_PRECHECK(SaveOld
);
570 if (!PyArg_ParseTuple(_args
, ""))
572 SaveOld(_self
->ob_itself
);
579 #if !TARGET_API_MAC_CARBON
581 static PyObject
*WinObj_DrawNew(WindowObject
*_self
, PyObject
*_args
)
583 PyObject
*_res
= NULL
;
586 PyMac_PRECHECK(DrawNew
);
588 if (!PyArg_ParseTuple(_args
, "b",
591 DrawNew(_self
->ob_itself
,
599 static PyObject
*WinObj_PaintOne(WindowObject
*_self
, PyObject
*_args
)
601 PyObject
*_res
= NULL
;
602 RgnHandle clobberedRgn
;
604 PyMac_PRECHECK(PaintOne
);
606 if (!PyArg_ParseTuple(_args
, "O&",
607 ResObj_Convert
, &clobberedRgn
))
609 PaintOne(_self
->ob_itself
,
616 static PyObject
*WinObj_PaintBehind(WindowObject
*_self
, PyObject
*_args
)
618 PyObject
*_res
= NULL
;
619 RgnHandle clobberedRgn
;
621 PyMac_PRECHECK(PaintBehind
);
623 if (!PyArg_ParseTuple(_args
, "O&",
624 ResObj_Convert
, &clobberedRgn
))
626 PaintBehind(_self
->ob_itself
,
633 static PyObject
*WinObj_CalcVis(WindowObject
*_self
, PyObject
*_args
)
635 PyObject
*_res
= NULL
;
637 PyMac_PRECHECK(CalcVis
);
639 if (!PyArg_ParseTuple(_args
, ""))
641 CalcVis(_self
->ob_itself
);
647 static PyObject
*WinObj_CalcVisBehind(WindowObject
*_self
, PyObject
*_args
)
649 PyObject
*_res
= NULL
;
650 RgnHandle clobberedRgn
;
651 #ifndef CalcVisBehind
652 PyMac_PRECHECK(CalcVisBehind
);
654 if (!PyArg_ParseTuple(_args
, "O&",
655 ResObj_Convert
, &clobberedRgn
))
657 CalcVisBehind(_self
->ob_itself
,
664 static PyObject
*WinObj_BringToFront(WindowObject
*_self
, PyObject
*_args
)
666 PyObject
*_res
= NULL
;
668 PyMac_PRECHECK(BringToFront
);
670 if (!PyArg_ParseTuple(_args
, ""))
672 BringToFront(_self
->ob_itself
);
678 static PyObject
*WinObj_SendBehind(WindowObject
*_self
, PyObject
*_args
)
680 PyObject
*_res
= NULL
;
681 WindowPtr behindWindow
;
683 PyMac_PRECHECK(SendBehind
);
685 if (!PyArg_ParseTuple(_args
, "O&",
686 WinObj_Convert
, &behindWindow
))
688 SendBehind(_self
->ob_itself
,
695 static PyObject
*WinObj_SelectWindow(WindowObject
*_self
, PyObject
*_args
)
697 PyObject
*_res
= NULL
;
699 PyMac_PRECHECK(SelectWindow
);
701 if (!PyArg_ParseTuple(_args
, ""))
703 SelectWindow(_self
->ob_itself
);
709 #if !TARGET_API_MAC_OS8
711 static PyObject
*WinObj_GetNextWindowOfClass(WindowObject
*_self
, PyObject
*_args
)
713 PyObject
*_res
= NULL
;
715 WindowClass inWindowClass
;
716 Boolean mustBeVisible
;
717 #ifndef GetNextWindowOfClass
718 PyMac_PRECHECK(GetNextWindowOfClass
);
720 if (!PyArg_ParseTuple(_args
, "lb",
724 _rv
= GetNextWindowOfClass(_self
->ob_itself
,
727 _res
= Py_BuildValue("O&",
733 #if !TARGET_API_MAC_OS8
735 static PyObject
*WinObj_SetWindowAlternateTitle(WindowObject
*_self
, PyObject
*_args
)
737 PyObject
*_res
= NULL
;
740 #ifndef SetWindowAlternateTitle
741 PyMac_PRECHECK(SetWindowAlternateTitle
);
743 if (!PyArg_ParseTuple(_args
, "O&",
744 CFStringRefObj_Convert
, &inTitle
))
746 _err
= SetWindowAlternateTitle(_self
->ob_itself
,
748 if (_err
!= noErr
) return PyMac_Error(_err
);
755 #if !TARGET_API_MAC_OS8
757 static PyObject
*WinObj_CopyWindowAlternateTitle(WindowObject
*_self
, PyObject
*_args
)
759 PyObject
*_res
= NULL
;
761 CFStringRef outTitle
;
762 #ifndef CopyWindowAlternateTitle
763 PyMac_PRECHECK(CopyWindowAlternateTitle
);
765 if (!PyArg_ParseTuple(_args
, ""))
767 _err
= CopyWindowAlternateTitle(_self
->ob_itself
,
769 if (_err
!= noErr
) return PyMac_Error(_err
);
770 _res
= Py_BuildValue("O&",
771 CFStringRefObj_New
, outTitle
);
776 #if !TARGET_API_MAC_CARBON
778 static PyObject
*WinObj_IsValidWindowPtr(WindowObject
*_self
, PyObject
*_args
)
780 PyObject
*_res
= NULL
;
782 #ifndef IsValidWindowPtr
783 PyMac_PRECHECK(IsValidWindowPtr
);
785 if (!PyArg_ParseTuple(_args
, ""))
787 _rv
= IsValidWindowPtr(_self
->ob_itself
);
788 _res
= Py_BuildValue("b",
794 static PyObject
*WinObj_HiliteWindow(WindowObject
*_self
, PyObject
*_args
)
796 PyObject
*_res
= NULL
;
799 PyMac_PRECHECK(HiliteWindow
);
801 if (!PyArg_ParseTuple(_args
, "b",
804 HiliteWindow(_self
->ob_itself
,
811 static PyObject
*WinObj_SetWRefCon(WindowObject
*_self
, PyObject
*_args
)
813 PyObject
*_res
= NULL
;
816 PyMac_PRECHECK(SetWRefCon
);
818 if (!PyArg_ParseTuple(_args
, "l",
821 SetWRefCon(_self
->ob_itself
,
828 static PyObject
*WinObj_GetWRefCon(WindowObject
*_self
, PyObject
*_args
)
830 PyObject
*_res
= NULL
;
833 PyMac_PRECHECK(GetWRefCon
);
835 if (!PyArg_ParseTuple(_args
, ""))
837 _rv
= GetWRefCon(_self
->ob_itself
);
838 _res
= Py_BuildValue("l",
843 static PyObject
*WinObj_SetWindowPic(WindowObject
*_self
, PyObject
*_args
)
845 PyObject
*_res
= NULL
;
848 PyMac_PRECHECK(SetWindowPic
);
850 if (!PyArg_ParseTuple(_args
, "O&",
851 ResObj_Convert
, &pic
))
853 SetWindowPic(_self
->ob_itself
,
860 static PyObject
*WinObj_GetWindowPic(WindowObject
*_self
, PyObject
*_args
)
862 PyObject
*_res
= NULL
;
865 PyMac_PRECHECK(GetWindowPic
);
867 if (!PyArg_ParseTuple(_args
, ""))
869 _rv
= GetWindowPic(_self
->ob_itself
);
870 _res
= Py_BuildValue("O&",
875 static PyObject
*WinObj_GetWVariant(WindowObject
*_self
, PyObject
*_args
)
877 PyObject
*_res
= NULL
;
880 PyMac_PRECHECK(GetWVariant
);
882 if (!PyArg_ParseTuple(_args
, ""))
884 _rv
= GetWVariant(_self
->ob_itself
);
885 _res
= Py_BuildValue("h",
890 static PyObject
*WinObj_GetWindowFeatures(WindowObject
*_self
, PyObject
*_args
)
892 PyObject
*_res
= NULL
;
895 #ifndef GetWindowFeatures
896 PyMac_PRECHECK(GetWindowFeatures
);
898 if (!PyArg_ParseTuple(_args
, ""))
900 _err
= GetWindowFeatures(_self
->ob_itself
,
902 if (_err
!= noErr
) return PyMac_Error(_err
);
903 _res
= Py_BuildValue("l",
908 static PyObject
*WinObj_GetWindowRegion(WindowObject
*_self
, PyObject
*_args
)
910 PyObject
*_res
= NULL
;
912 WindowRegionCode inRegionCode
;
914 #ifndef GetWindowRegion
915 PyMac_PRECHECK(GetWindowRegion
);
917 if (!PyArg_ParseTuple(_args
, "HO&",
919 ResObj_Convert
, &ioWinRgn
))
921 _err
= GetWindowRegion(_self
->ob_itself
,
924 if (_err
!= noErr
) return PyMac_Error(_err
);
930 static PyObject
*WinObj_GetWindowStructureWidths(WindowObject
*_self
, PyObject
*_args
)
932 PyObject
*_res
= NULL
;
935 #ifndef GetWindowStructureWidths
936 PyMac_PRECHECK(GetWindowStructureWidths
);
938 if (!PyArg_ParseTuple(_args
, ""))
940 _err
= GetWindowStructureWidths(_self
->ob_itself
,
942 if (_err
!= noErr
) return PyMac_Error(_err
);
943 _res
= Py_BuildValue("O&",
944 PyMac_BuildRect
, &outRect
);
948 static PyObject
*WinObj_BeginUpdate(WindowObject
*_self
, PyObject
*_args
)
950 PyObject
*_res
= NULL
;
952 PyMac_PRECHECK(BeginUpdate
);
954 if (!PyArg_ParseTuple(_args
, ""))
956 BeginUpdate(_self
->ob_itself
);
962 static PyObject
*WinObj_EndUpdate(WindowObject
*_self
, PyObject
*_args
)
964 PyObject
*_res
= NULL
;
966 PyMac_PRECHECK(EndUpdate
);
968 if (!PyArg_ParseTuple(_args
, ""))
970 EndUpdate(_self
->ob_itself
);
976 static PyObject
*WinObj_InvalWindowRgn(WindowObject
*_self
, PyObject
*_args
)
978 PyObject
*_res
= NULL
;
981 #ifndef InvalWindowRgn
982 PyMac_PRECHECK(InvalWindowRgn
);
984 if (!PyArg_ParseTuple(_args
, "O&",
985 ResObj_Convert
, ®ion
))
987 _err
= InvalWindowRgn(_self
->ob_itself
,
989 if (_err
!= noErr
) return PyMac_Error(_err
);
995 static PyObject
*WinObj_InvalWindowRect(WindowObject
*_self
, PyObject
*_args
)
997 PyObject
*_res
= NULL
;
1000 #ifndef InvalWindowRect
1001 PyMac_PRECHECK(InvalWindowRect
);
1003 if (!PyArg_ParseTuple(_args
, "O&",
1004 PyMac_GetRect
, &bounds
))
1006 _err
= InvalWindowRect(_self
->ob_itself
,
1008 if (_err
!= noErr
) return PyMac_Error(_err
);
1014 static PyObject
*WinObj_ValidWindowRgn(WindowObject
*_self
, PyObject
*_args
)
1016 PyObject
*_res
= NULL
;
1019 #ifndef ValidWindowRgn
1020 PyMac_PRECHECK(ValidWindowRgn
);
1022 if (!PyArg_ParseTuple(_args
, "O&",
1023 ResObj_Convert
, ®ion
))
1025 _err
= ValidWindowRgn(_self
->ob_itself
,
1027 if (_err
!= noErr
) return PyMac_Error(_err
);
1033 static PyObject
*WinObj_ValidWindowRect(WindowObject
*_self
, PyObject
*_args
)
1035 PyObject
*_res
= NULL
;
1038 #ifndef ValidWindowRect
1039 PyMac_PRECHECK(ValidWindowRect
);
1041 if (!PyArg_ParseTuple(_args
, "O&",
1042 PyMac_GetRect
, &bounds
))
1044 _err
= ValidWindowRect(_self
->ob_itself
,
1046 if (_err
!= noErr
) return PyMac_Error(_err
);
1052 static PyObject
*WinObj_DrawGrowIcon(WindowObject
*_self
, PyObject
*_args
)
1054 PyObject
*_res
= NULL
;
1055 #ifndef DrawGrowIcon
1056 PyMac_PRECHECK(DrawGrowIcon
);
1058 if (!PyArg_ParseTuple(_args
, ""))
1060 DrawGrowIcon(_self
->ob_itself
);
1066 static PyObject
*WinObj_SetWTitle(WindowObject
*_self
, PyObject
*_args
)
1068 PyObject
*_res
= NULL
;
1071 PyMac_PRECHECK(SetWTitle
);
1073 if (!PyArg_ParseTuple(_args
, "O&",
1074 PyMac_GetStr255
, title
))
1076 SetWTitle(_self
->ob_itself
,
1083 static PyObject
*WinObj_GetWTitle(WindowObject
*_self
, PyObject
*_args
)
1085 PyObject
*_res
= NULL
;
1088 PyMac_PRECHECK(GetWTitle
);
1090 if (!PyArg_ParseTuple(_args
, ""))
1092 GetWTitle(_self
->ob_itself
,
1094 _res
= Py_BuildValue("O&",
1095 PyMac_BuildStr255
, title
);
1099 #if !TARGET_API_MAC_OS8
1101 static PyObject
*WinObj_SetWindowTitleWithCFString(WindowObject
*_self
, PyObject
*_args
)
1103 PyObject
*_res
= NULL
;
1105 CFStringRef inString
;
1106 #ifndef SetWindowTitleWithCFString
1107 PyMac_PRECHECK(SetWindowTitleWithCFString
);
1109 if (!PyArg_ParseTuple(_args
, "O&",
1110 CFStringRefObj_Convert
, &inString
))
1112 _err
= SetWindowTitleWithCFString(_self
->ob_itself
,
1114 if (_err
!= noErr
) return PyMac_Error(_err
);
1121 #if !TARGET_API_MAC_OS8
1123 static PyObject
*WinObj_CopyWindowTitleAsCFString(WindowObject
*_self
, PyObject
*_args
)
1125 PyObject
*_res
= NULL
;
1127 CFStringRef outString
;
1128 #ifndef CopyWindowTitleAsCFString
1129 PyMac_PRECHECK(CopyWindowTitleAsCFString
);
1131 if (!PyArg_ParseTuple(_args
, ""))
1133 _err
= CopyWindowTitleAsCFString(_self
->ob_itself
,
1135 if (_err
!= noErr
) return PyMac_Error(_err
);
1136 _res
= Py_BuildValue("O&",
1137 CFStringRefObj_New
, outString
);
1142 static PyObject
*WinObj_SetWindowProxyFSSpec(WindowObject
*_self
, PyObject
*_args
)
1144 PyObject
*_res
= NULL
;
1147 #ifndef SetWindowProxyFSSpec
1148 PyMac_PRECHECK(SetWindowProxyFSSpec
);
1150 if (!PyArg_ParseTuple(_args
, "O&",
1151 PyMac_GetFSSpec
, &inFile
))
1153 _err
= SetWindowProxyFSSpec(_self
->ob_itself
,
1155 if (_err
!= noErr
) return PyMac_Error(_err
);
1161 static PyObject
*WinObj_GetWindowProxyFSSpec(WindowObject
*_self
, PyObject
*_args
)
1163 PyObject
*_res
= NULL
;
1166 #ifndef GetWindowProxyFSSpec
1167 PyMac_PRECHECK(GetWindowProxyFSSpec
);
1169 if (!PyArg_ParseTuple(_args
, ""))
1171 _err
= GetWindowProxyFSSpec(_self
->ob_itself
,
1173 if (_err
!= noErr
) return PyMac_Error(_err
);
1174 _res
= Py_BuildValue("O&",
1175 PyMac_BuildFSSpec
, &outFile
);
1179 static PyObject
*WinObj_SetWindowProxyAlias(WindowObject
*_self
, PyObject
*_args
)
1181 PyObject
*_res
= NULL
;
1184 #ifndef SetWindowProxyAlias
1185 PyMac_PRECHECK(SetWindowProxyAlias
);
1187 if (!PyArg_ParseTuple(_args
, "O&",
1188 ResObj_Convert
, &alias
))
1190 _err
= SetWindowProxyAlias(_self
->ob_itself
,
1192 if (_err
!= noErr
) return PyMac_Error(_err
);
1198 static PyObject
*WinObj_GetWindowProxyAlias(WindowObject
*_self
, PyObject
*_args
)
1200 PyObject
*_res
= NULL
;
1203 #ifndef GetWindowProxyAlias
1204 PyMac_PRECHECK(GetWindowProxyAlias
);
1206 if (!PyArg_ParseTuple(_args
, ""))
1208 _err
= GetWindowProxyAlias(_self
->ob_itself
,
1210 if (_err
!= noErr
) return PyMac_Error(_err
);
1211 _res
= Py_BuildValue("O&",
1216 static PyObject
*WinObj_SetWindowProxyCreatorAndType(WindowObject
*_self
, PyObject
*_args
)
1218 PyObject
*_res
= NULL
;
1223 #ifndef SetWindowProxyCreatorAndType
1224 PyMac_PRECHECK(SetWindowProxyCreatorAndType
);
1226 if (!PyArg_ParseTuple(_args
, "O&O&h",
1227 PyMac_GetOSType
, &fileCreator
,
1228 PyMac_GetOSType
, &fileType
,
1231 _err
= SetWindowProxyCreatorAndType(_self
->ob_itself
,
1235 if (_err
!= noErr
) return PyMac_Error(_err
);
1241 static PyObject
*WinObj_GetWindowProxyIcon(WindowObject
*_self
, PyObject
*_args
)
1243 PyObject
*_res
= NULL
;
1246 #ifndef GetWindowProxyIcon
1247 PyMac_PRECHECK(GetWindowProxyIcon
);
1249 if (!PyArg_ParseTuple(_args
, ""))
1251 _err
= GetWindowProxyIcon(_self
->ob_itself
,
1253 if (_err
!= noErr
) return PyMac_Error(_err
);
1254 _res
= Py_BuildValue("O&",
1255 ResObj_New
, outIcon
);
1259 static PyObject
*WinObj_SetWindowProxyIcon(WindowObject
*_self
, PyObject
*_args
)
1261 PyObject
*_res
= NULL
;
1264 #ifndef SetWindowProxyIcon
1265 PyMac_PRECHECK(SetWindowProxyIcon
);
1267 if (!PyArg_ParseTuple(_args
, "O&",
1268 ResObj_Convert
, &icon
))
1270 _err
= SetWindowProxyIcon(_self
->ob_itself
,
1272 if (_err
!= noErr
) return PyMac_Error(_err
);
1278 static PyObject
*WinObj_RemoveWindowProxy(WindowObject
*_self
, PyObject
*_args
)
1280 PyObject
*_res
= NULL
;
1282 #ifndef RemoveWindowProxy
1283 PyMac_PRECHECK(RemoveWindowProxy
);
1285 if (!PyArg_ParseTuple(_args
, ""))
1287 _err
= RemoveWindowProxy(_self
->ob_itself
);
1288 if (_err
!= noErr
) return PyMac_Error(_err
);
1294 static PyObject
*WinObj_BeginWindowProxyDrag(WindowObject
*_self
, PyObject
*_args
)
1296 PyObject
*_res
= NULL
;
1298 DragReference outNewDrag
;
1299 RgnHandle outDragOutlineRgn
;
1300 #ifndef BeginWindowProxyDrag
1301 PyMac_PRECHECK(BeginWindowProxyDrag
);
1303 if (!PyArg_ParseTuple(_args
, "O&",
1304 ResObj_Convert
, &outDragOutlineRgn
))
1306 _err
= BeginWindowProxyDrag(_self
->ob_itself
,
1309 if (_err
!= noErr
) return PyMac_Error(_err
);
1310 _res
= Py_BuildValue("O&",
1311 DragObj_New
, outNewDrag
);
1315 static PyObject
*WinObj_EndWindowProxyDrag(WindowObject
*_self
, PyObject
*_args
)
1317 PyObject
*_res
= NULL
;
1319 DragReference theDrag
;
1320 #ifndef EndWindowProxyDrag
1321 PyMac_PRECHECK(EndWindowProxyDrag
);
1323 if (!PyArg_ParseTuple(_args
, "O&",
1324 DragObj_Convert
, &theDrag
))
1326 _err
= EndWindowProxyDrag(_self
->ob_itself
,
1328 if (_err
!= noErr
) return PyMac_Error(_err
);
1334 static PyObject
*WinObj_TrackWindowProxyFromExistingDrag(WindowObject
*_self
, PyObject
*_args
)
1336 PyObject
*_res
= NULL
;
1340 RgnHandle inDragOutlineRgn
;
1341 #ifndef TrackWindowProxyFromExistingDrag
1342 PyMac_PRECHECK(TrackWindowProxyFromExistingDrag
);
1344 if (!PyArg_ParseTuple(_args
, "O&O&O&",
1345 PyMac_GetPoint
, &startPt
,
1346 DragObj_Convert
, &drag
,
1347 ResObj_Convert
, &inDragOutlineRgn
))
1349 _err
= TrackWindowProxyFromExistingDrag(_self
->ob_itself
,
1353 if (_err
!= noErr
) return PyMac_Error(_err
);
1359 static PyObject
*WinObj_TrackWindowProxyDrag(WindowObject
*_self
, PyObject
*_args
)
1361 PyObject
*_res
= NULL
;
1364 #ifndef TrackWindowProxyDrag
1365 PyMac_PRECHECK(TrackWindowProxyDrag
);
1367 if (!PyArg_ParseTuple(_args
, "O&",
1368 PyMac_GetPoint
, &startPt
))
1370 _err
= TrackWindowProxyDrag(_self
->ob_itself
,
1372 if (_err
!= noErr
) return PyMac_Error(_err
);
1378 static PyObject
*WinObj_IsWindowModified(WindowObject
*_self
, PyObject
*_args
)
1380 PyObject
*_res
= NULL
;
1382 #ifndef IsWindowModified
1383 PyMac_PRECHECK(IsWindowModified
);
1385 if (!PyArg_ParseTuple(_args
, ""))
1387 _rv
= IsWindowModified(_self
->ob_itself
);
1388 _res
= Py_BuildValue("b",
1393 static PyObject
*WinObj_SetWindowModified(WindowObject
*_self
, PyObject
*_args
)
1395 PyObject
*_res
= NULL
;
1398 #ifndef SetWindowModified
1399 PyMac_PRECHECK(SetWindowModified
);
1401 if (!PyArg_ParseTuple(_args
, "b",
1404 _err
= SetWindowModified(_self
->ob_itself
,
1406 if (_err
!= noErr
) return PyMac_Error(_err
);
1412 static PyObject
*WinObj_IsWindowPathSelectClick(WindowObject
*_self
, PyObject
*_args
)
1414 PyObject
*_res
= NULL
;
1417 #ifndef IsWindowPathSelectClick
1418 PyMac_PRECHECK(IsWindowPathSelectClick
);
1420 if (!PyArg_ParseTuple(_args
, "O&",
1421 PyMac_GetEventRecord
, &event
))
1423 _rv
= IsWindowPathSelectClick(_self
->ob_itself
,
1425 _res
= Py_BuildValue("b",
1430 static PyObject
*WinObj_WindowPathSelect(WindowObject
*_self
, PyObject
*_args
)
1432 PyObject
*_res
= NULL
;
1435 SInt32 outMenuResult
;
1436 #ifndef WindowPathSelect
1437 PyMac_PRECHECK(WindowPathSelect
);
1439 if (!PyArg_ParseTuple(_args
, "O&",
1440 MenuObj_Convert
, &menu
))
1442 _err
= WindowPathSelect(_self
->ob_itself
,
1445 if (_err
!= noErr
) return PyMac_Error(_err
);
1446 _res
= Py_BuildValue("l",
1451 static PyObject
*WinObj_HiliteWindowFrameForDrag(WindowObject
*_self
, PyObject
*_args
)
1453 PyObject
*_res
= NULL
;
1456 #ifndef HiliteWindowFrameForDrag
1457 PyMac_PRECHECK(HiliteWindowFrameForDrag
);
1459 if (!PyArg_ParseTuple(_args
, "b",
1462 _err
= HiliteWindowFrameForDrag(_self
->ob_itself
,
1464 if (_err
!= noErr
) return PyMac_Error(_err
);
1470 static PyObject
*WinObj_TransitionWindow(WindowObject
*_self
, PyObject
*_args
)
1472 PyObject
*_res
= NULL
;
1474 WindowTransitionEffect effect
;
1475 WindowTransitionAction action
;
1477 #ifndef TransitionWindow
1478 PyMac_PRECHECK(TransitionWindow
);
1480 if (!PyArg_ParseTuple(_args
, "llO&",
1483 PyMac_GetRect
, &rect
))
1485 _err
= TransitionWindow(_self
->ob_itself
,
1489 if (_err
!= noErr
) return PyMac_Error(_err
);
1495 #if TARGET_API_MAC_OSX
1497 static PyObject
*WinObj_TransitionWindowAndParent(WindowObject
*_self
, PyObject
*_args
)
1499 PyObject
*_res
= NULL
;
1501 WindowPtr parentWindow
;
1502 WindowTransitionEffect effect
;
1503 WindowTransitionAction action
;
1505 #ifndef TransitionWindowAndParent
1506 PyMac_PRECHECK(TransitionWindowAndParent
);
1508 if (!PyArg_ParseTuple(_args
, "O&llO&",
1509 WinObj_Convert
, &parentWindow
,
1512 PyMac_GetRect
, &rect
))
1514 _err
= TransitionWindowAndParent(_self
->ob_itself
,
1519 if (_err
!= noErr
) return PyMac_Error(_err
);
1526 static PyObject
*WinObj_MacMoveWindow(WindowObject
*_self
, PyObject
*_args
)
1528 PyObject
*_res
= NULL
;
1532 #ifndef MacMoveWindow
1533 PyMac_PRECHECK(MacMoveWindow
);
1535 if (!PyArg_ParseTuple(_args
, "hhb",
1540 MacMoveWindow(_self
->ob_itself
,
1549 static PyObject
*WinObj_SizeWindow(WindowObject
*_self
, PyObject
*_args
)
1551 PyObject
*_res
= NULL
;
1556 PyMac_PRECHECK(SizeWindow
);
1558 if (!PyArg_ParseTuple(_args
, "hhb",
1563 SizeWindow(_self
->ob_itself
,
1572 static PyObject
*WinObj_GrowWindow(WindowObject
*_self
, PyObject
*_args
)
1574 PyObject
*_res
= NULL
;
1579 PyMac_PRECHECK(GrowWindow
);
1581 if (!PyArg_ParseTuple(_args
, "O&O&",
1582 PyMac_GetPoint
, &startPt
,
1583 PyMac_GetRect
, &bBox
))
1585 _rv
= GrowWindow(_self
->ob_itself
,
1588 _res
= Py_BuildValue("l",
1593 static PyObject
*WinObj_DragWindow(WindowObject
*_self
, PyObject
*_args
)
1595 PyObject
*_res
= NULL
;
1599 PyMac_PRECHECK(DragWindow
);
1601 if (!PyArg_ParseTuple(_args
, "O&O&",
1602 PyMac_GetPoint
, &startPt
,
1603 PyMac_GetRect
, &boundsRect
))
1605 DragWindow(_self
->ob_itself
,
1613 static PyObject
*WinObj_ZoomWindow(WindowObject
*_self
, PyObject
*_args
)
1615 PyObject
*_res
= NULL
;
1616 WindowPartCode partCode
;
1619 PyMac_PRECHECK(ZoomWindow
);
1621 if (!PyArg_ParseTuple(_args
, "hb",
1625 ZoomWindow(_self
->ob_itself
,
1633 static PyObject
*WinObj_IsWindowCollapsable(WindowObject
*_self
, PyObject
*_args
)
1635 PyObject
*_res
= NULL
;
1637 #ifndef IsWindowCollapsable
1638 PyMac_PRECHECK(IsWindowCollapsable
);
1640 if (!PyArg_ParseTuple(_args
, ""))
1642 _rv
= IsWindowCollapsable(_self
->ob_itself
);
1643 _res
= Py_BuildValue("b",
1648 static PyObject
*WinObj_IsWindowCollapsed(WindowObject
*_self
, PyObject
*_args
)
1650 PyObject
*_res
= NULL
;
1652 #ifndef IsWindowCollapsed
1653 PyMac_PRECHECK(IsWindowCollapsed
);
1655 if (!PyArg_ParseTuple(_args
, ""))
1657 _rv
= IsWindowCollapsed(_self
->ob_itself
);
1658 _res
= Py_BuildValue("b",
1663 static PyObject
*WinObj_CollapseWindow(WindowObject
*_self
, PyObject
*_args
)
1665 PyObject
*_res
= NULL
;
1668 #ifndef CollapseWindow
1669 PyMac_PRECHECK(CollapseWindow
);
1671 if (!PyArg_ParseTuple(_args
, "b",
1674 _err
= CollapseWindow(_self
->ob_itself
,
1676 if (_err
!= noErr
) return PyMac_Error(_err
);
1682 static PyObject
*WinObj_GetWindowBounds(WindowObject
*_self
, PyObject
*_args
)
1684 PyObject
*_res
= NULL
;
1686 WindowRegionCode regionCode
;
1688 #ifndef GetWindowBounds
1689 PyMac_PRECHECK(GetWindowBounds
);
1691 if (!PyArg_ParseTuple(_args
, "H",
1694 _err
= GetWindowBounds(_self
->ob_itself
,
1697 if (_err
!= noErr
) return PyMac_Error(_err
);
1698 _res
= Py_BuildValue("O&",
1699 PyMac_BuildRect
, &globalBounds
);
1703 static PyObject
*WinObj_ResizeWindow(WindowObject
*_self
, PyObject
*_args
)
1705 PyObject
*_res
= NULL
;
1708 Rect sizeConstraints
;
1709 Rect newContentRect
;
1710 #ifndef ResizeWindow
1711 PyMac_PRECHECK(ResizeWindow
);
1713 if (!PyArg_ParseTuple(_args
, "O&O&",
1714 PyMac_GetPoint
, &startPoint
,
1715 PyMac_GetRect
, &sizeConstraints
))
1717 _rv
= ResizeWindow(_self
->ob_itself
,
1721 _res
= Py_BuildValue("bO&",
1723 PyMac_BuildRect
, &newContentRect
);
1727 static PyObject
*WinObj_SetWindowBounds(WindowObject
*_self
, PyObject
*_args
)
1729 PyObject
*_res
= NULL
;
1731 WindowRegionCode regionCode
;
1733 #ifndef SetWindowBounds
1734 PyMac_PRECHECK(SetWindowBounds
);
1736 if (!PyArg_ParseTuple(_args
, "HO&",
1738 PyMac_GetRect
, &globalBounds
))
1740 _err
= SetWindowBounds(_self
->ob_itself
,
1743 if (_err
!= noErr
) return PyMac_Error(_err
);
1749 static PyObject
*WinObj_RepositionWindow(WindowObject
*_self
, PyObject
*_args
)
1751 PyObject
*_res
= NULL
;
1753 WindowPtr parentWindow
;
1754 WindowPositionMethod method
;
1755 #ifndef RepositionWindow
1756 PyMac_PRECHECK(RepositionWindow
);
1758 if (!PyArg_ParseTuple(_args
, "O&l",
1759 WinObj_Convert
, &parentWindow
,
1762 _err
= RepositionWindow(_self
->ob_itself
,
1765 if (_err
!= noErr
) return PyMac_Error(_err
);
1771 static PyObject
*WinObj_MoveWindowStructure(WindowObject
*_self
, PyObject
*_args
)
1773 PyObject
*_res
= NULL
;
1777 #ifndef MoveWindowStructure
1778 PyMac_PRECHECK(MoveWindowStructure
);
1780 if (!PyArg_ParseTuple(_args
, "hh",
1784 _err
= MoveWindowStructure(_self
->ob_itself
,
1787 if (_err
!= noErr
) return PyMac_Error(_err
);
1793 static PyObject
*WinObj_IsWindowInStandardState(WindowObject
*_self
, PyObject
*_args
)
1795 PyObject
*_res
= NULL
;
1798 Rect idealStandardState
;
1799 #ifndef IsWindowInStandardState
1800 PyMac_PRECHECK(IsWindowInStandardState
);
1802 if (!PyArg_ParseTuple(_args
, ""))
1804 _rv
= IsWindowInStandardState(_self
->ob_itself
,
1806 &idealStandardState
);
1807 _res
= Py_BuildValue("bO&O&",
1809 PyMac_BuildPoint
, idealSize
,
1810 PyMac_BuildRect
, &idealStandardState
);
1814 static PyObject
*WinObj_ZoomWindowIdeal(WindowObject
*_self
, PyObject
*_args
)
1816 PyObject
*_res
= NULL
;
1818 WindowPartCode partCode
;
1820 #ifndef ZoomWindowIdeal
1821 PyMac_PRECHECK(ZoomWindowIdeal
);
1823 if (!PyArg_ParseTuple(_args
, "h",
1826 _err
= ZoomWindowIdeal(_self
->ob_itself
,
1829 if (_err
!= noErr
) return PyMac_Error(_err
);
1830 _res
= Py_BuildValue("O&",
1831 PyMac_BuildPoint
, ioIdealSize
);
1835 static PyObject
*WinObj_GetWindowIdealUserState(WindowObject
*_self
, PyObject
*_args
)
1837 PyObject
*_res
= NULL
;
1840 #ifndef GetWindowIdealUserState
1841 PyMac_PRECHECK(GetWindowIdealUserState
);
1843 if (!PyArg_ParseTuple(_args
, ""))
1845 _err
= GetWindowIdealUserState(_self
->ob_itself
,
1847 if (_err
!= noErr
) return PyMac_Error(_err
);
1848 _res
= Py_BuildValue("O&",
1849 PyMac_BuildRect
, &userState
);
1853 static PyObject
*WinObj_SetWindowIdealUserState(WindowObject
*_self
, PyObject
*_args
)
1855 PyObject
*_res
= NULL
;
1858 #ifndef SetWindowIdealUserState
1859 PyMac_PRECHECK(SetWindowIdealUserState
);
1861 if (!PyArg_ParseTuple(_args
, "O&",
1862 PyMac_GetRect
, &userState
))
1864 _err
= SetWindowIdealUserState(_self
->ob_itself
,
1866 if (_err
!= noErr
) return PyMac_Error(_err
);
1872 #if !TARGET_API_MAC_OS8
1874 static PyObject
*WinObj_GetWindowGreatestAreaDevice(WindowObject
*_self
, PyObject
*_args
)
1876 PyObject
*_res
= NULL
;
1878 WindowRegionCode inRegion
;
1879 GDHandle outGreatestDevice
;
1880 Rect outGreatestDeviceRect
;
1881 #ifndef GetWindowGreatestAreaDevice
1882 PyMac_PRECHECK(GetWindowGreatestAreaDevice
);
1884 if (!PyArg_ParseTuple(_args
, "H",
1887 _err
= GetWindowGreatestAreaDevice(_self
->ob_itself
,
1890 &outGreatestDeviceRect
);
1891 if (_err
!= noErr
) return PyMac_Error(_err
);
1892 _res
= Py_BuildValue("O&O&",
1893 ResObj_New
, outGreatestDevice
,
1894 PyMac_BuildRect
, &outGreatestDeviceRect
);
1899 #if !TARGET_API_MAC_OS8
1901 static PyObject
*WinObj_ConstrainWindowToScreen(WindowObject
*_self
, PyObject
*_args
)
1903 PyObject
*_res
= NULL
;
1905 WindowRegionCode inRegionCode
;
1906 WindowConstrainOptions inOptions
;
1909 #ifndef ConstrainWindowToScreen
1910 PyMac_PRECHECK(ConstrainWindowToScreen
);
1912 if (!PyArg_ParseTuple(_args
, "HlO&",
1915 PyMac_GetRect
, &inScreenRect
))
1917 _err
= ConstrainWindowToScreen(_self
->ob_itself
,
1922 if (_err
!= noErr
) return PyMac_Error(_err
);
1923 _res
= Py_BuildValue("O&",
1924 PyMac_BuildRect
, &outStructure
);
1929 static PyObject
*WinObj_HideWindow(WindowObject
*_self
, PyObject
*_args
)
1931 PyObject
*_res
= NULL
;
1933 PyMac_PRECHECK(HideWindow
);
1935 if (!PyArg_ParseTuple(_args
, ""))
1937 HideWindow(_self
->ob_itself
);
1943 static PyObject
*WinObj_MacShowWindow(WindowObject
*_self
, PyObject
*_args
)
1945 PyObject
*_res
= NULL
;
1946 #ifndef MacShowWindow
1947 PyMac_PRECHECK(MacShowWindow
);
1949 if (!PyArg_ParseTuple(_args
, ""))
1951 MacShowWindow(_self
->ob_itself
);
1957 static PyObject
*WinObj_ShowHide(WindowObject
*_self
, PyObject
*_args
)
1959 PyObject
*_res
= NULL
;
1962 PyMac_PRECHECK(ShowHide
);
1964 if (!PyArg_ParseTuple(_args
, "b",
1967 ShowHide(_self
->ob_itself
,
1974 static PyObject
*WinObj_MacIsWindowVisible(WindowObject
*_self
, PyObject
*_args
)
1976 PyObject
*_res
= NULL
;
1978 #ifndef MacIsWindowVisible
1979 PyMac_PRECHECK(MacIsWindowVisible
);
1981 if (!PyArg_ParseTuple(_args
, ""))
1983 _rv
= MacIsWindowVisible(_self
->ob_itself
);
1984 _res
= Py_BuildValue("b",
1989 #if !TARGET_API_MAC_OS8
1991 static PyObject
*WinObj_ShowSheetWindow(WindowObject
*_self
, PyObject
*_args
)
1993 PyObject
*_res
= NULL
;
1995 WindowPtr inParentWindow
;
1996 #ifndef ShowSheetWindow
1997 PyMac_PRECHECK(ShowSheetWindow
);
1999 if (!PyArg_ParseTuple(_args
, "O&",
2000 WinObj_Convert
, &inParentWindow
))
2002 _err
= ShowSheetWindow(_self
->ob_itself
,
2004 if (_err
!= noErr
) return PyMac_Error(_err
);
2011 #if !TARGET_API_MAC_OS8
2013 static PyObject
*WinObj_HideSheetWindow(WindowObject
*_self
, PyObject
*_args
)
2015 PyObject
*_res
= NULL
;
2017 #ifndef HideSheetWindow
2018 PyMac_PRECHECK(HideSheetWindow
);
2020 if (!PyArg_ParseTuple(_args
, ""))
2022 _err
= HideSheetWindow(_self
->ob_itself
);
2023 if (_err
!= noErr
) return PyMac_Error(_err
);
2030 #if !TARGET_API_MAC_OS8
2032 static PyObject
*WinObj_GetSheetWindowParent(WindowObject
*_self
, PyObject
*_args
)
2034 PyObject
*_res
= NULL
;
2036 WindowPtr outParentWindow
;
2037 #ifndef GetSheetWindowParent
2038 PyMac_PRECHECK(GetSheetWindowParent
);
2040 if (!PyArg_ParseTuple(_args
, ""))
2042 _err
= GetSheetWindowParent(_self
->ob_itself
,
2044 if (_err
!= noErr
) return PyMac_Error(_err
);
2045 _res
= Py_BuildValue("O&",
2046 WinObj_WhichWindow
, outParentWindow
);
2051 #if !TARGET_API_MAC_OS8
2053 static PyObject
*WinObj_GetWindowPropertyAttributes(WindowObject
*_self
, PyObject
*_args
)
2055 PyObject
*_res
= NULL
;
2057 OSType propertyCreator
;
2060 #ifndef GetWindowPropertyAttributes
2061 PyMac_PRECHECK(GetWindowPropertyAttributes
);
2063 if (!PyArg_ParseTuple(_args
, "O&O&",
2064 PyMac_GetOSType
, &propertyCreator
,
2065 PyMac_GetOSType
, &propertyTag
))
2067 _err
= GetWindowPropertyAttributes(_self
->ob_itself
,
2071 if (_err
!= noErr
) return PyMac_Error(_err
);
2072 _res
= Py_BuildValue("l",
2078 #if !TARGET_API_MAC_OS8
2080 static PyObject
*WinObj_ChangeWindowPropertyAttributes(WindowObject
*_self
, PyObject
*_args
)
2082 PyObject
*_res
= NULL
;
2084 OSType propertyCreator
;
2086 UInt32 attributesToSet
;
2087 UInt32 attributesToClear
;
2088 #ifndef ChangeWindowPropertyAttributes
2089 PyMac_PRECHECK(ChangeWindowPropertyAttributes
);
2091 if (!PyArg_ParseTuple(_args
, "O&O&ll",
2092 PyMac_GetOSType
, &propertyCreator
,
2093 PyMac_GetOSType
, &propertyTag
,
2095 &attributesToClear
))
2097 _err
= ChangeWindowPropertyAttributes(_self
->ob_itself
,
2102 if (_err
!= noErr
) return PyMac_Error(_err
);
2109 static PyObject
*WinObj_TrackBox(WindowObject
*_self
, PyObject
*_args
)
2111 PyObject
*_res
= NULL
;
2114 WindowPartCode partCode
;
2116 PyMac_PRECHECK(TrackBox
);
2118 if (!PyArg_ParseTuple(_args
, "O&h",
2119 PyMac_GetPoint
, &thePt
,
2122 _rv
= TrackBox(_self
->ob_itself
,
2125 _res
= Py_BuildValue("b",
2130 static PyObject
*WinObj_TrackGoAway(WindowObject
*_self
, PyObject
*_args
)
2132 PyObject
*_res
= NULL
;
2136 PyMac_PRECHECK(TrackGoAway
);
2138 if (!PyArg_ParseTuple(_args
, "O&",
2139 PyMac_GetPoint
, &thePt
))
2141 _rv
= TrackGoAway(_self
->ob_itself
,
2143 _res
= Py_BuildValue("b",
2148 #if !TARGET_API_MAC_CARBON
2150 static PyObject
*WinObj_GetAuxWin(WindowObject
*_self
, PyObject
*_args
)
2152 PyObject
*_res
= NULL
;
2154 AuxWinHandle awHndl
;
2156 PyMac_PRECHECK(GetAuxWin
);
2158 if (!PyArg_ParseTuple(_args
, ""))
2160 _rv
= GetAuxWin(_self
->ob_itself
,
2162 _res
= Py_BuildValue("bO&",
2164 ResObj_New
, awHndl
);
2169 #if !TARGET_API_MAC_CARBON
2171 static PyObject
*WinObj_GetWindowGoAwayFlag(WindowObject
*_self
, PyObject
*_args
)
2173 PyObject
*_res
= NULL
;
2175 #ifndef GetWindowGoAwayFlag
2176 PyMac_PRECHECK(GetWindowGoAwayFlag
);
2178 if (!PyArg_ParseTuple(_args
, ""))
2180 _rv
= GetWindowGoAwayFlag(_self
->ob_itself
);
2181 _res
= Py_BuildValue("b",
2187 #if !TARGET_API_MAC_CARBON
2189 static PyObject
*WinObj_GetWindowSpareFlag(WindowObject
*_self
, PyObject
*_args
)
2191 PyObject
*_res
= NULL
;
2193 #ifndef GetWindowSpareFlag
2194 PyMac_PRECHECK(GetWindowSpareFlag
);
2196 if (!PyArg_ParseTuple(_args
, ""))
2198 _rv
= GetWindowSpareFlag(_self
->ob_itself
);
2199 _res
= Py_BuildValue("b",
2205 static PyObject
*WinObj_GetWindowPort(WindowObject
*_self
, PyObject
*_args
)
2207 PyObject
*_res
= NULL
;
2209 #ifndef GetWindowPort
2210 PyMac_PRECHECK(GetWindowPort
);
2212 if (!PyArg_ParseTuple(_args
, ""))
2214 _rv
= GetWindowPort(_self
->ob_itself
);
2215 _res
= Py_BuildValue("O&",
2220 static PyObject
*WinObj_GetWindowKind(WindowObject
*_self
, PyObject
*_args
)
2222 PyObject
*_res
= NULL
;
2224 #ifndef GetWindowKind
2225 PyMac_PRECHECK(GetWindowKind
);
2227 if (!PyArg_ParseTuple(_args
, ""))
2229 _rv
= GetWindowKind(_self
->ob_itself
);
2230 _res
= Py_BuildValue("h",
2235 static PyObject
*WinObj_IsWindowHilited(WindowObject
*_self
, PyObject
*_args
)
2237 PyObject
*_res
= NULL
;
2239 #ifndef IsWindowHilited
2240 PyMac_PRECHECK(IsWindowHilited
);
2242 if (!PyArg_ParseTuple(_args
, ""))
2244 _rv
= IsWindowHilited(_self
->ob_itself
);
2245 _res
= Py_BuildValue("b",
2250 #if !TARGET_API_MAC_OS8
2252 static PyObject
*WinObj_IsWindowUpdatePending(WindowObject
*_self
, PyObject
*_args
)
2254 PyObject
*_res
= NULL
;
2256 #ifndef IsWindowUpdatePending
2257 PyMac_PRECHECK(IsWindowUpdatePending
);
2259 if (!PyArg_ParseTuple(_args
, ""))
2261 _rv
= IsWindowUpdatePending(_self
->ob_itself
);
2262 _res
= Py_BuildValue("b",
2268 static PyObject
*WinObj_MacGetNextWindow(WindowObject
*_self
, PyObject
*_args
)
2270 PyObject
*_res
= NULL
;
2272 #ifndef MacGetNextWindow
2273 PyMac_PRECHECK(MacGetNextWindow
);
2275 if (!PyArg_ParseTuple(_args
, ""))
2277 _rv
= MacGetNextWindow(_self
->ob_itself
);
2278 _res
= Py_BuildValue("O&",
2283 static PyObject
*WinObj_GetWindowStandardState(WindowObject
*_self
, PyObject
*_args
)
2285 PyObject
*_res
= NULL
;
2287 #ifndef GetWindowStandardState
2288 PyMac_PRECHECK(GetWindowStandardState
);
2290 if (!PyArg_ParseTuple(_args
, ""))
2292 GetWindowStandardState(_self
->ob_itself
,
2294 _res
= Py_BuildValue("O&",
2295 PyMac_BuildRect
, &rect
);
2299 static PyObject
*WinObj_GetWindowUserState(WindowObject
*_self
, PyObject
*_args
)
2301 PyObject
*_res
= NULL
;
2303 #ifndef GetWindowUserState
2304 PyMac_PRECHECK(GetWindowUserState
);
2306 if (!PyArg_ParseTuple(_args
, ""))
2308 GetWindowUserState(_self
->ob_itself
,
2310 _res
= Py_BuildValue("O&",
2311 PyMac_BuildRect
, &rect
);
2315 static PyObject
*WinObj_SetWindowKind(WindowObject
*_self
, PyObject
*_args
)
2317 PyObject
*_res
= NULL
;
2319 #ifndef SetWindowKind
2320 PyMac_PRECHECK(SetWindowKind
);
2322 if (!PyArg_ParseTuple(_args
, "h",
2325 SetWindowKind(_self
->ob_itself
,
2332 static PyObject
*WinObj_SetWindowStandardState(WindowObject
*_self
, PyObject
*_args
)
2334 PyObject
*_res
= NULL
;
2336 #ifndef SetWindowStandardState
2337 PyMac_PRECHECK(SetWindowStandardState
);
2339 if (!PyArg_ParseTuple(_args
, "O&",
2340 PyMac_GetRect
, &rect
))
2342 SetWindowStandardState(_self
->ob_itself
,
2349 static PyObject
*WinObj_SetWindowUserState(WindowObject
*_self
, PyObject
*_args
)
2351 PyObject
*_res
= NULL
;
2353 #ifndef SetWindowUserState
2354 PyMac_PRECHECK(SetWindowUserState
);
2356 if (!PyArg_ParseTuple(_args
, "O&",
2357 PyMac_GetRect
, &rect
))
2359 SetWindowUserState(_self
->ob_itself
,
2366 static PyObject
*WinObj_SetPortWindowPort(WindowObject
*_self
, PyObject
*_args
)
2368 PyObject
*_res
= NULL
;
2369 #ifndef SetPortWindowPort
2370 PyMac_PRECHECK(SetPortWindowPort
);
2372 if (!PyArg_ParseTuple(_args
, ""))
2374 SetPortWindowPort(_self
->ob_itself
);
2380 static PyObject
*WinObj_GetWindowPortBounds(WindowObject
*_self
, PyObject
*_args
)
2382 PyObject
*_res
= NULL
;
2384 #ifndef GetWindowPortBounds
2385 PyMac_PRECHECK(GetWindowPortBounds
);
2387 if (!PyArg_ParseTuple(_args
, ""))
2389 GetWindowPortBounds(_self
->ob_itself
,
2391 _res
= Py_BuildValue("O&",
2392 PyMac_BuildRect
, &bounds
);
2396 static PyObject
*WinObj_IsWindowVisible(WindowObject
*_self
, PyObject
*_args
)
2398 PyObject
*_res
= NULL
;
2400 #ifndef IsWindowVisible
2401 PyMac_PRECHECK(IsWindowVisible
);
2403 if (!PyArg_ParseTuple(_args
, ""))
2405 _rv
= IsWindowVisible(_self
->ob_itself
);
2406 _res
= Py_BuildValue("b",
2411 #if !TARGET_API_MAC_CARBON
2413 static PyObject
*WinObj_GetWindowZoomFlag(WindowObject
*_self
, PyObject
*_args
)
2415 PyObject
*_res
= NULL
;
2417 #ifndef GetWindowZoomFlag
2418 PyMac_PRECHECK(GetWindowZoomFlag
);
2420 if (!PyArg_ParseTuple(_args
, ""))
2422 _rv
= GetWindowZoomFlag(_self
->ob_itself
);
2423 _res
= Py_BuildValue("b",
2429 static PyObject
*WinObj_GetWindowStructureRgn(WindowObject
*_self
, PyObject
*_args
)
2431 PyObject
*_res
= NULL
;
2433 #ifndef GetWindowStructureRgn
2434 PyMac_PRECHECK(GetWindowStructureRgn
);
2436 if (!PyArg_ParseTuple(_args
, "O&",
2437 ResObj_Convert
, &r
))
2439 GetWindowStructureRgn(_self
->ob_itself
,
2446 static PyObject
*WinObj_GetWindowContentRgn(WindowObject
*_self
, PyObject
*_args
)
2448 PyObject
*_res
= NULL
;
2450 #ifndef GetWindowContentRgn
2451 PyMac_PRECHECK(GetWindowContentRgn
);
2453 if (!PyArg_ParseTuple(_args
, "O&",
2454 ResObj_Convert
, &r
))
2456 GetWindowContentRgn(_self
->ob_itself
,
2463 static PyObject
*WinObj_GetWindowUpdateRgn(WindowObject
*_self
, PyObject
*_args
)
2465 PyObject
*_res
= NULL
;
2467 #ifndef GetWindowUpdateRgn
2468 PyMac_PRECHECK(GetWindowUpdateRgn
);
2470 if (!PyArg_ParseTuple(_args
, "O&",
2471 ResObj_Convert
, &r
))
2473 GetWindowUpdateRgn(_self
->ob_itself
,
2480 #if !TARGET_API_MAC_CARBON
2482 static PyObject
*WinObj_GetWindowTitleWidth(WindowObject
*_self
, PyObject
*_args
)
2484 PyObject
*_res
= NULL
;
2486 #ifndef GetWindowTitleWidth
2487 PyMac_PRECHECK(GetWindowTitleWidth
);
2489 if (!PyArg_ParseTuple(_args
, ""))
2491 _rv
= GetWindowTitleWidth(_self
->ob_itself
);
2492 _res
= Py_BuildValue("h",
2498 static PyObject
*WinObj_GetNextWindow(WindowObject
*_self
, PyObject
*_args
)
2500 PyObject
*_res
= NULL
;
2502 #ifndef GetNextWindow
2503 PyMac_PRECHECK(GetNextWindow
);
2505 if (!PyArg_ParseTuple(_args
, ""))
2507 _rv
= GetNextWindow(_self
->ob_itself
);
2508 _res
= Py_BuildValue("O&",
2509 WinObj_WhichWindow
, _rv
);
2513 #if !TARGET_API_MAC_CARBON
2515 static PyObject
*WinObj_CloseWindow(WindowObject
*_self
, PyObject
*_args
)
2517 PyObject
*_res
= NULL
;
2519 PyMac_PRECHECK(CloseWindow
);
2521 if (!PyArg_ParseTuple(_args
, ""))
2523 CloseWindow(_self
->ob_itself
);
2530 static PyObject
*WinObj_MoveWindow(WindowObject
*_self
, PyObject
*_args
)
2532 PyObject
*_res
= NULL
;
2537 PyMac_PRECHECK(MoveWindow
);
2539 if (!PyArg_ParseTuple(_args
, "hhb",
2544 MoveWindow(_self
->ob_itself
,
2553 static PyObject
*WinObj_ShowWindow(WindowObject
*_self
, PyObject
*_args
)
2555 PyObject
*_res
= NULL
;
2557 PyMac_PRECHECK(ShowWindow
);
2559 if (!PyArg_ParseTuple(_args
, ""))
2561 ShowWindow(_self
->ob_itself
);
2567 static PyMethodDef WinObj_methods
[] = {
2568 {"GetWindowOwnerCount", (PyCFunction
)WinObj_GetWindowOwnerCount
, 1,
2569 "() -> (UInt32 outCount)"},
2570 {"CloneWindow", (PyCFunction
)WinObj_CloneWindow
, 1,
2573 #if !TARGET_API_MAC_OS8
2574 {"GetWindowRetainCount", (PyCFunction
)WinObj_GetWindowRetainCount
, 1,
2575 "() -> (ItemCount _rv)"},
2578 #if !TARGET_API_MAC_OS8
2579 {"RetainWindow", (PyCFunction
)WinObj_RetainWindow
, 1,
2583 #if !TARGET_API_MAC_OS8
2584 {"ReleaseWindow", (PyCFunction
)WinObj_ReleaseWindow
, 1,
2588 #if !TARGET_API_MAC_OS8
2589 {"ReshapeCustomWindow", (PyCFunction
)WinObj_ReshapeCustomWindow
, 1,
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"},
2604 #if !TARGET_API_MAC_OS8
2605 {"SetWindowClass", (PyCFunction
)WinObj_SetWindowClass
, 1,
2606 "(WindowClass inWindowClass) -> None"},
2609 #if !TARGET_API_MAC_OS8
2610 {"SetWindowModality", (PyCFunction
)WinObj_SetWindowModality
, 1,
2611 "(WindowModality inModalKind, WindowPtr inUnavailableWindow) -> None"},
2614 #if !TARGET_API_MAC_OS8
2615 {"GetWindowModality", (PyCFunction
)WinObj_GetWindowModality
, 1,
2616 "() -> (WindowModality outModalKind, WindowPtr outUnavailableWindow)"},
2619 #if !TARGET_API_MAC_CARBON
2620 {"SetWinColor", (PyCFunction
)WinObj_SetWinColor
, 1,
2621 "(WCTabHandle newColorTable) -> None"},
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"},
2637 #if !TARGET_API_MAC_OS8
2638 {"ScrollWindowRegion", (PyCFunction
)WinObj_ScrollWindowRegion
, 1,
2639 "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
2641 {"ClipAbove", (PyCFunction
)WinObj_ClipAbove
, 1,
2644 #if !TARGET_API_MAC_CARBON
2645 {"SaveOld", (PyCFunction
)WinObj_SaveOld
, 1,
2649 #if !TARGET_API_MAC_CARBON
2650 {"DrawNew", (PyCFunction
)WinObj_DrawNew
, 1,
2651 "(Boolean update) -> None"},
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,
2659 {"CalcVisBehind", (PyCFunction
)WinObj_CalcVisBehind
, 1,
2660 "(RgnHandle clobberedRgn) -> None"},
2661 {"BringToFront", (PyCFunction
)WinObj_BringToFront
, 1,
2663 {"SendBehind", (PyCFunction
)WinObj_SendBehind
, 1,
2664 "(WindowPtr behindWindow) -> None"},
2665 {"SelectWindow", (PyCFunction
)WinObj_SelectWindow
, 1,
2668 #if !TARGET_API_MAC_OS8
2669 {"GetNextWindowOfClass", (PyCFunction
)WinObj_GetNextWindowOfClass
, 1,
2670 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
2673 #if !TARGET_API_MAC_OS8
2674 {"SetWindowAlternateTitle", (PyCFunction
)WinObj_SetWindowAlternateTitle
, 1,
2675 "(CFStringRef inTitle) -> None"},
2678 #if !TARGET_API_MAC_OS8
2679 {"CopyWindowAlternateTitle", (PyCFunction
)WinObj_CopyWindowAlternateTitle
, 1,
2680 "() -> (CFStringRef outTitle)"},
2683 #if !TARGET_API_MAC_CARBON
2684 {"IsValidWindowPtr", (PyCFunction
)WinObj_IsValidWindowPtr
, 1,
2685 "() -> (Boolean _rv)"},
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,
2707 {"EndUpdate", (PyCFunction
)WinObj_EndUpdate
, 1,
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,
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"},
2729 #if !TARGET_API_MAC_OS8
2730 {"CopyWindowTitleAsCFString", (PyCFunction
)WinObj_CopyWindowTitleAsCFString
, 1,
2731 "() -> (CFStringRef outString)"},
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,
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"},
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)"},
2814 #if !TARGET_API_MAC_OS8
2815 {"ConstrainWindowToScreen", (PyCFunction
)WinObj_ConstrainWindowToScreen
, 1,
2816 "(WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, Rect inScreenRect) -> (Rect outStructure)"},
2818 {"HideWindow", (PyCFunction
)WinObj_HideWindow
, 1,
2820 {"MacShowWindow", (PyCFunction
)WinObj_MacShowWindow
, 1,
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"},
2832 #if !TARGET_API_MAC_OS8
2833 {"HideSheetWindow", (PyCFunction
)WinObj_HideSheetWindow
, 1,
2837 #if !TARGET_API_MAC_OS8
2838 {"GetSheetWindowParent", (PyCFunction
)WinObj_GetSheetWindowParent
, 1,
2839 "() -> (WindowPtr outParentWindow)"},
2842 #if !TARGET_API_MAC_OS8
2843 {"GetWindowPropertyAttributes", (PyCFunction
)WinObj_GetWindowPropertyAttributes
, 1,
2844 "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
2847 #if !TARGET_API_MAC_OS8
2848 {"ChangeWindowPropertyAttributes", (PyCFunction
)WinObj_ChangeWindowPropertyAttributes
, 1,
2849 "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
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)"},
2861 #if !TARGET_API_MAC_CARBON
2862 {"GetWindowGoAwayFlag", (PyCFunction
)WinObj_GetWindowGoAwayFlag
, 1,
2863 "() -> (Boolean _rv)"},
2866 #if !TARGET_API_MAC_CARBON
2867 {"GetWindowSpareFlag", (PyCFunction
)WinObj_GetWindowSpareFlag
, 1,
2868 "() -> (Boolean _rv)"},
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)"},
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,
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)"},
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)"},
2915 {"GetNextWindow", (PyCFunction
)WinObj_GetNextWindow
, 1,
2916 "() -> (WindowPtr _rv)"},
2918 #if !TARGET_API_MAC_CARBON
2919 {"CloseWindow", (PyCFunction
)WinObj_CloseWindow
, 1,
2922 {"MoveWindow", (PyCFunction
)WinObj_MoveWindow
, 1,
2923 "(short hGlobal, short vGlobal, Boolean front) -> None"},
2924 {"ShowWindow", (PyCFunction
)WinObj_ShowWindow
, 1,
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;
2945 static PyObject
* WinObj_repr(WindowObject
*self
)
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
)
2960 "_Win.Window", /*tp_name*/
2961 sizeof(WindowObject
), /*tp_basicsize*/
2964 (destructor
) WinObj_dealloc
, /*tp_dealloc*/
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
;
2985 #ifndef GetNewCWindow
2986 PyMac_PRECHECK(GetNewCWindow
);
2988 if (!PyArg_ParseTuple(_args
, "hO&",
2990 WinObj_Convert
, &behind
))
2992 _rv
= GetNewCWindow(windowID
,
2995 _res
= Py_BuildValue("O&",
3000 static PyObject
*Win_NewWindow(PyObject
*_self
, PyObject
*_args
)
3002 PyObject
*_res
= NULL
;
3012 PyMac_PRECHECK(NewWindow
);
3014 if (!PyArg_ParseTuple(_args
, "O&O&bhO&bl",
3015 PyMac_GetRect
, &boundsRect
,
3016 PyMac_GetStr255
, title
,
3019 WinObj_Convert
, &behind
,
3023 _rv
= NewWindow((void *)0,
3031 _res
= Py_BuildValue("O&",
3036 static PyObject
*Win_GetNewWindow(PyObject
*_self
, PyObject
*_args
)
3038 PyObject
*_res
= NULL
;
3042 #ifndef GetNewWindow
3043 PyMac_PRECHECK(GetNewWindow
);
3045 if (!PyArg_ParseTuple(_args
, "hO&",
3047 WinObj_Convert
, &behind
))
3049 _rv
= GetNewWindow(windowID
,
3052 _res
= Py_BuildValue("O&",
3057 static PyObject
*Win_NewCWindow(PyObject
*_self
, PyObject
*_args
)
3059 PyObject
*_res
= NULL
;
3069 PyMac_PRECHECK(NewCWindow
);
3071 if (!PyArg_ParseTuple(_args
, "O&O&bhO&bl",
3072 PyMac_GetRect
, &boundsRect
,
3073 PyMac_GetStr255
, title
,
3076 WinObj_Convert
, &behind
,
3080 _rv
= NewCWindow((void *)0,
3088 _res
= Py_BuildValue("O&",
3093 static PyObject
*Win_CreateNewWindow(PyObject
*_self
, PyObject
*_args
)
3095 PyObject
*_res
= NULL
;
3097 WindowClass windowClass
;
3098 WindowAttributes attributes
;
3100 WindowPtr outWindow
;
3101 #ifndef CreateNewWindow
3102 PyMac_PRECHECK(CreateNewWindow
);
3104 if (!PyArg_ParseTuple(_args
, "llO&",
3107 PyMac_GetRect
, &contentBounds
))
3109 _err
= CreateNewWindow(windowClass
,
3113 if (_err
!= noErr
) return PyMac_Error(_err
);
3114 _res
= Py_BuildValue("O&",
3115 WinObj_WhichWindow
, outWindow
);
3119 static PyObject
*Win_CreateWindowFromResource(PyObject
*_self
, PyObject
*_args
)
3121 PyObject
*_res
= NULL
;
3124 WindowPtr outWindow
;
3125 #ifndef CreateWindowFromResource
3126 PyMac_PRECHECK(CreateWindowFromResource
);
3128 if (!PyArg_ParseTuple(_args
, "h",
3131 _err
= CreateWindowFromResource(resID
,
3133 if (_err
!= noErr
) return PyMac_Error(_err
);
3134 _res
= Py_BuildValue("O&",
3135 WinObj_WhichWindow
, outWindow
);
3139 static PyObject
*Win_ShowFloatingWindows(PyObject
*_self
, PyObject
*_args
)
3141 PyObject
*_res
= NULL
;
3143 #ifndef ShowFloatingWindows
3144 PyMac_PRECHECK(ShowFloatingWindows
);
3146 if (!PyArg_ParseTuple(_args
, ""))
3148 _err
= ShowFloatingWindows();
3149 if (_err
!= noErr
) return PyMac_Error(_err
);
3155 static PyObject
*Win_HideFloatingWindows(PyObject
*_self
, PyObject
*_args
)
3157 PyObject
*_res
= NULL
;
3159 #ifndef HideFloatingWindows
3160 PyMac_PRECHECK(HideFloatingWindows
);
3162 if (!PyArg_ParseTuple(_args
, ""))
3164 _err
= HideFloatingWindows();
3165 if (_err
!= noErr
) return PyMac_Error(_err
);
3171 static PyObject
*Win_AreFloatingWindowsVisible(PyObject
*_self
, PyObject
*_args
)
3173 PyObject
*_res
= NULL
;
3175 #ifndef AreFloatingWindowsVisible
3176 PyMac_PRECHECK(AreFloatingWindowsVisible
);
3178 if (!PyArg_ParseTuple(_args
, ""))
3180 _rv
= AreFloatingWindowsVisible();
3181 _res
= Py_BuildValue("b",
3186 #if !TARGET_API_MAC_CARBON
3188 static PyObject
*Win_SetDeskCPat(PyObject
*_self
, PyObject
*_args
)
3190 PyObject
*_res
= NULL
;
3191 PixPatHandle deskPixPat
;
3193 PyMac_PRECHECK(SetDeskCPat
);
3195 if (!PyArg_ParseTuple(_args
, "O&",
3196 ResObj_Convert
, &deskPixPat
))
3198 SetDeskCPat(deskPixPat
);
3205 static PyObject
*Win_CheckUpdate(PyObject
*_self
, PyObject
*_args
)
3207 PyObject
*_res
= NULL
;
3209 EventRecord theEvent
;
3211 PyMac_PRECHECK(CheckUpdate
);
3213 if (!PyArg_ParseTuple(_args
, ""))
3215 _rv
= CheckUpdate(&theEvent
);
3216 _res
= Py_BuildValue("bO&",
3218 PyMac_BuildEventRecord
, &theEvent
);
3222 static PyObject
*Win_MacFindWindow(PyObject
*_self
, PyObject
*_args
)
3224 PyObject
*_res
= NULL
;
3228 #ifndef MacFindWindow
3229 PyMac_PRECHECK(MacFindWindow
);
3231 if (!PyArg_ParseTuple(_args
, "O&",
3232 PyMac_GetPoint
, &thePoint
))
3234 _rv
= MacFindWindow(thePoint
,
3236 _res
= Py_BuildValue("hO&",
3238 WinObj_WhichWindow
, window
);
3242 static PyObject
*Win_FrontWindow(PyObject
*_self
, PyObject
*_args
)
3244 PyObject
*_res
= NULL
;
3247 PyMac_PRECHECK(FrontWindow
);
3249 if (!PyArg_ParseTuple(_args
, ""))
3251 _rv
= FrontWindow();
3252 _res
= Py_BuildValue("O&",
3253 WinObj_WhichWindow
, _rv
);
3257 static PyObject
*Win_FrontNonFloatingWindow(PyObject
*_self
, PyObject
*_args
)
3259 PyObject
*_res
= NULL
;
3261 #ifndef FrontNonFloatingWindow
3262 PyMac_PRECHECK(FrontNonFloatingWindow
);
3264 if (!PyArg_ParseTuple(_args
, ""))
3266 _rv
= FrontNonFloatingWindow();
3267 _res
= Py_BuildValue("O&",
3268 WinObj_WhichWindow
, _rv
);
3272 #if !TARGET_API_MAC_OS8
3274 static PyObject
*Win_GetFrontWindowOfClass(PyObject
*_self
, PyObject
*_args
)
3276 PyObject
*_res
= NULL
;
3278 WindowClass inWindowClass
;
3279 Boolean mustBeVisible
;
3280 #ifndef GetFrontWindowOfClass
3281 PyMac_PRECHECK(GetFrontWindowOfClass
);
3283 if (!PyArg_ParseTuple(_args
, "lb",
3287 _rv
= GetFrontWindowOfClass(inWindowClass
,
3289 _res
= Py_BuildValue("O&",
3295 #if !TARGET_API_MAC_OS8
3297 static PyObject
*Win_FindWindowOfClass(PyObject
*_self
, PyObject
*_args
)
3299 PyObject
*_res
= NULL
;
3302 WindowClass inWindowClass
;
3303 WindowPtr outWindow
;
3304 WindowPartCode outWindowPart
;
3305 #ifndef FindWindowOfClass
3306 PyMac_PRECHECK(FindWindowOfClass
);
3308 if (!PyArg_ParseTuple(_args
, "O&l",
3309 PyMac_GetPoint
, &where
,
3312 _err
= FindWindowOfClass(&where
,
3316 if (_err
!= noErr
) return PyMac_Error(_err
);
3317 _res
= Py_BuildValue("O&h",
3318 WinObj_WhichWindow
, outWindow
,
3324 #if !TARGET_API_MAC_OS8
3326 static PyObject
*Win_CreateStandardWindowMenu(PyObject
*_self
, PyObject
*_args
)
3328 PyObject
*_res
= NULL
;
3330 OptionBits inOptions
;
3332 #ifndef CreateStandardWindowMenu
3333 PyMac_PRECHECK(CreateStandardWindowMenu
);
3335 if (!PyArg_ParseTuple(_args
, "l",
3338 _err
= CreateStandardWindowMenu(inOptions
,
3340 if (_err
!= noErr
) return PyMac_Error(_err
);
3341 _res
= Py_BuildValue("O&",
3342 MenuObj_New
, outMenu
);
3347 #if !TARGET_API_MAC_CARBON
3349 static PyObject
*Win_InitWindows(PyObject
*_self
, PyObject
*_args
)
3351 PyObject
*_res
= NULL
;
3353 PyMac_PRECHECK(InitWindows
);
3355 if (!PyArg_ParseTuple(_args
, ""))
3364 #if !TARGET_API_MAC_CARBON
3366 static PyObject
*Win_GetWMgrPort(PyObject
*_self
, PyObject
*_args
)
3368 PyObject
*_res
= NULL
;
3371 PyMac_PRECHECK(GetWMgrPort
);
3373 if (!PyArg_ParseTuple(_args
, ""))
3375 GetWMgrPort(&wPort
);
3376 _res
= Py_BuildValue("O&",
3377 GrafObj_New
, wPort
);
3382 #if !TARGET_API_MAC_CARBON
3384 static PyObject
*Win_GetCWMgrPort(PyObject
*_self
, PyObject
*_args
)
3386 PyObject
*_res
= NULL
;
3388 #ifndef GetCWMgrPort
3389 PyMac_PRECHECK(GetCWMgrPort
);
3391 if (!PyArg_ParseTuple(_args
, ""))
3393 GetCWMgrPort(&wMgrCPort
);
3394 _res
= Py_BuildValue("O&",
3395 GrafObj_New
, wMgrCPort
);
3400 #if !TARGET_API_MAC_CARBON
3402 static PyObject
*Win_InitFloatingWindows(PyObject
*_self
, PyObject
*_args
)
3404 PyObject
*_res
= NULL
;
3406 #ifndef InitFloatingWindows
3407 PyMac_PRECHECK(InitFloatingWindows
);
3409 if (!PyArg_ParseTuple(_args
, ""))
3411 _err
= InitFloatingWindows();
3412 if (_err
!= noErr
) return PyMac_Error(_err
);
3419 #if !TARGET_API_MAC_CARBON
3421 static PyObject
*Win_InvalRect(PyObject
*_self
, PyObject
*_args
)
3423 PyObject
*_res
= NULL
;
3426 PyMac_PRECHECK(InvalRect
);
3428 if (!PyArg_ParseTuple(_args
, "O&",
3429 PyMac_GetRect
, &badRect
))
3431 InvalRect(&badRect
);
3438 #if !TARGET_API_MAC_CARBON
3440 static PyObject
*Win_InvalRgn(PyObject
*_self
, PyObject
*_args
)
3442 PyObject
*_res
= NULL
;
3445 PyMac_PRECHECK(InvalRgn
);
3447 if (!PyArg_ParseTuple(_args
, "O&",
3448 ResObj_Convert
, &badRgn
))
3457 #if !TARGET_API_MAC_CARBON
3459 static PyObject
*Win_ValidRect(PyObject
*_self
, PyObject
*_args
)
3461 PyObject
*_res
= NULL
;
3464 PyMac_PRECHECK(ValidRect
);
3466 if (!PyArg_ParseTuple(_args
, "O&",
3467 PyMac_GetRect
, &goodRect
))
3469 ValidRect(&goodRect
);
3476 #if !TARGET_API_MAC_CARBON
3478 static PyObject
*Win_ValidRgn(PyObject
*_self
, PyObject
*_args
)
3480 PyObject
*_res
= NULL
;
3483 PyMac_PRECHECK(ValidRgn
);
3485 if (!PyArg_ParseTuple(_args
, "O&",
3486 ResObj_Convert
, &goodRgn
))
3495 static PyObject
*Win_CollapseAllWindows(PyObject
*_self
, PyObject
*_args
)
3497 PyObject
*_res
= NULL
;
3500 #ifndef CollapseAllWindows
3501 PyMac_PRECHECK(CollapseAllWindows
);
3503 if (!PyArg_ParseTuple(_args
, "b",
3506 _err
= CollapseAllWindows(collapse
);
3507 if (_err
!= noErr
) return PyMac_Error(_err
);
3513 #if !TARGET_API_MAC_OS8
3515 static PyObject
*Win_GetAvailableWindowPositioningBounds(PyObject
*_self
, PyObject
*_args
)
3517 PyObject
*_res
= NULL
;
3521 #ifndef GetAvailableWindowPositioningBounds
3522 PyMac_PRECHECK(GetAvailableWindowPositioningBounds
);
3524 if (!PyArg_ParseTuple(_args
, "O&",
3525 ResObj_Convert
, &inDevice
))
3527 _err
= GetAvailableWindowPositioningBounds(inDevice
,
3529 if (_err
!= noErr
) return PyMac_Error(_err
);
3530 _res
= Py_BuildValue("O&",
3531 PyMac_BuildRect
, &availableRect
);
3536 #if !TARGET_API_MAC_OS8
3538 static PyObject
*Win_DisableScreenUpdates(PyObject
*_self
, PyObject
*_args
)
3540 PyObject
*_res
= NULL
;
3542 #ifndef DisableScreenUpdates
3543 PyMac_PRECHECK(DisableScreenUpdates
);
3545 if (!PyArg_ParseTuple(_args
, ""))
3547 _err
= DisableScreenUpdates();
3548 if (_err
!= noErr
) return PyMac_Error(_err
);
3555 #if !TARGET_API_MAC_OS8
3557 static PyObject
*Win_EnableScreenUpdates(PyObject
*_self
, PyObject
*_args
)
3559 PyObject
*_res
= NULL
;
3561 #ifndef EnableScreenUpdates
3562 PyMac_PRECHECK(EnableScreenUpdates
);
3564 if (!PyArg_ParseTuple(_args
, ""))
3566 _err
= EnableScreenUpdates();
3567 if (_err
!= noErr
) return PyMac_Error(_err
);
3574 static PyObject
*Win_PinRect(PyObject
*_self
, PyObject
*_args
)
3576 PyObject
*_res
= NULL
;
3581 PyMac_PRECHECK(PinRect
);
3583 if (!PyArg_ParseTuple(_args
, "O&O&",
3584 PyMac_GetRect
, &theRect
,
3585 PyMac_GetPoint
, &thePt
))
3587 _rv
= PinRect(&theRect
,
3589 _res
= Py_BuildValue("l",
3594 static PyObject
*Win_GetGrayRgn(PyObject
*_self
, PyObject
*_args
)
3596 PyObject
*_res
= NULL
;
3599 PyMac_PRECHECK(GetGrayRgn
);
3601 if (!PyArg_ParseTuple(_args
, ""))
3604 _res
= Py_BuildValue("O&",
3609 static PyObject
*Win_GetWindowFromPort(PyObject
*_self
, PyObject
*_args
)
3611 PyObject
*_res
= NULL
;
3614 #ifndef GetWindowFromPort
3615 PyMac_PRECHECK(GetWindowFromPort
);
3617 if (!PyArg_ParseTuple(_args
, "O&",
3618 GrafObj_Convert
, &port
))
3620 _rv
= GetWindowFromPort(port
);
3621 _res
= Py_BuildValue("O&",
3626 static PyObject
*Win_WhichWindow(PyObject
*_self
, PyObject
*_args
)
3628 PyObject
*_res
= NULL
;
3632 if ( !PyArg_ParseTuple(_args
, "i", &ptr
) )
3634 _res
= WinObj_WhichWindow((WindowPtr
)ptr
);
3639 static PyObject
*Win_FindWindow(PyObject
*_self
, PyObject
*_args
)
3641 PyObject
*_res
= NULL
;
3644 WindowPtr theWindow
;
3646 PyMac_PRECHECK(FindWindow
);
3648 if (!PyArg_ParseTuple(_args
, "O&",
3649 PyMac_GetPoint
, &thePoint
))
3651 _rv
= FindWindow(thePoint
,
3653 _res
= Py_BuildValue("hO&",
3655 WinObj_WhichWindow
, theWindow
);
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,
3674 {"HideFloatingWindows", (PyCFunction
)Win_HideFloatingWindows
, 1,
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"},
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)"},
3697 #if !TARGET_API_MAC_OS8
3698 {"FindWindowOfClass", (PyCFunction
)Win_FindWindowOfClass
, 1,
3699 "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"},
3702 #if !TARGET_API_MAC_OS8
3703 {"CreateStandardWindowMenu", (PyCFunction
)Win_CreateStandardWindowMenu
, 1,
3704 "(OptionBits inOptions) -> (MenuHandle outMenu)"},
3707 #if !TARGET_API_MAC_CARBON
3708 {"InitWindows", (PyCFunction
)Win_InitWindows
, 1,
3712 #if !TARGET_API_MAC_CARBON
3713 {"GetWMgrPort", (PyCFunction
)Win_GetWMgrPort
, 1,
3714 "() -> (GrafPtr wPort)"},
3717 #if !TARGET_API_MAC_CARBON
3718 {"GetCWMgrPort", (PyCFunction
)Win_GetCWMgrPort
, 1,
3719 "() -> (CGrafPtr wMgrCPort)"},
3722 #if !TARGET_API_MAC_CARBON
3723 {"InitFloatingWindows", (PyCFunction
)Win_InitFloatingWindows
, 1,
3727 #if !TARGET_API_MAC_CARBON
3728 {"InvalRect", (PyCFunction
)Win_InvalRect
, 1,
3729 "(Rect badRect) -> None"},
3732 #if !TARGET_API_MAC_CARBON
3733 {"InvalRgn", (PyCFunction
)Win_InvalRgn
, 1,
3734 "(RgnHandle badRgn) -> None"},
3737 #if !TARGET_API_MAC_CARBON
3738 {"ValidRect", (PyCFunction
)Win_ValidRect
, 1,
3739 "(Rect goodRect) -> None"},
3742 #if !TARGET_API_MAC_CARBON
3743 {"ValidRgn", (PyCFunction
)Win_ValidRgn
, 1,
3744 "(RgnHandle goodRgn) -> None"},
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)"},
3754 #if !TARGET_API_MAC_OS8
3755 {"DisableScreenUpdates", (PyCFunction
)Win_DisableScreenUpdates
, 1,
3759 #if !TARGET_API_MAC_OS8
3760 {"EnableScreenUpdates", (PyCFunction
)Win_EnableScreenUpdates
, 1,
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)"},
3778 /* Return the object corresponding to the window, or NULL */
3781 WinObj_WhichWindow(WindowPtr w
)
3789 it
= (PyObject
*) GetWRefCon(w
);
3790 if (it
== NULL
|| !IsPointerValid((Ptr
)it
) || ((WindowObject
*)it
)->ob_itself
!= w
|| !WinObj_Check(it
)) {
3792 ((WindowObject
*)it
)->ob_freeit
= NULL
;
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)
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 ========================= */