2 /* =========================== Module Win =========================== */
9 #include "pymactoolbox.h"
13 #if !ACCESSOR_CALLS_ARE_FUNCTIONS
14 /* Carbon calls that we emulate in classic mode */
15 #define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
16 #define GetWindowFromPort(port) ((WindowRef)(port))
17 #define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect)
19 #if ACCESSOR_CALLS_ARE_FUNCTIONS
20 /* Classic calls that we emulate in carbon mode */
21 #define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
22 #define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
23 #define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
26 /* Function to dispose a window, with a "normal" calling sequence */
28 PyMac_AutoDisposeWindow(WindowPtr w
)
33 static PyObject
*Win_Error
;
35 /* ----------------------- Object type Window ----------------------- */
37 PyTypeObject Window_Type
;
39 #define WinObj_Check(x) ((x)->ob_type == &Window_Type)
41 typedef struct WindowObject
{
44 void (*ob_freeit
)(WindowPtr ptr
);
47 PyObject
*WinObj_New(itself
)
51 if (itself
== NULL
) return PyMac_Error(resNotFound
);
52 it
= PyObject_NEW(WindowObject
, &Window_Type
);
53 if (it
== NULL
) return NULL
;
54 it
->ob_itself
= itself
;
56 if (GetWRefCon(itself
) == 0)
58 SetWRefCon(itself
, (long)it
);
59 it
->ob_freeit
= PyMac_AutoDisposeWindow
;
61 return (PyObject
*)it
;
63 WinObj_Convert(v
, p_itself
)
67 if (DlgObj_Check(v
)) {
68 *p_itself
= DlgObj_ConvertToWindow(v
);
72 if (v
== Py_None
) { *p_itself
= NULL
; return 1; }
73 if (PyInt_Check(v
)) { *p_itself
= (WindowPtr
)PyInt_AsLong(v
); return 1; }
77 PyErr_SetString(PyExc_TypeError
, "Window required");
80 *p_itself
= ((WindowObject
*)v
)->ob_itself
;
84 static void WinObj_dealloc(self
)
87 if (self
->ob_freeit
&& self
->ob_itself
)
89 SetWRefCon(self
->ob_itself
, 0);
90 self
->ob_freeit(self
->ob_itself
);
92 self
->ob_itself
= NULL
;
93 self
->ob_freeit
= NULL
;
97 static PyObject
*WinObj_GetWindowOwnerCount(_self
, _args
)
101 PyObject
*_res
= NULL
;
104 if (!PyArg_ParseTuple(_args
, ""))
106 _err
= GetWindowOwnerCount(_self
->ob_itself
,
108 if (_err
!= noErr
) return PyMac_Error(_err
);
109 _res
= Py_BuildValue("l",
114 static PyObject
*WinObj_CloneWindow(_self
, _args
)
118 PyObject
*_res
= NULL
;
120 if (!PyArg_ParseTuple(_args
, ""))
122 _err
= CloneWindow(_self
->ob_itself
);
123 if (_err
!= noErr
) return PyMac_Error(_err
);
129 #if TARGET_API_MAC_CARBON
131 static PyObject
*WinObj_ReshapeCustomWindow(_self
, _args
)
135 PyObject
*_res
= NULL
;
137 if (!PyArg_ParseTuple(_args
, ""))
139 _err
= ReshapeCustomWindow(_self
->ob_itself
);
140 if (_err
!= noErr
) return PyMac_Error(_err
);
147 static PyObject
*WinObj_GetWindowClass(_self
, _args
)
151 PyObject
*_res
= NULL
;
153 WindowClass outClass
;
154 if (!PyArg_ParseTuple(_args
, ""))
156 _err
= GetWindowClass(_self
->ob_itself
,
158 if (_err
!= noErr
) return PyMac_Error(_err
);
159 _res
= Py_BuildValue("l",
164 static PyObject
*WinObj_GetWindowAttributes(_self
, _args
)
168 PyObject
*_res
= NULL
;
170 WindowAttributes outAttributes
;
171 if (!PyArg_ParseTuple(_args
, ""))
173 _err
= GetWindowAttributes(_self
->ob_itself
,
175 if (_err
!= noErr
) return PyMac_Error(_err
);
176 _res
= Py_BuildValue("l",
181 #if TARGET_API_MAC_CARBON
183 static PyObject
*WinObj_ChangeWindowAttributes(_self
, _args
)
187 PyObject
*_res
= NULL
;
189 WindowAttributes setTheseAttributes
;
190 WindowAttributes clearTheseAttributes
;
191 if (!PyArg_ParseTuple(_args
, "ll",
193 &clearTheseAttributes
))
195 _err
= ChangeWindowAttributes(_self
->ob_itself
,
197 clearTheseAttributes
);
198 if (_err
!= noErr
) return PyMac_Error(_err
);
205 #if !TARGET_API_MAC_CARBON
207 static PyObject
*WinObj_SetWinColor(_self
, _args
)
211 PyObject
*_res
= NULL
;
212 WCTabHandle newColorTable
;
213 if (!PyArg_ParseTuple(_args
, "O&",
214 ResObj_Convert
, &newColorTable
))
216 SetWinColor(_self
->ob_itself
,
224 static PyObject
*WinObj_SetWindowContentColor(_self
, _args
)
228 PyObject
*_res
= NULL
;
231 if (!PyArg_ParseTuple(_args
, "O&",
232 QdRGB_Convert
, &color
))
234 _err
= SetWindowContentColor(_self
->ob_itself
,
236 if (_err
!= noErr
) return PyMac_Error(_err
);
242 static PyObject
*WinObj_GetWindowContentColor(_self
, _args
)
246 PyObject
*_res
= NULL
;
249 if (!PyArg_ParseTuple(_args
, ""))
251 _err
= GetWindowContentColor(_self
->ob_itself
,
253 if (_err
!= noErr
) return PyMac_Error(_err
);
254 _res
= Py_BuildValue("O&",
259 static PyObject
*WinObj_GetWindowContentPattern(_self
, _args
)
263 PyObject
*_res
= NULL
;
265 PixPatHandle outPixPat
;
266 if (!PyArg_ParseTuple(_args
, "O&",
267 ResObj_Convert
, &outPixPat
))
269 _err
= GetWindowContentPattern(_self
->ob_itself
,
271 if (_err
!= noErr
) return PyMac_Error(_err
);
277 static PyObject
*WinObj_SetWindowContentPattern(_self
, _args
)
281 PyObject
*_res
= NULL
;
284 if (!PyArg_ParseTuple(_args
, "O&",
285 ResObj_Convert
, &pixPat
))
287 _err
= SetWindowContentPattern(_self
->ob_itself
,
289 if (_err
!= noErr
) return PyMac_Error(_err
);
295 #if TARGET_API_MAC_CARBON
297 static PyObject
*WinObj_ScrollWindowRect(_self
, _args
)
301 PyObject
*_res
= NULL
;
306 ScrollWindowOptions inOptions
;
307 RgnHandle outExposedRgn
;
308 if (!PyArg_ParseTuple(_args
, "O&hhlO&",
309 PyMac_GetRect
, &inScrollRect
,
313 ResObj_Convert
, &outExposedRgn
))
315 _err
= ScrollWindowRect(_self
->ob_itself
,
321 if (_err
!= noErr
) return PyMac_Error(_err
);
328 #if TARGET_API_MAC_CARBON
330 static PyObject
*WinObj_ScrollWindowRegion(_self
, _args
)
334 PyObject
*_res
= NULL
;
336 RgnHandle inScrollRgn
;
339 ScrollWindowOptions inOptions
;
340 RgnHandle outExposedRgn
;
341 if (!PyArg_ParseTuple(_args
, "O&hhlO&",
342 ResObj_Convert
, &inScrollRgn
,
346 ResObj_Convert
, &outExposedRgn
))
348 _err
= ScrollWindowRegion(_self
->ob_itself
,
354 if (_err
!= noErr
) return PyMac_Error(_err
);
361 static PyObject
*WinObj_ClipAbove(_self
, _args
)
365 PyObject
*_res
= NULL
;
366 if (!PyArg_ParseTuple(_args
, ""))
368 ClipAbove(_self
->ob_itself
);
374 #if !TARGET_API_MAC_CARBON
376 static PyObject
*WinObj_SaveOld(_self
, _args
)
380 PyObject
*_res
= NULL
;
381 if (!PyArg_ParseTuple(_args
, ""))
383 SaveOld(_self
->ob_itself
);
390 #if !TARGET_API_MAC_CARBON
392 static PyObject
*WinObj_DrawNew(_self
, _args
)
396 PyObject
*_res
= NULL
;
398 if (!PyArg_ParseTuple(_args
, "b",
401 DrawNew(_self
->ob_itself
,
409 static PyObject
*WinObj_PaintOne(_self
, _args
)
413 PyObject
*_res
= NULL
;
414 RgnHandle clobberedRgn
;
415 if (!PyArg_ParseTuple(_args
, "O&",
416 ResObj_Convert
, &clobberedRgn
))
418 PaintOne(_self
->ob_itself
,
425 static PyObject
*WinObj_PaintBehind(_self
, _args
)
429 PyObject
*_res
= NULL
;
430 RgnHandle clobberedRgn
;
431 if (!PyArg_ParseTuple(_args
, "O&",
432 ResObj_Convert
, &clobberedRgn
))
434 PaintBehind(_self
->ob_itself
,
441 static PyObject
*WinObj_CalcVis(_self
, _args
)
445 PyObject
*_res
= NULL
;
446 if (!PyArg_ParseTuple(_args
, ""))
448 CalcVis(_self
->ob_itself
);
454 static PyObject
*WinObj_CalcVisBehind(_self
, _args
)
458 PyObject
*_res
= NULL
;
459 RgnHandle clobberedRgn
;
460 if (!PyArg_ParseTuple(_args
, "O&",
461 ResObj_Convert
, &clobberedRgn
))
463 CalcVisBehind(_self
->ob_itself
,
470 static PyObject
*WinObj_BringToFront(_self
, _args
)
474 PyObject
*_res
= NULL
;
475 if (!PyArg_ParseTuple(_args
, ""))
477 BringToFront(_self
->ob_itself
);
483 static PyObject
*WinObj_SendBehind(_self
, _args
)
487 PyObject
*_res
= NULL
;
488 WindowPtr behindWindow
;
489 if (!PyArg_ParseTuple(_args
, "O&",
490 WinObj_Convert
, &behindWindow
))
492 SendBehind(_self
->ob_itself
,
499 static PyObject
*WinObj_SelectWindow(_self
, _args
)
503 PyObject
*_res
= NULL
;
504 if (!PyArg_ParseTuple(_args
, ""))
506 SelectWindow(_self
->ob_itself
);
512 #if TARGET_API_MAC_CARBON
514 static PyObject
*WinObj_GetNextWindowOfClass(_self
, _args
)
518 PyObject
*_res
= NULL
;
520 WindowClass inWindowClass
;
521 Boolean mustBeVisible
;
522 if (!PyArg_ParseTuple(_args
, "lb",
526 _rv
= GetNextWindowOfClass(_self
->ob_itself
,
529 _res
= Py_BuildValue("O&",
535 #if !TARGET_API_MAC_CARBON
537 static PyObject
*WinObj_IsValidWindowPtr(_self
, _args
)
541 PyObject
*_res
= NULL
;
543 if (!PyArg_ParseTuple(_args
, ""))
545 _rv
= IsValidWindowPtr(_self
->ob_itself
);
546 _res
= Py_BuildValue("b",
552 static PyObject
*WinObj_HiliteWindow(_self
, _args
)
556 PyObject
*_res
= NULL
;
558 if (!PyArg_ParseTuple(_args
, "b",
561 HiliteWindow(_self
->ob_itself
,
568 static PyObject
*WinObj_SetWRefCon(_self
, _args
)
572 PyObject
*_res
= NULL
;
574 if (!PyArg_ParseTuple(_args
, "l",
577 SetWRefCon(_self
->ob_itself
,
584 static PyObject
*WinObj_GetWRefCon(_self
, _args
)
588 PyObject
*_res
= NULL
;
590 if (!PyArg_ParseTuple(_args
, ""))
592 _rv
= GetWRefCon(_self
->ob_itself
);
593 _res
= Py_BuildValue("l",
598 static PyObject
*WinObj_SetWindowPic(_self
, _args
)
602 PyObject
*_res
= NULL
;
604 if (!PyArg_ParseTuple(_args
, "O&",
605 ResObj_Convert
, &pic
))
607 SetWindowPic(_self
->ob_itself
,
614 static PyObject
*WinObj_GetWindowPic(_self
, _args
)
618 PyObject
*_res
= NULL
;
620 if (!PyArg_ParseTuple(_args
, ""))
622 _rv
= GetWindowPic(_self
->ob_itself
);
623 _res
= Py_BuildValue("O&",
628 static PyObject
*WinObj_GetWVariant(_self
, _args
)
632 PyObject
*_res
= NULL
;
634 if (!PyArg_ParseTuple(_args
, ""))
636 _rv
= GetWVariant(_self
->ob_itself
);
637 _res
= Py_BuildValue("h",
642 static PyObject
*WinObj_GetWindowFeatures(_self
, _args
)
646 PyObject
*_res
= NULL
;
649 if (!PyArg_ParseTuple(_args
, ""))
651 _err
= GetWindowFeatures(_self
->ob_itself
,
653 if (_err
!= noErr
) return PyMac_Error(_err
);
654 _res
= Py_BuildValue("l",
659 static PyObject
*WinObj_GetWindowRegion(_self
, _args
)
663 PyObject
*_res
= NULL
;
665 WindowRegionCode inRegionCode
;
667 if (!PyArg_ParseTuple(_args
, "HO&",
669 ResObj_Convert
, &ioWinRgn
))
671 _err
= GetWindowRegion(_self
->ob_itself
,
674 if (_err
!= noErr
) return PyMac_Error(_err
);
680 static PyObject
*WinObj_BeginUpdate(_self
, _args
)
684 PyObject
*_res
= NULL
;
685 if (!PyArg_ParseTuple(_args
, ""))
687 BeginUpdate(_self
->ob_itself
);
693 static PyObject
*WinObj_EndUpdate(_self
, _args
)
697 PyObject
*_res
= NULL
;
698 if (!PyArg_ParseTuple(_args
, ""))
700 EndUpdate(_self
->ob_itself
);
706 static PyObject
*WinObj_InvalWindowRgn(_self
, _args
)
710 PyObject
*_res
= NULL
;
713 if (!PyArg_ParseTuple(_args
, "O&",
714 ResObj_Convert
, ®ion
))
716 _err
= InvalWindowRgn(_self
->ob_itself
,
718 if (_err
!= noErr
) return PyMac_Error(_err
);
724 static PyObject
*WinObj_InvalWindowRect(_self
, _args
)
728 PyObject
*_res
= NULL
;
731 if (!PyArg_ParseTuple(_args
, "O&",
732 PyMac_GetRect
, &bounds
))
734 _err
= InvalWindowRect(_self
->ob_itself
,
736 if (_err
!= noErr
) return PyMac_Error(_err
);
742 static PyObject
*WinObj_ValidWindowRgn(_self
, _args
)
746 PyObject
*_res
= NULL
;
749 if (!PyArg_ParseTuple(_args
, "O&",
750 ResObj_Convert
, ®ion
))
752 _err
= ValidWindowRgn(_self
->ob_itself
,
754 if (_err
!= noErr
) return PyMac_Error(_err
);
760 static PyObject
*WinObj_ValidWindowRect(_self
, _args
)
764 PyObject
*_res
= NULL
;
767 if (!PyArg_ParseTuple(_args
, "O&",
768 PyMac_GetRect
, &bounds
))
770 _err
= ValidWindowRect(_self
->ob_itself
,
772 if (_err
!= noErr
) return PyMac_Error(_err
);
778 static PyObject
*WinObj_DrawGrowIcon(_self
, _args
)
782 PyObject
*_res
= NULL
;
783 if (!PyArg_ParseTuple(_args
, ""))
785 DrawGrowIcon(_self
->ob_itself
);
791 static PyObject
*WinObj_SetWTitle(_self
, _args
)
795 PyObject
*_res
= NULL
;
797 if (!PyArg_ParseTuple(_args
, "O&",
798 PyMac_GetStr255
, title
))
800 SetWTitle(_self
->ob_itself
,
807 static PyObject
*WinObj_GetWTitle(_self
, _args
)
811 PyObject
*_res
= NULL
;
813 if (!PyArg_ParseTuple(_args
, ""))
815 GetWTitle(_self
->ob_itself
,
817 _res
= Py_BuildValue("O&",
818 PyMac_BuildStr255
, title
);
822 static PyObject
*WinObj_SetWindowProxyFSSpec(_self
, _args
)
826 PyObject
*_res
= NULL
;
829 if (!PyArg_ParseTuple(_args
, "O&",
830 PyMac_GetFSSpec
, &inFile
))
832 _err
= SetWindowProxyFSSpec(_self
->ob_itself
,
834 if (_err
!= noErr
) return PyMac_Error(_err
);
840 static PyObject
*WinObj_GetWindowProxyFSSpec(_self
, _args
)
844 PyObject
*_res
= NULL
;
847 if (!PyArg_ParseTuple(_args
, ""))
849 _err
= GetWindowProxyFSSpec(_self
->ob_itself
,
851 if (_err
!= noErr
) return PyMac_Error(_err
);
852 _res
= Py_BuildValue("O&",
853 PyMac_BuildFSSpec
, outFile
);
857 static PyObject
*WinObj_SetWindowProxyAlias(_self
, _args
)
861 PyObject
*_res
= NULL
;
864 if (!PyArg_ParseTuple(_args
, "O&",
865 ResObj_Convert
, &alias
))
867 _err
= SetWindowProxyAlias(_self
->ob_itself
,
869 if (_err
!= noErr
) return PyMac_Error(_err
);
875 static PyObject
*WinObj_GetWindowProxyAlias(_self
, _args
)
879 PyObject
*_res
= NULL
;
882 if (!PyArg_ParseTuple(_args
, ""))
884 _err
= GetWindowProxyAlias(_self
->ob_itself
,
886 if (_err
!= noErr
) return PyMac_Error(_err
);
887 _res
= Py_BuildValue("O&",
892 static PyObject
*WinObj_SetWindowProxyCreatorAndType(_self
, _args
)
896 PyObject
*_res
= NULL
;
901 if (!PyArg_ParseTuple(_args
, "O&O&h",
902 PyMac_GetOSType
, &fileCreator
,
903 PyMac_GetOSType
, &fileType
,
906 _err
= SetWindowProxyCreatorAndType(_self
->ob_itself
,
910 if (_err
!= noErr
) return PyMac_Error(_err
);
916 static PyObject
*WinObj_GetWindowProxyIcon(_self
, _args
)
920 PyObject
*_res
= NULL
;
923 if (!PyArg_ParseTuple(_args
, ""))
925 _err
= GetWindowProxyIcon(_self
->ob_itself
,
927 if (_err
!= noErr
) return PyMac_Error(_err
);
928 _res
= Py_BuildValue("O&",
929 ResObj_New
, outIcon
);
933 static PyObject
*WinObj_SetWindowProxyIcon(_self
, _args
)
937 PyObject
*_res
= NULL
;
940 if (!PyArg_ParseTuple(_args
, "O&",
941 ResObj_Convert
, &icon
))
943 _err
= SetWindowProxyIcon(_self
->ob_itself
,
945 if (_err
!= noErr
) return PyMac_Error(_err
);
951 static PyObject
*WinObj_RemoveWindowProxy(_self
, _args
)
955 PyObject
*_res
= NULL
;
957 if (!PyArg_ParseTuple(_args
, ""))
959 _err
= RemoveWindowProxy(_self
->ob_itself
);
960 if (_err
!= noErr
) return PyMac_Error(_err
);
966 static PyObject
*WinObj_BeginWindowProxyDrag(_self
, _args
)
970 PyObject
*_res
= NULL
;
972 DragReference outNewDrag
;
973 RgnHandle outDragOutlineRgn
;
974 if (!PyArg_ParseTuple(_args
, "O&",
975 ResObj_Convert
, &outDragOutlineRgn
))
977 _err
= BeginWindowProxyDrag(_self
->ob_itself
,
980 if (_err
!= noErr
) return PyMac_Error(_err
);
981 _res
= Py_BuildValue("O&",
982 DragObj_New
, outNewDrag
);
986 static PyObject
*WinObj_EndWindowProxyDrag(_self
, _args
)
990 PyObject
*_res
= NULL
;
992 DragReference theDrag
;
993 if (!PyArg_ParseTuple(_args
, "O&",
994 DragObj_Convert
, &theDrag
))
996 _err
= EndWindowProxyDrag(_self
->ob_itself
,
998 if (_err
!= noErr
) return PyMac_Error(_err
);
1004 static PyObject
*WinObj_TrackWindowProxyFromExistingDrag(_self
, _args
)
1005 WindowObject
*_self
;
1008 PyObject
*_res
= NULL
;
1012 RgnHandle inDragOutlineRgn
;
1013 if (!PyArg_ParseTuple(_args
, "O&O&O&",
1014 PyMac_GetPoint
, &startPt
,
1015 DragObj_Convert
, &drag
,
1016 ResObj_Convert
, &inDragOutlineRgn
))
1018 _err
= TrackWindowProxyFromExistingDrag(_self
->ob_itself
,
1022 if (_err
!= noErr
) return PyMac_Error(_err
);
1028 static PyObject
*WinObj_TrackWindowProxyDrag(_self
, _args
)
1029 WindowObject
*_self
;
1032 PyObject
*_res
= NULL
;
1035 if (!PyArg_ParseTuple(_args
, "O&",
1036 PyMac_GetPoint
, &startPt
))
1038 _err
= TrackWindowProxyDrag(_self
->ob_itself
,
1040 if (_err
!= noErr
) return PyMac_Error(_err
);
1046 static PyObject
*WinObj_IsWindowModified(_self
, _args
)
1047 WindowObject
*_self
;
1050 PyObject
*_res
= NULL
;
1052 if (!PyArg_ParseTuple(_args
, ""))
1054 _rv
= IsWindowModified(_self
->ob_itself
);
1055 _res
= Py_BuildValue("b",
1060 static PyObject
*WinObj_SetWindowModified(_self
, _args
)
1061 WindowObject
*_self
;
1064 PyObject
*_res
= NULL
;
1067 if (!PyArg_ParseTuple(_args
, "b",
1070 _err
= SetWindowModified(_self
->ob_itself
,
1072 if (_err
!= noErr
) return PyMac_Error(_err
);
1078 static PyObject
*WinObj_IsWindowPathSelectClick(_self
, _args
)
1079 WindowObject
*_self
;
1082 PyObject
*_res
= NULL
;
1085 if (!PyArg_ParseTuple(_args
, "O&",
1086 PyMac_GetEventRecord
, &event
))
1088 _rv
= IsWindowPathSelectClick(_self
->ob_itself
,
1090 _res
= Py_BuildValue("b",
1095 static PyObject
*WinObj_WindowPathSelect(_self
, _args
)
1096 WindowObject
*_self
;
1099 PyObject
*_res
= NULL
;
1102 SInt32 outMenuResult
;
1103 if (!PyArg_ParseTuple(_args
, "O&",
1104 MenuObj_Convert
, &menu
))
1106 _err
= WindowPathSelect(_self
->ob_itself
,
1109 if (_err
!= noErr
) return PyMac_Error(_err
);
1110 _res
= Py_BuildValue("l",
1115 static PyObject
*WinObj_HiliteWindowFrameForDrag(_self
, _args
)
1116 WindowObject
*_self
;
1119 PyObject
*_res
= NULL
;
1122 if (!PyArg_ParseTuple(_args
, "b",
1125 _err
= HiliteWindowFrameForDrag(_self
->ob_itself
,
1127 if (_err
!= noErr
) return PyMac_Error(_err
);
1133 static PyObject
*WinObj_TransitionWindow(_self
, _args
)
1134 WindowObject
*_self
;
1137 PyObject
*_res
= NULL
;
1139 WindowTransitionEffect effect
;
1140 WindowTransitionAction action
;
1142 if (!PyArg_ParseTuple(_args
, "llO&",
1145 PyMac_GetRect
, &rect
))
1147 _err
= TransitionWindow(_self
->ob_itself
,
1151 if (_err
!= noErr
) return PyMac_Error(_err
);
1157 static PyObject
*WinObj_MacMoveWindow(_self
, _args
)
1158 WindowObject
*_self
;
1161 PyObject
*_res
= NULL
;
1165 if (!PyArg_ParseTuple(_args
, "hhb",
1170 MacMoveWindow(_self
->ob_itself
,
1179 static PyObject
*WinObj_SizeWindow(_self
, _args
)
1180 WindowObject
*_self
;
1183 PyObject
*_res
= NULL
;
1187 if (!PyArg_ParseTuple(_args
, "hhb",
1192 SizeWindow(_self
->ob_itself
,
1201 static PyObject
*WinObj_GrowWindow(_self
, _args
)
1202 WindowObject
*_self
;
1205 PyObject
*_res
= NULL
;
1209 if (!PyArg_ParseTuple(_args
, "O&O&",
1210 PyMac_GetPoint
, &startPt
,
1211 PyMac_GetRect
, &bBox
))
1213 _rv
= GrowWindow(_self
->ob_itself
,
1216 _res
= Py_BuildValue("l",
1221 static PyObject
*WinObj_DragWindow(_self
, _args
)
1222 WindowObject
*_self
;
1225 PyObject
*_res
= NULL
;
1228 if (!PyArg_ParseTuple(_args
, "O&O&",
1229 PyMac_GetPoint
, &startPt
,
1230 PyMac_GetRect
, &boundsRect
))
1232 DragWindow(_self
->ob_itself
,
1240 static PyObject
*WinObj_ZoomWindow(_self
, _args
)
1241 WindowObject
*_self
;
1244 PyObject
*_res
= NULL
;
1245 WindowPartCode partCode
;
1247 if (!PyArg_ParseTuple(_args
, "hb",
1251 ZoomWindow(_self
->ob_itself
,
1259 static PyObject
*WinObj_IsWindowCollapsable(_self
, _args
)
1260 WindowObject
*_self
;
1263 PyObject
*_res
= NULL
;
1265 if (!PyArg_ParseTuple(_args
, ""))
1267 _rv
= IsWindowCollapsable(_self
->ob_itself
);
1268 _res
= Py_BuildValue("b",
1273 static PyObject
*WinObj_IsWindowCollapsed(_self
, _args
)
1274 WindowObject
*_self
;
1277 PyObject
*_res
= NULL
;
1279 if (!PyArg_ParseTuple(_args
, ""))
1281 _rv
= IsWindowCollapsed(_self
->ob_itself
);
1282 _res
= Py_BuildValue("b",
1287 static PyObject
*WinObj_CollapseWindow(_self
, _args
)
1288 WindowObject
*_self
;
1291 PyObject
*_res
= NULL
;
1294 if (!PyArg_ParseTuple(_args
, "b",
1297 _err
= CollapseWindow(_self
->ob_itself
,
1299 if (_err
!= noErr
) return PyMac_Error(_err
);
1305 static PyObject
*WinObj_GetWindowBounds(_self
, _args
)
1306 WindowObject
*_self
;
1309 PyObject
*_res
= NULL
;
1311 WindowRegionCode regionCode
;
1313 if (!PyArg_ParseTuple(_args
, "H",
1316 _err
= GetWindowBounds(_self
->ob_itself
,
1319 if (_err
!= noErr
) return PyMac_Error(_err
);
1320 _res
= Py_BuildValue("O&",
1321 PyMac_BuildRect
, &globalBounds
);
1325 static PyObject
*WinObj_ResizeWindow(_self
, _args
)
1326 WindowObject
*_self
;
1329 PyObject
*_res
= NULL
;
1332 Rect sizeConstraints
;
1333 Rect newContentRect
;
1334 if (!PyArg_ParseTuple(_args
, "O&O&",
1335 PyMac_GetPoint
, &startPoint
,
1336 PyMac_GetRect
, &sizeConstraints
))
1338 _rv
= ResizeWindow(_self
->ob_itself
,
1342 _res
= Py_BuildValue("bO&",
1344 PyMac_BuildRect
, &newContentRect
);
1348 static PyObject
*WinObj_SetWindowBounds(_self
, _args
)
1349 WindowObject
*_self
;
1352 PyObject
*_res
= NULL
;
1354 WindowRegionCode regionCode
;
1356 if (!PyArg_ParseTuple(_args
, "HO&",
1358 PyMac_GetRect
, &globalBounds
))
1360 _err
= SetWindowBounds(_self
->ob_itself
,
1363 if (_err
!= noErr
) return PyMac_Error(_err
);
1369 static PyObject
*WinObj_RepositionWindow(_self
, _args
)
1370 WindowObject
*_self
;
1373 PyObject
*_res
= NULL
;
1375 WindowPtr parentWindow
;
1376 WindowPositionMethod method
;
1377 if (!PyArg_ParseTuple(_args
, "O&l",
1378 WinObj_Convert
, &parentWindow
,
1381 _err
= RepositionWindow(_self
->ob_itself
,
1384 if (_err
!= noErr
) return PyMac_Error(_err
);
1390 static PyObject
*WinObj_MoveWindowStructure(_self
, _args
)
1391 WindowObject
*_self
;
1394 PyObject
*_res
= NULL
;
1398 if (!PyArg_ParseTuple(_args
, "hh",
1402 _err
= MoveWindowStructure(_self
->ob_itself
,
1405 if (_err
!= noErr
) return PyMac_Error(_err
);
1411 static PyObject
*WinObj_IsWindowInStandardState(_self
, _args
)
1412 WindowObject
*_self
;
1415 PyObject
*_res
= NULL
;
1418 Rect idealStandardState
;
1419 if (!PyArg_ParseTuple(_args
, ""))
1421 _rv
= IsWindowInStandardState(_self
->ob_itself
,
1423 &idealStandardState
);
1424 _res
= Py_BuildValue("bO&O&",
1426 PyMac_BuildPoint
, idealSize
,
1427 PyMac_BuildRect
, &idealStandardState
);
1431 static PyObject
*WinObj_ZoomWindowIdeal(_self
, _args
)
1432 WindowObject
*_self
;
1435 PyObject
*_res
= NULL
;
1437 WindowPartCode partCode
;
1439 if (!PyArg_ParseTuple(_args
, "h",
1442 _err
= ZoomWindowIdeal(_self
->ob_itself
,
1445 if (_err
!= noErr
) return PyMac_Error(_err
);
1446 _res
= Py_BuildValue("O&",
1447 PyMac_BuildPoint
, ioIdealSize
);
1451 static PyObject
*WinObj_GetWindowIdealUserState(_self
, _args
)
1452 WindowObject
*_self
;
1455 PyObject
*_res
= NULL
;
1458 if (!PyArg_ParseTuple(_args
, ""))
1460 _err
= GetWindowIdealUserState(_self
->ob_itself
,
1462 if (_err
!= noErr
) return PyMac_Error(_err
);
1463 _res
= Py_BuildValue("O&",
1464 PyMac_BuildRect
, &userState
);
1468 static PyObject
*WinObj_SetWindowIdealUserState(_self
, _args
)
1469 WindowObject
*_self
;
1472 PyObject
*_res
= NULL
;
1475 if (!PyArg_ParseTuple(_args
, ""))
1477 _err
= SetWindowIdealUserState(_self
->ob_itself
,
1479 if (_err
!= noErr
) return PyMac_Error(_err
);
1480 _res
= Py_BuildValue("O&",
1481 PyMac_BuildRect
, &userState
);
1485 static PyObject
*WinObj_HideWindow(_self
, _args
)
1486 WindowObject
*_self
;
1489 PyObject
*_res
= NULL
;
1490 if (!PyArg_ParseTuple(_args
, ""))
1492 HideWindow(_self
->ob_itself
);
1498 static PyObject
*WinObj_MacShowWindow(_self
, _args
)
1499 WindowObject
*_self
;
1502 PyObject
*_res
= NULL
;
1503 if (!PyArg_ParseTuple(_args
, ""))
1505 MacShowWindow(_self
->ob_itself
);
1511 static PyObject
*WinObj_ShowHide(_self
, _args
)
1512 WindowObject
*_self
;
1515 PyObject
*_res
= NULL
;
1517 if (!PyArg_ParseTuple(_args
, "b",
1520 ShowHide(_self
->ob_itself
,
1527 #if TARGET_API_MAC_CARBON
1529 static PyObject
*WinObj_GetWindowPropertyAttributes(_self
, _args
)
1530 WindowObject
*_self
;
1533 PyObject
*_res
= NULL
;
1535 OSType propertyCreator
;
1538 if (!PyArg_ParseTuple(_args
, "O&O&",
1539 PyMac_GetOSType
, &propertyCreator
,
1540 PyMac_GetOSType
, &propertyTag
))
1542 _err
= GetWindowPropertyAttributes(_self
->ob_itself
,
1546 if (_err
!= noErr
) return PyMac_Error(_err
);
1547 _res
= Py_BuildValue("l",
1553 #if TARGET_API_MAC_CARBON
1555 static PyObject
*WinObj_ChangeWindowPropertyAttributes(_self
, _args
)
1556 WindowObject
*_self
;
1559 PyObject
*_res
= NULL
;
1561 OSType propertyCreator
;
1563 UInt32 attributesToSet
;
1564 UInt32 attributesToClear
;
1565 if (!PyArg_ParseTuple(_args
, "O&O&ll",
1566 PyMac_GetOSType
, &propertyCreator
,
1567 PyMac_GetOSType
, &propertyTag
,
1569 &attributesToClear
))
1571 _err
= ChangeWindowPropertyAttributes(_self
->ob_itself
,
1576 if (_err
!= noErr
) return PyMac_Error(_err
);
1583 static PyObject
*WinObj_TrackBox(_self
, _args
)
1584 WindowObject
*_self
;
1587 PyObject
*_res
= NULL
;
1590 WindowPartCode partCode
;
1591 if (!PyArg_ParseTuple(_args
, "O&h",
1592 PyMac_GetPoint
, &thePt
,
1595 _rv
= TrackBox(_self
->ob_itself
,
1598 _res
= Py_BuildValue("b",
1603 static PyObject
*WinObj_TrackGoAway(_self
, _args
)
1604 WindowObject
*_self
;
1607 PyObject
*_res
= NULL
;
1610 if (!PyArg_ParseTuple(_args
, "O&",
1611 PyMac_GetPoint
, &thePt
))
1613 _rv
= TrackGoAway(_self
->ob_itself
,
1615 _res
= Py_BuildValue("b",
1620 #if !TARGET_API_MAC_CARBON
1622 static PyObject
*WinObj_GetAuxWin(_self
, _args
)
1623 WindowObject
*_self
;
1626 PyObject
*_res
= NULL
;
1628 AuxWinHandle awHndl
;
1629 if (!PyArg_ParseTuple(_args
, ""))
1631 _rv
= GetAuxWin(_self
->ob_itself
,
1633 _res
= Py_BuildValue("bO&",
1635 ResObj_New
, awHndl
);
1640 #if !TARGET_API_MAC_CARBON
1642 static PyObject
*WinObj_GetWindowGoAwayFlag(_self
, _args
)
1643 WindowObject
*_self
;
1646 PyObject
*_res
= NULL
;
1648 if (!PyArg_ParseTuple(_args
, ""))
1650 _rv
= GetWindowGoAwayFlag(_self
->ob_itself
);
1651 _res
= Py_BuildValue("b",
1657 #if !TARGET_API_MAC_CARBON
1659 static PyObject
*WinObj_GetWindowSpareFlag(_self
, _args
)
1660 WindowObject
*_self
;
1663 PyObject
*_res
= NULL
;
1665 if (!PyArg_ParseTuple(_args
, ""))
1667 _rv
= GetWindowSpareFlag(_self
->ob_itself
);
1668 _res
= Py_BuildValue("b",
1674 static PyObject
*WinObj_GetWindowPort(_self
, _args
)
1675 WindowObject
*_self
;
1678 PyObject
*_res
= NULL
;
1680 if (!PyArg_ParseTuple(_args
, ""))
1682 _rv
= GetWindowPort(_self
->ob_itself
);
1683 _res
= Py_BuildValue("O&",
1688 static PyObject
*WinObj_GetWindowKind(_self
, _args
)
1689 WindowObject
*_self
;
1692 PyObject
*_res
= NULL
;
1694 if (!PyArg_ParseTuple(_args
, ""))
1696 _rv
= GetWindowKind(_self
->ob_itself
);
1697 _res
= Py_BuildValue("h",
1702 static PyObject
*WinObj_MacIsWindowVisible(_self
, _args
)
1703 WindowObject
*_self
;
1706 PyObject
*_res
= NULL
;
1708 if (!PyArg_ParseTuple(_args
, ""))
1710 _rv
= MacIsWindowVisible(_self
->ob_itself
);
1711 _res
= Py_BuildValue("b",
1716 static PyObject
*WinObj_IsWindowHilited(_self
, _args
)
1717 WindowObject
*_self
;
1720 PyObject
*_res
= NULL
;
1722 if (!PyArg_ParseTuple(_args
, ""))
1724 _rv
= IsWindowHilited(_self
->ob_itself
);
1725 _res
= Py_BuildValue("b",
1730 #if TARGET_API_MAC_CARBON
1732 static PyObject
*WinObj_IsWindowUpdatePending(_self
, _args
)
1733 WindowObject
*_self
;
1736 PyObject
*_res
= NULL
;
1738 if (!PyArg_ParseTuple(_args
, ""))
1740 _rv
= IsWindowUpdatePending(_self
->ob_itself
);
1741 _res
= Py_BuildValue("b",
1747 static PyObject
*WinObj_MacGetNextWindow(_self
, _args
)
1748 WindowObject
*_self
;
1751 PyObject
*_res
= NULL
;
1753 if (!PyArg_ParseTuple(_args
, ""))
1755 _rv
= MacGetNextWindow(_self
->ob_itself
);
1756 _res
= Py_BuildValue("O&",
1761 static PyObject
*WinObj_GetWindowStandardState(_self
, _args
)
1762 WindowObject
*_self
;
1765 PyObject
*_res
= NULL
;
1767 if (!PyArg_ParseTuple(_args
, ""))
1769 GetWindowStandardState(_self
->ob_itself
,
1771 _res
= Py_BuildValue("O&",
1772 PyMac_BuildRect
, &rect
);
1776 static PyObject
*WinObj_GetWindowUserState(_self
, _args
)
1777 WindowObject
*_self
;
1780 PyObject
*_res
= NULL
;
1782 if (!PyArg_ParseTuple(_args
, ""))
1784 GetWindowUserState(_self
->ob_itself
,
1786 _res
= Py_BuildValue("O&",
1787 PyMac_BuildRect
, &rect
);
1791 static PyObject
*WinObj_SetWindowKind(_self
, _args
)
1792 WindowObject
*_self
;
1795 PyObject
*_res
= NULL
;
1797 if (!PyArg_ParseTuple(_args
, "h",
1800 SetWindowKind(_self
->ob_itself
,
1807 static PyObject
*WinObj_SetWindowStandardState(_self
, _args
)
1808 WindowObject
*_self
;
1811 PyObject
*_res
= NULL
;
1813 if (!PyArg_ParseTuple(_args
, "O&",
1814 PyMac_GetRect
, &rect
))
1816 SetWindowStandardState(_self
->ob_itself
,
1823 static PyObject
*WinObj_SetWindowUserState(_self
, _args
)
1824 WindowObject
*_self
;
1827 PyObject
*_res
= NULL
;
1829 if (!PyArg_ParseTuple(_args
, "O&",
1830 PyMac_GetRect
, &rect
))
1832 SetWindowUserState(_self
->ob_itself
,
1839 static PyObject
*WinObj_SetPortWindowPort(_self
, _args
)
1840 WindowObject
*_self
;
1843 PyObject
*_res
= NULL
;
1844 if (!PyArg_ParseTuple(_args
, ""))
1846 SetPortWindowPort(_self
->ob_itself
);
1852 static PyObject
*WinObj_GetWindowPortBounds(_self
, _args
)
1853 WindowObject
*_self
;
1856 PyObject
*_res
= NULL
;
1858 if (!PyArg_ParseTuple(_args
, ""))
1860 GetWindowPortBounds(_self
->ob_itself
,
1862 _res
= Py_BuildValue("O&",
1863 PyMac_BuildRect
, &bounds
);
1867 static PyObject
*WinObj_IsWindowVisible(_self
, _args
)
1868 WindowObject
*_self
;
1871 PyObject
*_res
= NULL
;
1873 if (!PyArg_ParseTuple(_args
, ""))
1875 _rv
= IsWindowVisible(_self
->ob_itself
);
1876 _res
= Py_BuildValue("b",
1881 #if !TARGET_API_MAC_CARBON
1883 static PyObject
*WinObj_GetWindowZoomFlag(_self
, _args
)
1884 WindowObject
*_self
;
1887 PyObject
*_res
= NULL
;
1889 if (!PyArg_ParseTuple(_args
, ""))
1891 _rv
= GetWindowZoomFlag(_self
->ob_itself
);
1892 _res
= Py_BuildValue("b",
1898 static PyObject
*WinObj_GetWindowStructureRgn(_self
, _args
)
1899 WindowObject
*_self
;
1902 PyObject
*_res
= NULL
;
1904 if (!PyArg_ParseTuple(_args
, "O&",
1905 ResObj_Convert
, &r
))
1907 GetWindowStructureRgn(_self
->ob_itself
,
1914 static PyObject
*WinObj_GetWindowContentRgn(_self
, _args
)
1915 WindowObject
*_self
;
1918 PyObject
*_res
= NULL
;
1920 if (!PyArg_ParseTuple(_args
, "O&",
1921 ResObj_Convert
, &r
))
1923 GetWindowContentRgn(_self
->ob_itself
,
1930 static PyObject
*WinObj_GetWindowUpdateRgn(_self
, _args
)
1931 WindowObject
*_self
;
1934 PyObject
*_res
= NULL
;
1936 if (!PyArg_ParseTuple(_args
, "O&",
1937 ResObj_Convert
, &r
))
1939 GetWindowUpdateRgn(_self
->ob_itself
,
1946 #if !TARGET_API_MAC_CARBON
1948 static PyObject
*WinObj_GetWindowTitleWidth(_self
, _args
)
1949 WindowObject
*_self
;
1952 PyObject
*_res
= NULL
;
1954 if (!PyArg_ParseTuple(_args
, ""))
1956 _rv
= GetWindowTitleWidth(_self
->ob_itself
);
1957 _res
= Py_BuildValue("h",
1963 static PyObject
*WinObj_GetNextWindow(_self
, _args
)
1964 WindowObject
*_self
;
1967 PyObject
*_res
= NULL
;
1969 if (!PyArg_ParseTuple(_args
, ""))
1971 _rv
= GetNextWindow(_self
->ob_itself
);
1972 _res
= Py_BuildValue("O&",
1973 WinObj_WhichWindow
, _rv
);
1977 #if !TARGET_API_MAC_CARBON
1979 static PyObject
*WinObj_CloseWindow(_self
, _args
)
1980 WindowObject
*_self
;
1983 PyObject
*_res
= NULL
;
1984 if (!PyArg_ParseTuple(_args
, ""))
1986 CloseWindow(_self
->ob_itself
);
1993 static PyObject
*WinObj_MoveWindow(_self
, _args
)
1994 WindowObject
*_self
;
1997 PyObject
*_res
= NULL
;
2001 if (!PyArg_ParseTuple(_args
, "hhb",
2006 MoveWindow(_self
->ob_itself
,
2015 static PyObject
*WinObj_ShowWindow(_self
, _args
)
2016 WindowObject
*_self
;
2019 PyObject
*_res
= NULL
;
2020 if (!PyArg_ParseTuple(_args
, ""))
2022 ShowWindow(_self
->ob_itself
);
2028 static PyMethodDef WinObj_methods
[] = {
2029 {"GetWindowOwnerCount", (PyCFunction
)WinObj_GetWindowOwnerCount
, 1,
2030 "() -> (UInt32 outCount)"},
2031 {"CloneWindow", (PyCFunction
)WinObj_CloneWindow
, 1,
2034 #if TARGET_API_MAC_CARBON
2035 {"ReshapeCustomWindow", (PyCFunction
)WinObj_ReshapeCustomWindow
, 1,
2038 {"GetWindowClass", (PyCFunction
)WinObj_GetWindowClass
, 1,
2039 "() -> (WindowClass outClass)"},
2040 {"GetWindowAttributes", (PyCFunction
)WinObj_GetWindowAttributes
, 1,
2041 "() -> (WindowAttributes outAttributes)"},
2043 #if TARGET_API_MAC_CARBON
2044 {"ChangeWindowAttributes", (PyCFunction
)WinObj_ChangeWindowAttributes
, 1,
2045 "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"},
2048 #if !TARGET_API_MAC_CARBON
2049 {"SetWinColor", (PyCFunction
)WinObj_SetWinColor
, 1,
2050 "(WCTabHandle newColorTable) -> None"},
2052 {"SetWindowContentColor", (PyCFunction
)WinObj_SetWindowContentColor
, 1,
2053 "(RGBColor color) -> None"},
2054 {"GetWindowContentColor", (PyCFunction
)WinObj_GetWindowContentColor
, 1,
2055 "() -> (RGBColor color)"},
2056 {"GetWindowContentPattern", (PyCFunction
)WinObj_GetWindowContentPattern
, 1,
2057 "(PixPatHandle outPixPat) -> None"},
2058 {"SetWindowContentPattern", (PyCFunction
)WinObj_SetWindowContentPattern
, 1,
2059 "(PixPatHandle pixPat) -> None"},
2061 #if TARGET_API_MAC_CARBON
2062 {"ScrollWindowRect", (PyCFunction
)WinObj_ScrollWindowRect
, 1,
2063 "(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
2066 #if TARGET_API_MAC_CARBON
2067 {"ScrollWindowRegion", (PyCFunction
)WinObj_ScrollWindowRegion
, 1,
2068 "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
2070 {"ClipAbove", (PyCFunction
)WinObj_ClipAbove
, 1,
2073 #if !TARGET_API_MAC_CARBON
2074 {"SaveOld", (PyCFunction
)WinObj_SaveOld
, 1,
2078 #if !TARGET_API_MAC_CARBON
2079 {"DrawNew", (PyCFunction
)WinObj_DrawNew
, 1,
2080 "(Boolean update) -> None"},
2082 {"PaintOne", (PyCFunction
)WinObj_PaintOne
, 1,
2083 "(RgnHandle clobberedRgn) -> None"},
2084 {"PaintBehind", (PyCFunction
)WinObj_PaintBehind
, 1,
2085 "(RgnHandle clobberedRgn) -> None"},
2086 {"CalcVis", (PyCFunction
)WinObj_CalcVis
, 1,
2088 {"CalcVisBehind", (PyCFunction
)WinObj_CalcVisBehind
, 1,
2089 "(RgnHandle clobberedRgn) -> None"},
2090 {"BringToFront", (PyCFunction
)WinObj_BringToFront
, 1,
2092 {"SendBehind", (PyCFunction
)WinObj_SendBehind
, 1,
2093 "(WindowPtr behindWindow) -> None"},
2094 {"SelectWindow", (PyCFunction
)WinObj_SelectWindow
, 1,
2097 #if TARGET_API_MAC_CARBON
2098 {"GetNextWindowOfClass", (PyCFunction
)WinObj_GetNextWindowOfClass
, 1,
2099 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
2102 #if !TARGET_API_MAC_CARBON
2103 {"IsValidWindowPtr", (PyCFunction
)WinObj_IsValidWindowPtr
, 1,
2104 "() -> (Boolean _rv)"},
2106 {"HiliteWindow", (PyCFunction
)WinObj_HiliteWindow
, 1,
2107 "(Boolean fHilite) -> None"},
2108 {"SetWRefCon", (PyCFunction
)WinObj_SetWRefCon
, 1,
2109 "(long data) -> None"},
2110 {"GetWRefCon", (PyCFunction
)WinObj_GetWRefCon
, 1,
2111 "() -> (long _rv)"},
2112 {"SetWindowPic", (PyCFunction
)WinObj_SetWindowPic
, 1,
2113 "(PicHandle pic) -> None"},
2114 {"GetWindowPic", (PyCFunction
)WinObj_GetWindowPic
, 1,
2115 "() -> (PicHandle _rv)"},
2116 {"GetWVariant", (PyCFunction
)WinObj_GetWVariant
, 1,
2117 "() -> (short _rv)"},
2118 {"GetWindowFeatures", (PyCFunction
)WinObj_GetWindowFeatures
, 1,
2119 "() -> (UInt32 outFeatures)"},
2120 {"GetWindowRegion", (PyCFunction
)WinObj_GetWindowRegion
, 1,
2121 "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"},
2122 {"BeginUpdate", (PyCFunction
)WinObj_BeginUpdate
, 1,
2124 {"EndUpdate", (PyCFunction
)WinObj_EndUpdate
, 1,
2126 {"InvalWindowRgn", (PyCFunction
)WinObj_InvalWindowRgn
, 1,
2127 "(RgnHandle region) -> None"},
2128 {"InvalWindowRect", (PyCFunction
)WinObj_InvalWindowRect
, 1,
2129 "(Rect bounds) -> None"},
2130 {"ValidWindowRgn", (PyCFunction
)WinObj_ValidWindowRgn
, 1,
2131 "(RgnHandle region) -> None"},
2132 {"ValidWindowRect", (PyCFunction
)WinObj_ValidWindowRect
, 1,
2133 "(Rect bounds) -> None"},
2134 {"DrawGrowIcon", (PyCFunction
)WinObj_DrawGrowIcon
, 1,
2136 {"SetWTitle", (PyCFunction
)WinObj_SetWTitle
, 1,
2137 "(Str255 title) -> None"},
2138 {"GetWTitle", (PyCFunction
)WinObj_GetWTitle
, 1,
2139 "() -> (Str255 title)"},
2140 {"SetWindowProxyFSSpec", (PyCFunction
)WinObj_SetWindowProxyFSSpec
, 1,
2141 "(FSSpec inFile) -> None"},
2142 {"GetWindowProxyFSSpec", (PyCFunction
)WinObj_GetWindowProxyFSSpec
, 1,
2143 "() -> (FSSpec outFile)"},
2144 {"SetWindowProxyAlias", (PyCFunction
)WinObj_SetWindowProxyAlias
, 1,
2145 "(AliasHandle alias) -> None"},
2146 {"GetWindowProxyAlias", (PyCFunction
)WinObj_GetWindowProxyAlias
, 1,
2147 "() -> (AliasHandle alias)"},
2148 {"SetWindowProxyCreatorAndType", (PyCFunction
)WinObj_SetWindowProxyCreatorAndType
, 1,
2149 "(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None"},
2150 {"GetWindowProxyIcon", (PyCFunction
)WinObj_GetWindowProxyIcon
, 1,
2151 "() -> (IconRef outIcon)"},
2152 {"SetWindowProxyIcon", (PyCFunction
)WinObj_SetWindowProxyIcon
, 1,
2153 "(IconRef icon) -> None"},
2154 {"RemoveWindowProxy", (PyCFunction
)WinObj_RemoveWindowProxy
, 1,
2156 {"BeginWindowProxyDrag", (PyCFunction
)WinObj_BeginWindowProxyDrag
, 1,
2157 "(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)"},
2158 {"EndWindowProxyDrag", (PyCFunction
)WinObj_EndWindowProxyDrag
, 1,
2159 "(DragReference theDrag) -> None"},
2160 {"TrackWindowProxyFromExistingDrag", (PyCFunction
)WinObj_TrackWindowProxyFromExistingDrag
, 1,
2161 "(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None"},
2162 {"TrackWindowProxyDrag", (PyCFunction
)WinObj_TrackWindowProxyDrag
, 1,
2163 "(Point startPt) -> None"},
2164 {"IsWindowModified", (PyCFunction
)WinObj_IsWindowModified
, 1,
2165 "() -> (Boolean _rv)"},
2166 {"SetWindowModified", (PyCFunction
)WinObj_SetWindowModified
, 1,
2167 "(Boolean modified) -> None"},
2168 {"IsWindowPathSelectClick", (PyCFunction
)WinObj_IsWindowPathSelectClick
, 1,
2169 "(EventRecord event) -> (Boolean _rv)"},
2170 {"WindowPathSelect", (PyCFunction
)WinObj_WindowPathSelect
, 1,
2171 "(MenuHandle menu) -> (SInt32 outMenuResult)"},
2172 {"HiliteWindowFrameForDrag", (PyCFunction
)WinObj_HiliteWindowFrameForDrag
, 1,
2173 "(Boolean hilited) -> None"},
2174 {"TransitionWindow", (PyCFunction
)WinObj_TransitionWindow
, 1,
2175 "(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"},
2176 {"MacMoveWindow", (PyCFunction
)WinObj_MacMoveWindow
, 1,
2177 "(short hGlobal, short vGlobal, Boolean front) -> None"},
2178 {"SizeWindow", (PyCFunction
)WinObj_SizeWindow
, 1,
2179 "(short w, short h, Boolean fUpdate) -> None"},
2180 {"GrowWindow", (PyCFunction
)WinObj_GrowWindow
, 1,
2181 "(Point startPt, Rect bBox) -> (long _rv)"},
2182 {"DragWindow", (PyCFunction
)WinObj_DragWindow
, 1,
2183 "(Point startPt, Rect boundsRect) -> None"},
2184 {"ZoomWindow", (PyCFunction
)WinObj_ZoomWindow
, 1,
2185 "(WindowPartCode partCode, Boolean front) -> None"},
2186 {"IsWindowCollapsable", (PyCFunction
)WinObj_IsWindowCollapsable
, 1,
2187 "() -> (Boolean _rv)"},
2188 {"IsWindowCollapsed", (PyCFunction
)WinObj_IsWindowCollapsed
, 1,
2189 "() -> (Boolean _rv)"},
2190 {"CollapseWindow", (PyCFunction
)WinObj_CollapseWindow
, 1,
2191 "(Boolean collapse) -> None"},
2192 {"GetWindowBounds", (PyCFunction
)WinObj_GetWindowBounds
, 1,
2193 "(WindowRegionCode regionCode) -> (Rect globalBounds)"},
2194 {"ResizeWindow", (PyCFunction
)WinObj_ResizeWindow
, 1,
2195 "(Point startPoint, Rect sizeConstraints) -> (Boolean _rv, Rect newContentRect)"},
2196 {"SetWindowBounds", (PyCFunction
)WinObj_SetWindowBounds
, 1,
2197 "(WindowRegionCode regionCode, Rect globalBounds) -> None"},
2198 {"RepositionWindow", (PyCFunction
)WinObj_RepositionWindow
, 1,
2199 "(WindowPtr parentWindow, WindowPositionMethod method) -> None"},
2200 {"MoveWindowStructure", (PyCFunction
)WinObj_MoveWindowStructure
, 1,
2201 "(short hGlobal, short vGlobal) -> None"},
2202 {"IsWindowInStandardState", (PyCFunction
)WinObj_IsWindowInStandardState
, 1,
2203 "() -> (Boolean _rv, Point idealSize, Rect idealStandardState)"},
2204 {"ZoomWindowIdeal", (PyCFunction
)WinObj_ZoomWindowIdeal
, 1,
2205 "(WindowPartCode partCode) -> (Point ioIdealSize)"},
2206 {"GetWindowIdealUserState", (PyCFunction
)WinObj_GetWindowIdealUserState
, 1,
2207 "() -> (Rect userState)"},
2208 {"SetWindowIdealUserState", (PyCFunction
)WinObj_SetWindowIdealUserState
, 1,
2209 "() -> (Rect userState)"},
2210 {"HideWindow", (PyCFunction
)WinObj_HideWindow
, 1,
2212 {"MacShowWindow", (PyCFunction
)WinObj_MacShowWindow
, 1,
2214 {"ShowHide", (PyCFunction
)WinObj_ShowHide
, 1,
2215 "(Boolean showFlag) -> None"},
2217 #if TARGET_API_MAC_CARBON
2218 {"GetWindowPropertyAttributes", (PyCFunction
)WinObj_GetWindowPropertyAttributes
, 1,
2219 "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
2222 #if TARGET_API_MAC_CARBON
2223 {"ChangeWindowPropertyAttributes", (PyCFunction
)WinObj_ChangeWindowPropertyAttributes
, 1,
2224 "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
2226 {"TrackBox", (PyCFunction
)WinObj_TrackBox
, 1,
2227 "(Point thePt, WindowPartCode partCode) -> (Boolean _rv)"},
2228 {"TrackGoAway", (PyCFunction
)WinObj_TrackGoAway
, 1,
2229 "(Point thePt) -> (Boolean _rv)"},
2231 #if !TARGET_API_MAC_CARBON
2232 {"GetAuxWin", (PyCFunction
)WinObj_GetAuxWin
, 1,
2233 "() -> (Boolean _rv, AuxWinHandle awHndl)"},
2236 #if !TARGET_API_MAC_CARBON
2237 {"GetWindowGoAwayFlag", (PyCFunction
)WinObj_GetWindowGoAwayFlag
, 1,
2238 "() -> (Boolean _rv)"},
2241 #if !TARGET_API_MAC_CARBON
2242 {"GetWindowSpareFlag", (PyCFunction
)WinObj_GetWindowSpareFlag
, 1,
2243 "() -> (Boolean _rv)"},
2245 {"GetWindowPort", (PyCFunction
)WinObj_GetWindowPort
, 1,
2246 "() -> (CGrafPtr _rv)"},
2247 {"GetWindowKind", (PyCFunction
)WinObj_GetWindowKind
, 1,
2248 "() -> (short _rv)"},
2249 {"MacIsWindowVisible", (PyCFunction
)WinObj_MacIsWindowVisible
, 1,
2250 "() -> (Boolean _rv)"},
2251 {"IsWindowHilited", (PyCFunction
)WinObj_IsWindowHilited
, 1,
2252 "() -> (Boolean _rv)"},
2254 #if TARGET_API_MAC_CARBON
2255 {"IsWindowUpdatePending", (PyCFunction
)WinObj_IsWindowUpdatePending
, 1,
2256 "() -> (Boolean _rv)"},
2258 {"MacGetNextWindow", (PyCFunction
)WinObj_MacGetNextWindow
, 1,
2259 "() -> (WindowPtr _rv)"},
2260 {"GetWindowStandardState", (PyCFunction
)WinObj_GetWindowStandardState
, 1,
2261 "() -> (Rect rect)"},
2262 {"GetWindowUserState", (PyCFunction
)WinObj_GetWindowUserState
, 1,
2263 "() -> (Rect rect)"},
2264 {"SetWindowKind", (PyCFunction
)WinObj_SetWindowKind
, 1,
2265 "(short kind) -> None"},
2266 {"SetWindowStandardState", (PyCFunction
)WinObj_SetWindowStandardState
, 1,
2267 "(Rect rect) -> None"},
2268 {"SetWindowUserState", (PyCFunction
)WinObj_SetWindowUserState
, 1,
2269 "(Rect rect) -> None"},
2270 {"SetPortWindowPort", (PyCFunction
)WinObj_SetPortWindowPort
, 1,
2272 {"GetWindowPortBounds", (PyCFunction
)WinObj_GetWindowPortBounds
, 1,
2273 "() -> (Rect bounds)"},
2274 {"IsWindowVisible", (PyCFunction
)WinObj_IsWindowVisible
, 1,
2275 "() -> (Boolean _rv)"},
2277 #if !TARGET_API_MAC_CARBON
2278 {"GetWindowZoomFlag", (PyCFunction
)WinObj_GetWindowZoomFlag
, 1,
2279 "() -> (Boolean _rv)"},
2281 {"GetWindowStructureRgn", (PyCFunction
)WinObj_GetWindowStructureRgn
, 1,
2282 "(RgnHandle r) -> None"},
2283 {"GetWindowContentRgn", (PyCFunction
)WinObj_GetWindowContentRgn
, 1,
2284 "(RgnHandle r) -> None"},
2285 {"GetWindowUpdateRgn", (PyCFunction
)WinObj_GetWindowUpdateRgn
, 1,
2286 "(RgnHandle r) -> None"},
2288 #if !TARGET_API_MAC_CARBON
2289 {"GetWindowTitleWidth", (PyCFunction
)WinObj_GetWindowTitleWidth
, 1,
2290 "() -> (short _rv)"},
2292 {"GetNextWindow", (PyCFunction
)WinObj_GetNextWindow
, 1,
2293 "() -> (WindowPtr _rv)"},
2295 #if !TARGET_API_MAC_CARBON
2296 {"CloseWindow", (PyCFunction
)WinObj_CloseWindow
, 1,
2299 {"MoveWindow", (PyCFunction
)WinObj_MoveWindow
, 1,
2300 "(short hGlobal, short vGlobal, Boolean front) -> None"},
2301 {"ShowWindow", (PyCFunction
)WinObj_ShowWindow
, 1,
2306 PyMethodChain WinObj_chain
= { WinObj_methods
, NULL
};
2308 static PyObject
*WinObj_getattr(self
, name
)
2312 return Py_FindMethodInChain(&WinObj_chain
, (PyObject
*)self
, name
);
2315 #define WinObj_setattr NULL
2317 static int WinObj_compare(self
, other
)
2318 WindowObject
*self
, *other
;
2320 if ( self
->ob_itself
> other
->ob_itself
) return 1;
2321 if ( self
->ob_itself
< other
->ob_itself
) return -1;
2325 static PyObject
* WinObj_repr(self
)
2329 sprintf(buf
, "<Window object at 0x%08.8x for 0x%08.8x>", self
, self
->ob_itself
);
2330 return PyString_FromString(buf
);
2333 static int WinObj_hash(self
)
2336 return (int)self
->ob_itself
;
2339 PyTypeObject Window_Type
= {
2340 PyObject_HEAD_INIT(&PyType_Type
)
2342 "Window", /*tp_name*/
2343 sizeof(WindowObject
), /*tp_basicsize*/
2346 (destructor
) WinObj_dealloc
, /*tp_dealloc*/
2348 (getattrfunc
) WinObj_getattr
, /*tp_getattr*/
2349 (setattrfunc
) WinObj_setattr
, /*tp_setattr*/
2350 (cmpfunc
) WinObj_compare
, /*tp_compare*/
2351 (reprfunc
) WinObj_repr
, /*tp_repr*/
2352 (PyNumberMethods
*)0, /* tp_as_number */
2353 (PySequenceMethods
*)0, /* tp_as_sequence */
2354 (PyMappingMethods
*)0, /* tp_as_mapping */
2355 (hashfunc
) WinObj_hash
, /*tp_hash*/
2358 /* --------------------- End object type Window --------------------- */
2361 static PyObject
*Win_GetNewCWindow(_self
, _args
)
2365 PyObject
*_res
= NULL
;
2369 if (!PyArg_ParseTuple(_args
, "hO&",
2371 WinObj_Convert
, &behind
))
2373 _rv
= GetNewCWindow(windowID
,
2376 _res
= Py_BuildValue("O&",
2381 static PyObject
*Win_NewWindow(_self
, _args
)
2385 PyObject
*_res
= NULL
;
2394 if (!PyArg_ParseTuple(_args
, "O&O&bhO&bl",
2395 PyMac_GetRect
, &boundsRect
,
2396 PyMac_GetStr255
, title
,
2399 WinObj_Convert
, &behind
,
2403 _rv
= NewWindow((void *)0,
2411 _res
= Py_BuildValue("O&",
2416 static PyObject
*Win_GetNewWindow(_self
, _args
)
2420 PyObject
*_res
= NULL
;
2424 if (!PyArg_ParseTuple(_args
, "hO&",
2426 WinObj_Convert
, &behind
))
2428 _rv
= GetNewWindow(windowID
,
2431 _res
= Py_BuildValue("O&",
2436 static PyObject
*Win_NewCWindow(_self
, _args
)
2440 PyObject
*_res
= NULL
;
2449 if (!PyArg_ParseTuple(_args
, "O&O&bhO&bl",
2450 PyMac_GetRect
, &boundsRect
,
2451 PyMac_GetStr255
, title
,
2454 WinObj_Convert
, &behind
,
2458 _rv
= NewCWindow((void *)0,
2466 _res
= Py_BuildValue("O&",
2471 static PyObject
*Win_CreateNewWindow(_self
, _args
)
2475 PyObject
*_res
= NULL
;
2477 WindowClass windowClass
;
2478 WindowAttributes attributes
;
2480 WindowPtr outWindow
;
2481 if (!PyArg_ParseTuple(_args
, "llO&",
2484 PyMac_GetRect
, &contentBounds
))
2486 _err
= CreateNewWindow(windowClass
,
2490 if (_err
!= noErr
) return PyMac_Error(_err
);
2491 _res
= Py_BuildValue("O&",
2492 WinObj_WhichWindow
, outWindow
);
2496 static PyObject
*Win_CreateWindowFromResource(_self
, _args
)
2500 PyObject
*_res
= NULL
;
2503 WindowPtr outWindow
;
2504 if (!PyArg_ParseTuple(_args
, "h",
2507 _err
= CreateWindowFromResource(resID
,
2509 if (_err
!= noErr
) return PyMac_Error(_err
);
2510 _res
= Py_BuildValue("O&",
2511 WinObj_WhichWindow
, outWindow
);
2515 static PyObject
*Win_ShowFloatingWindows(_self
, _args
)
2519 PyObject
*_res
= NULL
;
2521 if (!PyArg_ParseTuple(_args
, ""))
2523 _err
= ShowFloatingWindows();
2524 if (_err
!= noErr
) return PyMac_Error(_err
);
2530 static PyObject
*Win_HideFloatingWindows(_self
, _args
)
2534 PyObject
*_res
= NULL
;
2536 if (!PyArg_ParseTuple(_args
, ""))
2538 _err
= HideFloatingWindows();
2539 if (_err
!= noErr
) return PyMac_Error(_err
);
2545 static PyObject
*Win_AreFloatingWindowsVisible(_self
, _args
)
2549 PyObject
*_res
= NULL
;
2551 if (!PyArg_ParseTuple(_args
, ""))
2553 _rv
= AreFloatingWindowsVisible();
2554 _res
= Py_BuildValue("b",
2559 #if !TARGET_API_MAC_CARBON
2561 static PyObject
*Win_SetDeskCPat(_self
, _args
)
2565 PyObject
*_res
= NULL
;
2566 PixPatHandle deskPixPat
;
2567 if (!PyArg_ParseTuple(_args
, "O&",
2568 ResObj_Convert
, &deskPixPat
))
2570 SetDeskCPat(deskPixPat
);
2577 static PyObject
*Win_CheckUpdate(_self
, _args
)
2581 PyObject
*_res
= NULL
;
2583 EventRecord theEvent
;
2584 if (!PyArg_ParseTuple(_args
, ""))
2586 _rv
= CheckUpdate(&theEvent
);
2587 _res
= Py_BuildValue("bO&",
2589 PyMac_BuildEventRecord
, &theEvent
);
2593 static PyObject
*Win_MacFindWindow(_self
, _args
)
2597 PyObject
*_res
= NULL
;
2601 if (!PyArg_ParseTuple(_args
, "O&",
2602 PyMac_GetPoint
, &thePoint
))
2604 _rv
= MacFindWindow(thePoint
,
2606 _res
= Py_BuildValue("hO&",
2608 WinObj_WhichWindow
, window
);
2612 static PyObject
*Win_FrontWindow(_self
, _args
)
2616 PyObject
*_res
= NULL
;
2618 if (!PyArg_ParseTuple(_args
, ""))
2620 _rv
= FrontWindow();
2621 _res
= Py_BuildValue("O&",
2622 WinObj_WhichWindow
, _rv
);
2626 static PyObject
*Win_FrontNonFloatingWindow(_self
, _args
)
2630 PyObject
*_res
= NULL
;
2632 if (!PyArg_ParseTuple(_args
, ""))
2634 _rv
= FrontNonFloatingWindow();
2635 _res
= Py_BuildValue("O&",
2636 WinObj_WhichWindow
, _rv
);
2640 #if TARGET_API_MAC_CARBON
2642 static PyObject
*Win_GetFrontWindowOfClass(_self
, _args
)
2646 PyObject
*_res
= NULL
;
2648 WindowClass inWindowClass
;
2649 Boolean mustBeVisible
;
2650 if (!PyArg_ParseTuple(_args
, "lb",
2654 _rv
= GetFrontWindowOfClass(inWindowClass
,
2656 _res
= Py_BuildValue("O&",
2662 #if TARGET_API_MAC_CARBON
2664 static PyObject
*Win_FindWindowOfClass(_self
, _args
)
2668 PyObject
*_res
= NULL
;
2671 WindowClass inWindowClass
;
2672 WindowPtr outWindow
;
2673 WindowPartCode outWindowPart
;
2674 if (!PyArg_ParseTuple(_args
, "O&l",
2675 PyMac_GetPoint
, &where
,
2678 _err
= FindWindowOfClass(&where
,
2682 if (_err
!= noErr
) return PyMac_Error(_err
);
2683 _res
= Py_BuildValue("O&h",
2684 WinObj_WhichWindow
, outWindow
,
2690 #if !TARGET_API_MAC_CARBON
2692 static PyObject
*Win_InitWindows(_self
, _args
)
2696 PyObject
*_res
= NULL
;
2697 if (!PyArg_ParseTuple(_args
, ""))
2706 #if !TARGET_API_MAC_CARBON
2708 static PyObject
*Win_GetWMgrPort(_self
, _args
)
2712 PyObject
*_res
= NULL
;
2714 if (!PyArg_ParseTuple(_args
, ""))
2716 GetWMgrPort(&wPort
);
2717 _res
= Py_BuildValue("O&",
2718 GrafObj_New
, wPort
);
2723 #if !TARGET_API_MAC_CARBON
2725 static PyObject
*Win_GetCWMgrPort(_self
, _args
)
2729 PyObject
*_res
= NULL
;
2731 if (!PyArg_ParseTuple(_args
, ""))
2733 GetCWMgrPort(&wMgrCPort
);
2734 _res
= Py_BuildValue("O&",
2735 GrafObj_New
, wMgrCPort
);
2740 #if !TARGET_API_MAC_CARBON
2742 static PyObject
*Win_InitFloatingWindows(_self
, _args
)
2746 PyObject
*_res
= NULL
;
2748 if (!PyArg_ParseTuple(_args
, ""))
2750 _err
= InitFloatingWindows();
2751 if (_err
!= noErr
) return PyMac_Error(_err
);
2758 #if !TARGET_API_MAC_CARBON
2760 static PyObject
*Win_InvalRect(_self
, _args
)
2764 PyObject
*_res
= NULL
;
2766 if (!PyArg_ParseTuple(_args
, "O&",
2767 PyMac_GetRect
, &badRect
))
2769 InvalRect(&badRect
);
2776 #if !TARGET_API_MAC_CARBON
2778 static PyObject
*Win_InvalRgn(_self
, _args
)
2782 PyObject
*_res
= NULL
;
2784 if (!PyArg_ParseTuple(_args
, "O&",
2785 ResObj_Convert
, &badRgn
))
2794 #if !TARGET_API_MAC_CARBON
2796 static PyObject
*Win_ValidRect(_self
, _args
)
2800 PyObject
*_res
= NULL
;
2802 if (!PyArg_ParseTuple(_args
, "O&",
2803 PyMac_GetRect
, &goodRect
))
2805 ValidRect(&goodRect
);
2812 #if !TARGET_API_MAC_CARBON
2814 static PyObject
*Win_ValidRgn(_self
, _args
)
2818 PyObject
*_res
= NULL
;
2820 if (!PyArg_ParseTuple(_args
, "O&",
2821 ResObj_Convert
, &goodRgn
))
2830 static PyObject
*Win_CollapseAllWindows(_self
, _args
)
2834 PyObject
*_res
= NULL
;
2837 if (!PyArg_ParseTuple(_args
, "b",
2840 _err
= CollapseAllWindows(collapse
);
2841 if (_err
!= noErr
) return PyMac_Error(_err
);
2847 static PyObject
*Win_PinRect(_self
, _args
)
2851 PyObject
*_res
= NULL
;
2855 if (!PyArg_ParseTuple(_args
, "O&O&",
2856 PyMac_GetRect
, &theRect
,
2857 PyMac_GetPoint
, &thePt
))
2859 _rv
= PinRect(&theRect
,
2861 _res
= Py_BuildValue("l",
2866 static PyObject
*Win_GetGrayRgn(_self
, _args
)
2870 PyObject
*_res
= NULL
;
2872 if (!PyArg_ParseTuple(_args
, ""))
2875 _res
= Py_BuildValue("O&",
2880 static PyObject
*Win_GetWindowFromPort(_self
, _args
)
2884 PyObject
*_res
= NULL
;
2887 if (!PyArg_ParseTuple(_args
, "O&",
2888 GrafObj_Convert
, &port
))
2890 _rv
= GetWindowFromPort(port
);
2891 _res
= Py_BuildValue("O&",
2896 static PyObject
*Win_WhichWindow(_self
, _args
)
2900 PyObject
*_res
= NULL
;
2904 if ( !PyArg_ParseTuple(_args
, "i", &ptr
) )
2906 return WinObj_WhichWindow((WindowPtr
)ptr
);
2910 static PyObject
*Win_FindWindow(_self
, _args
)
2914 PyObject
*_res
= NULL
;
2917 WindowPtr theWindow
;
2918 if (!PyArg_ParseTuple(_args
, "O&",
2919 PyMac_GetPoint
, &thePoint
))
2921 _rv
= FindWindow(thePoint
,
2923 _res
= Py_BuildValue("hO&",
2925 WinObj_WhichWindow
, theWindow
);
2929 static PyMethodDef Win_methods
[] = {
2930 {"GetNewCWindow", (PyCFunction
)Win_GetNewCWindow
, 1,
2931 "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
2932 {"NewWindow", (PyCFunction
)Win_NewWindow
, 1,
2933 "(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
2934 {"GetNewWindow", (PyCFunction
)Win_GetNewWindow
, 1,
2935 "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
2936 {"NewCWindow", (PyCFunction
)Win_NewCWindow
, 1,
2937 "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
2938 {"CreateNewWindow", (PyCFunction
)Win_CreateNewWindow
, 1,
2939 "(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)"},
2940 {"CreateWindowFromResource", (PyCFunction
)Win_CreateWindowFromResource
, 1,
2941 "(SInt16 resID) -> (WindowPtr outWindow)"},
2942 {"ShowFloatingWindows", (PyCFunction
)Win_ShowFloatingWindows
, 1,
2944 {"HideFloatingWindows", (PyCFunction
)Win_HideFloatingWindows
, 1,
2946 {"AreFloatingWindowsVisible", (PyCFunction
)Win_AreFloatingWindowsVisible
, 1,
2947 "() -> (Boolean _rv)"},
2949 #if !TARGET_API_MAC_CARBON
2950 {"SetDeskCPat", (PyCFunction
)Win_SetDeskCPat
, 1,
2951 "(PixPatHandle deskPixPat) -> None"},
2953 {"CheckUpdate", (PyCFunction
)Win_CheckUpdate
, 1,
2954 "() -> (Boolean _rv, EventRecord theEvent)"},
2955 {"MacFindWindow", (PyCFunction
)Win_MacFindWindow
, 1,
2956 "(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)"},
2957 {"FrontWindow", (PyCFunction
)Win_FrontWindow
, 1,
2958 "() -> (WindowPtr _rv)"},
2959 {"FrontNonFloatingWindow", (PyCFunction
)Win_FrontNonFloatingWindow
, 1,
2960 "() -> (WindowPtr _rv)"},
2962 #if TARGET_API_MAC_CARBON
2963 {"GetFrontWindowOfClass", (PyCFunction
)Win_GetFrontWindowOfClass
, 1,
2964 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
2967 #if TARGET_API_MAC_CARBON
2968 {"FindWindowOfClass", (PyCFunction
)Win_FindWindowOfClass
, 1,
2969 "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"},
2972 #if !TARGET_API_MAC_CARBON
2973 {"InitWindows", (PyCFunction
)Win_InitWindows
, 1,
2977 #if !TARGET_API_MAC_CARBON
2978 {"GetWMgrPort", (PyCFunction
)Win_GetWMgrPort
, 1,
2979 "() -> (GrafPtr wPort)"},
2982 #if !TARGET_API_MAC_CARBON
2983 {"GetCWMgrPort", (PyCFunction
)Win_GetCWMgrPort
, 1,
2984 "() -> (CGrafPtr wMgrCPort)"},
2987 #if !TARGET_API_MAC_CARBON
2988 {"InitFloatingWindows", (PyCFunction
)Win_InitFloatingWindows
, 1,
2992 #if !TARGET_API_MAC_CARBON
2993 {"InvalRect", (PyCFunction
)Win_InvalRect
, 1,
2994 "(Rect badRect) -> None"},
2997 #if !TARGET_API_MAC_CARBON
2998 {"InvalRgn", (PyCFunction
)Win_InvalRgn
, 1,
2999 "(RgnHandle badRgn) -> None"},
3002 #if !TARGET_API_MAC_CARBON
3003 {"ValidRect", (PyCFunction
)Win_ValidRect
, 1,
3004 "(Rect goodRect) -> None"},
3007 #if !TARGET_API_MAC_CARBON
3008 {"ValidRgn", (PyCFunction
)Win_ValidRgn
, 1,
3009 "(RgnHandle goodRgn) -> None"},
3011 {"CollapseAllWindows", (PyCFunction
)Win_CollapseAllWindows
, 1,
3012 "(Boolean collapse) -> None"},
3013 {"PinRect", (PyCFunction
)Win_PinRect
, 1,
3014 "(Rect theRect, Point thePt) -> (long _rv)"},
3015 {"GetGrayRgn", (PyCFunction
)Win_GetGrayRgn
, 1,
3016 "() -> (RgnHandle _rv)"},
3017 {"GetWindowFromPort", (PyCFunction
)Win_GetWindowFromPort
, 1,
3018 "(CGrafPtr port) -> (WindowPtr _rv)"},
3019 {"WhichWindow", (PyCFunction
)Win_WhichWindow
, 1,
3020 "Resolve an integer WindowPtr address to a Window object"},
3021 {"FindWindow", (PyCFunction
)Win_FindWindow
, 1,
3022 "(Point thePoint) -> (short _rv, WindowPtr theWindow)"},
3028 /* Return the object corresponding to the window, or NULL */
3031 WinObj_WhichWindow(w
)
3040 it
= (PyObject
*) GetWRefCon(w
);
3041 if (it
== NULL
|| ((WindowObject
*)it
)->ob_itself
!= w
|| !WinObj_Check(it
)) {
3043 ((WindowObject
*)it
)->ob_freeit
= NULL
;
3060 m
= Py_InitModule("Win", Win_methods
);
3061 d
= PyModule_GetDict(m
);
3062 Win_Error
= PyMac_GetOSErrException();
3063 if (Win_Error
== NULL
||
3064 PyDict_SetItemString(d
, "Error", Win_Error
) != 0)
3066 Window_Type
.ob_type
= &PyType_Type
;
3067 Py_INCREF(&Window_Type
);
3068 if (PyDict_SetItemString(d
, "WindowType", (PyObject
*)&Window_Type
) != 0)
3069 Py_FatalError("can't initialize WindowType");
3072 /* ========================= End module Win ========================= */