2 /* =========================== Module Win =========================== */
9 #include "pymactoolbox.h"
11 #ifdef WITHOUT_FRAMEWORKS
14 #include <Carbon/Carbon.h>
17 #ifdef USE_TOOLBOX_OBJECT_GLUE
18 extern PyObject
*_WinObj_New(WindowRef
);
19 extern PyObject
*_WinObj_WhichWindow(WindowRef
);
20 extern int _WinObj_Convert(PyObject
*, WindowRef
*);
22 #define WinObj_New _WinObj_New
23 #define WinObj_WhichWindow _WinObj_WhichWindow
24 #define WinObj_Convert _WinObj_Convert
27 #if !ACCESSOR_CALLS_ARE_FUNCTIONS
28 /* Carbon calls that we emulate in classic mode */
29 #define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
30 #define GetWindowFromPort(port) ((WindowRef)(port))
31 #define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect)
32 #define IsPointerValid(p) (((long)p&3) == 0)
34 #if ACCESSOR_CALLS_ARE_FUNCTIONS
35 /* Classic calls that we emulate in carbon mode */
36 #define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
37 #define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
38 #define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
41 /* Function to dispose a window, with a "normal" calling sequence */
43 PyMac_AutoDisposeWindow(WindowPtr w
)
48 static PyObject
*Win_Error
;
50 /* ----------------------- Object type Window ----------------------- */
52 PyTypeObject Window_Type
;
54 #define WinObj_Check(x) ((x)->ob_type == &Window_Type)
56 typedef struct WindowObject
{
59 void (*ob_freeit
)(WindowPtr ptr
);
62 PyObject
*WinObj_New(WindowPtr itself
)
65 if (itself
== NULL
) return PyMac_Error(resNotFound
);
66 it
= PyObject_NEW(WindowObject
, &Window_Type
);
67 if (it
== NULL
) return NULL
;
68 it
->ob_itself
= itself
;
70 if (GetWRefCon(itself
) == 0)
72 SetWRefCon(itself
, (long)it
);
73 it
->ob_freeit
= PyMac_AutoDisposeWindow
;
75 return (PyObject
*)it
;
77 WinObj_Convert(PyObject
*v
, WindowPtr
*p_itself
)
80 if (v
== Py_None
) { *p_itself
= NULL
; return 1; }
81 if (PyInt_Check(v
)) { *p_itself
= (WindowPtr
)PyInt_AsLong(v
); return 1; }
85 if (DlgObj_Convert(v
, &dlg
) && dlg
) {
86 *p_itself
= GetDialogWindow(dlg
);
93 PyErr_SetString(PyExc_TypeError
, "Window required");
96 *p_itself
= ((WindowObject
*)v
)->ob_itself
;
100 static void WinObj_dealloc(WindowObject
*self
)
102 if (self
->ob_freeit
&& self
->ob_itself
)
104 SetWRefCon(self
->ob_itself
, 0);
105 self
->ob_freeit(self
->ob_itself
);
107 self
->ob_itself
= NULL
;
108 self
->ob_freeit
= NULL
;
112 static PyObject
*WinObj_GetWindowOwnerCount(WindowObject
*_self
, PyObject
*_args
)
114 PyObject
*_res
= NULL
;
117 if (!PyArg_ParseTuple(_args
, ""))
119 _err
= GetWindowOwnerCount(_self
->ob_itself
,
121 if (_err
!= noErr
) return PyMac_Error(_err
);
122 _res
= Py_BuildValue("l",
127 static PyObject
*WinObj_CloneWindow(WindowObject
*_self
, PyObject
*_args
)
129 PyObject
*_res
= NULL
;
131 if (!PyArg_ParseTuple(_args
, ""))
133 _err
= CloneWindow(_self
->ob_itself
);
134 if (_err
!= noErr
) return PyMac_Error(_err
);
140 #if TARGET_API_MAC_CARBON
142 static PyObject
*WinObj_ReshapeCustomWindow(WindowObject
*_self
, PyObject
*_args
)
144 PyObject
*_res
= NULL
;
146 if (!PyArg_ParseTuple(_args
, ""))
148 _err
= ReshapeCustomWindow(_self
->ob_itself
);
149 if (_err
!= noErr
) return PyMac_Error(_err
);
156 static PyObject
*WinObj_GetWindowClass(WindowObject
*_self
, PyObject
*_args
)
158 PyObject
*_res
= NULL
;
160 WindowClass outClass
;
161 if (!PyArg_ParseTuple(_args
, ""))
163 _err
= GetWindowClass(_self
->ob_itself
,
165 if (_err
!= noErr
) return PyMac_Error(_err
);
166 _res
= Py_BuildValue("l",
171 static PyObject
*WinObj_GetWindowAttributes(WindowObject
*_self
, PyObject
*_args
)
173 PyObject
*_res
= NULL
;
175 WindowAttributes outAttributes
;
176 if (!PyArg_ParseTuple(_args
, ""))
178 _err
= GetWindowAttributes(_self
->ob_itself
,
180 if (_err
!= noErr
) return PyMac_Error(_err
);
181 _res
= Py_BuildValue("l",
186 #if TARGET_API_MAC_CARBON
188 static PyObject
*WinObj_ChangeWindowAttributes(WindowObject
*_self
, PyObject
*_args
)
190 PyObject
*_res
= NULL
;
192 WindowAttributes setTheseAttributes
;
193 WindowAttributes clearTheseAttributes
;
194 if (!PyArg_ParseTuple(_args
, "ll",
196 &clearTheseAttributes
))
198 _err
= ChangeWindowAttributes(_self
->ob_itself
,
200 clearTheseAttributes
);
201 if (_err
!= noErr
) return PyMac_Error(_err
);
208 #if !TARGET_API_MAC_CARBON
210 static PyObject
*WinObj_SetWinColor(WindowObject
*_self
, PyObject
*_args
)
212 PyObject
*_res
= NULL
;
213 WCTabHandle newColorTable
;
214 if (!PyArg_ParseTuple(_args
, "O&",
215 ResObj_Convert
, &newColorTable
))
217 SetWinColor(_self
->ob_itself
,
225 static PyObject
*WinObj_SetWindowContentColor(WindowObject
*_self
, PyObject
*_args
)
227 PyObject
*_res
= NULL
;
230 if (!PyArg_ParseTuple(_args
, "O&",
231 QdRGB_Convert
, &color
))
233 _err
= SetWindowContentColor(_self
->ob_itself
,
235 if (_err
!= noErr
) return PyMac_Error(_err
);
241 static PyObject
*WinObj_GetWindowContentColor(WindowObject
*_self
, PyObject
*_args
)
243 PyObject
*_res
= NULL
;
246 if (!PyArg_ParseTuple(_args
, ""))
248 _err
= GetWindowContentColor(_self
->ob_itself
,
250 if (_err
!= noErr
) return PyMac_Error(_err
);
251 _res
= Py_BuildValue("O&",
256 static PyObject
*WinObj_GetWindowContentPattern(WindowObject
*_self
, PyObject
*_args
)
258 PyObject
*_res
= NULL
;
260 PixPatHandle outPixPat
;
261 if (!PyArg_ParseTuple(_args
, "O&",
262 ResObj_Convert
, &outPixPat
))
264 _err
= GetWindowContentPattern(_self
->ob_itself
,
266 if (_err
!= noErr
) return PyMac_Error(_err
);
272 static PyObject
*WinObj_SetWindowContentPattern(WindowObject
*_self
, PyObject
*_args
)
274 PyObject
*_res
= NULL
;
277 if (!PyArg_ParseTuple(_args
, "O&",
278 ResObj_Convert
, &pixPat
))
280 _err
= SetWindowContentPattern(_self
->ob_itself
,
282 if (_err
!= noErr
) return PyMac_Error(_err
);
288 #if TARGET_API_MAC_CARBON
290 static PyObject
*WinObj_ScrollWindowRect(WindowObject
*_self
, PyObject
*_args
)
292 PyObject
*_res
= NULL
;
297 ScrollWindowOptions inOptions
;
298 RgnHandle outExposedRgn
;
299 if (!PyArg_ParseTuple(_args
, "O&hhlO&",
300 PyMac_GetRect
, &inScrollRect
,
304 ResObj_Convert
, &outExposedRgn
))
306 _err
= ScrollWindowRect(_self
->ob_itself
,
312 if (_err
!= noErr
) return PyMac_Error(_err
);
319 #if TARGET_API_MAC_CARBON
321 static PyObject
*WinObj_ScrollWindowRegion(WindowObject
*_self
, PyObject
*_args
)
323 PyObject
*_res
= NULL
;
325 RgnHandle inScrollRgn
;
328 ScrollWindowOptions inOptions
;
329 RgnHandle outExposedRgn
;
330 if (!PyArg_ParseTuple(_args
, "O&hhlO&",
331 ResObj_Convert
, &inScrollRgn
,
335 ResObj_Convert
, &outExposedRgn
))
337 _err
= ScrollWindowRegion(_self
->ob_itself
,
343 if (_err
!= noErr
) return PyMac_Error(_err
);
350 static PyObject
*WinObj_ClipAbove(WindowObject
*_self
, PyObject
*_args
)
352 PyObject
*_res
= NULL
;
353 if (!PyArg_ParseTuple(_args
, ""))
355 ClipAbove(_self
->ob_itself
);
361 #if !TARGET_API_MAC_CARBON
363 static PyObject
*WinObj_SaveOld(WindowObject
*_self
, PyObject
*_args
)
365 PyObject
*_res
= NULL
;
366 if (!PyArg_ParseTuple(_args
, ""))
368 SaveOld(_self
->ob_itself
);
375 #if !TARGET_API_MAC_CARBON
377 static PyObject
*WinObj_DrawNew(WindowObject
*_self
, PyObject
*_args
)
379 PyObject
*_res
= NULL
;
381 if (!PyArg_ParseTuple(_args
, "b",
384 DrawNew(_self
->ob_itself
,
392 static PyObject
*WinObj_PaintOne(WindowObject
*_self
, PyObject
*_args
)
394 PyObject
*_res
= NULL
;
395 RgnHandle clobberedRgn
;
396 if (!PyArg_ParseTuple(_args
, "O&",
397 ResObj_Convert
, &clobberedRgn
))
399 PaintOne(_self
->ob_itself
,
406 static PyObject
*WinObj_PaintBehind(WindowObject
*_self
, PyObject
*_args
)
408 PyObject
*_res
= NULL
;
409 RgnHandle clobberedRgn
;
410 if (!PyArg_ParseTuple(_args
, "O&",
411 ResObj_Convert
, &clobberedRgn
))
413 PaintBehind(_self
->ob_itself
,
420 static PyObject
*WinObj_CalcVis(WindowObject
*_self
, PyObject
*_args
)
422 PyObject
*_res
= NULL
;
423 if (!PyArg_ParseTuple(_args
, ""))
425 CalcVis(_self
->ob_itself
);
431 static PyObject
*WinObj_CalcVisBehind(WindowObject
*_self
, PyObject
*_args
)
433 PyObject
*_res
= NULL
;
434 RgnHandle clobberedRgn
;
435 if (!PyArg_ParseTuple(_args
, "O&",
436 ResObj_Convert
, &clobberedRgn
))
438 CalcVisBehind(_self
->ob_itself
,
445 static PyObject
*WinObj_BringToFront(WindowObject
*_self
, PyObject
*_args
)
447 PyObject
*_res
= NULL
;
448 if (!PyArg_ParseTuple(_args
, ""))
450 BringToFront(_self
->ob_itself
);
456 static PyObject
*WinObj_SendBehind(WindowObject
*_self
, PyObject
*_args
)
458 PyObject
*_res
= NULL
;
459 WindowPtr behindWindow
;
460 if (!PyArg_ParseTuple(_args
, "O&",
461 WinObj_Convert
, &behindWindow
))
463 SendBehind(_self
->ob_itself
,
470 static PyObject
*WinObj_SelectWindow(WindowObject
*_self
, PyObject
*_args
)
472 PyObject
*_res
= NULL
;
473 if (!PyArg_ParseTuple(_args
, ""))
475 SelectWindow(_self
->ob_itself
);
481 #if TARGET_API_MAC_CARBON
483 static PyObject
*WinObj_GetNextWindowOfClass(WindowObject
*_self
, PyObject
*_args
)
485 PyObject
*_res
= NULL
;
487 WindowClass inWindowClass
;
488 Boolean mustBeVisible
;
489 if (!PyArg_ParseTuple(_args
, "lb",
493 _rv
= GetNextWindowOfClass(_self
->ob_itself
,
496 _res
= Py_BuildValue("O&",
502 #if !TARGET_API_MAC_CARBON
504 static PyObject
*WinObj_IsValidWindowPtr(WindowObject
*_self
, PyObject
*_args
)
506 PyObject
*_res
= NULL
;
508 if (!PyArg_ParseTuple(_args
, ""))
510 _rv
= IsValidWindowPtr(_self
->ob_itself
);
511 _res
= Py_BuildValue("b",
517 static PyObject
*WinObj_HiliteWindow(WindowObject
*_self
, PyObject
*_args
)
519 PyObject
*_res
= NULL
;
521 if (!PyArg_ParseTuple(_args
, "b",
524 HiliteWindow(_self
->ob_itself
,
531 static PyObject
*WinObj_SetWRefCon(WindowObject
*_self
, PyObject
*_args
)
533 PyObject
*_res
= NULL
;
535 if (!PyArg_ParseTuple(_args
, "l",
538 SetWRefCon(_self
->ob_itself
,
545 static PyObject
*WinObj_GetWRefCon(WindowObject
*_self
, PyObject
*_args
)
547 PyObject
*_res
= NULL
;
549 if (!PyArg_ParseTuple(_args
, ""))
551 _rv
= GetWRefCon(_self
->ob_itself
);
552 _res
= Py_BuildValue("l",
557 static PyObject
*WinObj_SetWindowPic(WindowObject
*_self
, PyObject
*_args
)
559 PyObject
*_res
= NULL
;
561 if (!PyArg_ParseTuple(_args
, "O&",
562 ResObj_Convert
, &pic
))
564 SetWindowPic(_self
->ob_itself
,
571 static PyObject
*WinObj_GetWindowPic(WindowObject
*_self
, PyObject
*_args
)
573 PyObject
*_res
= NULL
;
575 if (!PyArg_ParseTuple(_args
, ""))
577 _rv
= GetWindowPic(_self
->ob_itself
);
578 _res
= Py_BuildValue("O&",
583 static PyObject
*WinObj_GetWVariant(WindowObject
*_self
, PyObject
*_args
)
585 PyObject
*_res
= NULL
;
587 if (!PyArg_ParseTuple(_args
, ""))
589 _rv
= GetWVariant(_self
->ob_itself
);
590 _res
= Py_BuildValue("h",
595 static PyObject
*WinObj_GetWindowFeatures(WindowObject
*_self
, PyObject
*_args
)
597 PyObject
*_res
= NULL
;
600 if (!PyArg_ParseTuple(_args
, ""))
602 _err
= GetWindowFeatures(_self
->ob_itself
,
604 if (_err
!= noErr
) return PyMac_Error(_err
);
605 _res
= Py_BuildValue("l",
610 static PyObject
*WinObj_GetWindowRegion(WindowObject
*_self
, PyObject
*_args
)
612 PyObject
*_res
= NULL
;
614 WindowRegionCode inRegionCode
;
616 if (!PyArg_ParseTuple(_args
, "HO&",
618 ResObj_Convert
, &ioWinRgn
))
620 _err
= GetWindowRegion(_self
->ob_itself
,
623 if (_err
!= noErr
) return PyMac_Error(_err
);
629 static PyObject
*WinObj_BeginUpdate(WindowObject
*_self
, PyObject
*_args
)
631 PyObject
*_res
= NULL
;
632 if (!PyArg_ParseTuple(_args
, ""))
634 BeginUpdate(_self
->ob_itself
);
640 static PyObject
*WinObj_EndUpdate(WindowObject
*_self
, PyObject
*_args
)
642 PyObject
*_res
= NULL
;
643 if (!PyArg_ParseTuple(_args
, ""))
645 EndUpdate(_self
->ob_itself
);
651 static PyObject
*WinObj_InvalWindowRgn(WindowObject
*_self
, PyObject
*_args
)
653 PyObject
*_res
= NULL
;
656 if (!PyArg_ParseTuple(_args
, "O&",
657 ResObj_Convert
, ®ion
))
659 _err
= InvalWindowRgn(_self
->ob_itself
,
661 if (_err
!= noErr
) return PyMac_Error(_err
);
667 static PyObject
*WinObj_InvalWindowRect(WindowObject
*_self
, PyObject
*_args
)
669 PyObject
*_res
= NULL
;
672 if (!PyArg_ParseTuple(_args
, "O&",
673 PyMac_GetRect
, &bounds
))
675 _err
= InvalWindowRect(_self
->ob_itself
,
677 if (_err
!= noErr
) return PyMac_Error(_err
);
683 static PyObject
*WinObj_ValidWindowRgn(WindowObject
*_self
, PyObject
*_args
)
685 PyObject
*_res
= NULL
;
688 if (!PyArg_ParseTuple(_args
, "O&",
689 ResObj_Convert
, ®ion
))
691 _err
= ValidWindowRgn(_self
->ob_itself
,
693 if (_err
!= noErr
) return PyMac_Error(_err
);
699 static PyObject
*WinObj_ValidWindowRect(WindowObject
*_self
, PyObject
*_args
)
701 PyObject
*_res
= NULL
;
704 if (!PyArg_ParseTuple(_args
, "O&",
705 PyMac_GetRect
, &bounds
))
707 _err
= ValidWindowRect(_self
->ob_itself
,
709 if (_err
!= noErr
) return PyMac_Error(_err
);
715 static PyObject
*WinObj_DrawGrowIcon(WindowObject
*_self
, PyObject
*_args
)
717 PyObject
*_res
= NULL
;
718 if (!PyArg_ParseTuple(_args
, ""))
720 DrawGrowIcon(_self
->ob_itself
);
726 static PyObject
*WinObj_SetWTitle(WindowObject
*_self
, PyObject
*_args
)
728 PyObject
*_res
= NULL
;
730 if (!PyArg_ParseTuple(_args
, "O&",
731 PyMac_GetStr255
, title
))
733 SetWTitle(_self
->ob_itself
,
740 static PyObject
*WinObj_GetWTitle(WindowObject
*_self
, PyObject
*_args
)
742 PyObject
*_res
= NULL
;
744 if (!PyArg_ParseTuple(_args
, ""))
746 GetWTitle(_self
->ob_itself
,
748 _res
= Py_BuildValue("O&",
749 PyMac_BuildStr255
, title
);
753 static PyObject
*WinObj_SetWindowProxyFSSpec(WindowObject
*_self
, PyObject
*_args
)
755 PyObject
*_res
= NULL
;
758 if (!PyArg_ParseTuple(_args
, "O&",
759 PyMac_GetFSSpec
, &inFile
))
761 _err
= SetWindowProxyFSSpec(_self
->ob_itself
,
763 if (_err
!= noErr
) return PyMac_Error(_err
);
769 static PyObject
*WinObj_GetWindowProxyFSSpec(WindowObject
*_self
, PyObject
*_args
)
771 PyObject
*_res
= NULL
;
774 if (!PyArg_ParseTuple(_args
, ""))
776 _err
= GetWindowProxyFSSpec(_self
->ob_itself
,
778 if (_err
!= noErr
) return PyMac_Error(_err
);
779 _res
= Py_BuildValue("O&",
780 PyMac_BuildFSSpec
, outFile
);
784 static PyObject
*WinObj_SetWindowProxyAlias(WindowObject
*_self
, PyObject
*_args
)
786 PyObject
*_res
= NULL
;
789 if (!PyArg_ParseTuple(_args
, "O&",
790 ResObj_Convert
, &alias
))
792 _err
= SetWindowProxyAlias(_self
->ob_itself
,
794 if (_err
!= noErr
) return PyMac_Error(_err
);
800 static PyObject
*WinObj_GetWindowProxyAlias(WindowObject
*_self
, PyObject
*_args
)
802 PyObject
*_res
= NULL
;
805 if (!PyArg_ParseTuple(_args
, ""))
807 _err
= GetWindowProxyAlias(_self
->ob_itself
,
809 if (_err
!= noErr
) return PyMac_Error(_err
);
810 _res
= Py_BuildValue("O&",
815 static PyObject
*WinObj_SetWindowProxyCreatorAndType(WindowObject
*_self
, PyObject
*_args
)
817 PyObject
*_res
= NULL
;
822 if (!PyArg_ParseTuple(_args
, "O&O&h",
823 PyMac_GetOSType
, &fileCreator
,
824 PyMac_GetOSType
, &fileType
,
827 _err
= SetWindowProxyCreatorAndType(_self
->ob_itself
,
831 if (_err
!= noErr
) return PyMac_Error(_err
);
837 static PyObject
*WinObj_GetWindowProxyIcon(WindowObject
*_self
, PyObject
*_args
)
839 PyObject
*_res
= NULL
;
842 if (!PyArg_ParseTuple(_args
, ""))
844 _err
= GetWindowProxyIcon(_self
->ob_itself
,
846 if (_err
!= noErr
) return PyMac_Error(_err
);
847 _res
= Py_BuildValue("O&",
848 ResObj_New
, outIcon
);
852 static PyObject
*WinObj_SetWindowProxyIcon(WindowObject
*_self
, PyObject
*_args
)
854 PyObject
*_res
= NULL
;
857 if (!PyArg_ParseTuple(_args
, "O&",
858 ResObj_Convert
, &icon
))
860 _err
= SetWindowProxyIcon(_self
->ob_itself
,
862 if (_err
!= noErr
) return PyMac_Error(_err
);
868 static PyObject
*WinObj_RemoveWindowProxy(WindowObject
*_self
, PyObject
*_args
)
870 PyObject
*_res
= NULL
;
872 if (!PyArg_ParseTuple(_args
, ""))
874 _err
= RemoveWindowProxy(_self
->ob_itself
);
875 if (_err
!= noErr
) return PyMac_Error(_err
);
881 static PyObject
*WinObj_BeginWindowProxyDrag(WindowObject
*_self
, PyObject
*_args
)
883 PyObject
*_res
= NULL
;
885 DragReference outNewDrag
;
886 RgnHandle outDragOutlineRgn
;
887 if (!PyArg_ParseTuple(_args
, "O&",
888 ResObj_Convert
, &outDragOutlineRgn
))
890 _err
= BeginWindowProxyDrag(_self
->ob_itself
,
893 if (_err
!= noErr
) return PyMac_Error(_err
);
894 _res
= Py_BuildValue("O&",
895 DragObj_New
, outNewDrag
);
899 static PyObject
*WinObj_EndWindowProxyDrag(WindowObject
*_self
, PyObject
*_args
)
901 PyObject
*_res
= NULL
;
903 DragReference theDrag
;
904 if (!PyArg_ParseTuple(_args
, "O&",
905 DragObj_Convert
, &theDrag
))
907 _err
= EndWindowProxyDrag(_self
->ob_itself
,
909 if (_err
!= noErr
) return PyMac_Error(_err
);
915 static PyObject
*WinObj_TrackWindowProxyFromExistingDrag(WindowObject
*_self
, PyObject
*_args
)
917 PyObject
*_res
= NULL
;
921 RgnHandle inDragOutlineRgn
;
922 if (!PyArg_ParseTuple(_args
, "O&O&O&",
923 PyMac_GetPoint
, &startPt
,
924 DragObj_Convert
, &drag
,
925 ResObj_Convert
, &inDragOutlineRgn
))
927 _err
= TrackWindowProxyFromExistingDrag(_self
->ob_itself
,
931 if (_err
!= noErr
) return PyMac_Error(_err
);
937 static PyObject
*WinObj_TrackWindowProxyDrag(WindowObject
*_self
, PyObject
*_args
)
939 PyObject
*_res
= NULL
;
942 if (!PyArg_ParseTuple(_args
, "O&",
943 PyMac_GetPoint
, &startPt
))
945 _err
= TrackWindowProxyDrag(_self
->ob_itself
,
947 if (_err
!= noErr
) return PyMac_Error(_err
);
953 static PyObject
*WinObj_IsWindowModified(WindowObject
*_self
, PyObject
*_args
)
955 PyObject
*_res
= NULL
;
957 if (!PyArg_ParseTuple(_args
, ""))
959 _rv
= IsWindowModified(_self
->ob_itself
);
960 _res
= Py_BuildValue("b",
965 static PyObject
*WinObj_SetWindowModified(WindowObject
*_self
, PyObject
*_args
)
967 PyObject
*_res
= NULL
;
970 if (!PyArg_ParseTuple(_args
, "b",
973 _err
= SetWindowModified(_self
->ob_itself
,
975 if (_err
!= noErr
) return PyMac_Error(_err
);
981 static PyObject
*WinObj_IsWindowPathSelectClick(WindowObject
*_self
, PyObject
*_args
)
983 PyObject
*_res
= NULL
;
986 if (!PyArg_ParseTuple(_args
, "O&",
987 PyMac_GetEventRecord
, &event
))
989 _rv
= IsWindowPathSelectClick(_self
->ob_itself
,
991 _res
= Py_BuildValue("b",
996 static PyObject
*WinObj_WindowPathSelect(WindowObject
*_self
, PyObject
*_args
)
998 PyObject
*_res
= NULL
;
1001 SInt32 outMenuResult
;
1002 if (!PyArg_ParseTuple(_args
, "O&",
1003 MenuObj_Convert
, &menu
))
1005 _err
= WindowPathSelect(_self
->ob_itself
,
1008 if (_err
!= noErr
) return PyMac_Error(_err
);
1009 _res
= Py_BuildValue("l",
1014 static PyObject
*WinObj_HiliteWindowFrameForDrag(WindowObject
*_self
, PyObject
*_args
)
1016 PyObject
*_res
= NULL
;
1019 if (!PyArg_ParseTuple(_args
, "b",
1022 _err
= HiliteWindowFrameForDrag(_self
->ob_itself
,
1024 if (_err
!= noErr
) return PyMac_Error(_err
);
1030 static PyObject
*WinObj_TransitionWindow(WindowObject
*_self
, PyObject
*_args
)
1032 PyObject
*_res
= NULL
;
1034 WindowTransitionEffect effect
;
1035 WindowTransitionAction action
;
1037 if (!PyArg_ParseTuple(_args
, "llO&",
1040 PyMac_GetRect
, &rect
))
1042 _err
= TransitionWindow(_self
->ob_itself
,
1046 if (_err
!= noErr
) return PyMac_Error(_err
);
1052 static PyObject
*WinObj_MacMoveWindow(WindowObject
*_self
, PyObject
*_args
)
1054 PyObject
*_res
= NULL
;
1058 if (!PyArg_ParseTuple(_args
, "hhb",
1063 MacMoveWindow(_self
->ob_itself
,
1072 static PyObject
*WinObj_SizeWindow(WindowObject
*_self
, PyObject
*_args
)
1074 PyObject
*_res
= NULL
;
1078 if (!PyArg_ParseTuple(_args
, "hhb",
1083 SizeWindow(_self
->ob_itself
,
1092 static PyObject
*WinObj_GrowWindow(WindowObject
*_self
, PyObject
*_args
)
1094 PyObject
*_res
= NULL
;
1098 if (!PyArg_ParseTuple(_args
, "O&O&",
1099 PyMac_GetPoint
, &startPt
,
1100 PyMac_GetRect
, &bBox
))
1102 _rv
= GrowWindow(_self
->ob_itself
,
1105 _res
= Py_BuildValue("l",
1110 static PyObject
*WinObj_DragWindow(WindowObject
*_self
, PyObject
*_args
)
1112 PyObject
*_res
= NULL
;
1115 if (!PyArg_ParseTuple(_args
, "O&O&",
1116 PyMac_GetPoint
, &startPt
,
1117 PyMac_GetRect
, &boundsRect
))
1119 DragWindow(_self
->ob_itself
,
1127 static PyObject
*WinObj_ZoomWindow(WindowObject
*_self
, PyObject
*_args
)
1129 PyObject
*_res
= NULL
;
1130 WindowPartCode partCode
;
1132 if (!PyArg_ParseTuple(_args
, "hb",
1136 ZoomWindow(_self
->ob_itself
,
1144 static PyObject
*WinObj_IsWindowCollapsable(WindowObject
*_self
, PyObject
*_args
)
1146 PyObject
*_res
= NULL
;
1148 if (!PyArg_ParseTuple(_args
, ""))
1150 _rv
= IsWindowCollapsable(_self
->ob_itself
);
1151 _res
= Py_BuildValue("b",
1156 static PyObject
*WinObj_IsWindowCollapsed(WindowObject
*_self
, PyObject
*_args
)
1158 PyObject
*_res
= NULL
;
1160 if (!PyArg_ParseTuple(_args
, ""))
1162 _rv
= IsWindowCollapsed(_self
->ob_itself
);
1163 _res
= Py_BuildValue("b",
1168 static PyObject
*WinObj_CollapseWindow(WindowObject
*_self
, PyObject
*_args
)
1170 PyObject
*_res
= NULL
;
1173 if (!PyArg_ParseTuple(_args
, "b",
1176 _err
= CollapseWindow(_self
->ob_itself
,
1178 if (_err
!= noErr
) return PyMac_Error(_err
);
1184 static PyObject
*WinObj_GetWindowBounds(WindowObject
*_self
, PyObject
*_args
)
1186 PyObject
*_res
= NULL
;
1188 WindowRegionCode regionCode
;
1190 if (!PyArg_ParseTuple(_args
, "H",
1193 _err
= GetWindowBounds(_self
->ob_itself
,
1196 if (_err
!= noErr
) return PyMac_Error(_err
);
1197 _res
= Py_BuildValue("O&",
1198 PyMac_BuildRect
, &globalBounds
);
1202 static PyObject
*WinObj_ResizeWindow(WindowObject
*_self
, PyObject
*_args
)
1204 PyObject
*_res
= NULL
;
1207 Rect sizeConstraints
;
1208 Rect newContentRect
;
1209 if (!PyArg_ParseTuple(_args
, "O&O&",
1210 PyMac_GetPoint
, &startPoint
,
1211 PyMac_GetRect
, &sizeConstraints
))
1213 _rv
= ResizeWindow(_self
->ob_itself
,
1217 _res
= Py_BuildValue("bO&",
1219 PyMac_BuildRect
, &newContentRect
);
1223 static PyObject
*WinObj_SetWindowBounds(WindowObject
*_self
, PyObject
*_args
)
1225 PyObject
*_res
= NULL
;
1227 WindowRegionCode regionCode
;
1229 if (!PyArg_ParseTuple(_args
, "HO&",
1231 PyMac_GetRect
, &globalBounds
))
1233 _err
= SetWindowBounds(_self
->ob_itself
,
1236 if (_err
!= noErr
) return PyMac_Error(_err
);
1242 static PyObject
*WinObj_RepositionWindow(WindowObject
*_self
, PyObject
*_args
)
1244 PyObject
*_res
= NULL
;
1246 WindowPtr parentWindow
;
1247 WindowPositionMethod method
;
1248 if (!PyArg_ParseTuple(_args
, "O&l",
1249 WinObj_Convert
, &parentWindow
,
1252 _err
= RepositionWindow(_self
->ob_itself
,
1255 if (_err
!= noErr
) return PyMac_Error(_err
);
1261 static PyObject
*WinObj_MoveWindowStructure(WindowObject
*_self
, PyObject
*_args
)
1263 PyObject
*_res
= NULL
;
1267 if (!PyArg_ParseTuple(_args
, "hh",
1271 _err
= MoveWindowStructure(_self
->ob_itself
,
1274 if (_err
!= noErr
) return PyMac_Error(_err
);
1280 static PyObject
*WinObj_IsWindowInStandardState(WindowObject
*_self
, PyObject
*_args
)
1282 PyObject
*_res
= NULL
;
1285 Rect idealStandardState
;
1286 if (!PyArg_ParseTuple(_args
, ""))
1288 _rv
= IsWindowInStandardState(_self
->ob_itself
,
1290 &idealStandardState
);
1291 _res
= Py_BuildValue("bO&O&",
1293 PyMac_BuildPoint
, idealSize
,
1294 PyMac_BuildRect
, &idealStandardState
);
1298 static PyObject
*WinObj_ZoomWindowIdeal(WindowObject
*_self
, PyObject
*_args
)
1300 PyObject
*_res
= NULL
;
1302 WindowPartCode partCode
;
1304 if (!PyArg_ParseTuple(_args
, "h",
1307 _err
= ZoomWindowIdeal(_self
->ob_itself
,
1310 if (_err
!= noErr
) return PyMac_Error(_err
);
1311 _res
= Py_BuildValue("O&",
1312 PyMac_BuildPoint
, ioIdealSize
);
1316 static PyObject
*WinObj_GetWindowIdealUserState(WindowObject
*_self
, PyObject
*_args
)
1318 PyObject
*_res
= NULL
;
1321 if (!PyArg_ParseTuple(_args
, ""))
1323 _err
= GetWindowIdealUserState(_self
->ob_itself
,
1325 if (_err
!= noErr
) return PyMac_Error(_err
);
1326 _res
= Py_BuildValue("O&",
1327 PyMac_BuildRect
, &userState
);
1331 static PyObject
*WinObj_SetWindowIdealUserState(WindowObject
*_self
, PyObject
*_args
)
1333 PyObject
*_res
= NULL
;
1336 if (!PyArg_ParseTuple(_args
, ""))
1338 _err
= SetWindowIdealUserState(_self
->ob_itself
,
1340 if (_err
!= noErr
) return PyMac_Error(_err
);
1341 _res
= Py_BuildValue("O&",
1342 PyMac_BuildRect
, &userState
);
1346 static PyObject
*WinObj_HideWindow(WindowObject
*_self
, PyObject
*_args
)
1348 PyObject
*_res
= NULL
;
1349 if (!PyArg_ParseTuple(_args
, ""))
1351 HideWindow(_self
->ob_itself
);
1357 static PyObject
*WinObj_MacShowWindow(WindowObject
*_self
, PyObject
*_args
)
1359 PyObject
*_res
= NULL
;
1360 if (!PyArg_ParseTuple(_args
, ""))
1362 MacShowWindow(_self
->ob_itself
);
1368 static PyObject
*WinObj_ShowHide(WindowObject
*_self
, PyObject
*_args
)
1370 PyObject
*_res
= NULL
;
1372 if (!PyArg_ParseTuple(_args
, "b",
1375 ShowHide(_self
->ob_itself
,
1382 #if TARGET_API_MAC_CARBON
1384 static PyObject
*WinObj_GetWindowPropertyAttributes(WindowObject
*_self
, PyObject
*_args
)
1386 PyObject
*_res
= NULL
;
1388 OSType propertyCreator
;
1391 if (!PyArg_ParseTuple(_args
, "O&O&",
1392 PyMac_GetOSType
, &propertyCreator
,
1393 PyMac_GetOSType
, &propertyTag
))
1395 _err
= GetWindowPropertyAttributes(_self
->ob_itself
,
1399 if (_err
!= noErr
) return PyMac_Error(_err
);
1400 _res
= Py_BuildValue("l",
1406 #if TARGET_API_MAC_CARBON
1408 static PyObject
*WinObj_ChangeWindowPropertyAttributes(WindowObject
*_self
, PyObject
*_args
)
1410 PyObject
*_res
= NULL
;
1412 OSType propertyCreator
;
1414 UInt32 attributesToSet
;
1415 UInt32 attributesToClear
;
1416 if (!PyArg_ParseTuple(_args
, "O&O&ll",
1417 PyMac_GetOSType
, &propertyCreator
,
1418 PyMac_GetOSType
, &propertyTag
,
1420 &attributesToClear
))
1422 _err
= ChangeWindowPropertyAttributes(_self
->ob_itself
,
1427 if (_err
!= noErr
) return PyMac_Error(_err
);
1434 static PyObject
*WinObj_TrackBox(WindowObject
*_self
, PyObject
*_args
)
1436 PyObject
*_res
= NULL
;
1439 WindowPartCode partCode
;
1440 if (!PyArg_ParseTuple(_args
, "O&h",
1441 PyMac_GetPoint
, &thePt
,
1444 _rv
= TrackBox(_self
->ob_itself
,
1447 _res
= Py_BuildValue("b",
1452 static PyObject
*WinObj_TrackGoAway(WindowObject
*_self
, PyObject
*_args
)
1454 PyObject
*_res
= NULL
;
1457 if (!PyArg_ParseTuple(_args
, "O&",
1458 PyMac_GetPoint
, &thePt
))
1460 _rv
= TrackGoAway(_self
->ob_itself
,
1462 _res
= Py_BuildValue("b",
1467 #if !TARGET_API_MAC_CARBON
1469 static PyObject
*WinObj_GetAuxWin(WindowObject
*_self
, PyObject
*_args
)
1471 PyObject
*_res
= NULL
;
1473 AuxWinHandle awHndl
;
1474 if (!PyArg_ParseTuple(_args
, ""))
1476 _rv
= GetAuxWin(_self
->ob_itself
,
1478 _res
= Py_BuildValue("bO&",
1480 ResObj_New
, awHndl
);
1485 #if !TARGET_API_MAC_CARBON
1487 static PyObject
*WinObj_GetWindowGoAwayFlag(WindowObject
*_self
, PyObject
*_args
)
1489 PyObject
*_res
= NULL
;
1491 if (!PyArg_ParseTuple(_args
, ""))
1493 _rv
= GetWindowGoAwayFlag(_self
->ob_itself
);
1494 _res
= Py_BuildValue("b",
1500 #if !TARGET_API_MAC_CARBON
1502 static PyObject
*WinObj_GetWindowSpareFlag(WindowObject
*_self
, PyObject
*_args
)
1504 PyObject
*_res
= NULL
;
1506 if (!PyArg_ParseTuple(_args
, ""))
1508 _rv
= GetWindowSpareFlag(_self
->ob_itself
);
1509 _res
= Py_BuildValue("b",
1515 static PyObject
*WinObj_GetWindowPort(WindowObject
*_self
, PyObject
*_args
)
1517 PyObject
*_res
= NULL
;
1519 if (!PyArg_ParseTuple(_args
, ""))
1521 _rv
= GetWindowPort(_self
->ob_itself
);
1522 _res
= Py_BuildValue("O&",
1527 static PyObject
*WinObj_GetWindowKind(WindowObject
*_self
, PyObject
*_args
)
1529 PyObject
*_res
= NULL
;
1531 if (!PyArg_ParseTuple(_args
, ""))
1533 _rv
= GetWindowKind(_self
->ob_itself
);
1534 _res
= Py_BuildValue("h",
1539 static PyObject
*WinObj_MacIsWindowVisible(WindowObject
*_self
, PyObject
*_args
)
1541 PyObject
*_res
= NULL
;
1543 if (!PyArg_ParseTuple(_args
, ""))
1545 _rv
= MacIsWindowVisible(_self
->ob_itself
);
1546 _res
= Py_BuildValue("b",
1551 static PyObject
*WinObj_IsWindowHilited(WindowObject
*_self
, PyObject
*_args
)
1553 PyObject
*_res
= NULL
;
1555 if (!PyArg_ParseTuple(_args
, ""))
1557 _rv
= IsWindowHilited(_self
->ob_itself
);
1558 _res
= Py_BuildValue("b",
1563 #if TARGET_API_MAC_CARBON
1565 static PyObject
*WinObj_IsWindowUpdatePending(WindowObject
*_self
, PyObject
*_args
)
1567 PyObject
*_res
= NULL
;
1569 if (!PyArg_ParseTuple(_args
, ""))
1571 _rv
= IsWindowUpdatePending(_self
->ob_itself
);
1572 _res
= Py_BuildValue("b",
1578 static PyObject
*WinObj_MacGetNextWindow(WindowObject
*_self
, PyObject
*_args
)
1580 PyObject
*_res
= NULL
;
1582 if (!PyArg_ParseTuple(_args
, ""))
1584 _rv
= MacGetNextWindow(_self
->ob_itself
);
1585 _res
= Py_BuildValue("O&",
1590 static PyObject
*WinObj_GetWindowStandardState(WindowObject
*_self
, PyObject
*_args
)
1592 PyObject
*_res
= NULL
;
1594 if (!PyArg_ParseTuple(_args
, ""))
1596 GetWindowStandardState(_self
->ob_itself
,
1598 _res
= Py_BuildValue("O&",
1599 PyMac_BuildRect
, &rect
);
1603 static PyObject
*WinObj_GetWindowUserState(WindowObject
*_self
, PyObject
*_args
)
1605 PyObject
*_res
= NULL
;
1607 if (!PyArg_ParseTuple(_args
, ""))
1609 GetWindowUserState(_self
->ob_itself
,
1611 _res
= Py_BuildValue("O&",
1612 PyMac_BuildRect
, &rect
);
1616 static PyObject
*WinObj_SetWindowKind(WindowObject
*_self
, PyObject
*_args
)
1618 PyObject
*_res
= NULL
;
1620 if (!PyArg_ParseTuple(_args
, "h",
1623 SetWindowKind(_self
->ob_itself
,
1630 static PyObject
*WinObj_SetWindowStandardState(WindowObject
*_self
, PyObject
*_args
)
1632 PyObject
*_res
= NULL
;
1634 if (!PyArg_ParseTuple(_args
, "O&",
1635 PyMac_GetRect
, &rect
))
1637 SetWindowStandardState(_self
->ob_itself
,
1644 static PyObject
*WinObj_SetWindowUserState(WindowObject
*_self
, PyObject
*_args
)
1646 PyObject
*_res
= NULL
;
1648 if (!PyArg_ParseTuple(_args
, "O&",
1649 PyMac_GetRect
, &rect
))
1651 SetWindowUserState(_self
->ob_itself
,
1658 static PyObject
*WinObj_SetPortWindowPort(WindowObject
*_self
, PyObject
*_args
)
1660 PyObject
*_res
= NULL
;
1661 if (!PyArg_ParseTuple(_args
, ""))
1663 SetPortWindowPort(_self
->ob_itself
);
1669 static PyObject
*WinObj_GetWindowPortBounds(WindowObject
*_self
, PyObject
*_args
)
1671 PyObject
*_res
= NULL
;
1673 if (!PyArg_ParseTuple(_args
, ""))
1675 GetWindowPortBounds(_self
->ob_itself
,
1677 _res
= Py_BuildValue("O&",
1678 PyMac_BuildRect
, &bounds
);
1682 static PyObject
*WinObj_IsWindowVisible(WindowObject
*_self
, PyObject
*_args
)
1684 PyObject
*_res
= NULL
;
1686 if (!PyArg_ParseTuple(_args
, ""))
1688 _rv
= IsWindowVisible(_self
->ob_itself
);
1689 _res
= Py_BuildValue("b",
1694 #if !TARGET_API_MAC_CARBON
1696 static PyObject
*WinObj_GetWindowZoomFlag(WindowObject
*_self
, PyObject
*_args
)
1698 PyObject
*_res
= NULL
;
1700 if (!PyArg_ParseTuple(_args
, ""))
1702 _rv
= GetWindowZoomFlag(_self
->ob_itself
);
1703 _res
= Py_BuildValue("b",
1709 static PyObject
*WinObj_GetWindowStructureRgn(WindowObject
*_self
, PyObject
*_args
)
1711 PyObject
*_res
= NULL
;
1713 if (!PyArg_ParseTuple(_args
, "O&",
1714 ResObj_Convert
, &r
))
1716 GetWindowStructureRgn(_self
->ob_itself
,
1723 static PyObject
*WinObj_GetWindowContentRgn(WindowObject
*_self
, PyObject
*_args
)
1725 PyObject
*_res
= NULL
;
1727 if (!PyArg_ParseTuple(_args
, "O&",
1728 ResObj_Convert
, &r
))
1730 GetWindowContentRgn(_self
->ob_itself
,
1737 static PyObject
*WinObj_GetWindowUpdateRgn(WindowObject
*_self
, PyObject
*_args
)
1739 PyObject
*_res
= NULL
;
1741 if (!PyArg_ParseTuple(_args
, "O&",
1742 ResObj_Convert
, &r
))
1744 GetWindowUpdateRgn(_self
->ob_itself
,
1751 #if !TARGET_API_MAC_CARBON
1753 static PyObject
*WinObj_GetWindowTitleWidth(WindowObject
*_self
, PyObject
*_args
)
1755 PyObject
*_res
= NULL
;
1757 if (!PyArg_ParseTuple(_args
, ""))
1759 _rv
= GetWindowTitleWidth(_self
->ob_itself
);
1760 _res
= Py_BuildValue("h",
1766 static PyObject
*WinObj_GetNextWindow(WindowObject
*_self
, PyObject
*_args
)
1768 PyObject
*_res
= NULL
;
1770 if (!PyArg_ParseTuple(_args
, ""))
1772 _rv
= GetNextWindow(_self
->ob_itself
);
1773 _res
= Py_BuildValue("O&",
1774 WinObj_WhichWindow
, _rv
);
1778 #if !TARGET_API_MAC_CARBON
1780 static PyObject
*WinObj_CloseWindow(WindowObject
*_self
, PyObject
*_args
)
1782 PyObject
*_res
= NULL
;
1783 if (!PyArg_ParseTuple(_args
, ""))
1785 CloseWindow(_self
->ob_itself
);
1792 static PyObject
*WinObj_MoveWindow(WindowObject
*_self
, PyObject
*_args
)
1794 PyObject
*_res
= NULL
;
1798 if (!PyArg_ParseTuple(_args
, "hhb",
1803 MoveWindow(_self
->ob_itself
,
1812 static PyObject
*WinObj_ShowWindow(WindowObject
*_self
, PyObject
*_args
)
1814 PyObject
*_res
= NULL
;
1815 if (!PyArg_ParseTuple(_args
, ""))
1817 ShowWindow(_self
->ob_itself
);
1823 static PyMethodDef WinObj_methods
[] = {
1824 {"GetWindowOwnerCount", (PyCFunction
)WinObj_GetWindowOwnerCount
, 1,
1825 "() -> (UInt32 outCount)"},
1826 {"CloneWindow", (PyCFunction
)WinObj_CloneWindow
, 1,
1829 #if TARGET_API_MAC_CARBON
1830 {"ReshapeCustomWindow", (PyCFunction
)WinObj_ReshapeCustomWindow
, 1,
1833 {"GetWindowClass", (PyCFunction
)WinObj_GetWindowClass
, 1,
1834 "() -> (WindowClass outClass)"},
1835 {"GetWindowAttributes", (PyCFunction
)WinObj_GetWindowAttributes
, 1,
1836 "() -> (WindowAttributes outAttributes)"},
1838 #if TARGET_API_MAC_CARBON
1839 {"ChangeWindowAttributes", (PyCFunction
)WinObj_ChangeWindowAttributes
, 1,
1840 "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"},
1843 #if !TARGET_API_MAC_CARBON
1844 {"SetWinColor", (PyCFunction
)WinObj_SetWinColor
, 1,
1845 "(WCTabHandle newColorTable) -> None"},
1847 {"SetWindowContentColor", (PyCFunction
)WinObj_SetWindowContentColor
, 1,
1848 "(RGBColor color) -> None"},
1849 {"GetWindowContentColor", (PyCFunction
)WinObj_GetWindowContentColor
, 1,
1850 "() -> (RGBColor color)"},
1851 {"GetWindowContentPattern", (PyCFunction
)WinObj_GetWindowContentPattern
, 1,
1852 "(PixPatHandle outPixPat) -> None"},
1853 {"SetWindowContentPattern", (PyCFunction
)WinObj_SetWindowContentPattern
, 1,
1854 "(PixPatHandle pixPat) -> None"},
1856 #if TARGET_API_MAC_CARBON
1857 {"ScrollWindowRect", (PyCFunction
)WinObj_ScrollWindowRect
, 1,
1858 "(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
1861 #if TARGET_API_MAC_CARBON
1862 {"ScrollWindowRegion", (PyCFunction
)WinObj_ScrollWindowRegion
, 1,
1863 "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
1865 {"ClipAbove", (PyCFunction
)WinObj_ClipAbove
, 1,
1868 #if !TARGET_API_MAC_CARBON
1869 {"SaveOld", (PyCFunction
)WinObj_SaveOld
, 1,
1873 #if !TARGET_API_MAC_CARBON
1874 {"DrawNew", (PyCFunction
)WinObj_DrawNew
, 1,
1875 "(Boolean update) -> None"},
1877 {"PaintOne", (PyCFunction
)WinObj_PaintOne
, 1,
1878 "(RgnHandle clobberedRgn) -> None"},
1879 {"PaintBehind", (PyCFunction
)WinObj_PaintBehind
, 1,
1880 "(RgnHandle clobberedRgn) -> None"},
1881 {"CalcVis", (PyCFunction
)WinObj_CalcVis
, 1,
1883 {"CalcVisBehind", (PyCFunction
)WinObj_CalcVisBehind
, 1,
1884 "(RgnHandle clobberedRgn) -> None"},
1885 {"BringToFront", (PyCFunction
)WinObj_BringToFront
, 1,
1887 {"SendBehind", (PyCFunction
)WinObj_SendBehind
, 1,
1888 "(WindowPtr behindWindow) -> None"},
1889 {"SelectWindow", (PyCFunction
)WinObj_SelectWindow
, 1,
1892 #if TARGET_API_MAC_CARBON
1893 {"GetNextWindowOfClass", (PyCFunction
)WinObj_GetNextWindowOfClass
, 1,
1894 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
1897 #if !TARGET_API_MAC_CARBON
1898 {"IsValidWindowPtr", (PyCFunction
)WinObj_IsValidWindowPtr
, 1,
1899 "() -> (Boolean _rv)"},
1901 {"HiliteWindow", (PyCFunction
)WinObj_HiliteWindow
, 1,
1902 "(Boolean fHilite) -> None"},
1903 {"SetWRefCon", (PyCFunction
)WinObj_SetWRefCon
, 1,
1904 "(long data) -> None"},
1905 {"GetWRefCon", (PyCFunction
)WinObj_GetWRefCon
, 1,
1906 "() -> (long _rv)"},
1907 {"SetWindowPic", (PyCFunction
)WinObj_SetWindowPic
, 1,
1908 "(PicHandle pic) -> None"},
1909 {"GetWindowPic", (PyCFunction
)WinObj_GetWindowPic
, 1,
1910 "() -> (PicHandle _rv)"},
1911 {"GetWVariant", (PyCFunction
)WinObj_GetWVariant
, 1,
1912 "() -> (short _rv)"},
1913 {"GetWindowFeatures", (PyCFunction
)WinObj_GetWindowFeatures
, 1,
1914 "() -> (UInt32 outFeatures)"},
1915 {"GetWindowRegion", (PyCFunction
)WinObj_GetWindowRegion
, 1,
1916 "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"},
1917 {"BeginUpdate", (PyCFunction
)WinObj_BeginUpdate
, 1,
1919 {"EndUpdate", (PyCFunction
)WinObj_EndUpdate
, 1,
1921 {"InvalWindowRgn", (PyCFunction
)WinObj_InvalWindowRgn
, 1,
1922 "(RgnHandle region) -> None"},
1923 {"InvalWindowRect", (PyCFunction
)WinObj_InvalWindowRect
, 1,
1924 "(Rect bounds) -> None"},
1925 {"ValidWindowRgn", (PyCFunction
)WinObj_ValidWindowRgn
, 1,
1926 "(RgnHandle region) -> None"},
1927 {"ValidWindowRect", (PyCFunction
)WinObj_ValidWindowRect
, 1,
1928 "(Rect bounds) -> None"},
1929 {"DrawGrowIcon", (PyCFunction
)WinObj_DrawGrowIcon
, 1,
1931 {"SetWTitle", (PyCFunction
)WinObj_SetWTitle
, 1,
1932 "(Str255 title) -> None"},
1933 {"GetWTitle", (PyCFunction
)WinObj_GetWTitle
, 1,
1934 "() -> (Str255 title)"},
1935 {"SetWindowProxyFSSpec", (PyCFunction
)WinObj_SetWindowProxyFSSpec
, 1,
1936 "(FSSpec inFile) -> None"},
1937 {"GetWindowProxyFSSpec", (PyCFunction
)WinObj_GetWindowProxyFSSpec
, 1,
1938 "() -> (FSSpec outFile)"},
1939 {"SetWindowProxyAlias", (PyCFunction
)WinObj_SetWindowProxyAlias
, 1,
1940 "(AliasHandle alias) -> None"},
1941 {"GetWindowProxyAlias", (PyCFunction
)WinObj_GetWindowProxyAlias
, 1,
1942 "() -> (AliasHandle alias)"},
1943 {"SetWindowProxyCreatorAndType", (PyCFunction
)WinObj_SetWindowProxyCreatorAndType
, 1,
1944 "(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None"},
1945 {"GetWindowProxyIcon", (PyCFunction
)WinObj_GetWindowProxyIcon
, 1,
1946 "() -> (IconRef outIcon)"},
1947 {"SetWindowProxyIcon", (PyCFunction
)WinObj_SetWindowProxyIcon
, 1,
1948 "(IconRef icon) -> None"},
1949 {"RemoveWindowProxy", (PyCFunction
)WinObj_RemoveWindowProxy
, 1,
1951 {"BeginWindowProxyDrag", (PyCFunction
)WinObj_BeginWindowProxyDrag
, 1,
1952 "(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)"},
1953 {"EndWindowProxyDrag", (PyCFunction
)WinObj_EndWindowProxyDrag
, 1,
1954 "(DragReference theDrag) -> None"},
1955 {"TrackWindowProxyFromExistingDrag", (PyCFunction
)WinObj_TrackWindowProxyFromExistingDrag
, 1,
1956 "(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None"},
1957 {"TrackWindowProxyDrag", (PyCFunction
)WinObj_TrackWindowProxyDrag
, 1,
1958 "(Point startPt) -> None"},
1959 {"IsWindowModified", (PyCFunction
)WinObj_IsWindowModified
, 1,
1960 "() -> (Boolean _rv)"},
1961 {"SetWindowModified", (PyCFunction
)WinObj_SetWindowModified
, 1,
1962 "(Boolean modified) -> None"},
1963 {"IsWindowPathSelectClick", (PyCFunction
)WinObj_IsWindowPathSelectClick
, 1,
1964 "(EventRecord event) -> (Boolean _rv)"},
1965 {"WindowPathSelect", (PyCFunction
)WinObj_WindowPathSelect
, 1,
1966 "(MenuHandle menu) -> (SInt32 outMenuResult)"},
1967 {"HiliteWindowFrameForDrag", (PyCFunction
)WinObj_HiliteWindowFrameForDrag
, 1,
1968 "(Boolean hilited) -> None"},
1969 {"TransitionWindow", (PyCFunction
)WinObj_TransitionWindow
, 1,
1970 "(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"},
1971 {"MacMoveWindow", (PyCFunction
)WinObj_MacMoveWindow
, 1,
1972 "(short hGlobal, short vGlobal, Boolean front) -> None"},
1973 {"SizeWindow", (PyCFunction
)WinObj_SizeWindow
, 1,
1974 "(short w, short h, Boolean fUpdate) -> None"},
1975 {"GrowWindow", (PyCFunction
)WinObj_GrowWindow
, 1,
1976 "(Point startPt, Rect bBox) -> (long _rv)"},
1977 {"DragWindow", (PyCFunction
)WinObj_DragWindow
, 1,
1978 "(Point startPt, Rect boundsRect) -> None"},
1979 {"ZoomWindow", (PyCFunction
)WinObj_ZoomWindow
, 1,
1980 "(WindowPartCode partCode, Boolean front) -> None"},
1981 {"IsWindowCollapsable", (PyCFunction
)WinObj_IsWindowCollapsable
, 1,
1982 "() -> (Boolean _rv)"},
1983 {"IsWindowCollapsed", (PyCFunction
)WinObj_IsWindowCollapsed
, 1,
1984 "() -> (Boolean _rv)"},
1985 {"CollapseWindow", (PyCFunction
)WinObj_CollapseWindow
, 1,
1986 "(Boolean collapse) -> None"},
1987 {"GetWindowBounds", (PyCFunction
)WinObj_GetWindowBounds
, 1,
1988 "(WindowRegionCode regionCode) -> (Rect globalBounds)"},
1989 {"ResizeWindow", (PyCFunction
)WinObj_ResizeWindow
, 1,
1990 "(Point startPoint, Rect sizeConstraints) -> (Boolean _rv, Rect newContentRect)"},
1991 {"SetWindowBounds", (PyCFunction
)WinObj_SetWindowBounds
, 1,
1992 "(WindowRegionCode regionCode, Rect globalBounds) -> None"},
1993 {"RepositionWindow", (PyCFunction
)WinObj_RepositionWindow
, 1,
1994 "(WindowPtr parentWindow, WindowPositionMethod method) -> None"},
1995 {"MoveWindowStructure", (PyCFunction
)WinObj_MoveWindowStructure
, 1,
1996 "(short hGlobal, short vGlobal) -> None"},
1997 {"IsWindowInStandardState", (PyCFunction
)WinObj_IsWindowInStandardState
, 1,
1998 "() -> (Boolean _rv, Point idealSize, Rect idealStandardState)"},
1999 {"ZoomWindowIdeal", (PyCFunction
)WinObj_ZoomWindowIdeal
, 1,
2000 "(WindowPartCode partCode) -> (Point ioIdealSize)"},
2001 {"GetWindowIdealUserState", (PyCFunction
)WinObj_GetWindowIdealUserState
, 1,
2002 "() -> (Rect userState)"},
2003 {"SetWindowIdealUserState", (PyCFunction
)WinObj_SetWindowIdealUserState
, 1,
2004 "() -> (Rect userState)"},
2005 {"HideWindow", (PyCFunction
)WinObj_HideWindow
, 1,
2007 {"MacShowWindow", (PyCFunction
)WinObj_MacShowWindow
, 1,
2009 {"ShowHide", (PyCFunction
)WinObj_ShowHide
, 1,
2010 "(Boolean showFlag) -> None"},
2012 #if TARGET_API_MAC_CARBON
2013 {"GetWindowPropertyAttributes", (PyCFunction
)WinObj_GetWindowPropertyAttributes
, 1,
2014 "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
2017 #if TARGET_API_MAC_CARBON
2018 {"ChangeWindowPropertyAttributes", (PyCFunction
)WinObj_ChangeWindowPropertyAttributes
, 1,
2019 "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
2021 {"TrackBox", (PyCFunction
)WinObj_TrackBox
, 1,
2022 "(Point thePt, WindowPartCode partCode) -> (Boolean _rv)"},
2023 {"TrackGoAway", (PyCFunction
)WinObj_TrackGoAway
, 1,
2024 "(Point thePt) -> (Boolean _rv)"},
2026 #if !TARGET_API_MAC_CARBON
2027 {"GetAuxWin", (PyCFunction
)WinObj_GetAuxWin
, 1,
2028 "() -> (Boolean _rv, AuxWinHandle awHndl)"},
2031 #if !TARGET_API_MAC_CARBON
2032 {"GetWindowGoAwayFlag", (PyCFunction
)WinObj_GetWindowGoAwayFlag
, 1,
2033 "() -> (Boolean _rv)"},
2036 #if !TARGET_API_MAC_CARBON
2037 {"GetWindowSpareFlag", (PyCFunction
)WinObj_GetWindowSpareFlag
, 1,
2038 "() -> (Boolean _rv)"},
2040 {"GetWindowPort", (PyCFunction
)WinObj_GetWindowPort
, 1,
2041 "() -> (CGrafPtr _rv)"},
2042 {"GetWindowKind", (PyCFunction
)WinObj_GetWindowKind
, 1,
2043 "() -> (short _rv)"},
2044 {"MacIsWindowVisible", (PyCFunction
)WinObj_MacIsWindowVisible
, 1,
2045 "() -> (Boolean _rv)"},
2046 {"IsWindowHilited", (PyCFunction
)WinObj_IsWindowHilited
, 1,
2047 "() -> (Boolean _rv)"},
2049 #if TARGET_API_MAC_CARBON
2050 {"IsWindowUpdatePending", (PyCFunction
)WinObj_IsWindowUpdatePending
, 1,
2051 "() -> (Boolean _rv)"},
2053 {"MacGetNextWindow", (PyCFunction
)WinObj_MacGetNextWindow
, 1,
2054 "() -> (WindowPtr _rv)"},
2055 {"GetWindowStandardState", (PyCFunction
)WinObj_GetWindowStandardState
, 1,
2056 "() -> (Rect rect)"},
2057 {"GetWindowUserState", (PyCFunction
)WinObj_GetWindowUserState
, 1,
2058 "() -> (Rect rect)"},
2059 {"SetWindowKind", (PyCFunction
)WinObj_SetWindowKind
, 1,
2060 "(short kind) -> None"},
2061 {"SetWindowStandardState", (PyCFunction
)WinObj_SetWindowStandardState
, 1,
2062 "(Rect rect) -> None"},
2063 {"SetWindowUserState", (PyCFunction
)WinObj_SetWindowUserState
, 1,
2064 "(Rect rect) -> None"},
2065 {"SetPortWindowPort", (PyCFunction
)WinObj_SetPortWindowPort
, 1,
2067 {"GetWindowPortBounds", (PyCFunction
)WinObj_GetWindowPortBounds
, 1,
2068 "() -> (Rect bounds)"},
2069 {"IsWindowVisible", (PyCFunction
)WinObj_IsWindowVisible
, 1,
2070 "() -> (Boolean _rv)"},
2072 #if !TARGET_API_MAC_CARBON
2073 {"GetWindowZoomFlag", (PyCFunction
)WinObj_GetWindowZoomFlag
, 1,
2074 "() -> (Boolean _rv)"},
2076 {"GetWindowStructureRgn", (PyCFunction
)WinObj_GetWindowStructureRgn
, 1,
2077 "(RgnHandle r) -> None"},
2078 {"GetWindowContentRgn", (PyCFunction
)WinObj_GetWindowContentRgn
, 1,
2079 "(RgnHandle r) -> None"},
2080 {"GetWindowUpdateRgn", (PyCFunction
)WinObj_GetWindowUpdateRgn
, 1,
2081 "(RgnHandle r) -> None"},
2083 #if !TARGET_API_MAC_CARBON
2084 {"GetWindowTitleWidth", (PyCFunction
)WinObj_GetWindowTitleWidth
, 1,
2085 "() -> (short _rv)"},
2087 {"GetNextWindow", (PyCFunction
)WinObj_GetNextWindow
, 1,
2088 "() -> (WindowPtr _rv)"},
2090 #if !TARGET_API_MAC_CARBON
2091 {"CloseWindow", (PyCFunction
)WinObj_CloseWindow
, 1,
2094 {"MoveWindow", (PyCFunction
)WinObj_MoveWindow
, 1,
2095 "(short hGlobal, short vGlobal, Boolean front) -> None"},
2096 {"ShowWindow", (PyCFunction
)WinObj_ShowWindow
, 1,
2101 PyMethodChain WinObj_chain
= { WinObj_methods
, NULL
};
2103 static PyObject
*WinObj_getattr(WindowObject
*self
, char *name
)
2105 return Py_FindMethodInChain(&WinObj_chain
, (PyObject
*)self
, name
);
2108 #define WinObj_setattr NULL
2110 static int WinObj_compare(WindowObject
*self
, WindowObject
*other
)
2112 if ( self
->ob_itself
> other
->ob_itself
) return 1;
2113 if ( self
->ob_itself
< other
->ob_itself
) return -1;
2117 static PyObject
* WinObj_repr(WindowObject
*self
)
2120 sprintf(buf
, "<Window object at 0x%08.8x for 0x%08.8x>", self
, self
->ob_itself
);
2121 return PyString_FromString(buf
);
2124 static int WinObj_hash(WindowObject
*self
)
2126 return (int)self
->ob_itself
;
2129 PyTypeObject Window_Type
= {
2130 PyObject_HEAD_INIT(&PyType_Type
)
2132 "Window", /*tp_name*/
2133 sizeof(WindowObject
), /*tp_basicsize*/
2136 (destructor
) WinObj_dealloc
, /*tp_dealloc*/
2138 (getattrfunc
) WinObj_getattr
, /*tp_getattr*/
2139 (setattrfunc
) WinObj_setattr
, /*tp_setattr*/
2140 (cmpfunc
) WinObj_compare
, /*tp_compare*/
2141 (reprfunc
) WinObj_repr
, /*tp_repr*/
2142 (PyNumberMethods
*)0, /* tp_as_number */
2143 (PySequenceMethods
*)0, /* tp_as_sequence */
2144 (PyMappingMethods
*)0, /* tp_as_mapping */
2145 (hashfunc
) WinObj_hash
, /*tp_hash*/
2148 /* --------------------- End object type Window --------------------- */
2151 static PyObject
*Win_GetNewCWindow(PyObject
*_self
, PyObject
*_args
)
2153 PyObject
*_res
= NULL
;
2157 if (!PyArg_ParseTuple(_args
, "hO&",
2159 WinObj_Convert
, &behind
))
2161 _rv
= GetNewCWindow(windowID
,
2164 _res
= Py_BuildValue("O&",
2169 static PyObject
*Win_NewWindow(PyObject
*_self
, PyObject
*_args
)
2171 PyObject
*_res
= NULL
;
2180 if (!PyArg_ParseTuple(_args
, "O&O&bhO&bl",
2181 PyMac_GetRect
, &boundsRect
,
2182 PyMac_GetStr255
, title
,
2185 WinObj_Convert
, &behind
,
2189 _rv
= NewWindow((void *)0,
2197 _res
= Py_BuildValue("O&",
2202 static PyObject
*Win_GetNewWindow(PyObject
*_self
, PyObject
*_args
)
2204 PyObject
*_res
= NULL
;
2208 if (!PyArg_ParseTuple(_args
, "hO&",
2210 WinObj_Convert
, &behind
))
2212 _rv
= GetNewWindow(windowID
,
2215 _res
= Py_BuildValue("O&",
2220 static PyObject
*Win_NewCWindow(PyObject
*_self
, PyObject
*_args
)
2222 PyObject
*_res
= NULL
;
2231 if (!PyArg_ParseTuple(_args
, "O&O&bhO&bl",
2232 PyMac_GetRect
, &boundsRect
,
2233 PyMac_GetStr255
, title
,
2236 WinObj_Convert
, &behind
,
2240 _rv
= NewCWindow((void *)0,
2248 _res
= Py_BuildValue("O&",
2253 static PyObject
*Win_CreateNewWindow(PyObject
*_self
, PyObject
*_args
)
2255 PyObject
*_res
= NULL
;
2257 WindowClass windowClass
;
2258 WindowAttributes attributes
;
2260 WindowPtr outWindow
;
2261 if (!PyArg_ParseTuple(_args
, "llO&",
2264 PyMac_GetRect
, &contentBounds
))
2266 _err
= CreateNewWindow(windowClass
,
2270 if (_err
!= noErr
) return PyMac_Error(_err
);
2271 _res
= Py_BuildValue("O&",
2272 WinObj_WhichWindow
, outWindow
);
2276 static PyObject
*Win_CreateWindowFromResource(PyObject
*_self
, PyObject
*_args
)
2278 PyObject
*_res
= NULL
;
2281 WindowPtr outWindow
;
2282 if (!PyArg_ParseTuple(_args
, "h",
2285 _err
= CreateWindowFromResource(resID
,
2287 if (_err
!= noErr
) return PyMac_Error(_err
);
2288 _res
= Py_BuildValue("O&",
2289 WinObj_WhichWindow
, outWindow
);
2293 static PyObject
*Win_ShowFloatingWindows(PyObject
*_self
, PyObject
*_args
)
2295 PyObject
*_res
= NULL
;
2297 if (!PyArg_ParseTuple(_args
, ""))
2299 _err
= ShowFloatingWindows();
2300 if (_err
!= noErr
) return PyMac_Error(_err
);
2306 static PyObject
*Win_HideFloatingWindows(PyObject
*_self
, PyObject
*_args
)
2308 PyObject
*_res
= NULL
;
2310 if (!PyArg_ParseTuple(_args
, ""))
2312 _err
= HideFloatingWindows();
2313 if (_err
!= noErr
) return PyMac_Error(_err
);
2319 static PyObject
*Win_AreFloatingWindowsVisible(PyObject
*_self
, PyObject
*_args
)
2321 PyObject
*_res
= NULL
;
2323 if (!PyArg_ParseTuple(_args
, ""))
2325 _rv
= AreFloatingWindowsVisible();
2326 _res
= Py_BuildValue("b",
2331 #if !TARGET_API_MAC_CARBON
2333 static PyObject
*Win_SetDeskCPat(PyObject
*_self
, PyObject
*_args
)
2335 PyObject
*_res
= NULL
;
2336 PixPatHandle deskPixPat
;
2337 if (!PyArg_ParseTuple(_args
, "O&",
2338 ResObj_Convert
, &deskPixPat
))
2340 SetDeskCPat(deskPixPat
);
2347 static PyObject
*Win_CheckUpdate(PyObject
*_self
, PyObject
*_args
)
2349 PyObject
*_res
= NULL
;
2351 EventRecord theEvent
;
2352 if (!PyArg_ParseTuple(_args
, ""))
2354 _rv
= CheckUpdate(&theEvent
);
2355 _res
= Py_BuildValue("bO&",
2357 PyMac_BuildEventRecord
, &theEvent
);
2361 static PyObject
*Win_MacFindWindow(PyObject
*_self
, PyObject
*_args
)
2363 PyObject
*_res
= NULL
;
2367 if (!PyArg_ParseTuple(_args
, "O&",
2368 PyMac_GetPoint
, &thePoint
))
2370 _rv
= MacFindWindow(thePoint
,
2372 _res
= Py_BuildValue("hO&",
2374 WinObj_WhichWindow
, window
);
2378 static PyObject
*Win_FrontWindow(PyObject
*_self
, PyObject
*_args
)
2380 PyObject
*_res
= NULL
;
2382 if (!PyArg_ParseTuple(_args
, ""))
2384 _rv
= FrontWindow();
2385 _res
= Py_BuildValue("O&",
2386 WinObj_WhichWindow
, _rv
);
2390 static PyObject
*Win_FrontNonFloatingWindow(PyObject
*_self
, PyObject
*_args
)
2392 PyObject
*_res
= NULL
;
2394 if (!PyArg_ParseTuple(_args
, ""))
2396 _rv
= FrontNonFloatingWindow();
2397 _res
= Py_BuildValue("O&",
2398 WinObj_WhichWindow
, _rv
);
2402 #if TARGET_API_MAC_CARBON
2404 static PyObject
*Win_GetFrontWindowOfClass(PyObject
*_self
, PyObject
*_args
)
2406 PyObject
*_res
= NULL
;
2408 WindowClass inWindowClass
;
2409 Boolean mustBeVisible
;
2410 if (!PyArg_ParseTuple(_args
, "lb",
2414 _rv
= GetFrontWindowOfClass(inWindowClass
,
2416 _res
= Py_BuildValue("O&",
2422 #if TARGET_API_MAC_CARBON
2424 static PyObject
*Win_FindWindowOfClass(PyObject
*_self
, PyObject
*_args
)
2426 PyObject
*_res
= NULL
;
2429 WindowClass inWindowClass
;
2430 WindowPtr outWindow
;
2431 WindowPartCode outWindowPart
;
2432 if (!PyArg_ParseTuple(_args
, "O&l",
2433 PyMac_GetPoint
, &where
,
2436 _err
= FindWindowOfClass(&where
,
2440 if (_err
!= noErr
) return PyMac_Error(_err
);
2441 _res
= Py_BuildValue("O&h",
2442 WinObj_WhichWindow
, outWindow
,
2448 #if !TARGET_API_MAC_CARBON
2450 static PyObject
*Win_InitWindows(PyObject
*_self
, PyObject
*_args
)
2452 PyObject
*_res
= NULL
;
2453 if (!PyArg_ParseTuple(_args
, ""))
2462 #if !TARGET_API_MAC_CARBON
2464 static PyObject
*Win_GetWMgrPort(PyObject
*_self
, PyObject
*_args
)
2466 PyObject
*_res
= NULL
;
2468 if (!PyArg_ParseTuple(_args
, ""))
2470 GetWMgrPort(&wPort
);
2471 _res
= Py_BuildValue("O&",
2472 GrafObj_New
, wPort
);
2477 #if !TARGET_API_MAC_CARBON
2479 static PyObject
*Win_GetCWMgrPort(PyObject
*_self
, PyObject
*_args
)
2481 PyObject
*_res
= NULL
;
2483 if (!PyArg_ParseTuple(_args
, ""))
2485 GetCWMgrPort(&wMgrCPort
);
2486 _res
= Py_BuildValue("O&",
2487 GrafObj_New
, wMgrCPort
);
2492 #if !TARGET_API_MAC_CARBON
2494 static PyObject
*Win_InitFloatingWindows(PyObject
*_self
, PyObject
*_args
)
2496 PyObject
*_res
= NULL
;
2498 if (!PyArg_ParseTuple(_args
, ""))
2500 _err
= InitFloatingWindows();
2501 if (_err
!= noErr
) return PyMac_Error(_err
);
2508 #if !TARGET_API_MAC_CARBON
2510 static PyObject
*Win_InvalRect(PyObject
*_self
, PyObject
*_args
)
2512 PyObject
*_res
= NULL
;
2514 if (!PyArg_ParseTuple(_args
, "O&",
2515 PyMac_GetRect
, &badRect
))
2517 InvalRect(&badRect
);
2524 #if !TARGET_API_MAC_CARBON
2526 static PyObject
*Win_InvalRgn(PyObject
*_self
, PyObject
*_args
)
2528 PyObject
*_res
= NULL
;
2530 if (!PyArg_ParseTuple(_args
, "O&",
2531 ResObj_Convert
, &badRgn
))
2540 #if !TARGET_API_MAC_CARBON
2542 static PyObject
*Win_ValidRect(PyObject
*_self
, PyObject
*_args
)
2544 PyObject
*_res
= NULL
;
2546 if (!PyArg_ParseTuple(_args
, "O&",
2547 PyMac_GetRect
, &goodRect
))
2549 ValidRect(&goodRect
);
2556 #if !TARGET_API_MAC_CARBON
2558 static PyObject
*Win_ValidRgn(PyObject
*_self
, PyObject
*_args
)
2560 PyObject
*_res
= NULL
;
2562 if (!PyArg_ParseTuple(_args
, "O&",
2563 ResObj_Convert
, &goodRgn
))
2572 static PyObject
*Win_CollapseAllWindows(PyObject
*_self
, PyObject
*_args
)
2574 PyObject
*_res
= NULL
;
2577 if (!PyArg_ParseTuple(_args
, "b",
2580 _err
= CollapseAllWindows(collapse
);
2581 if (_err
!= noErr
) return PyMac_Error(_err
);
2587 static PyObject
*Win_PinRect(PyObject
*_self
, PyObject
*_args
)
2589 PyObject
*_res
= NULL
;
2593 if (!PyArg_ParseTuple(_args
, "O&O&",
2594 PyMac_GetRect
, &theRect
,
2595 PyMac_GetPoint
, &thePt
))
2597 _rv
= PinRect(&theRect
,
2599 _res
= Py_BuildValue("l",
2604 static PyObject
*Win_GetGrayRgn(PyObject
*_self
, PyObject
*_args
)
2606 PyObject
*_res
= NULL
;
2608 if (!PyArg_ParseTuple(_args
, ""))
2611 _res
= Py_BuildValue("O&",
2616 static PyObject
*Win_GetWindowFromPort(PyObject
*_self
, PyObject
*_args
)
2618 PyObject
*_res
= NULL
;
2621 if (!PyArg_ParseTuple(_args
, "O&",
2622 GrafObj_Convert
, &port
))
2624 _rv
= GetWindowFromPort(port
);
2625 _res
= Py_BuildValue("O&",
2630 static PyObject
*Win_WhichWindow(PyObject
*_self
, PyObject
*_args
)
2632 PyObject
*_res
= NULL
;
2636 if ( !PyArg_ParseTuple(_args
, "i", &ptr
) )
2638 return WinObj_WhichWindow((WindowPtr
)ptr
);
2642 static PyObject
*Win_FindWindow(PyObject
*_self
, PyObject
*_args
)
2644 PyObject
*_res
= NULL
;
2647 WindowPtr theWindow
;
2648 if (!PyArg_ParseTuple(_args
, "O&",
2649 PyMac_GetPoint
, &thePoint
))
2651 _rv
= FindWindow(thePoint
,
2653 _res
= Py_BuildValue("hO&",
2655 WinObj_WhichWindow
, theWindow
);
2659 static PyMethodDef Win_methods
[] = {
2660 {"GetNewCWindow", (PyCFunction
)Win_GetNewCWindow
, 1,
2661 "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
2662 {"NewWindow", (PyCFunction
)Win_NewWindow
, 1,
2663 "(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
2664 {"GetNewWindow", (PyCFunction
)Win_GetNewWindow
, 1,
2665 "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
2666 {"NewCWindow", (PyCFunction
)Win_NewCWindow
, 1,
2667 "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
2668 {"CreateNewWindow", (PyCFunction
)Win_CreateNewWindow
, 1,
2669 "(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)"},
2670 {"CreateWindowFromResource", (PyCFunction
)Win_CreateWindowFromResource
, 1,
2671 "(SInt16 resID) -> (WindowPtr outWindow)"},
2672 {"ShowFloatingWindows", (PyCFunction
)Win_ShowFloatingWindows
, 1,
2674 {"HideFloatingWindows", (PyCFunction
)Win_HideFloatingWindows
, 1,
2676 {"AreFloatingWindowsVisible", (PyCFunction
)Win_AreFloatingWindowsVisible
, 1,
2677 "() -> (Boolean _rv)"},
2679 #if !TARGET_API_MAC_CARBON
2680 {"SetDeskCPat", (PyCFunction
)Win_SetDeskCPat
, 1,
2681 "(PixPatHandle deskPixPat) -> None"},
2683 {"CheckUpdate", (PyCFunction
)Win_CheckUpdate
, 1,
2684 "() -> (Boolean _rv, EventRecord theEvent)"},
2685 {"MacFindWindow", (PyCFunction
)Win_MacFindWindow
, 1,
2686 "(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)"},
2687 {"FrontWindow", (PyCFunction
)Win_FrontWindow
, 1,
2688 "() -> (WindowPtr _rv)"},
2689 {"FrontNonFloatingWindow", (PyCFunction
)Win_FrontNonFloatingWindow
, 1,
2690 "() -> (WindowPtr _rv)"},
2692 #if TARGET_API_MAC_CARBON
2693 {"GetFrontWindowOfClass", (PyCFunction
)Win_GetFrontWindowOfClass
, 1,
2694 "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
2697 #if TARGET_API_MAC_CARBON
2698 {"FindWindowOfClass", (PyCFunction
)Win_FindWindowOfClass
, 1,
2699 "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"},
2702 #if !TARGET_API_MAC_CARBON
2703 {"InitWindows", (PyCFunction
)Win_InitWindows
, 1,
2707 #if !TARGET_API_MAC_CARBON
2708 {"GetWMgrPort", (PyCFunction
)Win_GetWMgrPort
, 1,
2709 "() -> (GrafPtr wPort)"},
2712 #if !TARGET_API_MAC_CARBON
2713 {"GetCWMgrPort", (PyCFunction
)Win_GetCWMgrPort
, 1,
2714 "() -> (CGrafPtr wMgrCPort)"},
2717 #if !TARGET_API_MAC_CARBON
2718 {"InitFloatingWindows", (PyCFunction
)Win_InitFloatingWindows
, 1,
2722 #if !TARGET_API_MAC_CARBON
2723 {"InvalRect", (PyCFunction
)Win_InvalRect
, 1,
2724 "(Rect badRect) -> None"},
2727 #if !TARGET_API_MAC_CARBON
2728 {"InvalRgn", (PyCFunction
)Win_InvalRgn
, 1,
2729 "(RgnHandle badRgn) -> None"},
2732 #if !TARGET_API_MAC_CARBON
2733 {"ValidRect", (PyCFunction
)Win_ValidRect
, 1,
2734 "(Rect goodRect) -> None"},
2737 #if !TARGET_API_MAC_CARBON
2738 {"ValidRgn", (PyCFunction
)Win_ValidRgn
, 1,
2739 "(RgnHandle goodRgn) -> None"},
2741 {"CollapseAllWindows", (PyCFunction
)Win_CollapseAllWindows
, 1,
2742 "(Boolean collapse) -> None"},
2743 {"PinRect", (PyCFunction
)Win_PinRect
, 1,
2744 "(Rect theRect, Point thePt) -> (long _rv)"},
2745 {"GetGrayRgn", (PyCFunction
)Win_GetGrayRgn
, 1,
2746 "() -> (RgnHandle _rv)"},
2747 {"GetWindowFromPort", (PyCFunction
)Win_GetWindowFromPort
, 1,
2748 "(CGrafPtr port) -> (WindowPtr _rv)"},
2749 {"WhichWindow", (PyCFunction
)Win_WhichWindow
, 1,
2750 "Resolve an integer WindowPtr address to a Window object"},
2751 {"FindWindow", (PyCFunction
)Win_FindWindow
, 1,
2752 "(Point thePoint) -> (short _rv, WindowPtr theWindow)"},
2758 /* Return the object corresponding to the window, or NULL */
2761 WinObj_WhichWindow(WindowPtr w
)
2769 it
= (PyObject
*) GetWRefCon(w
);
2770 if (it
== NULL
|| !IsPointerValid((Ptr
)it
) || ((WindowObject
*)it
)->ob_itself
!= w
|| !WinObj_Check(it
)) {
2772 ((WindowObject
*)it
)->ob_freeit
= NULL
;
2788 PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr
, WinObj_New
);
2789 PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr
, WinObj_WhichWindow
);
2790 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr
, WinObj_Convert
);
2793 m
= Py_InitModule("Win", Win_methods
);
2794 d
= PyModule_GetDict(m
);
2795 Win_Error
= PyMac_GetOSErrException();
2796 if (Win_Error
== NULL
||
2797 PyDict_SetItemString(d
, "Error", Win_Error
) != 0)
2799 Window_Type
.ob_type
= &PyType_Type
;
2800 Py_INCREF(&Window_Type
);
2801 if (PyDict_SetItemString(d
, "WindowType", (PyObject
*)&Window_Type
) != 0)
2802 Py_FatalError("can't initialize WindowType");
2805 /* ========================= End module Win ========================= */