/Mac/Modules/win/_Winmodule.c
http://unladen-swallow.googlecode.com/ · C · 3265 lines · 3056 code · 198 blank · 11 comment · 327 complexity · c6fb76daca4c71dd4064a7870f571f18 MD5 · raw file
Large files are truncated click here to view the full file
- /* ========================== Module _Win =========================== */
- #include "Python.h"
- #ifndef __LP64__
- #include "pymactoolbox.h"
- /* Macro to test whether a weak-loaded CFM function exists */
- #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
- PyErr_SetString(PyExc_NotImplementedError, \
- "Not available in this shared library/OS version"); \
- return NULL; \
- }} while(0)
- #include <Carbon/Carbon.h>
- #ifdef USE_TOOLBOX_OBJECT_GLUE
- extern PyObject *_WinObj_New(WindowRef);
- extern PyObject *_WinObj_WhichWindow(WindowRef);
- extern int _WinObj_Convert(PyObject *, WindowRef *);
- #define WinObj_New _WinObj_New
- #define WinObj_WhichWindow _WinObj_WhichWindow
- #define WinObj_Convert _WinObj_Convert
- #endif
- /* Classic calls that we emulate in carbon mode */
- #define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
- #define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
- #define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
- /* Function to dispose a window, with a "normal" calling sequence */
- static void
- PyMac_AutoDisposeWindow(WindowPtr w)
- {
- DisposeWindow(w);
- }
- static PyObject *Win_Error;
- /* ----------------------- Object type Window ----------------------- */
- PyTypeObject Window_Type;
- #define WinObj_Check(x) ((x)->ob_type == &Window_Type || PyObject_TypeCheck((x), &Window_Type))
- typedef struct WindowObject {
- PyObject_HEAD
- WindowPtr ob_itself;
- void (*ob_freeit)(WindowPtr ptr);
- } WindowObject;
- PyObject *WinObj_New(WindowPtr itself)
- {
- WindowObject *it;
- if (itself == NULL) return PyMac_Error(resNotFound);
- /* XXXX Or should we use WhichWindow code here? */
- it = PyObject_NEW(WindowObject, &Window_Type);
- if (it == NULL) return NULL;
- it->ob_itself = itself;
- it->ob_freeit = NULL;
- if (GetWRefCon(itself) == 0)
- {
- SetWRefCon(itself, (long)it);
- it->ob_freeit = PyMac_AutoDisposeWindow;
- }
- return (PyObject *)it;
- }
- int WinObj_Convert(PyObject *v, WindowPtr *p_itself)
- {
- if (v == Py_None) { *p_itself = NULL; return 1; }
- if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
- {
- DialogRef dlg;
- if (DlgObj_Convert(v, &dlg) && dlg) {
- *p_itself = GetDialogWindow(dlg);
- return 1;
- }
- PyErr_Clear();
- }
- if (!WinObj_Check(v))
- {
- PyErr_SetString(PyExc_TypeError, "Window required");
- return 0;
- }
- *p_itself = ((WindowObject *)v)->ob_itself;
- return 1;
- }
- static void WinObj_dealloc(WindowObject *self)
- {
- if (self->ob_freeit && self->ob_itself)
- {
- SetWRefCon(self->ob_itself, 0);
- self->ob_freeit(self->ob_itself);
- }
- self->ob_itself = NULL;
- self->ob_freeit = NULL;
- self->ob_type->tp_free((PyObject *)self);
- }
- static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- UInt32 outCount;
- #ifndef GetWindowOwnerCount
- PyMac_PRECHECK(GetWindowOwnerCount);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowOwnerCount(_self->ob_itself,
- &outCount);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outCount);
- return _res;
- }
- static PyObject *WinObj_CloneWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- #ifndef CloneWindow
- PyMac_PRECHECK(CloneWindow);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = CloneWindow(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowRetainCount(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- ItemCount _rv;
- #ifndef GetWindowRetainCount
- PyMac_PRECHECK(GetWindowRetainCount);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetWindowRetainCount(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
- }
- static PyObject *WinObj_RetainWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- #ifndef RetainWindow
- PyMac_PRECHECK(RetainWindow);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = RetainWindow(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ReleaseWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- #ifndef ReleaseWindow
- PyMac_PRECHECK(ReleaseWindow);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = ReleaseWindow(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ReshapeCustomWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- #ifndef ReshapeCustomWindow
- PyMac_PRECHECK(ReshapeCustomWindow);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = ReshapeCustomWindow(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowWidgetHilite(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowDefPartCode outHilite;
- #ifndef GetWindowWidgetHilite
- PyMac_PRECHECK(GetWindowWidgetHilite);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowWidgetHilite(_self->ob_itself,
- &outHilite);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("h",
- outHilite);
- return _res;
- }
- static PyObject *WinObj_GetWindowClass(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowClass outClass;
- #ifndef GetWindowClass
- PyMac_PRECHECK(GetWindowClass);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowClass(_self->ob_itself,
- &outClass);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outClass);
- return _res;
- }
- static PyObject *WinObj_GetWindowAttributes(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowAttributes outAttributes;
- #ifndef GetWindowAttributes
- PyMac_PRECHECK(GetWindowAttributes);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowAttributes(_self->ob_itself,
- &outAttributes);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outAttributes);
- return _res;
- }
- static PyObject *WinObj_ChangeWindowAttributes(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowAttributes setTheseAttributes;
- WindowAttributes clearTheseAttributes;
- #ifndef ChangeWindowAttributes
- PyMac_PRECHECK(ChangeWindowAttributes);
- #endif
- if (!PyArg_ParseTuple(_args, "ll",
- &setTheseAttributes,
- &clearTheseAttributes))
- return NULL;
- _err = ChangeWindowAttributes(_self->ob_itself,
- setTheseAttributes,
- clearTheseAttributes);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_SetWindowClass(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowClass inWindowClass;
- #ifndef SetWindowClass
- PyMac_PRECHECK(SetWindowClass);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &inWindowClass))
- return NULL;
- _err = SetWindowClass(_self->ob_itself,
- inWindowClass);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_SetWindowModality(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowModality inModalKind;
- WindowPtr inUnavailableWindow;
- #ifndef SetWindowModality
- PyMac_PRECHECK(SetWindowModality);
- #endif
- if (!PyArg_ParseTuple(_args, "lO&",
- &inModalKind,
- WinObj_Convert, &inUnavailableWindow))
- return NULL;
- _err = SetWindowModality(_self->ob_itself,
- inModalKind,
- inUnavailableWindow);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowModality(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowModality outModalKind;
- WindowPtr outUnavailableWindow;
- #ifndef GetWindowModality
- PyMac_PRECHECK(GetWindowModality);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowModality(_self->ob_itself,
- &outModalKind,
- &outUnavailableWindow);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("lO&",
- outModalKind,
- WinObj_WhichWindow, outUnavailableWindow);
- return _res;
- }
- static PyObject *WinObj_SetWindowContentColor(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- RGBColor color;
- #ifndef SetWindowContentColor
- PyMac_PRECHECK(SetWindowContentColor);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- QdRGB_Convert, &color))
- return NULL;
- _err = SetWindowContentColor(_self->ob_itself,
- &color);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowContentColor(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- RGBColor color;
- #ifndef GetWindowContentColor
- PyMac_PRECHECK(GetWindowContentColor);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowContentColor(_self->ob_itself,
- &color);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- QdRGB_New, &color);
- return _res;
- }
- static PyObject *WinObj_GetWindowContentPattern(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- PixPatHandle outPixPat;
- #ifndef GetWindowContentPattern
- PyMac_PRECHECK(GetWindowContentPattern);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &outPixPat))
- return NULL;
- _err = GetWindowContentPattern(_self->ob_itself,
- outPixPat);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_SetWindowContentPattern(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- PixPatHandle pixPat;
- #ifndef SetWindowContentPattern
- PyMac_PRECHECK(SetWindowContentPattern);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &pixPat))
- return NULL;
- _err = SetWindowContentPattern(_self->ob_itself,
- pixPat);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ScrollWindowRect(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Rect inScrollRect;
- SInt16 inHPixels;
- SInt16 inVPixels;
- ScrollWindowOptions inOptions;
- RgnHandle outExposedRgn;
- #ifndef ScrollWindowRect
- PyMac_PRECHECK(ScrollWindowRect);
- #endif
- if (!PyArg_ParseTuple(_args, "O&hhlO&",
- PyMac_GetRect, &inScrollRect,
- &inHPixels,
- &inVPixels,
- &inOptions,
- ResObj_Convert, &outExposedRgn))
- return NULL;
- _err = ScrollWindowRect(_self->ob_itself,
- &inScrollRect,
- inHPixels,
- inVPixels,
- inOptions,
- outExposedRgn);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ScrollWindowRegion(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- RgnHandle inScrollRgn;
- SInt16 inHPixels;
- SInt16 inVPixels;
- ScrollWindowOptions inOptions;
- RgnHandle outExposedRgn;
- #ifndef ScrollWindowRegion
- PyMac_PRECHECK(ScrollWindowRegion);
- #endif
- if (!PyArg_ParseTuple(_args, "O&hhlO&",
- ResObj_Convert, &inScrollRgn,
- &inHPixels,
- &inVPixels,
- &inOptions,
- ResObj_Convert, &outExposedRgn))
- return NULL;
- _err = ScrollWindowRegion(_self->ob_itself,
- inScrollRgn,
- inHPixels,
- inVPixels,
- inOptions,
- outExposedRgn);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ClipAbove(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef ClipAbove
- PyMac_PRECHECK(ClipAbove);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- ClipAbove(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_PaintOne(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- RgnHandle clobberedRgn;
- #ifndef PaintOne
- PyMac_PRECHECK(PaintOne);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &clobberedRgn))
- return NULL;
- PaintOne(_self->ob_itself,
- clobberedRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_PaintBehind(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- RgnHandle clobberedRgn;
- #ifndef PaintBehind
- PyMac_PRECHECK(PaintBehind);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &clobberedRgn))
- return NULL;
- PaintBehind(_self->ob_itself,
- clobberedRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_CalcVis(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef CalcVis
- PyMac_PRECHECK(CalcVis);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- CalcVis(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_CalcVisBehind(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- RgnHandle clobberedRgn;
- #ifndef CalcVisBehind
- PyMac_PRECHECK(CalcVisBehind);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &clobberedRgn))
- return NULL;
- CalcVisBehind(_self->ob_itself,
- clobberedRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_BringToFront(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef BringToFront
- PyMac_PRECHECK(BringToFront);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- BringToFront(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_SendBehind(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- WindowPtr behindWindow;
- #ifndef SendBehind
- PyMac_PRECHECK(SendBehind);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- WinObj_Convert, &behindWindow))
- return NULL;
- SendBehind(_self->ob_itself,
- behindWindow);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_SelectWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef SelectWindow
- PyMac_PRECHECK(SelectWindow);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- SelectWindow(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetNextWindowOfClass(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- WindowPtr _rv;
- WindowClass inWindowClass;
- Boolean mustBeVisible;
- #ifndef GetNextWindowOfClass
- PyMac_PRECHECK(GetNextWindowOfClass);
- #endif
- if (!PyArg_ParseTuple(_args, "lb",
- &inWindowClass,
- &mustBeVisible))
- return NULL;
- _rv = GetNextWindowOfClass(_self->ob_itself,
- inWindowClass,
- mustBeVisible);
- _res = Py_BuildValue("O&",
- WinObj_New, _rv);
- return _res;
- }
- static PyObject *WinObj_SetWindowAlternateTitle(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- CFStringRef inTitle;
- #ifndef SetWindowAlternateTitle
- PyMac_PRECHECK(SetWindowAlternateTitle);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- CFStringRefObj_Convert, &inTitle))
- return NULL;
- _err = SetWindowAlternateTitle(_self->ob_itself,
- inTitle);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_CopyWindowAlternateTitle(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- CFStringRef outTitle;
- #ifndef CopyWindowAlternateTitle
- PyMac_PRECHECK(CopyWindowAlternateTitle);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = CopyWindowAlternateTitle(_self->ob_itself,
- &outTitle);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- CFStringRefObj_New, outTitle);
- return _res;
- }
- static PyObject *WinObj_HiliteWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean fHilite;
- #ifndef HiliteWindow
- PyMac_PRECHECK(HiliteWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "b",
- &fHilite))
- return NULL;
- HiliteWindow(_self->ob_itself,
- fHilite);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_SetWRefCon(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- long data;
- #ifndef SetWRefCon
- PyMac_PRECHECK(SetWRefCon);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &data))
- return NULL;
- SetWRefCon(_self->ob_itself,
- data);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWRefCon(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- long _rv;
- #ifndef GetWRefCon
- PyMac_PRECHECK(GetWRefCon);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetWRefCon(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
- }
- static PyObject *WinObj_SetWindowPic(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- PicHandle pic;
- #ifndef SetWindowPic
- PyMac_PRECHECK(SetWindowPic);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &pic))
- return NULL;
- SetWindowPic(_self->ob_itself,
- pic);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowPic(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- PicHandle _rv;
- #ifndef GetWindowPic
- PyMac_PRECHECK(GetWindowPic);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetWindowPic(_self->ob_itself);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
- }
- static PyObject *WinObj_GetWVariant(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- short _rv;
- #ifndef GetWVariant
- PyMac_PRECHECK(GetWVariant);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetWVariant(_self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
- }
- static PyObject *WinObj_GetWindowFeatures(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- UInt32 outFeatures;
- #ifndef GetWindowFeatures
- PyMac_PRECHECK(GetWindowFeatures);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowFeatures(_self->ob_itself,
- &outFeatures);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outFeatures);
- return _res;
- }
- static PyObject *WinObj_GetWindowRegion(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowRegionCode inRegionCode;
- RgnHandle ioWinRgn;
- #ifndef GetWindowRegion
- PyMac_PRECHECK(GetWindowRegion);
- #endif
- if (!PyArg_ParseTuple(_args, "HO&",
- &inRegionCode,
- ResObj_Convert, &ioWinRgn))
- return NULL;
- _err = GetWindowRegion(_self->ob_itself,
- inRegionCode,
- ioWinRgn);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowStructureWidths(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Rect outRect;
- #ifndef GetWindowStructureWidths
- PyMac_PRECHECK(GetWindowStructureWidths);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowStructureWidths(_self->ob_itself,
- &outRect);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &outRect);
- return _res;
- }
- static PyObject *WinObj_BeginUpdate(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef BeginUpdate
- PyMac_PRECHECK(BeginUpdate);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- BeginUpdate(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_EndUpdate(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef EndUpdate
- PyMac_PRECHECK(EndUpdate);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- EndUpdate(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_InvalWindowRgn(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- RgnHandle region;
- #ifndef InvalWindowRgn
- PyMac_PRECHECK(InvalWindowRgn);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, ®ion))
- return NULL;
- _err = InvalWindowRgn(_self->ob_itself,
- region);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_InvalWindowRect(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Rect bounds;
- #ifndef InvalWindowRect
- PyMac_PRECHECK(InvalWindowRect);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &bounds))
- return NULL;
- _err = InvalWindowRect(_self->ob_itself,
- &bounds);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ValidWindowRgn(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- RgnHandle region;
- #ifndef ValidWindowRgn
- PyMac_PRECHECK(ValidWindowRgn);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, ®ion))
- return NULL;
- _err = ValidWindowRgn(_self->ob_itself,
- region);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ValidWindowRect(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Rect bounds;
- #ifndef ValidWindowRect
- PyMac_PRECHECK(ValidWindowRect);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &bounds))
- return NULL;
- _err = ValidWindowRect(_self->ob_itself,
- &bounds);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_DrawGrowIcon(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef DrawGrowIcon
- PyMac_PRECHECK(DrawGrowIcon);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- DrawGrowIcon(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_SetWTitle(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Str255 title;
- #ifndef SetWTitle
- PyMac_PRECHECK(SetWTitle);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetStr255, title))
- return NULL;
- SetWTitle(_self->ob_itself,
- title);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWTitle(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Str255 title;
- #ifndef GetWTitle
- PyMac_PRECHECK(GetWTitle);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- GetWTitle(_self->ob_itself,
- title);
- _res = Py_BuildValue("O&",
- PyMac_BuildStr255, title);
- return _res;
- }
- static PyObject *WinObj_SetWindowTitleWithCFString(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- CFStringRef inString;
- #ifndef SetWindowTitleWithCFString
- PyMac_PRECHECK(SetWindowTitleWithCFString);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- CFStringRefObj_Convert, &inString))
- return NULL;
- _err = SetWindowTitleWithCFString(_self->ob_itself,
- inString);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_CopyWindowTitleAsCFString(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- CFStringRef outString;
- #ifndef CopyWindowTitleAsCFString
- PyMac_PRECHECK(CopyWindowTitleAsCFString);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = CopyWindowTitleAsCFString(_self->ob_itself,
- &outString);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- CFStringRefObj_New, outString);
- return _res;
- }
- static PyObject *WinObj_SetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- FSSpec inFile;
- #ifndef SetWindowProxyFSSpec
- PyMac_PRECHECK(SetWindowProxyFSSpec);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetFSSpec, &inFile))
- return NULL;
- _err = SetWindowProxyFSSpec(_self->ob_itself,
- &inFile);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- FSSpec outFile;
- #ifndef GetWindowProxyFSSpec
- PyMac_PRECHECK(GetWindowProxyFSSpec);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowProxyFSSpec(_self->ob_itself,
- &outFile);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyMac_BuildFSSpec, &outFile);
- return _res;
- }
- static PyObject *WinObj_SetWindowProxyAlias(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- AliasHandle inAlias;
- #ifndef SetWindowProxyAlias
- PyMac_PRECHECK(SetWindowProxyAlias);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &inAlias))
- return NULL;
- _err = SetWindowProxyAlias(_self->ob_itself,
- inAlias);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowProxyAlias(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- AliasHandle alias;
- #ifndef GetWindowProxyAlias
- PyMac_PRECHECK(GetWindowProxyAlias);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowProxyAlias(_self->ob_itself,
- &alias);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- ResObj_New, alias);
- return _res;
- }
- static PyObject *WinObj_SetWindowProxyCreatorAndType(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- OSType fileCreator;
- OSType fileType;
- SInt16 vRefNum;
- #ifndef SetWindowProxyCreatorAndType
- PyMac_PRECHECK(SetWindowProxyCreatorAndType);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&h",
- PyMac_GetOSType, &fileCreator,
- PyMac_GetOSType, &fileType,
- &vRefNum))
- return NULL;
- _err = SetWindowProxyCreatorAndType(_self->ob_itself,
- fileCreator,
- fileType,
- vRefNum);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowProxyIcon(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- IconRef outIcon;
- #ifndef GetWindowProxyIcon
- PyMac_PRECHECK(GetWindowProxyIcon);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowProxyIcon(_self->ob_itself,
- &outIcon);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- ResObj_New, outIcon);
- return _res;
- }
- static PyObject *WinObj_SetWindowProxyIcon(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- IconRef icon;
- #ifndef SetWindowProxyIcon
- PyMac_PRECHECK(SetWindowProxyIcon);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &icon))
- return NULL;
- _err = SetWindowProxyIcon(_self->ob_itself,
- icon);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_RemoveWindowProxy(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- #ifndef RemoveWindowProxy
- PyMac_PRECHECK(RemoveWindowProxy);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = RemoveWindowProxy(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_BeginWindowProxyDrag(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- DragReference outNewDrag;
- RgnHandle outDragOutlineRgn;
- #ifndef BeginWindowProxyDrag
- PyMac_PRECHECK(BeginWindowProxyDrag);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &outDragOutlineRgn))
- return NULL;
- _err = BeginWindowProxyDrag(_self->ob_itself,
- &outNewDrag,
- outDragOutlineRgn);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- DragObj_New, outNewDrag);
- return _res;
- }
- static PyObject *WinObj_EndWindowProxyDrag(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- DragReference theDrag;
- #ifndef EndWindowProxyDrag
- PyMac_PRECHECK(EndWindowProxyDrag);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- DragObj_Convert, &theDrag))
- return NULL;
- _err = EndWindowProxyDrag(_self->ob_itself,
- theDrag);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_TrackWindowProxyFromExistingDrag(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Point startPt;
- DragReference drag;
- RgnHandle inDragOutlineRgn;
- #ifndef TrackWindowProxyFromExistingDrag
- PyMac_PRECHECK(TrackWindowProxyFromExistingDrag);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- PyMac_GetPoint, &startPt,
- DragObj_Convert, &drag,
- ResObj_Convert, &inDragOutlineRgn))
- return NULL;
- _err = TrackWindowProxyFromExistingDrag(_self->ob_itself,
- startPt,
- drag,
- inDragOutlineRgn);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_TrackWindowProxyDrag(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Point startPt;
- #ifndef TrackWindowProxyDrag
- PyMac_PRECHECK(TrackWindowProxyDrag);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &startPt))
- return NULL;
- _err = TrackWindowProxyDrag(_self->ob_itself,
- startPt);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_IsWindowModified(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- #ifndef IsWindowModified
- PyMac_PRECHECK(IsWindowModified);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = IsWindowModified(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *WinObj_SetWindowModified(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Boolean modified;
- #ifndef SetWindowModified
- PyMac_PRECHECK(SetWindowModified);
- #endif
- if (!PyArg_ParseTuple(_args, "b",
- &modified))
- return NULL;
- _err = SetWindowModified(_self->ob_itself,
- modified);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_IsWindowPathSelectClick(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- EventRecord event;
- #ifndef IsWindowPathSelectClick
- PyMac_PRECHECK(IsWindowPathSelectClick);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetEventRecord, &event))
- return NULL;
- _rv = IsWindowPathSelectClick(_self->ob_itself,
- &event);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *WinObj_WindowPathSelect(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- MenuHandle menu;
- SInt32 outMenuResult;
- #ifndef WindowPathSelect
- PyMac_PRECHECK(WindowPathSelect);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- MenuObj_Convert, &menu))
- return NULL;
- _err = WindowPathSelect(_self->ob_itself,
- menu,
- &outMenuResult);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outMenuResult);
- return _res;
- }
- static PyObject *WinObj_HiliteWindowFrameForDrag(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Boolean hilited;
- #ifndef HiliteWindowFrameForDrag
- PyMac_PRECHECK(HiliteWindowFrameForDrag);
- #endif
- if (!PyArg_ParseTuple(_args, "b",
- &hilited))
- return NULL;
- _err = HiliteWindowFrameForDrag(_self->ob_itself,
- hilited);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_TransitionWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowTransitionEffect inEffect;
- WindowTransitionAction inAction;
- Rect inRect;
- #ifndef TransitionWindow
- PyMac_PRECHECK(TransitionWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "llO&",
- &inEffect,
- &inAction,
- PyMac_GetRect, &inRect))
- return NULL;
- _err = TransitionWindow(_self->ob_itself,
- inEffect,
- inAction,
- &inRect);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_TransitionWindowAndParent(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowPtr inParentWindow;
- WindowTransitionEffect inEffect;
- WindowTransitionAction inAction;
- Rect inRect;
- #ifndef TransitionWindowAndParent
- PyMac_PRECHECK(TransitionWindowAndParent);
- #endif
- if (!PyArg_ParseTuple(_args, "O&llO&",
- WinObj_Convert, &inParentWindow,
- &inEffect,
- &inAction,
- PyMac_GetRect, &inRect))
- return NULL;
- _err = TransitionWindowAndParent(_self->ob_itself,
- inParentWindow,
- inEffect,
- inAction,
- &inRect);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_MacMoveWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- short hGlobal;
- short vGlobal;
- Boolean front;
- #ifndef MacMoveWindow
- PyMac_PRECHECK(MacMoveWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "hhb",
- &hGlobal,
- &vGlobal,
- &front))
- return NULL;
- MacMoveWindow(_self->ob_itself,
- hGlobal,
- vGlobal,
- front);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_SizeWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- short w;
- short h;
- Boolean fUpdate;
- #ifndef SizeWindow
- PyMac_PRECHECK(SizeWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "hhb",
- &w,
- &h,
- &fUpdate))
- return NULL;
- SizeWindow(_self->ob_itself,
- w,
- h,
- fUpdate);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GrowWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- long _rv;
- Point startPt;
- Rect bBox;
- #ifndef GrowWindow
- PyMac_PRECHECK(GrowWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &startPt,
- PyMac_GetRect, &bBox))
- return NULL;
- _rv = GrowWindow(_self->ob_itself,
- startPt,
- &bBox);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
- }
- static PyObject *WinObj_DragWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Point startPt;
- Rect boundsRect;
- #ifndef DragWindow
- PyMac_PRECHECK(DragWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &startPt,
- PyMac_GetRect, &boundsRect))
- return NULL;
- DragWindow(_self->ob_itself,
- startPt,
- &boundsRect);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ZoomWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- WindowPartCode partCode;
- Boolean front;
- #ifndef ZoomWindow
- PyMac_PRECHECK(ZoomWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "hb",
- &partCode,
- &front))
- return NULL;
- ZoomWindow(_self->ob_itself,
- partCode,
- front);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_IsWindowCollapsable(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- #ifndef IsWindowCollapsable
- PyMac_PRECHECK(IsWindowCollapsable);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = IsWindowCollapsable(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *WinObj_IsWindowCollapsed(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- #ifndef IsWindowCollapsed
- PyMac_PRECHECK(IsWindowCollapsed);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = IsWindowCollapsed(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *WinObj_CollapseWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Boolean collapse;
- #ifndef CollapseWindow
- PyMac_PRECHECK(CollapseWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "b",
- &collapse))
- return NULL;
- _err = CollapseWindow(_self->ob_itself,
- collapse);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowBounds(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowRegionCode regionCode;
- Rect globalBounds;
- #ifndef GetWindowBounds
- PyMac_PRECHECK(GetWindowBounds);
- #endif
- if (!PyArg_ParseTuple(_args, "H",
- ®ionCode))
- return NULL;
- _err = GetWindowBounds(_self->ob_itself,
- regionCode,
- &globalBounds);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &globalBounds);
- return _res;
- }
- static PyObject *WinObj_ResizeWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- Point inStartPoint;
- Rect inSizeConstraints;
- Rect outNewContentRect;
- #ifndef ResizeWindow
- PyMac_PRECHECK(ResizeWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &inStartPoint,
- PyMac_GetRect, &inSizeConstraints))
- return NULL;
- _rv = ResizeWindow(_self->ob_itself,
- inStartPoint,
- &inSizeConstraints,
- &outNewContentRect);
- _res = Py_BuildValue("bO&",
- _rv,
- PyMac_BuildRect, &outNewContentRect);
- return _res;
- }
- static PyObject *WinObj_SetWindowBounds(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowRegionCode regionCode;
- Rect globalBounds;
- #ifndef SetWindowBounds
- PyMac_PRECHECK(SetWindowBounds);
- #endif
- if (!PyArg_ParseTuple(_args, "HO&",
- ®ionCode,
- PyMac_GetRect, &globalBounds))
- return NULL;
- _err = SetWindowBounds(_self->ob_itself,
- regionCode,
- &globalBounds);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_RepositionWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowPtr parentWindow;
- WindowPositionMethod method;
- #ifndef RepositionWindow
- PyMac_PRECHECK(RepositionWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "O&l",
- WinObj_Convert, &parentWindow,
- &method))
- return NULL;
- _err = RepositionWindow(_self->ob_itself,
- parentWindow,
- method);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_MoveWindowStructure(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- short hGlobal;
- short vGlobal;
- #ifndef MoveWindowStructure
- PyMac_PRECHECK(MoveWindowStructure);
- #endif
- if (!PyArg_ParseTuple(_args, "hh",
- &hGlobal,
- &vGlobal))
- return NULL;
- _err = MoveWindowStructure(_self->ob_itself,
- hGlobal,
- vGlobal);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_IsWindowInStandardState(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- Point inIdealSize;
- Rect outIdealStandardState;
- #ifndef IsWindowInStandardState
- PyMac_PRECHECK(IsWindowInStandardState);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &inIdealSize))
- return NULL;
- _rv = IsWindowInStandardState(_self->ob_itself,
- &inIdealSize,
- &outIdealStandardState);
- _res = Py_BuildValue("bO&",
- _rv,
- PyMac_BuildRect, &outIdealStandardState);
- return _res;
- }
- static PyObject *WinObj_ZoomWindowIdeal(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowPartCode inPartCode;
- Point ioIdealSize;
- #ifndef ZoomWindowIdeal
- PyMac_PRECHECK(ZoomWindowIdeal);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &inPartCode))
- return NULL;
- _err = ZoomWindowIdeal(_self->ob_itself,
- inPartCode,
- &ioIdealSize);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, ioIdealSize);
- return _res;
- }
- static PyObject *WinObj_GetWindowIdealUserState(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Rect outUserState;
- #ifndef GetWindowIdealUserState
- PyMac_PRECHECK(GetWindowIdealUserState);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetWindowIdealUserState(_self->ob_itself,
- &outUserState);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &outUserState);
- return _res;
- }
- static PyObject *WinObj_SetWindowIdealUserState(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Rect inUserState;
- #ifndef SetWindowIdealUserState
- PyMac_PRECHECK(SetWindowIdealUserState);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &inUserState))
- return NULL;
- _err = SetWindowIdealUserState(_self->ob_itself,
- &inUserState);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetWindowGreatestAreaDevice(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowRegionCode inRegion;
- GDHandle outGreatestDevice;
- Rect outGreatestDeviceRect;
- #ifndef GetWindowGreatestAreaDevice
- PyMac_PRECHECK(GetWindowGreatestAreaDevice);
- #endif
- if (!PyArg_ParseTuple(_args, "H",
- &inRegion))
- return NULL;
- _err = GetWindowGreatestAreaDevice(_self->ob_itself,
- inRegion,
- &outGreatestDevice,
- &outGreatestDeviceRect);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&O&",
- ResObj_New, outGreatestDevice,
- PyMac_BuildRect, &outGreatestDeviceRect);
- return _res;
- }
- static PyObject *WinObj_ConstrainWindowToScreen(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowRegionCode inRegionCode;
- WindowConstrainOptions inOptions;
- Rect inScreenRect;
- Rect outStructure;
- #ifndef ConstrainWindowToScreen
- PyMac_PRECHECK(ConstrainWindowToScreen);
- #endif
- if (!PyArg_ParseTuple(_args, "HlO&",
- &inRegionCode,
- &inOptions,
- PyMac_GetRect, &inScreenRect))
- return NULL;
- _err = ConstrainWindowToScreen(_self->ob_itself,
- inRegionCode,
- inOptions,
- &inScreenRect,
- &outStructure);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &outStructure);
- return _res;
- }
- static PyObject *WinObj_HideWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef HideWindow
- PyMac_PRECHECK(HideWindow);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- HideWindow(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_MacShowWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef MacShowWindow
- PyMac_PRECHECK(MacShowWindow);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- MacShowWindow(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_ShowHide(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean showFlag;
- #ifndef ShowHide
- PyMac_PRECHECK(ShowHide);
- #endif
- if (!PyArg_ParseTuple(_args, "b",
- &showFlag))
- return NULL;
- ShowHide(_self->ob_itself,
- showFlag);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_MacIsWindowVisible(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- #ifndef MacIsWindowVisible
- PyMac_PRECHECK(MacIsWindowVisible);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = MacIsWindowVisible(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *WinObj_ShowSheetWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowPtr inParentWindow;
- #ifndef ShowSheetWindow
- PyMac_PRECHECK(ShowSheetWindow);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- WinObj_Convert, &inParentWindow))
- return NULL;
- _err = ShowSheetWindow(_self->ob_itself,
- inParentWindow);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_HideSheetWindow(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- #ifndef HideSheetWindow
- PyMac_PRECHECK(HideSheetWindow);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = HideSheetWindow(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *WinObj_GetSheetWindowParent(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- WindowPtr outParentWindow;
- #ifndef GetSheetWindowParent
- PyMac_PRECHECK(GetSheetWindowParent);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetSheetWindowParent(_self->ob_itself,
- &outParentWindow);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- WinObj_WhichWindow, outParentWindow);
- return _res;
- }
- static PyObject *WinObj_GetWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- OSType propertyCreator;
- OSType propertyTag;
- UInt32 attributes;
- #ifndef GetWindowPropertyAttributes
- PyMac_PRECHECK(GetWindowPropertyAttributes);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetOSType, &propertyCreator,
- PyMac_GetOSType, &propertyTag))
- return NULL;
- _err = GetWindowPropertyAttributes(_self->ob_itself,
- propertyCreator,…