ยปCore Development>Code coverage>Mac/Modules/win/_Winmodule.c

Python code coverage for Mac/Modules/win/_Winmodule.c

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