summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-08-23 14:02:09 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-08-23 14:02:09 (GMT)
commit50ecb0ad835480e6a3446613ceeffa78a7bd2de3 (patch)
tree1d0f290f8cfb9bd0c78bd56960c0eb9b54f54581 /Mac/Modules
parent3cbf6d9d6ecd21a1dc4316c9f5620c422a45ae41 (diff)
downloadcpython-50ecb0ad835480e6a3446613ceeffa78a7bd2de3.zip
cpython-50ecb0ad835480e6a3446613ceeffa78a7bd2de3.tar.gz
cpython-50ecb0ad835480e6a3446613ceeffa78a7bd2de3.tar.bz2
Renamed the Mac toolbox modules to have an initial _ in their name.
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/ae/_AEmodule.c1283
-rw-r--r--Mac/Modules/app/_Appmodule.c1176
-rw-r--r--Mac/Modules/cf/_CFmodule.c3179
-rw-r--r--Mac/Modules/cm/_Cmmodule.c798
-rw-r--r--Mac/Modules/ctl/_Ctlmodule.c2694
-rw-r--r--Mac/Modules/dlg/_Dlgmodule.c1434
-rw-r--r--Mac/Modules/drag/_Dragmodule.c1012
-rw-r--r--Mac/Modules/evt/_Evtmodule.c459
-rw-r--r--Mac/Modules/fm/_Fmmodule.c359
-rw-r--r--Mac/Modules/help/_Helpmodule.c300
-rw-r--r--Mac/Modules/icn/_Icnmodule.c1417
-rw-r--r--Mac/Modules/list/_Listmodule.c1009
-rw-r--r--Mac/Modules/menu/_Menumodule.c2566
-rw-r--r--Mac/Modules/mlte/_Mltemodule.c1392
-rw-r--r--Mac/Modules/qd/_Qdmodule.c5695
-rw-r--r--Mac/Modules/qdoffs/_Qdoffsmodule.c604
-rw-r--r--Mac/Modules/qt/_Qtmodule.c8426
-rw-r--r--Mac/Modules/res/_Resmodule.c1587
-rw-r--r--Mac/Modules/scrap/_Scrapmodule.c260
-rw-r--r--Mac/Modules/snd/_Sndihooks.c513
-rw-r--r--Mac/Modules/snd/_Sndmodule.c1462
-rw-r--r--Mac/Modules/te/_TEmodule.c1040
-rw-r--r--Mac/Modules/win/_Winmodule.c2814
23 files changed, 41479 insertions, 0 deletions
diff --git a/Mac/Modules/ae/_AEmodule.c b/Mac/Modules/ae/_AEmodule.c
new file mode 100644
index 0000000..6b6e7dc
--- /dev/null
+++ b/Mac/Modules/ae/_AEmodule.c
@@ -0,0 +1,1283 @@
+
+/* =========================== Module _AE =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <AppleEvents.h>
+#include <AEObjects.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_AEDesc_New(AEDesc *);
+extern int _AEDesc_Convert(PyObject *, AEDesc *);
+
+#define AEDesc_New _AEDesc_New
+#define AEDesc_Convert _AEDesc_Convert
+#endif
+
+static pascal OSErr GenericEventHandler(); /* Forward */
+
+AEEventHandlerUPP upp_GenericEventHandler;
+
+static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn)
+{
+ if ( PyOS_InterruptOccurred() )
+ return 1;
+ if ( PyMac_HandleEvent(theEvent) < 0 ) {
+ PySys_WriteStderr("Exception in user event handler during AE processing\n");
+ PyErr_Clear();
+ }
+ return 0;
+}
+
+AEIdleUPP upp_AEIdleProc;
+
+static PyObject *AE_Error;
+
+/* ----------------------- Object type AEDesc ----------------------- */
+
+PyTypeObject AEDesc_Type;
+
+#define AEDesc_Check(x) ((x)->ob_type == &AEDesc_Type)
+
+typedef struct AEDescObject {
+ PyObject_HEAD
+ AEDesc ob_itself;
+} AEDescObject;
+
+PyObject *AEDesc_New(AEDesc *itself)
+{
+ AEDescObject *it;
+ it = PyObject_NEW(AEDescObject, &AEDesc_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = *itself;
+ return (PyObject *)it;
+}
+AEDesc_Convert(PyObject *v, AEDesc *p_itself)
+{
+ if (!AEDesc_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "AEDesc required");
+ return 0;
+ }
+ *p_itself = ((AEDescObject *)v)->ob_itself;
+ return 1;
+}
+
+static void AEDesc_dealloc(AEDescObject *self)
+{
+ AEDisposeDesc(&self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *AEDesc_AECoerceDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType toType;
+ AEDesc result;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &toType))
+ return NULL;
+ _err = AECoerceDesc(&_self->ob_itself,
+ toType,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AEDuplicateDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEDesc result;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEDuplicateDesc(&_self->ob_itself,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AECountItems(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long theCount;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AECountItems(&_self->ob_itself,
+ &theCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ theCount);
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutPtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "lO&s#",
+ &index,
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEPutPtr(&_self->ob_itself,
+ index,
+ typeCode,
+ dataPtr__in__, dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ AEDesc theAEDesc;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &index,
+ AEDesc_Convert, &theAEDesc))
+ return NULL;
+ _err = AEPutDesc(&_self->ob_itself,
+ index,
+ &theAEDesc);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetNthPtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ DescType desiredType;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ char *dataPtr__out__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "lO&i",
+ &index,
+ PyMac_GetOSType, &desiredType,
+ &dataPtr__in_len__))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEGetNthPtr(&_self->ob_itself,
+ index,
+ desiredType,
+ &theAEKeyword,
+ &typeCode,
+ dataPtr__out__, dataPtr__len__, &dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&s#",
+ PyMac_BuildOSType, theAEKeyword,
+ PyMac_BuildOSType, typeCode,
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetNthDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ DescType desiredType;
+ AEKeyword theAEKeyword;
+ AEDesc result;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &index,
+ PyMac_GetOSType, &desiredType))
+ return NULL;
+ _err = AEGetNthDesc(&_self->ob_itself,
+ index,
+ desiredType,
+ &theAEKeyword,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildOSType, theAEKeyword,
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AESizeOfNthItem(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ DescType typeCode;
+ Size dataSize;
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
+ return NULL;
+ _err = AESizeOfNthItem(&_self->ob_itself,
+ index,
+ &typeCode,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ PyMac_BuildOSType, typeCode,
+ dataSize);
+ return _res;
+}
+
+static PyObject *AEDesc_AEDeleteItem(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
+ return NULL;
+ _err = AEDeleteItem(&_self->ob_itself,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutParamPtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&O&s#",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEPutParamPtr(&_self->ob_itself,
+ theAEKeyword,
+ typeCode,
+ dataPtr__in__, dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutParamDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ AEDesc theAEDesc;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEKeyword,
+ AEDesc_Convert, &theAEDesc))
+ return NULL;
+ _err = AEPutParamDesc(&_self->ob_itself,
+ theAEKeyword,
+ &theAEDesc);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetParamPtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType desiredType;
+ DescType typeCode;
+ char *dataPtr__out__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&O&i",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &desiredType,
+ &dataPtr__in_len__))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEGetParamPtr(&_self->ob_itself,
+ theAEKeyword,
+ desiredType,
+ &typeCode,
+ dataPtr__out__, dataPtr__len__, &dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&s#",
+ PyMac_BuildOSType, typeCode,
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetParamDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType desiredType;
+ AEDesc result;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &desiredType))
+ return NULL;
+ _err = AEGetParamDesc(&_self->ob_itself,
+ theAEKeyword,
+ desiredType,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AESizeOfParam(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ Size dataSize;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theAEKeyword))
+ return NULL;
+ _err = AESizeOfParam(&_self->ob_itself,
+ theAEKeyword,
+ &typeCode,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ PyMac_BuildOSType, typeCode,
+ dataSize);
+ return _res;
+}
+
+static PyObject *AEDesc_AEDeleteParam(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theAEKeyword))
+ return NULL;
+ _err = AEDeleteParam(&_self->ob_itself,
+ theAEKeyword);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetAttributePtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType desiredType;
+ DescType typeCode;
+ char *dataPtr__out__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&O&i",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &desiredType,
+ &dataPtr__in_len__))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEGetAttributePtr(&_self->ob_itself,
+ theAEKeyword,
+ desiredType,
+ &typeCode,
+ dataPtr__out__, dataPtr__len__, &dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&s#",
+ PyMac_BuildOSType, typeCode,
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetAttributeDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType desiredType;
+ AEDesc result;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &desiredType))
+ return NULL;
+ _err = AEGetAttributeDesc(&_self->ob_itself,
+ theAEKeyword,
+ desiredType,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+static PyObject *AEDesc_AESizeOfAttribute(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ Size dataSize;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theAEKeyword))
+ return NULL;
+ _err = AESizeOfAttribute(&_self->ob_itself,
+ theAEKeyword,
+ &typeCode,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ PyMac_BuildOSType, typeCode,
+ dataSize);
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutAttributePtr(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&O&s#",
+ PyMac_GetOSType, &theAEKeyword,
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEPutAttributePtr(&_self->ob_itself,
+ theAEKeyword,
+ typeCode,
+ dataPtr__in__, dataPtr__len__);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AEDesc_AEPutAttributeDesc(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword theAEKeyword;
+ AEDesc theAEDesc;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEKeyword,
+ AEDesc_Convert, &theAEDesc))
+ return NULL;
+ _err = AEPutAttributeDesc(&_self->ob_itself,
+ theAEKeyword,
+ &theAEDesc);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *AEDesc_AEGetDescDataSize(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Size _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = AEGetDescDataSize(&_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *AEDesc_AESend(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AppleEvent reply;
+ AESendMode sendMode;
+ AESendPriority sendPriority;
+ long timeOutInTicks;
+ if (!PyArg_ParseTuple(_args, "lhl",
+ &sendMode,
+ &sendPriority,
+ &timeOutInTicks))
+ return NULL;
+ _err = AESend(&_self->ob_itself,
+ &reply,
+ sendMode,
+ sendPriority,
+ timeOutInTicks,
+ upp_AEIdleProc,
+ (AEFilterUPP)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &reply);
+ return _res;
+}
+
+static PyObject *AEDesc_AEResetTimer(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEResetTimer(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AESuspendTheCurrentEvent(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AESuspendTheCurrentEvent(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEResumeTheCurrentEvent(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AppleEvent reply;
+ AEEventHandlerUPP dispatcher__proc__ = upp_GenericEventHandler;
+ PyObject *dispatcher;
+ if (!PyArg_ParseTuple(_args, "O&O",
+ AEDesc_Convert, &reply,
+ &dispatcher))
+ return NULL;
+ _err = AEResumeTheCurrentEvent(&_self->ob_itself,
+ &reply,
+ dispatcher__proc__, (long)dispatcher);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ Py_INCREF(dispatcher); /* XXX leak, but needed */
+ return _res;
+}
+
+static PyObject *AEDesc_AEGetTheCurrentEvent(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEGetTheCurrentEvent(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AESetTheCurrentEvent(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AESetTheCurrentEvent(&_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AEDesc_AEResolve(AEDescObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short callbackFlags;
+ AEDesc theToken;
+ if (!PyArg_ParseTuple(_args, "h",
+ &callbackFlags))
+ return NULL;
+ _err = AEResolve(&_self->ob_itself,
+ callbackFlags,
+ &theToken);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &theToken);
+ return _res;
+}
+
+static PyMethodDef AEDesc_methods[] = {
+ {"AECoerceDesc", (PyCFunction)AEDesc_AECoerceDesc, 1,
+ "(DescType toType) -> (AEDesc result)"},
+ {"AEDuplicateDesc", (PyCFunction)AEDesc_AEDuplicateDesc, 1,
+ "() -> (AEDesc result)"},
+ {"AECountItems", (PyCFunction)AEDesc_AECountItems, 1,
+ "() -> (long theCount)"},
+ {"AEPutPtr", (PyCFunction)AEDesc_AEPutPtr, 1,
+ "(long index, DescType typeCode, Buffer dataPtr) -> None"},
+ {"AEPutDesc", (PyCFunction)AEDesc_AEPutDesc, 1,
+ "(long index, AEDesc theAEDesc) -> None"},
+ {"AEGetNthPtr", (PyCFunction)AEDesc_AEGetNthPtr, 1,
+ "(long index, DescType desiredType, Buffer dataPtr) -> (AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr)"},
+ {"AEGetNthDesc", (PyCFunction)AEDesc_AEGetNthDesc, 1,
+ "(long index, DescType desiredType) -> (AEKeyword theAEKeyword, AEDesc result)"},
+ {"AESizeOfNthItem", (PyCFunction)AEDesc_AESizeOfNthItem, 1,
+ "(long index) -> (DescType typeCode, Size dataSize)"},
+ {"AEDeleteItem", (PyCFunction)AEDesc_AEDeleteItem, 1,
+ "(long index) -> None"},
+ {"AEPutParamPtr", (PyCFunction)AEDesc_AEPutParamPtr, 1,
+ "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"},
+ {"AEPutParamDesc", (PyCFunction)AEDesc_AEPutParamDesc, 1,
+ "(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"},
+ {"AEGetParamPtr", (PyCFunction)AEDesc_AEGetParamPtr, 1,
+ "(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)"},
+ {"AEGetParamDesc", (PyCFunction)AEDesc_AEGetParamDesc, 1,
+ "(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)"},
+ {"AESizeOfParam", (PyCFunction)AEDesc_AESizeOfParam, 1,
+ "(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)"},
+ {"AEDeleteParam", (PyCFunction)AEDesc_AEDeleteParam, 1,
+ "(AEKeyword theAEKeyword) -> None"},
+ {"AEGetAttributePtr", (PyCFunction)AEDesc_AEGetAttributePtr, 1,
+ "(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)"},
+ {"AEGetAttributeDesc", (PyCFunction)AEDesc_AEGetAttributeDesc, 1,
+ "(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)"},
+ {"AESizeOfAttribute", (PyCFunction)AEDesc_AESizeOfAttribute, 1,
+ "(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)"},
+ {"AEPutAttributePtr", (PyCFunction)AEDesc_AEPutAttributePtr, 1,
+ "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"},
+ {"AEPutAttributeDesc", (PyCFunction)AEDesc_AEPutAttributeDesc, 1,
+ "(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"AEGetDescDataSize", (PyCFunction)AEDesc_AEGetDescDataSize, 1,
+ "() -> (Size _rv)"},
+#endif
+ {"AESend", (PyCFunction)AEDesc_AESend, 1,
+ "(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)"},
+ {"AEResetTimer", (PyCFunction)AEDesc_AEResetTimer, 1,
+ "() -> None"},
+ {"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1,
+ "() -> None"},
+ {"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1,
+ "(AppleEvent reply, EventHandler dispatcher) -> None"},
+ {"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1,
+ "() -> None"},
+ {"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1,
+ "() -> None"},
+ {"AEResolve", (PyCFunction)AEDesc_AEResolve, 1,
+ "(short callbackFlags) -> (AEDesc theToken)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain AEDesc_chain = { AEDesc_methods, NULL };
+
+static PyObject *AEDesc_getattr(AEDescObject *self, char *name)
+{
+
+ if (strcmp(name, "type") == 0)
+ return PyMac_BuildOSType(self->ob_itself.descriptorType);
+ if (strcmp(name, "data") == 0) {
+ PyObject *res;
+#if !TARGET_API_MAC_CARBON
+ char state;
+ state = HGetState(self->ob_itself.dataHandle);
+ HLock(self->ob_itself.dataHandle);
+ res = PyString_FromStringAndSize(
+ *self->ob_itself.dataHandle,
+ GetHandleSize(self->ob_itself.dataHandle));
+ HUnlock(self->ob_itself.dataHandle);
+ HSetState(self->ob_itself.dataHandle, state);
+#else
+ Size size;
+ char *ptr;
+ OSErr err;
+
+ size = AEGetDescDataSize(&self->ob_itself);
+ if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL )
+ return NULL;
+ if ( (ptr = PyString_AsString(res)) == NULL )
+ return NULL;
+ if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 )
+ return PyMac_Error(err);
+#endif
+ return res;
+ }
+ if (strcmp(name, "__members__") == 0)
+ return Py_BuildValue("[ss]", "data", "type");
+
+ return Py_FindMethodInChain(&AEDesc_chain, (PyObject *)self, name);
+}
+
+#define AEDesc_setattr NULL
+
+#define AEDesc_compare NULL
+
+#define AEDesc_repr NULL
+
+#define AEDesc_hash NULL
+
+PyTypeObject AEDesc_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "AEDesc", /*tp_name*/
+ sizeof(AEDescObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) AEDesc_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) AEDesc_getattr, /*tp_getattr*/
+ (setattrfunc) AEDesc_setattr, /*tp_setattr*/
+ (cmpfunc) AEDesc_compare, /*tp_compare*/
+ (reprfunc) AEDesc_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) AEDesc_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type AEDesc --------------------- */
+
+
+static PyObject *AE_AECoercePtr(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ DescType toType;
+ AEDesc result;
+ if (!PyArg_ParseTuple(_args, "O&s#O&",
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__,
+ PyMac_GetOSType, &toType))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AECoercePtr(typeCode,
+ dataPtr__in__, dataPtr__len__,
+ toType,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AE_AECreateDesc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ AEDesc result;
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AECreateDesc(typeCode,
+ dataPtr__in__, dataPtr__len__,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AE_AECreateList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ char *factoringPtr__in__;
+ long factoringPtr__len__;
+ int factoringPtr__in_len__;
+ Boolean isRecord;
+ AEDescList resultList;
+ if (!PyArg_ParseTuple(_args, "s#b",
+ &factoringPtr__in__, &factoringPtr__in_len__,
+ &isRecord))
+ return NULL;
+ factoringPtr__len__ = factoringPtr__in_len__;
+ _err = AECreateList(factoringPtr__in__, factoringPtr__len__,
+ isRecord,
+ &resultList);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &resultList);
+ factoringPtr__error__: ;
+ return _res;
+}
+
+static PyObject *AE_AECreateAppleEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEEventClass theAEEventClass;
+ AEEventID theAEEventID;
+ AEAddressDesc target;
+ AEReturnID returnID;
+ AETransactionID transactionID;
+ AppleEvent result;
+ if (!PyArg_ParseTuple(_args, "O&O&O&hl",
+ PyMac_GetOSType, &theAEEventClass,
+ PyMac_GetOSType, &theAEEventID,
+ AEDesc_Convert, &target,
+ &returnID,
+ &transactionID))
+ return NULL;
+ _err = AECreateAppleEvent(theAEEventClass,
+ theAEEventID,
+ &target,
+ returnID,
+ transactionID,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &result);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *AE_AEReplaceDescData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType typeCode;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ AEDesc theAEDesc;
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetOSType, &typeCode,
+ &dataPtr__in__, &dataPtr__in_len__))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AEReplaceDescData(typeCode,
+ dataPtr__in__, dataPtr__len__,
+ &theAEDesc);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &theAEDesc);
+ dataPtr__error__: ;
+ return _res;
+}
+#endif
+
+static PyObject *AE_AEProcessAppleEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ EventRecord theEventRecord;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEventRecord))
+ return NULL;
+ _err = AEProcessAppleEvent(&theEventRecord);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEGetInteractionAllowed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEInteractAllowed level;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEGetInteractionAllowed(&level);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ level);
+ return _res;
+}
+
+static PyObject *AE_AESetInteractionAllowed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEInteractAllowed level;
+ if (!PyArg_ParseTuple(_args, "b",
+ &level))
+ return NULL;
+ _err = AESetInteractionAllowed(level);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEInteractWithUser(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long timeOutInTicks;
+ if (!PyArg_ParseTuple(_args, "l",
+ &timeOutInTicks))
+ return NULL;
+ _err = AEInteractWithUser(timeOutInTicks,
+ (NMRecPtr)0,
+ upp_AEIdleProc);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEInstallEventHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEEventClass theAEEventClass;
+ AEEventID theAEEventID;
+ AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler;
+ PyObject *handler;
+ if (!PyArg_ParseTuple(_args, "O&O&O",
+ PyMac_GetOSType, &theAEEventClass,
+ PyMac_GetOSType, &theAEEventID,
+ &handler))
+ return NULL;
+ _err = AEInstallEventHandler(theAEEventClass,
+ theAEEventID,
+ handler__proc__, (long)handler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ Py_INCREF(handler); /* XXX leak, but needed */
+ return _res;
+}
+
+static PyObject *AE_AERemoveEventHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEEventClass theAEEventClass;
+ AEEventID theAEEventID;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEEventClass,
+ PyMac_GetOSType, &theAEEventID))
+ return NULL;
+ _err = AERemoveEventHandler(theAEEventClass,
+ theAEEventID,
+ upp_GenericEventHandler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEGetEventHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEEventClass theAEEventClass;
+ AEEventID theAEEventID;
+ AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler;
+ PyObject *handler;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theAEEventClass,
+ PyMac_GetOSType, &theAEEventID))
+ return NULL;
+ _err = AEGetEventHandler(theAEEventClass,
+ theAEEventID,
+ &handler__proc__, (long *)&handler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O",
+ handler);
+ Py_INCREF(handler); /* XXX leak, but needed */
+ return _res;
+}
+
+static PyObject *AE_AEInstallSpecialHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword functionClass;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &functionClass))
+ return NULL;
+ _err = AEInstallSpecialHandler(functionClass,
+ upp_GenericEventHandler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AERemoveSpecialHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword functionClass;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &functionClass))
+ return NULL;
+ _err = AERemoveSpecialHandler(functionClass,
+ upp_GenericEventHandler,
+ 0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEManagerInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEKeyword keyWord;
+ long result;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &keyWord))
+ return NULL;
+ _err = AEManagerInfo(keyWord,
+ &result);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ result);
+ return _res;
+}
+
+static PyObject *AE_AEObjectInit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEObjectInit();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *AE_AEDisposeToken(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEDesc theToken;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AEDisposeToken(&theToken);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &theToken);
+ return _res;
+}
+
+static PyObject *AE_AECallObjectAccessor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DescType desiredClass;
+ AEDesc containerToken;
+ DescType containerClass;
+ DescType keyForm;
+ AEDesc keyData;
+ AEDesc token;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&",
+ PyMac_GetOSType, &desiredClass,
+ AEDesc_Convert, &containerToken,
+ PyMac_GetOSType, &containerClass,
+ PyMac_GetOSType, &keyForm,
+ AEDesc_Convert, &keyData))
+ return NULL;
+ _err = AECallObjectAccessor(desiredClass,
+ &containerToken,
+ containerClass,
+ keyForm,
+ &keyData,
+ &token);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &token);
+ return _res;
+}
+
+static PyMethodDef AE_methods[] = {
+ {"AECoercePtr", (PyCFunction)AE_AECoercePtr, 1,
+ "(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)"},
+ {"AECreateDesc", (PyCFunction)AE_AECreateDesc, 1,
+ "(DescType typeCode, Buffer dataPtr) -> (AEDesc result)"},
+ {"AECreateList", (PyCFunction)AE_AECreateList, 1,
+ "(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"},
+ {"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1,
+ "(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)"},
+
+#if TARGET_API_MAC_CARBON
+ {"AEReplaceDescData", (PyCFunction)AE_AEReplaceDescData, 1,
+ "(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)"},
+#endif
+ {"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1,
+ "(EventRecord theEventRecord) -> None"},
+ {"AEGetInteractionAllowed", (PyCFunction)AE_AEGetInteractionAllowed, 1,
+ "() -> (AEInteractAllowed level)"},
+ {"AESetInteractionAllowed", (PyCFunction)AE_AESetInteractionAllowed, 1,
+ "(AEInteractAllowed level) -> None"},
+ {"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1,
+ "(long timeOutInTicks) -> None"},
+ {"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1,
+ "(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None"},
+ {"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1,
+ "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"},
+ {"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1,
+ "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"},
+ {"AEInstallSpecialHandler", (PyCFunction)AE_AEInstallSpecialHandler, 1,
+ "(AEKeyword functionClass) -> None"},
+ {"AERemoveSpecialHandler", (PyCFunction)AE_AERemoveSpecialHandler, 1,
+ "(AEKeyword functionClass) -> None"},
+ {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1,
+ "(AEKeyword keyWord) -> (long result)"},
+ {"AEObjectInit", (PyCFunction)AE_AEObjectInit, 1,
+ "() -> None"},
+ {"AEDisposeToken", (PyCFunction)AE_AEDisposeToken, 1,
+ "() -> (AEDesc theToken)"},
+ {"AECallObjectAccessor", (PyCFunction)AE_AECallObjectAccessor, 1,
+ "(DescType desiredClass, AEDesc containerToken, DescType containerClass, DescType keyForm, AEDesc keyData) -> (AEDesc token)"},
+ {NULL, NULL, 0}
+};
+
+
+
+#if UNIVERSAL_INTERFACES_VERSION >= 0x0340
+typedef long refcontype;
+#else
+typedef unsigned long refcontype;
+#endif
+
+static pascal OSErr
+GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon)
+{
+ PyObject *handler = (PyObject *)refcon;
+ AEDescObject *requestObject, *replyObject;
+ PyObject *args, *res;
+ if ((requestObject = (AEDescObject *)AEDesc_New((AppleEvent *)request)) == NULL) {
+ return -1;
+ }
+ if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) {
+ Py_DECREF(requestObject);
+ return -1;
+ }
+ if ((args = Py_BuildValue("OO", requestObject, replyObject)) == NULL) {
+ Py_DECREF(requestObject);
+ Py_DECREF(replyObject);
+ return -1;
+ }
+ res = PyEval_CallObject(handler, args);
+ requestObject->ob_itself.descriptorType = 'null';
+ requestObject->ob_itself.dataHandle = NULL;
+ replyObject->ob_itself.descriptorType = 'null';
+ replyObject->ob_itself.dataHandle = NULL;
+ Py_DECREF(args);
+ if (res == NULL)
+ return -1;
+ Py_DECREF(res);
+ return noErr;
+}
+
+
+void init_AE(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ upp_AEIdleProc = NewAEIdleUPP(AEIdleProc);
+#if UNIVERSAL_INTERFACES_VERSION >= 0x03400
+ upp_GenericEventHandler = NewAEEventHandlerUPP(&GenericEventHandler);
+#else
+ upp_GenericEventHandler = NewAEEventHandlerUPP(GenericEventHandler);
+#endif
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc, AEDesc_Convert);
+
+
+ m = Py_InitModule("_AE", AE_methods);
+ d = PyModule_GetDict(m);
+ AE_Error = PyMac_GetOSErrException();
+ if (AE_Error == NULL ||
+ PyDict_SetItemString(d, "Error", AE_Error) != 0)
+ return;
+ AEDesc_Type.ob_type = &PyType_Type;
+ Py_INCREF(&AEDesc_Type);
+ if (PyDict_SetItemString(d, "AEDescType", (PyObject *)&AEDesc_Type) != 0)
+ Py_FatalError("can't initialize AEDescType");
+}
+
+/* ========================= End module _AE ========================= */
+
diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c
new file mode 100644
index 0000000..b70feda
--- /dev/null
+++ b/Mac/Modules/app/_Appmodule.c
@@ -0,0 +1,1176 @@
+
+/* ========================== Module _App =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Appearance.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+
+static PyObject *App_Error;
+
+static PyObject *App_RegisterAppearanceClient(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = RegisterAppearanceClient();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_UnregisterAppearanceClient(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UnregisterAppearanceClient();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemePen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeBrush inBrush;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inBrush,
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetThemePen(inBrush,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeBrush inBrush;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inBrush,
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetThemeBackground(inBrush,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeTextColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeTextColor inColor;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inColor,
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetThemeTextColor(inColor,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeWindowBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ThemeBrush inBrush;
+ Boolean inUpdate;
+ if (!PyArg_ParseTuple(_args, "O&hb",
+ WinObj_Convert, &inWindow,
+ &inBrush,
+ &inUpdate))
+ return NULL;
+ _err = SetThemeWindowBackground(inWindow,
+ inBrush,
+ inUpdate);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeWindowHeader(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeWindowHeader(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeWindowListViewHeader(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeWindowListViewHeader(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemePlacard(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemePlacard(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeEditTextFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeEditTextFrame(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeListBoxFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeListBoxFrame(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeFocusRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ Boolean inHasFocus;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetRect, &inRect,
+ &inHasFocus))
+ return NULL;
+ _err = DrawThemeFocusRect(&inRect,
+ inHasFocus);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemePrimaryGroup(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemePrimaryGroup(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeSecondaryGroup(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeSecondaryGroup(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeSeparator(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeSeparator(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeModelessDialogFrame(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeModelessDialogFrame(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeGenericWell(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ Boolean inFillCenter;
+ if (!PyArg_ParseTuple(_args, "O&lb",
+ PyMac_GetRect, &inRect,
+ &inState,
+ &inFillCenter))
+ return NULL;
+ _err = DrawThemeGenericWell(&inRect,
+ inState,
+ inFillCenter);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeFocusRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean inHasFocus;
+ if (!PyArg_ParseTuple(_args, "b",
+ &inHasFocus))
+ return NULL;
+ _err = DrawThemeFocusRegion((RgnHandle)0,
+ inHasFocus);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_IsThemeInColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _rv = IsThemeInColor(inDepth,
+ inIsColorDevice);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *App_GetThemeAccentColors(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CTabHandle outColors;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeAccentColors(&outColors);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, outColors);
+ return _res;
+}
+
+static PyObject *App_DrawThemeMenuBarBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ ThemeMenuBarState inState;
+ UInt32 inAttributes;
+ if (!PyArg_ParseTuple(_args, "O&Hl",
+ PyMac_GetRect, &inBounds,
+ &inState,
+ &inAttributes))
+ return NULL;
+ _err = DrawThemeMenuBarBackground(&inBounds,
+ inState,
+ inAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuBarHeight(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outHeight;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeMenuBarHeight(&outHeight);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outHeight);
+ return _res;
+}
+
+static PyObject *App_DrawThemeMenuBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inMenuRect;
+ ThemeMenuType inMenuType;
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetRect, &inMenuRect,
+ &inMenuType))
+ return NULL;
+ _err = DrawThemeMenuBackground(&inMenuRect,
+ inMenuType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuBackgroundRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inMenuRect;
+ ThemeMenuType menuType;
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetRect, &inMenuRect,
+ &menuType))
+ return NULL;
+ _err = GetThemeMenuBackgroundRegion(&inMenuRect,
+ menuType,
+ (RgnHandle)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeMenuSeparator(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inItemRect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &inItemRect))
+ return NULL;
+ _err = DrawThemeMenuSeparator(&inItemRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuSeparatorHeight(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outHeight;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeMenuSeparatorHeight(&outHeight);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outHeight);
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuItemExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeMenuItemType inItemType;
+ SInt16 outHeight;
+ SInt16 outWidth;
+ if (!PyArg_ParseTuple(_args, "H",
+ &inItemType))
+ return NULL;
+ _err = GetThemeMenuItemExtra(inItemType,
+ &outHeight,
+ &outWidth);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hh",
+ outHeight,
+ outWidth);
+ return _res;
+}
+
+static PyObject *App_GetThemeMenuTitleExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outWidth;
+ Boolean inIsSquished;
+ if (!PyArg_ParseTuple(_args, "b",
+ &inIsSquished))
+ return NULL;
+ _err = GetThemeMenuTitleExtra(&outWidth,
+ inIsSquished);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outWidth);
+ return _res;
+}
+
+static PyObject *App_DrawThemeTabPane(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeDrawState inState;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &inRect,
+ &inState))
+ return NULL;
+ _err = DrawThemeTabPane(&inRect,
+ inState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeTabRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inRect;
+ ThemeTabStyle inStyle;
+ ThemeTabDirection inDirection;
+ if (!PyArg_ParseTuple(_args, "O&HH",
+ PyMac_GetRect, &inRect,
+ &inStyle,
+ &inDirection))
+ return NULL;
+ _err = GetThemeTabRegion(&inRect,
+ inStyle,
+ inDirection,
+ (RgnHandle)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeCursor inCursor;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inCursor))
+ return NULL;
+ _err = SetThemeCursor(inCursor);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetAnimatedThemeCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeCursor inCursor;
+ UInt32 inAnimationStep;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &inCursor,
+ &inAnimationStep))
+ return NULL;
+ _err = SetAnimatedThemeCursor(inCursor,
+ inAnimationStep);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeScrollBarThumbStyle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeScrollBarThumbStyle outStyle;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeScrollBarThumbStyle(&outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outStyle);
+ return _res;
+}
+
+static PyObject *App_GetThemeScrollBarArrowStyle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeScrollBarArrowStyle outStyle;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeScrollBarArrowStyle(&outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outStyle);
+ return _res;
+}
+
+static PyObject *App_GetThemeCheckBoxStyle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeCheckBoxStyle outStyle;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetThemeCheckBoxStyle(&outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outStyle);
+ return _res;
+}
+
+static PyObject *App_UseThemeFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeFontID inFontID;
+ ScriptCode inScript;
+ if (!PyArg_ParseTuple(_args, "Hh",
+ &inFontID,
+ &inScript))
+ return NULL;
+ _err = UseThemeFont(inFontID,
+ inScript);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeScrollBarArrows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ ThemeTrackEnableState enableState;
+ ThemeTrackPressState pressState;
+ Boolean isHoriz;
+ Rect trackBounds;
+ if (!PyArg_ParseTuple(_args, "O&bbb",
+ PyMac_GetRect, &bounds,
+ &enableState,
+ &pressState,
+ &isHoriz))
+ return NULL;
+ _err = DrawThemeScrollBarArrows(&bounds,
+ enableState,
+ pressState,
+ isHoriz,
+ &trackBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &trackBounds);
+ return _res;
+}
+
+static PyObject *App_GetThemeScrollBarTrackRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ ThemeTrackEnableState enableState;
+ ThemeTrackPressState pressState;
+ Boolean isHoriz;
+ Rect trackBounds;
+ if (!PyArg_ParseTuple(_args, "O&bbb",
+ PyMac_GetRect, &bounds,
+ &enableState,
+ &pressState,
+ &isHoriz))
+ return NULL;
+ _err = GetThemeScrollBarTrackRect(&bounds,
+ enableState,
+ pressState,
+ isHoriz,
+ &trackBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &trackBounds);
+ return _res;
+}
+
+static PyObject *App_HitTestThemeScrollBarArrows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect scrollBarBounds;
+ ThemeTrackEnableState enableState;
+ ThemeTrackPressState pressState;
+ Boolean isHoriz;
+ Point ptHit;
+ Rect trackBounds;
+ ControlPartCode partcode;
+ if (!PyArg_ParseTuple(_args, "O&bbbO&",
+ PyMac_GetRect, &scrollBarBounds,
+ &enableState,
+ &pressState,
+ &isHoriz,
+ PyMac_GetPoint, &ptHit))
+ return NULL;
+ _rv = HitTestThemeScrollBarArrows(&scrollBarBounds,
+ enableState,
+ pressState,
+ isHoriz,
+ ptHit,
+ &trackBounds,
+ &partcode);
+ _res = Py_BuildValue("bO&h",
+ _rv,
+ PyMac_BuildRect, &trackBounds,
+ partcode);
+ return _res;
+}
+
+static PyObject *App_DrawThemeScrollBarDelimiters(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeWindowType flavor;
+ Rect inContRect;
+ ThemeDrawState state;
+ ThemeWindowAttributes attributes;
+ if (!PyArg_ParseTuple(_args, "HO&ll",
+ &flavor,
+ PyMac_GetRect, &inContRect,
+ &state,
+ &attributes))
+ return NULL;
+ _err = DrawThemeScrollBarDelimiters(flavor,
+ &inContRect,
+ state,
+ attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_PlayThemeSound(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeSoundKind kind;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &kind))
+ return NULL;
+ _err = PlayThemeSound(kind);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_BeginThemeDragSound(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeDragSoundKind kind;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &kind))
+ return NULL;
+ _err = BeginThemeDragSound(kind);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_EndThemeDragSound(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EndThemeDragSound();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeTickMark(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ ThemeDrawState state;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &bounds,
+ &state))
+ return NULL;
+ _err = DrawThemeTickMark(&bounds,
+ state);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeStandaloneGrowBox(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point origin;
+ ThemeGrowDirection growDirection;
+ Boolean isSmall;
+ ThemeDrawState state;
+ if (!PyArg_ParseTuple(_args, "O&Hbl",
+ PyMac_GetPoint, &origin,
+ &growDirection,
+ &isSmall,
+ &state))
+ return NULL;
+ _err = DrawThemeStandaloneGrowBox(origin,
+ growDirection,
+ isSmall,
+ state);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemeStandaloneNoGrowBox(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point origin;
+ ThemeGrowDirection growDirection;
+ Boolean isSmall;
+ ThemeDrawState state;
+ if (!PyArg_ParseTuple(_args, "O&Hbl",
+ PyMac_GetPoint, &origin,
+ &growDirection,
+ &isSmall,
+ &state))
+ return NULL;
+ _err = DrawThemeStandaloneNoGrowBox(origin,
+ growDirection,
+ isSmall,
+ state);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeStandaloneGrowBoxBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point origin;
+ ThemeGrowDirection growDirection;
+ Boolean isSmall;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, "O&Hb",
+ PyMac_GetPoint, &origin,
+ &growDirection,
+ &isSmall))
+ return NULL;
+ _err = GetThemeStandaloneGrowBoxBounds(origin,
+ growDirection,
+ isSmall,
+ &bounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *App_NormalizeThemeDrawingState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NormalizeThemeDrawingState();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_ApplyThemeBackground(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeBackgroundKind inKind;
+ Rect bounds;
+ ThemeDrawState inState;
+ SInt16 inDepth;
+ Boolean inColorDev;
+ if (!PyArg_ParseTuple(_args, "lO&lhb",
+ &inKind,
+ PyMac_GetRect, &bounds,
+ &inState,
+ &inDepth,
+ &inColorDev))
+ return NULL;
+ _err = ApplyThemeBackground(inKind,
+ &bounds,
+ inState,
+ inDepth,
+ inColorDev);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_SetThemeTextColorForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Boolean isActive;
+ SInt16 depth;
+ Boolean isColorDev;
+ if (!PyArg_ParseTuple(_args, "O&bhb",
+ WinObj_Convert, &window,
+ &isActive,
+ &depth,
+ &isColorDev))
+ return NULL;
+ _err = SetThemeTextColorForWindow(window,
+ isActive,
+ depth,
+ isColorDev);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_IsValidAppearanceFileType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ OSType fileType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &fileType))
+ return NULL;
+ _rv = IsValidAppearanceFileType(fileType);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *App_GetThemeBrushAsColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeBrush inBrush;
+ SInt16 inDepth;
+ Boolean inColorDev;
+ RGBColor outColor;
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inBrush,
+ &inDepth,
+ &inColorDev))
+ return NULL;
+ _err = GetThemeBrushAsColor(inBrush,
+ inDepth,
+ inColorDev,
+ &outColor);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &outColor);
+ return _res;
+}
+
+static PyObject *App_GetThemeTextColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeTextColor inColor;
+ SInt16 inDepth;
+ Boolean inColorDev;
+ RGBColor outColor;
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &inColor,
+ &inDepth,
+ &inColorDev))
+ return NULL;
+ _err = GetThemeTextColor(inColor,
+ inDepth,
+ inColorDev,
+ &outColor);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &outColor);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *App_GetThemeMetric(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeMetric inMetric;
+ SInt32 outMetric;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inMetric))
+ return NULL;
+ _err = GetThemeMetric(inMetric,
+ &outMetric);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outMetric);
+ return _res;
+}
+#endif
+
+static PyMethodDef App_methods[] = {
+ {"RegisterAppearanceClient", (PyCFunction)App_RegisterAppearanceClient, 1,
+ "() -> None"},
+ {"UnregisterAppearanceClient", (PyCFunction)App_UnregisterAppearanceClient, 1,
+ "() -> None"},
+ {"SetThemePen", (PyCFunction)App_SetThemePen, 1,
+ "(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None"},
+ {"SetThemeBackground", (PyCFunction)App_SetThemeBackground, 1,
+ "(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None"},
+ {"SetThemeTextColor", (PyCFunction)App_SetThemeTextColor, 1,
+ "(ThemeTextColor inColor, SInt16 inDepth, Boolean inIsColorDevice) -> None"},
+ {"SetThemeWindowBackground", (PyCFunction)App_SetThemeWindowBackground, 1,
+ "(WindowPtr inWindow, ThemeBrush inBrush, Boolean inUpdate) -> None"},
+ {"DrawThemeWindowHeader", (PyCFunction)App_DrawThemeWindowHeader, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemeWindowListViewHeader", (PyCFunction)App_DrawThemeWindowListViewHeader, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemePlacard", (PyCFunction)App_DrawThemePlacard, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemeEditTextFrame", (PyCFunction)App_DrawThemeEditTextFrame, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemeListBoxFrame", (PyCFunction)App_DrawThemeListBoxFrame, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemeFocusRect", (PyCFunction)App_DrawThemeFocusRect, 1,
+ "(Rect inRect, Boolean inHasFocus) -> None"},
+ {"DrawThemePrimaryGroup", (PyCFunction)App_DrawThemePrimaryGroup, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemeSecondaryGroup", (PyCFunction)App_DrawThemeSecondaryGroup, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemeSeparator", (PyCFunction)App_DrawThemeSeparator, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemeModelessDialogFrame", (PyCFunction)App_DrawThemeModelessDialogFrame, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"DrawThemeGenericWell", (PyCFunction)App_DrawThemeGenericWell, 1,
+ "(Rect inRect, ThemeDrawState inState, Boolean inFillCenter) -> None"},
+ {"DrawThemeFocusRegion", (PyCFunction)App_DrawThemeFocusRegion, 1,
+ "(Boolean inHasFocus) -> None"},
+ {"IsThemeInColor", (PyCFunction)App_IsThemeInColor, 1,
+ "(SInt16 inDepth, Boolean inIsColorDevice) -> (Boolean _rv)"},
+ {"GetThemeAccentColors", (PyCFunction)App_GetThemeAccentColors, 1,
+ "() -> (CTabHandle outColors)"},
+ {"DrawThemeMenuBarBackground", (PyCFunction)App_DrawThemeMenuBarBackground, 1,
+ "(Rect inBounds, ThemeMenuBarState inState, UInt32 inAttributes) -> None"},
+ {"GetThemeMenuBarHeight", (PyCFunction)App_GetThemeMenuBarHeight, 1,
+ "() -> (SInt16 outHeight)"},
+ {"DrawThemeMenuBackground", (PyCFunction)App_DrawThemeMenuBackground, 1,
+ "(Rect inMenuRect, ThemeMenuType inMenuType) -> None"},
+ {"GetThemeMenuBackgroundRegion", (PyCFunction)App_GetThemeMenuBackgroundRegion, 1,
+ "(Rect inMenuRect, ThemeMenuType menuType) -> None"},
+ {"DrawThemeMenuSeparator", (PyCFunction)App_DrawThemeMenuSeparator, 1,
+ "(Rect inItemRect) -> None"},
+ {"GetThemeMenuSeparatorHeight", (PyCFunction)App_GetThemeMenuSeparatorHeight, 1,
+ "() -> (SInt16 outHeight)"},
+ {"GetThemeMenuItemExtra", (PyCFunction)App_GetThemeMenuItemExtra, 1,
+ "(ThemeMenuItemType inItemType) -> (SInt16 outHeight, SInt16 outWidth)"},
+ {"GetThemeMenuTitleExtra", (PyCFunction)App_GetThemeMenuTitleExtra, 1,
+ "(Boolean inIsSquished) -> (SInt16 outWidth)"},
+ {"DrawThemeTabPane", (PyCFunction)App_DrawThemeTabPane, 1,
+ "(Rect inRect, ThemeDrawState inState) -> None"},
+ {"GetThemeTabRegion", (PyCFunction)App_GetThemeTabRegion, 1,
+ "(Rect inRect, ThemeTabStyle inStyle, ThemeTabDirection inDirection) -> None"},
+ {"SetThemeCursor", (PyCFunction)App_SetThemeCursor, 1,
+ "(ThemeCursor inCursor) -> None"},
+ {"SetAnimatedThemeCursor", (PyCFunction)App_SetAnimatedThemeCursor, 1,
+ "(ThemeCursor inCursor, UInt32 inAnimationStep) -> None"},
+ {"GetThemeScrollBarThumbStyle", (PyCFunction)App_GetThemeScrollBarThumbStyle, 1,
+ "() -> (ThemeScrollBarThumbStyle outStyle)"},
+ {"GetThemeScrollBarArrowStyle", (PyCFunction)App_GetThemeScrollBarArrowStyle, 1,
+ "() -> (ThemeScrollBarArrowStyle outStyle)"},
+ {"GetThemeCheckBoxStyle", (PyCFunction)App_GetThemeCheckBoxStyle, 1,
+ "() -> (ThemeCheckBoxStyle outStyle)"},
+ {"UseThemeFont", (PyCFunction)App_UseThemeFont, 1,
+ "(ThemeFontID inFontID, ScriptCode inScript) -> None"},
+ {"DrawThemeScrollBarArrows", (PyCFunction)App_DrawThemeScrollBarArrows, 1,
+ "(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)"},
+ {"GetThemeScrollBarTrackRect", (PyCFunction)App_GetThemeScrollBarTrackRect, 1,
+ "(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)"},
+ {"HitTestThemeScrollBarArrows", (PyCFunction)App_HitTestThemeScrollBarArrows, 1,
+ "(Rect scrollBarBounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz, Point ptHit) -> (Boolean _rv, Rect trackBounds, ControlPartCode partcode)"},
+ {"DrawThemeScrollBarDelimiters", (PyCFunction)App_DrawThemeScrollBarDelimiters, 1,
+ "(ThemeWindowType flavor, Rect inContRect, ThemeDrawState state, ThemeWindowAttributes attributes) -> None"},
+ {"PlayThemeSound", (PyCFunction)App_PlayThemeSound, 1,
+ "(ThemeSoundKind kind) -> None"},
+ {"BeginThemeDragSound", (PyCFunction)App_BeginThemeDragSound, 1,
+ "(ThemeDragSoundKind kind) -> None"},
+ {"EndThemeDragSound", (PyCFunction)App_EndThemeDragSound, 1,
+ "() -> None"},
+ {"DrawThemeTickMark", (PyCFunction)App_DrawThemeTickMark, 1,
+ "(Rect bounds, ThemeDrawState state) -> None"},
+ {"DrawThemeStandaloneGrowBox", (PyCFunction)App_DrawThemeStandaloneGrowBox, 1,
+ "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None"},
+ {"DrawThemeStandaloneNoGrowBox", (PyCFunction)App_DrawThemeStandaloneNoGrowBox, 1,
+ "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None"},
+ {"GetThemeStandaloneGrowBoxBounds", (PyCFunction)App_GetThemeStandaloneGrowBoxBounds, 1,
+ "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall) -> (Rect bounds)"},
+ {"NormalizeThemeDrawingState", (PyCFunction)App_NormalizeThemeDrawingState, 1,
+ "() -> None"},
+ {"ApplyThemeBackground", (PyCFunction)App_ApplyThemeBackground, 1,
+ "(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None"},
+ {"SetThemeTextColorForWindow", (PyCFunction)App_SetThemeTextColorForWindow, 1,
+ "(WindowPtr window, Boolean isActive, SInt16 depth, Boolean isColorDev) -> None"},
+ {"IsValidAppearanceFileType", (PyCFunction)App_IsValidAppearanceFileType, 1,
+ "(OSType fileType) -> (Boolean _rv)"},
+ {"GetThemeBrushAsColor", (PyCFunction)App_GetThemeBrushAsColor, 1,
+ "(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"},
+ {"GetThemeTextColor", (PyCFunction)App_GetThemeTextColor, 1,
+ "(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetThemeMetric", (PyCFunction)App_GetThemeMetric, 1,
+ "(ThemeMetric inMetric) -> (SInt32 outMetric)"},
+#endif
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_App(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_App", App_methods);
+ d = PyModule_GetDict(m);
+ App_Error = PyMac_GetOSErrException();
+ if (App_Error == NULL ||
+ PyDict_SetItemString(d, "Error", App_Error) != 0)
+ return;
+}
+
+/* ======================== End module _App ========================= */
+
diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c
new file mode 100644
index 0000000..716e3fd
--- /dev/null
+++ b/Mac/Modules/cf/_CFmodule.c
@@ -0,0 +1,3179 @@
+
+/* =========================== Module _CF =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <CFBase.h>
+#include <CFArray.h>
+#include <CFData.h>
+#include <CFDictionary.h>
+#include <CFString.h>
+#include <CFURL.h>
+#else
+#include <CoreServices/CoreServices.h>
+#endif
+
+/* For now we declare them forward here. They'll go to mactoolbox later */
+staticforward PyObject *CFTypeRefObj_New(CFTypeRef);
+staticforward int CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
+staticforward PyObject *CFStringRefObj_New(CFStringRef);
+staticforward int CFStringRefObj_Convert(PyObject *, CFStringRef *);
+staticforward PyObject *CFURLRefObj_New(CFURLRef);
+staticforward int CFURLRefObj_Convert(PyObject *, CFURLRef *);
+
+staticforward int CFURLRefObj_Convert(PyObject *, CFURLRef *);
+
+// ADD declarations
+#ifdef NOTYET_USE_TOOLBOX_OBJECT_GLUE
+//extern PyObject *_CFTypeRefObj_New(CFTypeRef);
+//extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
+
+//#define CFTypeRefObj_New _CFTypeRefObj_New
+//#define CFTypeRefObj_Convert _CFTypeRefObj_Convert
+#endif
+
+/*
+** Parse/generate CFRange records
+*/
+PyObject *CFRange_New(CFRange *itself)
+{
+
+ return Py_BuildValue("ll", (long)itself->location, (long)itself->length);
+}
+
+CFRange_Convert(PyObject *v, CFRange *p_itself)
+{
+ long location, length;
+
+ if( !PyArg_ParseTuple(v, "ll", &location, &length) )
+ return 0;
+ p_itself->location = (CFIndex)location;
+ p_itself->length = (CFIndex)length;
+ return 1;
+}
+
+/* Optional CFURL argument or None (passed as NULL) */
+int
+OptionalCFURLRefObj_Convert(PyObject *v, CFURLRef *p_itself)
+{
+ if ( v == Py_None ) {
+ p_itself = NULL;
+ return 1;
+ }
+ return CFURLRefObj_Convert(v, p_itself);
+}
+
+
+static PyObject *CF_Error;
+
+/* --------------------- Object type CFTypeRef ---------------------- */
+
+PyTypeObject CFTypeRef_Type;
+
+#define CFTypeRefObj_Check(x) ((x)->ob_type == &CFTypeRef_Type)
+
+typedef struct CFTypeRefObject {
+ PyObject_HEAD
+ CFTypeRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFTypeRefObject;
+
+PyObject *CFTypeRefObj_New(CFTypeRef itself)
+{
+ CFTypeRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFTypeRefObject, &CFTypeRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFTypeRefObj_Convert(PyObject *v, CFTypeRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFTypeRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFTypeRef required");
+ return 0;
+ }
+ *p_itself = ((CFTypeRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFTypeRefObj_dealloc(CFTypeRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFTypeRefObj_CFGetTypeID(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+ PyMac_PRECHECK(CFGetTypeID);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFGetTypeID(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFRetain(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeRef _rv;
+ PyMac_PRECHECK(CFRetain);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFRetain(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFTypeRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFRelease(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(CFRelease);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFRelease(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFGetRetainCount(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ PyMac_PRECHECK(CFGetRetainCount);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFGetRetainCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFEqual(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFTypeRef cf2;
+ PyMac_PRECHECK(CFEqual);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFTypeRefObj_Convert, &cf2))
+ return NULL;
+ _rv = CFEqual(_self->ob_itself,
+ cf2);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFHash(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFHashCode _rv;
+ PyMac_PRECHECK(CFHash);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFHash(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFCopyDescription(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFCopyDescription);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFCopyDescription(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFTypeRefObj_CFShow(CFTypeRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(CFShow);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFShow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFTypeRefObj_methods[] = {
+ {"CFGetTypeID", (PyCFunction)CFTypeRefObj_CFGetTypeID, 1,
+ "() -> (CFTypeID _rv)"},
+ {"CFRetain", (PyCFunction)CFTypeRefObj_CFRetain, 1,
+ "() -> (CFTypeRef _rv)"},
+ {"CFRelease", (PyCFunction)CFTypeRefObj_CFRelease, 1,
+ "() -> None"},
+ {"CFGetRetainCount", (PyCFunction)CFTypeRefObj_CFGetRetainCount, 1,
+ "() -> (CFIndex _rv)"},
+ {"CFEqual", (PyCFunction)CFTypeRefObj_CFEqual, 1,
+ "(CFTypeRef cf2) -> (Boolean _rv)"},
+ {"CFHash", (PyCFunction)CFTypeRefObj_CFHash, 1,
+ "() -> (CFHashCode _rv)"},
+ {"CFCopyDescription", (PyCFunction)CFTypeRefObj_CFCopyDescription, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFShow", (PyCFunction)CFTypeRefObj_CFShow, 1,
+ "() -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFTypeRefObj_chain = { CFTypeRefObj_methods, NULL };
+
+static PyObject *CFTypeRefObj_getattr(CFTypeRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFTypeRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFTypeRefObj_setattr NULL
+
+static int CFTypeRefObj_compare(CFTypeRefObject *self, CFTypeRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFTypeRefObj_repr(CFTypeRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFTypeRef type-%d object at 0x%08.8x for 0x%08.8x>", CFGetTypeID(self->ob_itself), self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFTypeRefObj_hash(CFTypeRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFTypeRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFTypeRef", /*tp_name*/
+ sizeof(CFTypeRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFTypeRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFTypeRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFTypeRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFTypeRefObj_compare, /*tp_compare*/
+ (reprfunc) CFTypeRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFTypeRefObj_hash, /*tp_hash*/
+};
+
+/* ------------------- End object type CFTypeRef -------------------- */
+
+
+/* --------------------- Object type CFArrayRef --------------------- */
+
+PyTypeObject CFArrayRef_Type;
+
+#define CFArrayRefObj_Check(x) ((x)->ob_type == &CFArrayRef_Type)
+
+typedef struct CFArrayRefObject {
+ PyObject_HEAD
+ CFArrayRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFArrayRefObject;
+
+PyObject *CFArrayRefObj_New(CFArrayRef itself)
+{
+ CFArrayRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFArrayRefObject, &CFArrayRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFArrayRefObj_Convert(PyObject *v, CFArrayRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFArrayRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFArrayRef required");
+ return 0;
+ }
+ *p_itself = ((CFArrayRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFArrayRefObj_dealloc(CFArrayRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFArrayRefObj_CFArrayCreateCopy(CFArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFArrayCreateCopy((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFArrayRefObj_CFArrayGetCount(CFArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ PyMac_PRECHECK(CFArrayGetCount);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFArrayGetCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFArrayRefObj_CFStringCreateByCombiningStrings(CFArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef separatorString;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &separatorString))
+ return NULL;
+ _rv = CFStringCreateByCombiningStrings((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ separatorString);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef CFArrayRefObj_methods[] = {
+ {"CFArrayCreateCopy", (PyCFunction)CFArrayRefObj_CFArrayCreateCopy, 1,
+ "() -> (CFArrayRef _rv)"},
+ {"CFArrayGetCount", (PyCFunction)CFArrayRefObj_CFArrayGetCount, 1,
+ "() -> (CFIndex _rv)"},
+ {"CFStringCreateByCombiningStrings", (PyCFunction)CFArrayRefObj_CFStringCreateByCombiningStrings, 1,
+ "(CFStringRef separatorString) -> (CFStringRef _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFArrayRefObj_chain = { CFArrayRefObj_methods, &CFTypeRefObj_chain };
+
+static PyObject *CFArrayRefObj_getattr(CFArrayRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFArrayRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFArrayRefObj_setattr NULL
+
+static int CFArrayRefObj_compare(CFArrayRefObject *self, CFArrayRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFArrayRefObj_repr(CFArrayRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFArrayRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFArrayRefObj_hash(CFArrayRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFArrayRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFArrayRef", /*tp_name*/
+ sizeof(CFArrayRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFArrayRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFArrayRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFArrayRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFArrayRefObj_compare, /*tp_compare*/
+ (reprfunc) CFArrayRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFArrayRefObj_hash, /*tp_hash*/
+};
+
+/* ------------------- End object type CFArrayRef ------------------- */
+
+
+/* ----------------- Object type CFMutableArrayRef ------------------ */
+
+PyTypeObject CFMutableArrayRef_Type;
+
+#define CFMutableArrayRefObj_Check(x) ((x)->ob_type == &CFMutableArrayRef_Type)
+
+typedef struct CFMutableArrayRefObject {
+ PyObject_HEAD
+ CFMutableArrayRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFMutableArrayRefObject;
+
+PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef itself)
+{
+ CFMutableArrayRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFMutableArrayRefObject, &CFMutableArrayRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFMutableArrayRefObj_Convert(PyObject *v, CFMutableArrayRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFMutableArrayRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFMutableArrayRef required");
+ return 0;
+ }
+ *p_itself = ((CFMutableArrayRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFMutableArrayRefObj_dealloc(CFMutableArrayRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFMutableArrayRefObj_CFArrayRemoveValueAtIndex(CFMutableArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex idx;
+ PyMac_PRECHECK(CFArrayRemoveValueAtIndex);
+ if (!PyArg_ParseTuple(_args, "l",
+ &idx))
+ return NULL;
+ CFArrayRemoveValueAtIndex(_self->ob_itself,
+ idx);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableArrayRefObj_CFArrayRemoveAllValues(CFMutableArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(CFArrayRemoveAllValues);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFArrayRemoveAllValues(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices(CFMutableArrayRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex idx1;
+ CFIndex idx2;
+ PyMac_PRECHECK(CFArrayExchangeValuesAtIndices);
+ if (!PyArg_ParseTuple(_args, "ll",
+ &idx1,
+ &idx2))
+ return NULL;
+ CFArrayExchangeValuesAtIndices(_self->ob_itself,
+ idx1,
+ idx2);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFMutableArrayRefObj_methods[] = {
+ {"CFArrayRemoveValueAtIndex", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveValueAtIndex, 1,
+ "(CFIndex idx) -> None"},
+ {"CFArrayRemoveAllValues", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveAllValues, 1,
+ "() -> None"},
+ {"CFArrayExchangeValuesAtIndices", (PyCFunction)CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices, 1,
+ "(CFIndex idx1, CFIndex idx2) -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFMutableArrayRefObj_chain = { CFMutableArrayRefObj_methods, &CFArrayRefObj_chain };
+
+static PyObject *CFMutableArrayRefObj_getattr(CFMutableArrayRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFMutableArrayRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFMutableArrayRefObj_setattr NULL
+
+static int CFMutableArrayRefObj_compare(CFMutableArrayRefObject *self, CFMutableArrayRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFMutableArrayRefObj_repr(CFMutableArrayRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFMutableArrayRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFMutableArrayRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFMutableArrayRef", /*tp_name*/
+ sizeof(CFMutableArrayRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFMutableArrayRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFMutableArrayRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFMutableArrayRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFMutableArrayRefObj_compare, /*tp_compare*/
+ (reprfunc) CFMutableArrayRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFMutableArrayRefObj_hash, /*tp_hash*/
+};
+
+/* --------------- End object type CFMutableArrayRef ---------------- */
+
+
+/* ------------------ Object type CFDictionaryRef ------------------- */
+
+PyTypeObject CFDictionaryRef_Type;
+
+#define CFDictionaryRefObj_Check(x) ((x)->ob_type == &CFDictionaryRef_Type)
+
+typedef struct CFDictionaryRefObject {
+ PyObject_HEAD
+ CFDictionaryRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFDictionaryRefObject;
+
+PyObject *CFDictionaryRefObj_New(CFDictionaryRef itself)
+{
+ CFDictionaryRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFDictionaryRefObject, &CFDictionaryRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFDictionaryRefObj_Convert(PyObject *v, CFDictionaryRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFDictionaryRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFDictionaryRef required");
+ return 0;
+ }
+ *p_itself = ((CFDictionaryRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFDictionaryRefObj_dealloc(CFDictionaryRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFDictionaryRefObj_CFDictionaryCreateCopy(CFDictionaryRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDictionaryRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDictionaryCreateCopy((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFDictionaryRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFDictionaryRefObj_CFDictionaryGetCount(CFDictionaryRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ PyMac_PRECHECK(CFDictionaryGetCount);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDictionaryGetCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef CFDictionaryRefObj_methods[] = {
+ {"CFDictionaryCreateCopy", (PyCFunction)CFDictionaryRefObj_CFDictionaryCreateCopy, 1,
+ "() -> (CFDictionaryRef _rv)"},
+ {"CFDictionaryGetCount", (PyCFunction)CFDictionaryRefObj_CFDictionaryGetCount, 1,
+ "() -> (CFIndex _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFDictionaryRefObj_chain = { CFDictionaryRefObj_methods, &CFTypeRefObj_chain };
+
+static PyObject *CFDictionaryRefObj_getattr(CFDictionaryRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFDictionaryRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFDictionaryRefObj_setattr NULL
+
+static int CFDictionaryRefObj_compare(CFDictionaryRefObject *self, CFDictionaryRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFDictionaryRefObj_repr(CFDictionaryRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFDictionaryRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFDictionaryRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFDictionaryRef", /*tp_name*/
+ sizeof(CFDictionaryRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFDictionaryRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFDictionaryRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFDictionaryRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFDictionaryRefObj_compare, /*tp_compare*/
+ (reprfunc) CFDictionaryRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFDictionaryRefObj_hash, /*tp_hash*/
+};
+
+/* ---------------- End object type CFDictionaryRef ----------------- */
+
+
+/* --------------- Object type CFMutableDictionaryRef --------------- */
+
+PyTypeObject CFMutableDictionaryRef_Type;
+
+#define CFMutableDictionaryRefObj_Check(x) ((x)->ob_type == &CFMutableDictionaryRef_Type)
+
+typedef struct CFMutableDictionaryRefObject {
+ PyObject_HEAD
+ CFMutableDictionaryRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFMutableDictionaryRefObject;
+
+PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef itself)
+{
+ CFMutableDictionaryRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFMutableDictionaryRefObject, &CFMutableDictionaryRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFMutableDictionaryRefObj_Convert(PyObject *v, CFMutableDictionaryRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFMutableDictionaryRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFMutableDictionaryRef required");
+ return 0;
+ }
+ *p_itself = ((CFMutableDictionaryRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFMutableDictionaryRefObj_dealloc(CFMutableDictionaryRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFMutableDictionaryRefObj_CFDictionaryRemoveAllValues(CFMutableDictionaryRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(CFDictionaryRemoveAllValues);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFDictionaryRemoveAllValues(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFMutableDictionaryRefObj_methods[] = {
+ {"CFDictionaryRemoveAllValues", (PyCFunction)CFMutableDictionaryRefObj_CFDictionaryRemoveAllValues, 1,
+ "() -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFMutableDictionaryRefObj_chain = { CFMutableDictionaryRefObj_methods, &CFDictionaryRefObj_chain };
+
+static PyObject *CFMutableDictionaryRefObj_getattr(CFMutableDictionaryRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFMutableDictionaryRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFMutableDictionaryRefObj_setattr NULL
+
+static int CFMutableDictionaryRefObj_compare(CFMutableDictionaryRefObject *self, CFMutableDictionaryRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFMutableDictionaryRefObj_repr(CFMutableDictionaryRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFMutableDictionaryRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFMutableDictionaryRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFMutableDictionaryRef", /*tp_name*/
+ sizeof(CFMutableDictionaryRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFMutableDictionaryRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFMutableDictionaryRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFMutableDictionaryRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFMutableDictionaryRefObj_compare, /*tp_compare*/
+ (reprfunc) CFMutableDictionaryRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFMutableDictionaryRefObj_hash, /*tp_hash*/
+};
+
+/* ------------- End object type CFMutableDictionaryRef ------------- */
+
+
+/* --------------------- Object type CFDataRef ---------------------- */
+
+PyTypeObject CFDataRef_Type;
+
+#define CFDataRefObj_Check(x) ((x)->ob_type == &CFDataRef_Type)
+
+typedef struct CFDataRefObject {
+ PyObject_HEAD
+ CFDataRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFDataRefObject;
+
+PyObject *CFDataRefObj_New(CFDataRef itself)
+{
+ CFDataRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFDataRefObject, &CFDataRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFDataRefObj_Convert(PyObject *v, CFDataRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFDataRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFDataRef required");
+ return 0;
+ }
+ *p_itself = ((CFDataRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFDataRefObj_dealloc(CFDataRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFDataRefObj_CFDataCreateCopy(CFDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDataCreateCopy((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFDataRefObj_CFDataGetLength(CFDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ PyMac_PRECHECK(CFDataGetLength);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDataGetLength(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFDataRefObj_CFStringCreateFromExternalRepresentation(CFDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringEncoding encoding;
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateFromExternalRepresentation((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef CFDataRefObj_methods[] = {
+ {"CFDataCreateCopy", (PyCFunction)CFDataRefObj_CFDataCreateCopy, 1,
+ "() -> (CFDataRef _rv)"},
+ {"CFDataGetLength", (PyCFunction)CFDataRefObj_CFDataGetLength, 1,
+ "() -> (CFIndex _rv)"},
+ {"CFStringCreateFromExternalRepresentation", (PyCFunction)CFDataRefObj_CFStringCreateFromExternalRepresentation, 1,
+ "(CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFDataRefObj_chain = { CFDataRefObj_methods, &CFTypeRefObj_chain };
+
+static PyObject *CFDataRefObj_getattr(CFDataRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFDataRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFDataRefObj_setattr NULL
+
+static int CFDataRefObj_compare(CFDataRefObject *self, CFDataRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFDataRefObj_repr(CFDataRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFDataRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFDataRefObj_hash(CFDataRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFDataRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFDataRef", /*tp_name*/
+ sizeof(CFDataRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFDataRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFDataRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFDataRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFDataRefObj_compare, /*tp_compare*/
+ (reprfunc) CFDataRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFDataRefObj_hash, /*tp_hash*/
+};
+
+/* ------------------- End object type CFDataRef -------------------- */
+
+
+/* ------------------ Object type CFMutableDataRef ------------------ */
+
+PyTypeObject CFMutableDataRef_Type;
+
+#define CFMutableDataRefObj_Check(x) ((x)->ob_type == &CFMutableDataRef_Type)
+
+typedef struct CFMutableDataRefObject {
+ PyObject_HEAD
+ CFMutableDataRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFMutableDataRefObject;
+
+PyObject *CFMutableDataRefObj_New(CFMutableDataRef itself)
+{
+ CFMutableDataRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFMutableDataRefObject, &CFMutableDataRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFMutableDataRefObj_Convert(PyObject *v, CFMutableDataRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFMutableDataRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFMutableDataRef required");
+ return 0;
+ }
+ *p_itself = ((CFMutableDataRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFMutableDataRefObj_dealloc(CFMutableDataRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFMutableDataRefObj_CFDataSetLength(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex length;
+ PyMac_PRECHECK(CFDataSetLength);
+ if (!PyArg_ParseTuple(_args, "l",
+ &length))
+ return NULL;
+ CFDataSetLength(_self->ob_itself,
+ length);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableDataRefObj_CFDataIncreaseLength(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex extraLength;
+ PyMac_PRECHECK(CFDataIncreaseLength);
+ if (!PyArg_ParseTuple(_args, "l",
+ &extraLength))
+ return NULL;
+ CFDataIncreaseLength(_self->ob_itself,
+ extraLength);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableDataRefObj_CFDataAppendBytes(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned char *bytes__in__;
+ long bytes__len__;
+ int bytes__in_len__;
+ PyMac_PRECHECK(CFDataAppendBytes);
+ if (!PyArg_ParseTuple(_args, "s#",
+ &bytes__in__, &bytes__in_len__))
+ return NULL;
+ bytes__len__ = bytes__in_len__;
+ CFDataAppendBytes(_self->ob_itself,
+ bytes__in__, bytes__len__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ bytes__error__: ;
+ return _res;
+}
+
+static PyObject *CFMutableDataRefObj_CFDataReplaceBytes(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+ unsigned char *newBytes__in__;
+ long newBytes__len__;
+ int newBytes__in_len__;
+ PyMac_PRECHECK(CFDataReplaceBytes);
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ CFRange_Convert, &range,
+ &newBytes__in__, &newBytes__in_len__))
+ return NULL;
+ newBytes__len__ = newBytes__in_len__;
+ CFDataReplaceBytes(_self->ob_itself,
+ range,
+ newBytes__in__, newBytes__len__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ newBytes__error__: ;
+ return _res;
+}
+
+static PyObject *CFMutableDataRefObj_CFDataDeleteBytes(CFMutableDataRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+ PyMac_PRECHECK(CFDataDeleteBytes);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFRange_Convert, &range))
+ return NULL;
+ CFDataDeleteBytes(_self->ob_itself,
+ range);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFMutableDataRefObj_methods[] = {
+ {"CFDataSetLength", (PyCFunction)CFMutableDataRefObj_CFDataSetLength, 1,
+ "(CFIndex length) -> None"},
+ {"CFDataIncreaseLength", (PyCFunction)CFMutableDataRefObj_CFDataIncreaseLength, 1,
+ "(CFIndex extraLength) -> None"},
+ {"CFDataAppendBytes", (PyCFunction)CFMutableDataRefObj_CFDataAppendBytes, 1,
+ "(Buffer bytes) -> None"},
+ {"CFDataReplaceBytes", (PyCFunction)CFMutableDataRefObj_CFDataReplaceBytes, 1,
+ "(CFRange range, Buffer newBytes) -> None"},
+ {"CFDataDeleteBytes", (PyCFunction)CFMutableDataRefObj_CFDataDeleteBytes, 1,
+ "(CFRange range) -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFMutableDataRefObj_chain = { CFMutableDataRefObj_methods, &CFDataRefObj_chain };
+
+static PyObject *CFMutableDataRefObj_getattr(CFMutableDataRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFMutableDataRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFMutableDataRefObj_setattr NULL
+
+static int CFMutableDataRefObj_compare(CFMutableDataRefObject *self, CFMutableDataRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFMutableDataRefObj_repr(CFMutableDataRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFMutableDataRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFMutableDataRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFMutableDataRef", /*tp_name*/
+ sizeof(CFMutableDataRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFMutableDataRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFMutableDataRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFMutableDataRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFMutableDataRefObj_compare, /*tp_compare*/
+ (reprfunc) CFMutableDataRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFMutableDataRefObj_hash, /*tp_hash*/
+};
+
+/* ---------------- End object type CFMutableDataRef ---------------- */
+
+
+/* -------------------- Object type CFStringRef --------------------- */
+
+PyTypeObject CFStringRef_Type;
+
+#define CFStringRefObj_Check(x) ((x)->ob_type == &CFStringRef_Type)
+
+typedef struct CFStringRefObject {
+ PyObject_HEAD
+ CFStringRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFStringRefObject;
+
+PyObject *CFStringRefObj_New(CFStringRef itself)
+{
+ CFStringRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFStringRefObject, &CFStringRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFStringRefObj_Convert(PyObject *v, CFStringRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyString_Check(v)) {
+ char *cStr = PyString_AsString(v);
+ *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, 0);
+ return 1;
+ }
+ if (PyUnicode_Check(v)) {
+ /* We use the CF types here, if Python was configured differently that will give an error */
+ CFIndex size = PyUnicode_GetSize(v);
+ UniChar *unichars = PyUnicode_AsUnicode(v);
+ if (!unichars) return 0;
+ *p_itself = CFStringCreateWithCharacters((CFAllocatorRef)NULL, unichars, size);
+ return 1;
+ }
+
+
+ if (!CFStringRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFStringRef required");
+ return 0;
+ }
+ *p_itself = ((CFStringRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFStringRefObj_dealloc(CFStringRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFStringRefObj_CFStringCreateWithSubstring(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFRange range;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFRange_Convert, &range))
+ return NULL;
+ _rv = CFStringCreateWithSubstring((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ range);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCreateCopy(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringCreateCopy((CFAllocatorRef)NULL,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetLength(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ PyMac_PRECHECK(CFStringGetLength);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetLength(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetBytes(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ CFRange range;
+ CFStringEncoding encoding;
+ UInt8 lossByte;
+ Boolean isExternalRepresentation;
+ UInt8 buffer;
+ CFIndex maxBufLen;
+ CFIndex usedBufLen;
+ PyMac_PRECHECK(CFStringGetBytes);
+ if (!PyArg_ParseTuple(_args, "O&lbll",
+ CFRange_Convert, &range,
+ &encoding,
+ &lossByte,
+ &isExternalRepresentation,
+ &maxBufLen))
+ return NULL;
+ _rv = CFStringGetBytes(_self->ob_itself,
+ range,
+ encoding,
+ lossByte,
+ isExternalRepresentation,
+ &buffer,
+ maxBufLen,
+ &usedBufLen);
+ _res = Py_BuildValue("lbl",
+ _rv,
+ buffer,
+ usedBufLen);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCreateExternalRepresentation(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ CFStringEncoding encoding;
+ UInt8 lossByte;
+ if (!PyArg_ParseTuple(_args, "lb",
+ &encoding,
+ &lossByte))
+ return NULL;
+ _rv = CFStringCreateExternalRepresentation((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ encoding,
+ lossByte);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetSmallestEncoding(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ PyMac_PRECHECK(CFStringGetSmallestEncoding);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetSmallestEncoding(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetFastestEncoding(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ PyMac_PRECHECK(CFStringGetFastestEncoding);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetFastestEncoding(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCompareWithOptions(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFComparisonResult _rv;
+ CFStringRef string2;
+ CFRange rangeToCompare;
+ CFOptionFlags compareOptions;
+ PyMac_PRECHECK(CFStringCompareWithOptions);
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CFStringRefObj_Convert, &string2,
+ CFRange_Convert, &rangeToCompare,
+ &compareOptions))
+ return NULL;
+ _rv = CFStringCompareWithOptions(_self->ob_itself,
+ string2,
+ rangeToCompare,
+ compareOptions);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCompare(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFComparisonResult _rv;
+ CFStringRef string2;
+ CFOptionFlags compareOptions;
+ PyMac_PRECHECK(CFStringCompare);
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CFStringRefObj_Convert, &string2,
+ &compareOptions))
+ return NULL;
+ _rv = CFStringCompare(_self->ob_itself,
+ string2,
+ compareOptions);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringFindWithOptions(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef stringToFind;
+ CFRange rangeToSearch;
+ CFOptionFlags searchOptions;
+ CFRange result;
+ PyMac_PRECHECK(CFStringFindWithOptions);
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CFStringRefObj_Convert, &stringToFind,
+ CFRange_Convert, &rangeToSearch,
+ &searchOptions))
+ return NULL;
+ _rv = CFStringFindWithOptions(_self->ob_itself,
+ stringToFind,
+ rangeToSearch,
+ searchOptions,
+ &result);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CFRange_New, result);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCreateArrayWithFindResults(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef _rv;
+ CFStringRef stringToFind;
+ CFRange rangeToSearch;
+ CFOptionFlags compareOptions;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ CFStringRefObj_Convert, &stringToFind,
+ CFRange_Convert, &rangeToSearch,
+ &compareOptions))
+ return NULL;
+ _rv = CFStringCreateArrayWithFindResults((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ stringToFind,
+ rangeToSearch,
+ compareOptions);
+ _res = Py_BuildValue("O&",
+ CFArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringFind(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange _rv;
+ CFStringRef stringToFind;
+ CFOptionFlags compareOptions;
+ PyMac_PRECHECK(CFStringFind);
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CFStringRefObj_Convert, &stringToFind,
+ &compareOptions))
+ return NULL;
+ _rv = CFStringFind(_self->ob_itself,
+ stringToFind,
+ compareOptions);
+ _res = Py_BuildValue("O&",
+ CFRange_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringHasPrefix(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef prefix;
+ PyMac_PRECHECK(CFStringHasPrefix);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &prefix))
+ return NULL;
+ _rv = CFStringHasPrefix(_self->ob_itself,
+ prefix);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringHasSuffix(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringRef suffix;
+ PyMac_PRECHECK(CFStringHasSuffix);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &suffix))
+ return NULL;
+ _rv = CFStringHasSuffix(_self->ob_itself,
+ suffix);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetLineBounds(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+ CFIndex lineBeginIndex;
+ CFIndex lineEndIndex;
+ CFIndex contentsEndIndex;
+ PyMac_PRECHECK(CFStringGetLineBounds);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFRange_Convert, &range))
+ return NULL;
+ CFStringGetLineBounds(_self->ob_itself,
+ range,
+ &lineBeginIndex,
+ &lineEndIndex,
+ &contentsEndIndex);
+ _res = Py_BuildValue("lll",
+ lineBeginIndex,
+ lineEndIndex,
+ contentsEndIndex);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringCreateArrayBySeparatingStrings(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFArrayRef _rv;
+ CFStringRef separatorString;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &separatorString))
+ return NULL;
+ _rv = CFStringCreateArrayBySeparatingStrings((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ separatorString);
+ _res = Py_BuildValue("O&",
+ CFArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetIntValue(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ PyMac_PRECHECK(CFStringGetIntValue);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetIntValue(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetDoubleValue(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ double _rv;
+ PyMac_PRECHECK(CFStringGetDoubleValue);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetDoubleValue(_self->ob_itself);
+ _res = Py_BuildValue("d",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringConvertIANACharSetNameToEncoding(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ PyMac_PRECHECK(CFStringConvertIANACharSetNameToEncoding);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringConvertIANACharSetNameToEncoding(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFShowStr(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(CFShowStr);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFShowStr(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFURLCreateWithString(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ CFURLRef baseURL;
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptionalCFURLRefObj_Convert, &baseURL))
+ return NULL;
+ _rv = CFURLCreateWithString((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ baseURL);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFURLCreateWithFileSystemPath(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ CFURLPathStyle pathStyle;
+ Boolean isDirectory;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &pathStyle,
+ &isDirectory))
+ return NULL;
+ _rv = CFURLCreateWithFileSystemPath((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ pathStyle,
+ isDirectory);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveEscaped;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ return NULL;
+ _rv = CFURLCreateStringByReplacingPercentEscapes((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ charactersToLeaveEscaped);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFStringRefObj_CFStringGetString(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int size = CFStringGetLength(_self->ob_itself)+1;
+ char *data = malloc(size);
+
+ if( data == NULL ) return PyErr_NoMemory();
+ if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) {
+ _res = (PyObject *)PyString_FromString(data);
+ } else {
+ PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string");
+ _res = NULL;
+ }
+ free(data);
+ return _res;
+
+}
+
+static PyObject *CFStringRefObj_CFStringGetUnicode(CFStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int size = CFStringGetLength(_self->ob_itself)+1;
+ Py_UNICODE *data = malloc(size*sizeof(Py_UNICODE));
+ CFRange range;
+
+ range.location = 0;
+ range.length = size;
+ if( data == NULL ) return PyErr_NoMemory();
+ CFStringGetCharacters(_self->ob_itself, range, data);
+ _res = (PyObject *)PyUnicode_FromUnicode(data, size);
+ free(data);
+ return _res;
+
+}
+
+static PyMethodDef CFStringRefObj_methods[] = {
+ {"CFStringCreateWithSubstring", (PyCFunction)CFStringRefObj_CFStringCreateWithSubstring, 1,
+ "(CFRange range) -> (CFStringRef _rv)"},
+ {"CFStringCreateCopy", (PyCFunction)CFStringRefObj_CFStringCreateCopy, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFStringGetLength", (PyCFunction)CFStringRefObj_CFStringGetLength, 1,
+ "() -> (CFIndex _rv)"},
+ {"CFStringGetBytes", (PyCFunction)CFStringRefObj_CFStringGetBytes, 1,
+ "(CFRange range, CFStringEncoding encoding, UInt8 lossByte, Boolean isExternalRepresentation, CFIndex maxBufLen) -> (CFIndex _rv, UInt8 buffer, CFIndex usedBufLen)"},
+ {"CFStringCreateExternalRepresentation", (PyCFunction)CFStringRefObj_CFStringCreateExternalRepresentation, 1,
+ "(CFStringEncoding encoding, UInt8 lossByte) -> (CFDataRef _rv)"},
+ {"CFStringGetSmallestEncoding", (PyCFunction)CFStringRefObj_CFStringGetSmallestEncoding, 1,
+ "() -> (CFStringEncoding _rv)"},
+ {"CFStringGetFastestEncoding", (PyCFunction)CFStringRefObj_CFStringGetFastestEncoding, 1,
+ "() -> (CFStringEncoding _rv)"},
+ {"CFStringCompareWithOptions", (PyCFunction)CFStringRefObj_CFStringCompareWithOptions, 1,
+ "(CFStringRef string2, CFRange rangeToCompare, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
+ {"CFStringCompare", (PyCFunction)CFStringRefObj_CFStringCompare, 1,
+ "(CFStringRef string2, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
+ {"CFStringFindWithOptions", (PyCFunction)CFStringRefObj_CFStringFindWithOptions, 1,
+ "(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags searchOptions) -> (Boolean _rv, CFRange result)"},
+ {"CFStringCreateArrayWithFindResults", (PyCFunction)CFStringRefObj_CFStringCreateArrayWithFindResults, 1,
+ "(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags compareOptions) -> (CFArrayRef _rv)"},
+ {"CFStringFind", (PyCFunction)CFStringRefObj_CFStringFind, 1,
+ "(CFStringRef stringToFind, CFOptionFlags compareOptions) -> (CFRange _rv)"},
+ {"CFStringHasPrefix", (PyCFunction)CFStringRefObj_CFStringHasPrefix, 1,
+ "(CFStringRef prefix) -> (Boolean _rv)"},
+ {"CFStringHasSuffix", (PyCFunction)CFStringRefObj_CFStringHasSuffix, 1,
+ "(CFStringRef suffix) -> (Boolean _rv)"},
+ {"CFStringGetLineBounds", (PyCFunction)CFStringRefObj_CFStringGetLineBounds, 1,
+ "(CFRange range) -> (CFIndex lineBeginIndex, CFIndex lineEndIndex, CFIndex contentsEndIndex)"},
+ {"CFStringCreateArrayBySeparatingStrings", (PyCFunction)CFStringRefObj_CFStringCreateArrayBySeparatingStrings, 1,
+ "(CFStringRef separatorString) -> (CFArrayRef _rv)"},
+ {"CFStringGetIntValue", (PyCFunction)CFStringRefObj_CFStringGetIntValue, 1,
+ "() -> (SInt32 _rv)"},
+ {"CFStringGetDoubleValue", (PyCFunction)CFStringRefObj_CFStringGetDoubleValue, 1,
+ "() -> (double _rv)"},
+ {"CFStringConvertIANACharSetNameToEncoding", (PyCFunction)CFStringRefObj_CFStringConvertIANACharSetNameToEncoding, 1,
+ "() -> (CFStringEncoding _rv)"},
+ {"CFShowStr", (PyCFunction)CFStringRefObj_CFShowStr, 1,
+ "() -> None"},
+ {"CFURLCreateWithString", (PyCFunction)CFStringRefObj_CFURLCreateWithString, 1,
+ "(CFURLRef baseURL) -> (CFURLRef _rv)"},
+ {"CFURLCreateWithFileSystemPath", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPath, 1,
+ "(CFURLPathStyle pathStyle, Boolean isDirectory) -> (CFURLRef _rv)"},
+ {"CFURLCreateStringByReplacingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes, 1,
+ "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
+ {"CFStringGetString", (PyCFunction)CFStringRefObj_CFStringGetString, 1,
+ "() -> (string _rv)"},
+ {"CFStringGetUnicode", (PyCFunction)CFStringRefObj_CFStringGetUnicode, 1,
+ "() -> (unicode _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFStringRefObj_chain = { CFStringRefObj_methods, &CFTypeRefObj_chain };
+
+static PyObject *CFStringRefObj_getattr(CFStringRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFStringRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFStringRefObj_setattr NULL
+
+static int CFStringRefObj_compare(CFStringRefObject *self, CFStringRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFStringRefObj_repr(CFStringRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFStringRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFStringRefObj_hash(CFStringRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFStringRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFStringRef", /*tp_name*/
+ sizeof(CFStringRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFStringRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFStringRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFStringRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFStringRefObj_compare, /*tp_compare*/
+ (reprfunc) CFStringRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFStringRefObj_hash, /*tp_hash*/
+};
+
+/* ------------------ End object type CFStringRef ------------------- */
+
+
+/* ----------------- Object type CFMutableStringRef ----------------- */
+
+PyTypeObject CFMutableStringRef_Type;
+
+#define CFMutableStringRefObj_Check(x) ((x)->ob_type == &CFMutableStringRef_Type)
+
+typedef struct CFMutableStringRefObject {
+ PyObject_HEAD
+ CFMutableStringRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFMutableStringRefObject;
+
+PyObject *CFMutableStringRefObj_New(CFMutableStringRef itself)
+{
+ CFMutableStringRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFMutableStringRefObject, &CFMutableStringRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFMutableStringRefObj_Convert(PyObject *v, CFMutableStringRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFMutableStringRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFMutableStringRef required");
+ return 0;
+ }
+ *p_itself = ((CFMutableStringRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFMutableStringRefObj_dealloc(CFMutableStringRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFMutableStringRefObj_CFStringAppend(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef appendedString;
+ PyMac_PRECHECK(CFStringAppend);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &appendedString))
+ return NULL;
+ CFStringAppend(_self->ob_itself,
+ appendedString);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringAppendPascalString(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ StringPtr pStr;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringAppendPascalString);
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetStr255, &pStr,
+ &encoding))
+ return NULL;
+ CFStringAppendPascalString(_self->ob_itself,
+ pStr,
+ encoding);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringAppendCString(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char* cStr;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringAppendCString);
+ if (!PyArg_ParseTuple(_args, "sl",
+ &cStr,
+ &encoding))
+ return NULL;
+ CFStringAppendCString(_self->ob_itself,
+ cStr,
+ encoding);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringInsert(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex idx;
+ CFStringRef insertedStr;
+ PyMac_PRECHECK(CFStringInsert);
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &idx,
+ CFStringRefObj_Convert, &insertedStr))
+ return NULL;
+ CFStringInsert(_self->ob_itself,
+ idx,
+ insertedStr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringDelete(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+ PyMac_PRECHECK(CFStringDelete);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFRange_Convert, &range))
+ return NULL;
+ CFStringDelete(_self->ob_itself,
+ range);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringReplace(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFRange range;
+ CFStringRef replacement;
+ PyMac_PRECHECK(CFStringReplace);
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CFRange_Convert, &range,
+ CFStringRefObj_Convert, &replacement))
+ return NULL;
+ CFStringReplace(_self->ob_itself,
+ range,
+ replacement);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringReplaceAll(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef replacement;
+ PyMac_PRECHECK(CFStringReplaceAll);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &replacement))
+ return NULL;
+ CFStringReplaceAll(_self->ob_itself,
+ replacement);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringPad(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef padString;
+ CFIndex length;
+ CFIndex indexIntoPad;
+ PyMac_PRECHECK(CFStringPad);
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ CFStringRefObj_Convert, &padString,
+ &length,
+ &indexIntoPad))
+ return NULL;
+ CFStringPad(_self->ob_itself,
+ padString,
+ length,
+ indexIntoPad);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringTrim(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef trimString;
+ PyMac_PRECHECK(CFStringTrim);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &trimString))
+ return NULL;
+ CFStringTrim(_self->ob_itself,
+ trimString);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CFMutableStringRefObj_CFStringTrimWhitespace(CFMutableStringRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(CFStringTrimWhitespace);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CFStringTrimWhitespace(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef CFMutableStringRefObj_methods[] = {
+ {"CFStringAppend", (PyCFunction)CFMutableStringRefObj_CFStringAppend, 1,
+ "(CFStringRef appendedString) -> None"},
+ {"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1,
+ "(StringPtr pStr, CFStringEncoding encoding) -> None"},
+ {"CFStringAppendCString", (PyCFunction)CFMutableStringRefObj_CFStringAppendCString, 1,
+ "(char* cStr, CFStringEncoding encoding) -> None"},
+ {"CFStringInsert", (PyCFunction)CFMutableStringRefObj_CFStringInsert, 1,
+ "(CFIndex idx, CFStringRef insertedStr) -> None"},
+ {"CFStringDelete", (PyCFunction)CFMutableStringRefObj_CFStringDelete, 1,
+ "(CFRange range) -> None"},
+ {"CFStringReplace", (PyCFunction)CFMutableStringRefObj_CFStringReplace, 1,
+ "(CFRange range, CFStringRef replacement) -> None"},
+ {"CFStringReplaceAll", (PyCFunction)CFMutableStringRefObj_CFStringReplaceAll, 1,
+ "(CFStringRef replacement) -> None"},
+ {"CFStringPad", (PyCFunction)CFMutableStringRefObj_CFStringPad, 1,
+ "(CFStringRef padString, CFIndex length, CFIndex indexIntoPad) -> None"},
+ {"CFStringTrim", (PyCFunction)CFMutableStringRefObj_CFStringTrim, 1,
+ "(CFStringRef trimString) -> None"},
+ {"CFStringTrimWhitespace", (PyCFunction)CFMutableStringRefObj_CFStringTrimWhitespace, 1,
+ "() -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFMutableStringRefObj_chain = { CFMutableStringRefObj_methods, &CFStringRefObj_chain };
+
+static PyObject *CFMutableStringRefObj_getattr(CFMutableStringRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFMutableStringRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFMutableStringRefObj_setattr NULL
+
+static int CFMutableStringRefObj_compare(CFMutableStringRefObject *self, CFMutableStringRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFMutableStringRefObj_repr(CFMutableStringRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFMutableStringRef object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFMutableStringRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFMutableStringRef", /*tp_name*/
+ sizeof(CFMutableStringRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFMutableStringRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFMutableStringRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFMutableStringRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFMutableStringRefObj_compare, /*tp_compare*/
+ (reprfunc) CFMutableStringRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFMutableStringRefObj_hash, /*tp_hash*/
+};
+
+/* --------------- End object type CFMutableStringRef --------------- */
+
+
+/* ---------------------- Object type CFURLRef ---------------------- */
+
+PyTypeObject CFURLRef_Type;
+
+#define CFURLRefObj_Check(x) ((x)->ob_type == &CFURLRef_Type)
+
+typedef struct CFURLRefObject {
+ PyObject_HEAD
+ CFURLRef ob_itself;
+ void (*ob_freeit)(CFTypeRef ptr);
+} CFURLRefObject;
+
+PyObject *CFURLRefObj_New(CFURLRef itself)
+{
+ CFURLRefObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(CFURLRefObject, &CFURLRef_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = CFRelease;
+ return (PyObject *)it;
+}
+CFURLRefObj_Convert(PyObject *v, CFURLRef *p_itself)
+{
+
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ /* Check for other CF objects here */
+
+ if (!CFURLRefObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "CFURLRef required");
+ return 0;
+ }
+ *p_itself = ((CFURLRefObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CFURLRefObj_dealloc(CFURLRefObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit((CFTypeRef)self->ob_itself);
+ }
+ PyMem_DEL(self);
+}
+
+static PyObject *CFURLRefObj_CFURLCreateData(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ CFStringEncoding encoding;
+ Boolean escapeWhitespace;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &encoding,
+ &escapeWhitespace))
+ return NULL;
+ _rv = CFURLCreateData((CFAllocatorRef)NULL,
+ _self->ob_itself,
+ encoding,
+ escapeWhitespace);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyAbsoluteURL(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ PyMac_PRECHECK(CFURLCopyAbsoluteURL);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyAbsoluteURL(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLGetString(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFURLGetString);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetString(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLGetBaseURL(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ PyMac_PRECHECK(CFURLGetBaseURL);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetBaseURL(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCanBeDecomposed(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PyMac_PRECHECK(CFURLCanBeDecomposed);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCanBeDecomposed(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyScheme(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFURLCopyScheme);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyScheme(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyNetLocation(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFURLCopyNetLocation);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyNetLocation(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyPath(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFURLCopyPath);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyPath(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLHasDirectoryPath(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PyMac_PRECHECK(CFURLHasDirectoryPath);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLHasDirectoryPath(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyResourceSpecifier(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFURLCopyResourceSpecifier);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyResourceSpecifier(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyHostName(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFURLCopyHostName);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyHostName(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLGetPortNumber(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ PyMac_PRECHECK(CFURLGetPortNumber);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetPortNumber(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyUserName(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFURLCopyUserName);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyUserName(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyPassword(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ PyMac_PRECHECK(CFURLCopyPassword);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLCopyPassword(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyParameterString(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveEscaped;
+ PyMac_PRECHECK(CFURLCopyParameterString);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ return NULL;
+ _rv = CFURLCopyParameterString(_self->ob_itself,
+ charactersToLeaveEscaped);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyQueryString(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveEscaped;
+ PyMac_PRECHECK(CFURLCopyQueryString);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ return NULL;
+ _rv = CFURLCopyQueryString(_self->ob_itself,
+ charactersToLeaveEscaped);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CFURLRefObj_CFURLCopyFragment(CFURLRefObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringRef charactersToLeaveEscaped;
+ PyMac_PRECHECK(CFURLCopyFragment);
+ if (!PyArg_ParseTuple(_args, "O&",
+ CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ return NULL;
+ _rv = CFURLCopyFragment(_self->ob_itself,
+ charactersToLeaveEscaped);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef CFURLRefObj_methods[] = {
+ {"CFURLCreateData", (PyCFunction)CFURLRefObj_CFURLCreateData, 1,
+ "(CFStringEncoding encoding, Boolean escapeWhitespace) -> (CFDataRef _rv)"},
+ {"CFURLCopyAbsoluteURL", (PyCFunction)CFURLRefObj_CFURLCopyAbsoluteURL, 1,
+ "() -> (CFURLRef _rv)"},
+ {"CFURLGetString", (PyCFunction)CFURLRefObj_CFURLGetString, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFURLGetBaseURL", (PyCFunction)CFURLRefObj_CFURLGetBaseURL, 1,
+ "() -> (CFURLRef _rv)"},
+ {"CFURLCanBeDecomposed", (PyCFunction)CFURLRefObj_CFURLCanBeDecomposed, 1,
+ "() -> (Boolean _rv)"},
+ {"CFURLCopyScheme", (PyCFunction)CFURLRefObj_CFURLCopyScheme, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFURLCopyNetLocation", (PyCFunction)CFURLRefObj_CFURLCopyNetLocation, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFURLCopyPath", (PyCFunction)CFURLRefObj_CFURLCopyPath, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFURLHasDirectoryPath", (PyCFunction)CFURLRefObj_CFURLHasDirectoryPath, 1,
+ "() -> (Boolean _rv)"},
+ {"CFURLCopyResourceSpecifier", (PyCFunction)CFURLRefObj_CFURLCopyResourceSpecifier, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFURLCopyHostName", (PyCFunction)CFURLRefObj_CFURLCopyHostName, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFURLGetPortNumber", (PyCFunction)CFURLRefObj_CFURLGetPortNumber, 1,
+ "() -> (SInt32 _rv)"},
+ {"CFURLCopyUserName", (PyCFunction)CFURLRefObj_CFURLCopyUserName, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFURLCopyPassword", (PyCFunction)CFURLRefObj_CFURLCopyPassword, 1,
+ "() -> (CFStringRef _rv)"},
+ {"CFURLCopyParameterString", (PyCFunction)CFURLRefObj_CFURLCopyParameterString, 1,
+ "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
+ {"CFURLCopyQueryString", (PyCFunction)CFURLRefObj_CFURLCopyQueryString, 1,
+ "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
+ {"CFURLCopyFragment", (PyCFunction)CFURLRefObj_CFURLCopyFragment, 1,
+ "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CFURLRefObj_chain = { CFURLRefObj_methods, &CFTypeRefObj_chain };
+
+static PyObject *CFURLRefObj_getattr(CFURLRefObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CFURLRefObj_chain, (PyObject *)self, name);
+}
+
+#define CFURLRefObj_setattr NULL
+
+static int CFURLRefObj_compare(CFURLRefObject *self, CFURLRefObject *other)
+{
+ /* XXXX Or should we use CFEqual?? */
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * CFURLRefObj_repr(CFURLRefObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<CFURL object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int CFURLRefObj_hash(CFURLRefObject *self)
+{
+ /* XXXX Or should we use CFHash?? */
+ return (int)self->ob_itself;
+}
+
+PyTypeObject CFURLRef_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "CFURLRef", /*tp_name*/
+ sizeof(CFURLRefObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CFURLRefObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CFURLRefObj_getattr, /*tp_getattr*/
+ (setattrfunc) CFURLRefObj_setattr, /*tp_setattr*/
+ (cmpfunc) CFURLRefObj_compare, /*tp_compare*/
+ (reprfunc) CFURLRefObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CFURLRefObj_hash, /*tp_hash*/
+};
+
+/* -------------------- End object type CFURLRef -------------------- */
+
+
+static PyObject *CF_CFAllocatorGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+ PyMac_PRECHECK(CFAllocatorGetTypeID);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFAllocatorGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFAllocatorGetPreferredSizeForSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ CFIndex size;
+ CFOptionFlags hint;
+ PyMac_PRECHECK(CFAllocatorGetPreferredSizeForSize);
+ if (!PyArg_ParseTuple(_args, "ll",
+ &size,
+ &hint))
+ return NULL;
+ _rv = CFAllocatorGetPreferredSizeForSize((CFAllocatorRef)NULL,
+ size,
+ hint);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFCopyTypeIDDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFTypeID theType;
+ PyMac_PRECHECK(CFCopyTypeIDDescription);
+ if (!PyArg_ParseTuple(_args, "l",
+ &theType))
+ return NULL;
+ _rv = CFCopyTypeIDDescription(theType);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFArrayGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+ PyMac_PRECHECK(CFArrayGetTypeID);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFArrayGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFArrayCreateMutable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableArrayRef _rv;
+ CFIndex capacity;
+ PyMac_PRECHECK(CFArrayCreateMutable);
+ if (!PyArg_ParseTuple(_args, "l",
+ &capacity))
+ return NULL;
+ _rv = CFArrayCreateMutable((CFAllocatorRef)NULL,
+ capacity,
+ &kCFTypeArrayCallBacks);
+ _res = Py_BuildValue("O&",
+ CFMutableArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFArrayCreateMutableCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableArrayRef _rv;
+ CFIndex capacity;
+ CFArrayRef srcArray;
+ PyMac_PRECHECK(CFArrayCreateMutableCopy);
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &capacity,
+ CFArrayRefObj_Convert, &srcArray))
+ return NULL;
+ _rv = CFArrayCreateMutableCopy((CFAllocatorRef)NULL,
+ capacity,
+ srcArray);
+ _res = Py_BuildValue("O&",
+ CFMutableArrayRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDataGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+ PyMac_PRECHECK(CFDataGetTypeID);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDataGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDataCreate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ unsigned char *bytes__in__;
+ long bytes__len__;
+ int bytes__in_len__;
+ PyMac_PRECHECK(CFDataCreate);
+ if (!PyArg_ParseTuple(_args, "s#",
+ &bytes__in__, &bytes__in_len__))
+ return NULL;
+ bytes__len__ = bytes__in_len__;
+ _rv = CFDataCreate((CFAllocatorRef)NULL,
+ bytes__in__, bytes__len__);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ bytes__error__: ;
+ return _res;
+}
+
+static PyObject *CF_CFDataCreateWithBytesNoCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFDataRef _rv;
+ unsigned char *bytes__in__;
+ long bytes__len__;
+ int bytes__in_len__;
+ PyMac_PRECHECK(CFDataCreateWithBytesNoCopy);
+ if (!PyArg_ParseTuple(_args, "s#",
+ &bytes__in__, &bytes__in_len__))
+ return NULL;
+ bytes__len__ = bytes__in_len__;
+ _rv = CFDataCreateWithBytesNoCopy((CFAllocatorRef)NULL,
+ bytes__in__, bytes__len__,
+ (CFAllocatorRef)NULL);
+ _res = Py_BuildValue("O&",
+ CFDataRefObj_New, _rv);
+ bytes__error__: ;
+ return _res;
+}
+
+static PyObject *CF_CFDataCreateMutable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableDataRef _rv;
+ CFIndex capacity;
+ PyMac_PRECHECK(CFDataCreateMutable);
+ if (!PyArg_ParseTuple(_args, "l",
+ &capacity))
+ return NULL;
+ _rv = CFDataCreateMutable((CFAllocatorRef)NULL,
+ capacity);
+ _res = Py_BuildValue("O&",
+ CFMutableDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDataCreateMutableCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableDataRef _rv;
+ CFIndex capacity;
+ CFDataRef data;
+ PyMac_PRECHECK(CFDataCreateMutableCopy);
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &capacity,
+ CFDataRefObj_Convert, &data))
+ return NULL;
+ _rv = CFDataCreateMutableCopy((CFAllocatorRef)NULL,
+ capacity,
+ data);
+ _res = Py_BuildValue("O&",
+ CFMutableDataRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDictionaryGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+ PyMac_PRECHECK(CFDictionaryGetTypeID);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFDictionaryGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDictionaryCreateMutable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableDictionaryRef _rv;
+ CFIndex capacity;
+ PyMac_PRECHECK(CFDictionaryCreateMutable);
+ if (!PyArg_ParseTuple(_args, "l",
+ &capacity))
+ return NULL;
+ _rv = CFDictionaryCreateMutable((CFAllocatorRef)NULL,
+ capacity,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ _res = Py_BuildValue("O&",
+ CFMutableDictionaryRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFDictionaryCreateMutableCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableDictionaryRef _rv;
+ CFIndex capacity;
+ CFDictionaryRef dict;
+ PyMac_PRECHECK(CFDictionaryCreateMutableCopy);
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &capacity,
+ CFDictionaryRefObj_Convert, &dict))
+ return NULL;
+ _rv = CFDictionaryCreateMutableCopy((CFAllocatorRef)NULL,
+ capacity,
+ dict);
+ _res = Py_BuildValue("O&",
+ CFMutableDictionaryRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+ PyMac_PRECHECK(CFStringGetTypeID);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithPascalString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ StringPtr pStr;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringCreateWithPascalString);
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetStr255, &pStr,
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateWithPascalString((CFAllocatorRef)NULL,
+ pStr,
+ encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithCString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ char* cStr;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringCreateWithCString);
+ if (!PyArg_ParseTuple(_args, "sl",
+ &cStr,
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateWithCString((CFAllocatorRef)NULL,
+ cStr,
+ encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithPascalStringNoCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ StringPtr pStr;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringCreateWithPascalStringNoCopy);
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetStr255, &pStr,
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateWithPascalStringNoCopy((CFAllocatorRef)NULL,
+ pStr,
+ encoding,
+ (CFAllocatorRef)NULL);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithCStringNoCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ char* cStr;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringCreateWithCStringNoCopy);
+ if (!PyArg_ParseTuple(_args, "sl",
+ &cStr,
+ &encoding))
+ return NULL;
+ _rv = CFStringCreateWithCStringNoCopy((CFAllocatorRef)NULL,
+ cStr,
+ encoding,
+ (CFAllocatorRef)NULL);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateMutable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableStringRef _rv;
+ CFIndex maxLength;
+ PyMac_PRECHECK(CFStringCreateMutable);
+ if (!PyArg_ParseTuple(_args, "l",
+ &maxLength))
+ return NULL;
+ _rv = CFStringCreateMutable((CFAllocatorRef)NULL,
+ maxLength);
+ _res = Py_BuildValue("O&",
+ CFMutableStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateMutableCopy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFMutableStringRef _rv;
+ CFIndex maxLength;
+ CFStringRef theString;
+ PyMac_PRECHECK(CFStringCreateMutableCopy);
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &maxLength,
+ CFStringRefObj_Convert, &theString))
+ return NULL;
+ _rv = CFStringCreateMutableCopy((CFAllocatorRef)NULL,
+ maxLength,
+ theString);
+ _res = Py_BuildValue("O&",
+ CFMutableStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringCreateWithBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ unsigned char *bytes__in__;
+ long bytes__len__;
+ int bytes__in_len__;
+ CFStringEncoding encoding;
+ Boolean isExternalRepresentation;
+ PyMac_PRECHECK(CFStringCreateWithBytes);
+ if (!PyArg_ParseTuple(_args, "s#ll",
+ &bytes__in__, &bytes__in_len__,
+ &encoding,
+ &isExternalRepresentation))
+ return NULL;
+ bytes__len__ = bytes__in_len__;
+ _rv = CFStringCreateWithBytes((CFAllocatorRef)NULL,
+ bytes__in__, bytes__len__,
+ encoding,
+ isExternalRepresentation);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ bytes__error__: ;
+ return _res;
+}
+
+static PyObject *CF_CFStringGetSystemEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ PyMac_PRECHECK(CFStringGetSystemEncoding);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFStringGetSystemEncoding();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringGetMaximumSizeForEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFIndex _rv;
+ CFIndex length;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringGetMaximumSizeForEncoding);
+ if (!PyArg_ParseTuple(_args, "ll",
+ &length,
+ &encoding))
+ return NULL;
+ _rv = CFStringGetMaximumSizeForEncoding(length,
+ encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringIsEncodingAvailable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringIsEncodingAvailable);
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringIsEncodingAvailable(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringGetNameOfEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringGetNameOfEncoding);
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringGetNameOfEncoding(encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertEncodingToNSStringEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringConvertEncodingToNSStringEncoding);
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringConvertEncodingToNSStringEncoding(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertNSStringEncodingToEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ UInt32 encoding;
+ PyMac_PRECHECK(CFStringConvertNSStringEncodingToEncoding);
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringConvertNSStringEncodingToEncoding(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertEncodingToWindowsCodepage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringConvertEncodingToWindowsCodepage);
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringConvertEncodingToWindowsCodepage(encoding);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertWindowsCodepageToEncoding(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringEncoding _rv;
+ UInt32 codepage;
+ PyMac_PRECHECK(CFStringConvertWindowsCodepageToEncoding);
+ if (!PyArg_ParseTuple(_args, "l",
+ &codepage))
+ return NULL;
+ _rv = CFStringConvertWindowsCodepageToEncoding(codepage);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFStringConvertEncodingToIANACharSetName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ CFStringEncoding encoding;
+ PyMac_PRECHECK(CFStringConvertEncodingToIANACharSetName);
+ if (!PyArg_ParseTuple(_args, "l",
+ &encoding))
+ return NULL;
+ _rv = CFStringConvertEncodingToIANACharSetName(encoding);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF___CFStringMakeConstantString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ char* cStr;
+ PyMac_PRECHECK(__CFStringMakeConstantString);
+ if (!PyArg_ParseTuple(_args, "s",
+ &cStr))
+ return NULL;
+ _rv = __CFStringMakeConstantString(cStr);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CF_CFURLGetTypeID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFTypeID _rv;
+ PyMac_PRECHECK(CFURLGetTypeID);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CFURLGetTypeID();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CF_CFURLCreateWithBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CFURLRef _rv;
+ unsigned char *URLBytes__in__;
+ long URLBytes__len__;
+ int URLBytes__in_len__;
+ CFStringEncoding encoding;
+ CFURLRef baseURL;
+ PyMac_PRECHECK(CFURLCreateWithBytes);
+ if (!PyArg_ParseTuple(_args, "s#lO&",
+ &URLBytes__in__, &URLBytes__in_len__,
+ &encoding,
+ OptionalCFURLRefObj_Convert, &baseURL))
+ return NULL;
+ URLBytes__len__ = URLBytes__in_len__;
+ _rv = CFURLCreateWithBytes((CFAllocatorRef)NULL,
+ URLBytes__in__, URLBytes__len__,
+ encoding,
+ baseURL);
+ _res = Py_BuildValue("O&",
+ CFURLRefObj_New, _rv);
+ URLBytes__error__: ;
+ return _res;
+}
+
+static PyMethodDef CF_methods[] = {
+ {"CFAllocatorGetTypeID", (PyCFunction)CF_CFAllocatorGetTypeID, 1,
+ "() -> (CFTypeID _rv)"},
+ {"CFAllocatorGetPreferredSizeForSize", (PyCFunction)CF_CFAllocatorGetPreferredSizeForSize, 1,
+ "(CFIndex size, CFOptionFlags hint) -> (CFIndex _rv)"},
+ {"CFCopyTypeIDDescription", (PyCFunction)CF_CFCopyTypeIDDescription, 1,
+ "(CFTypeID theType) -> (CFStringRef _rv)"},
+ {"CFArrayGetTypeID", (PyCFunction)CF_CFArrayGetTypeID, 1,
+ "() -> (CFTypeID _rv)"},
+ {"CFArrayCreateMutable", (PyCFunction)CF_CFArrayCreateMutable, 1,
+ "(CFIndex capacity) -> (CFMutableArrayRef _rv)"},
+ {"CFArrayCreateMutableCopy", (PyCFunction)CF_CFArrayCreateMutableCopy, 1,
+ "(CFIndex capacity, CFArrayRef srcArray) -> (CFMutableArrayRef _rv)"},
+ {"CFDataGetTypeID", (PyCFunction)CF_CFDataGetTypeID, 1,
+ "() -> (CFTypeID _rv)"},
+ {"CFDataCreate", (PyCFunction)CF_CFDataCreate, 1,
+ "(Buffer bytes) -> (CFDataRef _rv)"},
+ {"CFDataCreateWithBytesNoCopy", (PyCFunction)CF_CFDataCreateWithBytesNoCopy, 1,
+ "(Buffer bytes) -> (CFDataRef _rv)"},
+ {"CFDataCreateMutable", (PyCFunction)CF_CFDataCreateMutable, 1,
+ "(CFIndex capacity) -> (CFMutableDataRef _rv)"},
+ {"CFDataCreateMutableCopy", (PyCFunction)CF_CFDataCreateMutableCopy, 1,
+ "(CFIndex capacity, CFDataRef data) -> (CFMutableDataRef _rv)"},
+ {"CFDictionaryGetTypeID", (PyCFunction)CF_CFDictionaryGetTypeID, 1,
+ "() -> (CFTypeID _rv)"},
+ {"CFDictionaryCreateMutable", (PyCFunction)CF_CFDictionaryCreateMutable, 1,
+ "(CFIndex capacity) -> (CFMutableDictionaryRef _rv)"},
+ {"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1,
+ "(CFIndex capacity, CFDictionaryRef dict) -> (CFMutableDictionaryRef _rv)"},
+ {"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1,
+ "() -> (CFTypeID _rv)"},
+ {"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1,
+ "(StringPtr pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1,
+ "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1,
+ "(StringPtr pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1,
+ "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {"CFStringCreateMutable", (PyCFunction)CF_CFStringCreateMutable, 1,
+ "(CFIndex maxLength) -> (CFMutableStringRef _rv)"},
+ {"CFStringCreateMutableCopy", (PyCFunction)CF_CFStringCreateMutableCopy, 1,
+ "(CFIndex maxLength, CFStringRef theString) -> (CFMutableStringRef _rv)"},
+ {"CFStringCreateWithBytes", (PyCFunction)CF_CFStringCreateWithBytes, 1,
+ "(Buffer bytes, CFStringEncoding encoding, Boolean isExternalRepresentation) -> (CFStringRef _rv)"},
+ {"CFStringGetSystemEncoding", (PyCFunction)CF_CFStringGetSystemEncoding, 1,
+ "() -> (CFStringEncoding _rv)"},
+ {"CFStringGetMaximumSizeForEncoding", (PyCFunction)CF_CFStringGetMaximumSizeForEncoding, 1,
+ "(CFIndex length, CFStringEncoding encoding) -> (CFIndex _rv)"},
+ {"CFStringIsEncodingAvailable", (PyCFunction)CF_CFStringIsEncodingAvailable, 1,
+ "(CFStringEncoding encoding) -> (Boolean _rv)"},
+ {"CFStringGetNameOfEncoding", (PyCFunction)CF_CFStringGetNameOfEncoding, 1,
+ "(CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {"CFStringConvertEncodingToNSStringEncoding", (PyCFunction)CF_CFStringConvertEncodingToNSStringEncoding, 1,
+ "(CFStringEncoding encoding) -> (UInt32 _rv)"},
+ {"CFStringConvertNSStringEncodingToEncoding", (PyCFunction)CF_CFStringConvertNSStringEncodingToEncoding, 1,
+ "(UInt32 encoding) -> (CFStringEncoding _rv)"},
+ {"CFStringConvertEncodingToWindowsCodepage", (PyCFunction)CF_CFStringConvertEncodingToWindowsCodepage, 1,
+ "(CFStringEncoding encoding) -> (UInt32 _rv)"},
+ {"CFStringConvertWindowsCodepageToEncoding", (PyCFunction)CF_CFStringConvertWindowsCodepageToEncoding, 1,
+ "(UInt32 codepage) -> (CFStringEncoding _rv)"},
+ {"CFStringConvertEncodingToIANACharSetName", (PyCFunction)CF_CFStringConvertEncodingToIANACharSetName, 1,
+ "(CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {"__CFStringMakeConstantString", (PyCFunction)CF___CFStringMakeConstantString, 1,
+ "(char* cStr) -> (CFStringRef _rv)"},
+ {"CFURLGetTypeID", (PyCFunction)CF_CFURLGetTypeID, 1,
+ "() -> (CFTypeID _rv)"},
+ {"CFURLCreateWithBytes", (PyCFunction)CF_CFURLCreateWithBytes, 1,
+ "(Buffer URLBytes, CFStringEncoding encoding, CFURLRef baseURL) -> (CFURLRef _rv)"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_CF(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ // PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New);
+ // PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert);
+
+
+ m = Py_InitModule("_CF", CF_methods);
+ d = PyModule_GetDict(m);
+ CF_Error = PyMac_GetOSErrException();
+ if (CF_Error == NULL ||
+ PyDict_SetItemString(d, "Error", CF_Error) != 0)
+ return;
+ CFTypeRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFTypeRef_Type);
+ if (PyDict_SetItemString(d, "CFTypeRefType", (PyObject *)&CFTypeRef_Type) != 0)
+ Py_FatalError("can't initialize CFTypeRefType");
+ CFArrayRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFArrayRef_Type);
+ if (PyDict_SetItemString(d, "CFArrayRefType", (PyObject *)&CFArrayRef_Type) != 0)
+ Py_FatalError("can't initialize CFArrayRefType");
+ CFMutableArrayRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFMutableArrayRef_Type);
+ if (PyDict_SetItemString(d, "CFMutableArrayRefType", (PyObject *)&CFMutableArrayRef_Type) != 0)
+ Py_FatalError("can't initialize CFMutableArrayRefType");
+ CFDictionaryRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFDictionaryRef_Type);
+ if (PyDict_SetItemString(d, "CFDictionaryRefType", (PyObject *)&CFDictionaryRef_Type) != 0)
+ Py_FatalError("can't initialize CFDictionaryRefType");
+ CFMutableDictionaryRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFMutableDictionaryRef_Type);
+ if (PyDict_SetItemString(d, "CFMutableDictionaryRefType", (PyObject *)&CFMutableDictionaryRef_Type) != 0)
+ Py_FatalError("can't initialize CFMutableDictionaryRefType");
+ CFDataRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFDataRef_Type);
+ if (PyDict_SetItemString(d, "CFDataRefType", (PyObject *)&CFDataRef_Type) != 0)
+ Py_FatalError("can't initialize CFDataRefType");
+ CFMutableDataRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFMutableDataRef_Type);
+ if (PyDict_SetItemString(d, "CFMutableDataRefType", (PyObject *)&CFMutableDataRef_Type) != 0)
+ Py_FatalError("can't initialize CFMutableDataRefType");
+ CFStringRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFStringRef_Type);
+ if (PyDict_SetItemString(d, "CFStringRefType", (PyObject *)&CFStringRef_Type) != 0)
+ Py_FatalError("can't initialize CFStringRefType");
+ CFMutableStringRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFMutableStringRef_Type);
+ if (PyDict_SetItemString(d, "CFMutableStringRefType", (PyObject *)&CFMutableStringRef_Type) != 0)
+ Py_FatalError("can't initialize CFMutableStringRefType");
+ CFURLRef_Type.ob_type = &PyType_Type;
+ Py_INCREF(&CFURLRef_Type);
+ if (PyDict_SetItemString(d, "CFURLRefType", (PyObject *)&CFURLRef_Type) != 0)
+ Py_FatalError("can't initialize CFURLRefType");
+}
+
+/* ========================= End module _CF ========================= */
+
diff --git a/Mac/Modules/cm/_Cmmodule.c b/Mac/Modules/cm/_Cmmodule.c
new file mode 100644
index 0000000..f13c046
--- /dev/null
+++ b/Mac/Modules/cm/_Cmmodule.c
@@ -0,0 +1,798 @@
+
+/* =========================== Module _Cm =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Components.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CmpObj_New(Component);
+extern int _CmpObj_Convert(PyObject *, Component *);
+extern PyObject *_CmpInstObj_New(ComponentInstance);
+extern int _CmpInstObj_Convert(PyObject *, ComponentInstance *);
+
+#define CmpObj_New _CmpObj_New
+#define CmpObj_Convert _CmpObj_Convert
+#define CmpInstObj_New _CmpInstObj_New
+#define CmpInstObj_Convert _CmpInstObj_Convert
+#endif
+
+/*
+** Parse/generate ComponentDescriptor records
+*/
+static PyObject *
+CmpDesc_New(ComponentDescription *itself)
+{
+
+ return Py_BuildValue("O&O&O&ll",
+ PyMac_BuildOSType, itself->componentType,
+ PyMac_BuildOSType, itself->componentSubType,
+ PyMac_BuildOSType, itself->componentManufacturer,
+ itself->componentFlags, itself->componentFlagsMask);
+}
+
+static int
+CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself)
+{
+ return PyArg_ParseTuple(v, "O&O&O&ll",
+ PyMac_GetOSType, &p_itself->componentType,
+ PyMac_GetOSType, &p_itself->componentSubType,
+ PyMac_GetOSType, &p_itself->componentManufacturer,
+ &p_itself->componentFlags, &p_itself->componentFlagsMask);
+}
+
+
+static PyObject *Cm_Error;
+
+/* ----------------- Object type ComponentInstance ------------------ */
+
+PyTypeObject ComponentInstance_Type;
+
+#define CmpInstObj_Check(x) ((x)->ob_type == &ComponentInstance_Type)
+
+typedef struct ComponentInstanceObject {
+ PyObject_HEAD
+ ComponentInstance ob_itself;
+} ComponentInstanceObject;
+
+PyObject *CmpInstObj_New(ComponentInstance itself)
+{
+ ComponentInstanceObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Cm_Error,"NULL ComponentInstance");
+ return NULL;
+ }
+ it = PyObject_NEW(ComponentInstanceObject, &ComponentInstance_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+CmpInstObj_Convert(PyObject *v, ComponentInstance *p_itself)
+{
+ if (!CmpInstObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "ComponentInstance required");
+ return 0;
+ }
+ *p_itself = ((ComponentInstanceObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CmpInstObj_dealloc(ComponentInstanceObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ PyMem_DEL(self);
+}
+
+static PyObject *CmpInstObj_CloseComponent(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CloseComponent(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpInstObj_GetComponentInstanceError(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetComponentInstanceError(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpInstObj_SetComponentInstanceError(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr theError;
+ if (!PyArg_ParseTuple(_args, "h",
+ &theError))
+ return NULL;
+ SetComponentInstanceError(_self->ob_itself,
+ theError);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpInstObj_GetComponentInstanceStorage(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentInstanceStorage(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CmpInstObj_SetComponentInstanceStorage(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle theStorage;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theStorage))
+ return NULL;
+ SetComponentInstanceStorage(_self->ob_itself,
+ theStorage);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *CmpInstObj_GetComponentInstanceA5(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentInstanceA5(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *CmpInstObj_SetComponentInstanceA5(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long theA5;
+ if (!PyArg_ParseTuple(_args, "l",
+ &theA5))
+ return NULL;
+ SetComponentInstanceA5(_self->ob_itself,
+ theA5);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *CmpInstObj_ComponentFunctionImplemented(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ short ftnNumber;
+ if (!PyArg_ParseTuple(_args, "h",
+ &ftnNumber))
+ return NULL;
+ _rv = ComponentFunctionImplemented(_self->ob_itself,
+ ftnNumber);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpInstObj_GetComponentVersion(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentVersion(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpInstObj_ComponentSetTarget(ComponentInstanceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ ComponentInstance target;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &target))
+ return NULL;
+ _rv = ComponentSetTarget(_self->ob_itself,
+ target);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef CmpInstObj_methods[] = {
+ {"CloseComponent", (PyCFunction)CmpInstObj_CloseComponent, 1,
+ "() -> None"},
+ {"GetComponentInstanceError", (PyCFunction)CmpInstObj_GetComponentInstanceError, 1,
+ "() -> None"},
+ {"SetComponentInstanceError", (PyCFunction)CmpInstObj_SetComponentInstanceError, 1,
+ "(OSErr theError) -> None"},
+ {"GetComponentInstanceStorage", (PyCFunction)CmpInstObj_GetComponentInstanceStorage, 1,
+ "() -> (Handle _rv)"},
+ {"SetComponentInstanceStorage", (PyCFunction)CmpInstObj_SetComponentInstanceStorage, 1,
+ "(Handle theStorage) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"GetComponentInstanceA5", (PyCFunction)CmpInstObj_GetComponentInstanceA5, 1,
+ "() -> (long _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SetComponentInstanceA5", (PyCFunction)CmpInstObj_SetComponentInstanceA5, 1,
+ "(long theA5) -> None"},
+#endif
+ {"ComponentFunctionImplemented", (PyCFunction)CmpInstObj_ComponentFunctionImplemented, 1,
+ "(short ftnNumber) -> (long _rv)"},
+ {"GetComponentVersion", (PyCFunction)CmpInstObj_GetComponentVersion, 1,
+ "() -> (long _rv)"},
+ {"ComponentSetTarget", (PyCFunction)CmpInstObj_ComponentSetTarget, 1,
+ "(ComponentInstance target) -> (long _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CmpInstObj_chain = { CmpInstObj_methods, NULL };
+
+static PyObject *CmpInstObj_getattr(ComponentInstanceObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CmpInstObj_chain, (PyObject *)self, name);
+}
+
+#define CmpInstObj_setattr NULL
+
+#define CmpInstObj_compare NULL
+
+#define CmpInstObj_repr NULL
+
+#define CmpInstObj_hash NULL
+
+PyTypeObject ComponentInstance_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "ComponentInstance", /*tp_name*/
+ sizeof(ComponentInstanceObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CmpInstObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CmpInstObj_getattr, /*tp_getattr*/
+ (setattrfunc) CmpInstObj_setattr, /*tp_setattr*/
+ (cmpfunc) CmpInstObj_compare, /*tp_compare*/
+ (reprfunc) CmpInstObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CmpInstObj_hash, /*tp_hash*/
+};
+
+/* --------------- End object type ComponentInstance ---------------- */
+
+
+/* --------------------- Object type Component ---------------------- */
+
+PyTypeObject Component_Type;
+
+#define CmpObj_Check(x) ((x)->ob_type == &Component_Type)
+
+typedef struct ComponentObject {
+ PyObject_HEAD
+ Component ob_itself;
+} ComponentObject;
+
+PyObject *CmpObj_New(Component itself)
+{
+ ComponentObject *it;
+ if (itself == NULL) {
+ /* XXXX Or should we return None? */
+ PyErr_SetString(Cm_Error,"No such component");
+ return NULL;
+ }
+ it = PyObject_NEW(ComponentObject, &Component_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+CmpObj_Convert(PyObject *v, Component *p_itself)
+{
+ if ( v == Py_None ) {
+ *p_itself = 0;
+ return 1;
+ }
+ if (!CmpObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Component required");
+ return 0;
+ }
+ *p_itself = ((ComponentObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CmpObj_dealloc(ComponentObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ PyMem_DEL(self);
+}
+
+static PyObject *CmpObj_UnregisterComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UnregisterComponent(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentInfo(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ComponentDescription cd;
+ Handle componentName;
+ Handle componentInfo;
+ Handle componentIcon;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &componentName,
+ ResObj_Convert, &componentInfo,
+ ResObj_Convert, &componentIcon))
+ return NULL;
+ _err = GetComponentInfo(_self->ob_itself,
+ &cd,
+ componentName,
+ componentInfo,
+ componentIcon);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpDesc_New, &cd);
+ return _res;
+}
+
+static PyObject *CmpObj_OpenComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentInstance _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = OpenComponent(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentRefcon(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentRefcon(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_SetComponentRefcon(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long theRefcon;
+ if (!PyArg_ParseTuple(_args, "l",
+ &theRefcon))
+ return NULL;
+ SetComponentRefcon(_self->ob_itself,
+ theRefcon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_OpenComponentResFile(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = OpenComponentResFile(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentResource(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType resType;
+ short resID;
+ Handle theResource;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &resType,
+ &resID))
+ return NULL;
+ _err = GetComponentResource(_self->ob_itself,
+ resType,
+ resID,
+ &theResource);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theResource);
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentIndString(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 theString;
+ short strListID;
+ short index;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetStr255, theString,
+ &strListID,
+ &index))
+ return NULL;
+ _err = GetComponentIndString(_self->ob_itself,
+ theString,
+ strListID,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_ResolveComponentAlias(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = ResolveComponentAlias(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_CountComponentInstances(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountComponentInstances(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_SetDefaultComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short flags;
+ if (!PyArg_ParseTuple(_args, "h",
+ &flags))
+ return NULL;
+ _err = SetDefaultComponent(_self->ob_itself,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_CaptureComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ Component capturingComponent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpObj_Convert, &capturingComponent))
+ return NULL;
+ _rv = CaptureComponent(_self->ob_itself,
+ capturingComponent);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CmpObj_UncaptureComponent(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UncaptureComponent(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CmpObj_GetComponentIconSuite(ComponentObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle iconSuite;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetComponentIconSuite(_self->ob_itself,
+ &iconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconSuite);
+ return _res;
+}
+
+static PyMethodDef CmpObj_methods[] = {
+ {"UnregisterComponent", (PyCFunction)CmpObj_UnregisterComponent, 1,
+ "() -> None"},
+ {"GetComponentInfo", (PyCFunction)CmpObj_GetComponentInfo, 1,
+ "(Handle componentName, Handle componentInfo, Handle componentIcon) -> (ComponentDescription cd)"},
+ {"OpenComponent", (PyCFunction)CmpObj_OpenComponent, 1,
+ "() -> (ComponentInstance _rv)"},
+ {"GetComponentRefcon", (PyCFunction)CmpObj_GetComponentRefcon, 1,
+ "() -> (long _rv)"},
+ {"SetComponentRefcon", (PyCFunction)CmpObj_SetComponentRefcon, 1,
+ "(long theRefcon) -> None"},
+ {"OpenComponentResFile", (PyCFunction)CmpObj_OpenComponentResFile, 1,
+ "() -> (short _rv)"},
+ {"GetComponentResource", (PyCFunction)CmpObj_GetComponentResource, 1,
+ "(OSType resType, short resID) -> (Handle theResource)"},
+ {"GetComponentIndString", (PyCFunction)CmpObj_GetComponentIndString, 1,
+ "(Str255 theString, short strListID, short index) -> None"},
+ {"ResolveComponentAlias", (PyCFunction)CmpObj_ResolveComponentAlias, 1,
+ "() -> (Component _rv)"},
+ {"CountComponentInstances", (PyCFunction)CmpObj_CountComponentInstances, 1,
+ "() -> (long _rv)"},
+ {"SetDefaultComponent", (PyCFunction)CmpObj_SetDefaultComponent, 1,
+ "(short flags) -> None"},
+ {"CaptureComponent", (PyCFunction)CmpObj_CaptureComponent, 1,
+ "(Component capturingComponent) -> (Component _rv)"},
+ {"UncaptureComponent", (PyCFunction)CmpObj_UncaptureComponent, 1,
+ "() -> None"},
+ {"GetComponentIconSuite", (PyCFunction)CmpObj_GetComponentIconSuite, 1,
+ "() -> (Handle iconSuite)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CmpObj_chain = { CmpObj_methods, NULL };
+
+static PyObject *CmpObj_getattr(ComponentObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CmpObj_chain, (PyObject *)self, name);
+}
+
+#define CmpObj_setattr NULL
+
+#define CmpObj_compare NULL
+
+#define CmpObj_repr NULL
+
+#define CmpObj_hash NULL
+
+PyTypeObject Component_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Component", /*tp_name*/
+ sizeof(ComponentObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CmpObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CmpObj_getattr, /*tp_getattr*/
+ (setattrfunc) CmpObj_setattr, /*tp_setattr*/
+ (cmpfunc) CmpObj_compare, /*tp_compare*/
+ (reprfunc) CmpObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CmpObj_hash, /*tp_hash*/
+};
+
+/* ------------------- End object type Component -------------------- */
+
+
+static PyObject *Cm_RegisterComponentResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ ComponentResourceHandle cr;
+ short global;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &cr,
+ &global))
+ return NULL;
+ _rv = RegisterComponentResource(cr,
+ global);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Cm_FindNextComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ Component aComponent;
+ ComponentDescription looking;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpObj_Convert, &aComponent,
+ CmpDesc_Convert, &looking))
+ return NULL;
+ _rv = FindNextComponent(aComponent,
+ &looking);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Cm_CountComponents(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ ComponentDescription looking;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpDesc_Convert, &looking))
+ return NULL;
+ _rv = CountComponents(&looking);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Cm_GetComponentListModSeed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetComponentListModSeed();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Cm_CloseComponentResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short refnum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refnum))
+ return NULL;
+ _err = CloseComponentResFile(refnum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Cm_OpenDefaultComponent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentInstance _rv;
+ OSType componentType;
+ OSType componentSubType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &componentType,
+ PyMac_GetOSType, &componentSubType))
+ return NULL;
+ _rv = OpenDefaultComponent(componentType,
+ componentSubType);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Cm_RegisterComponentResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ short resRefNum;
+ short global;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &resRefNum,
+ &global))
+ return NULL;
+ _rv = RegisterComponentResourceFile(resRefNum,
+ global);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef Cm_methods[] = {
+ {"RegisterComponentResource", (PyCFunction)Cm_RegisterComponentResource, 1,
+ "(ComponentResourceHandle cr, short global) -> (Component _rv)"},
+ {"FindNextComponent", (PyCFunction)Cm_FindNextComponent, 1,
+ "(Component aComponent, ComponentDescription looking) -> (Component _rv)"},
+ {"CountComponents", (PyCFunction)Cm_CountComponents, 1,
+ "(ComponentDescription looking) -> (long _rv)"},
+ {"GetComponentListModSeed", (PyCFunction)Cm_GetComponentListModSeed, 1,
+ "() -> (long _rv)"},
+ {"CloseComponentResFile", (PyCFunction)Cm_CloseComponentResFile, 1,
+ "(short refnum) -> None"},
+ {"OpenDefaultComponent", (PyCFunction)Cm_OpenDefaultComponent, 1,
+ "(OSType componentType, OSType componentSubType) -> (ComponentInstance _rv)"},
+ {"RegisterComponentResourceFile", (PyCFunction)Cm_RegisterComponentResourceFile, 1,
+ "(short resRefNum, short global) -> (long _rv)"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Cm(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Component, CmpObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Component, CmpObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, CmpInstObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, CmpInstObj_Convert);
+
+
+ m = Py_InitModule("_Cm", Cm_methods);
+ d = PyModule_GetDict(m);
+ Cm_Error = PyMac_GetOSErrException();
+ if (Cm_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Cm_Error) != 0)
+ return;
+ ComponentInstance_Type.ob_type = &PyType_Type;
+ Py_INCREF(&ComponentInstance_Type);
+ if (PyDict_SetItemString(d, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type) != 0)
+ Py_FatalError("can't initialize ComponentInstanceType");
+ Component_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Component_Type);
+ if (PyDict_SetItemString(d, "ComponentType", (PyObject *)&Component_Type) != 0)
+ Py_FatalError("can't initialize ComponentType");
+}
+
+/* ========================= End module _Cm ========================= */
+
diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c
new file mode 100644
index 0000000..d30cec1
--- /dev/null
+++ b/Mac/Modules/ctl/_Ctlmodule.c
@@ -0,0 +1,2694 @@
+
+/* ========================== Module _Ctl =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Controls.h>
+#include <ControlDefinitions.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CtlObj_New(ControlHandle);
+extern int _CtlObj_Convert(PyObject *, ControlHandle *);
+
+#define CtlObj_New _CtlObj_New
+#define CtlObj_Convert _CtlObj_Convert
+#endif
+
+staticforward PyObject *CtlObj_WhichControl(ControlHandle);
+
+#define as_Control(h) ((ControlHandle)h)
+#define as_Resource(ctl) ((Handle)ctl)
+#if TARGET_API_MAC_CARBON
+#define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp)
+#else
+#define GetControlRect(ctl, rectp) (*(rectp) = ((*(ctl))->contrlRect))
+#endif
+
+/*
+** Parse/generate ControlFontStyleRec records
+*/
+#if 0 /* Not needed */
+static PyObject *
+ControlFontStyle_New(ControlFontStyleRec *itself)
+{
+
+ return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font,
+ itself->size, itself->style, itself->mode, itself->just,
+ QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor);
+}
+#endif
+
+static int
+ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
+{
+ return PyArg_ParseTuple(v, "hhhhhhO&O&", &itself->flags,
+ &itself->font, &itself->size, &itself->style, &itself->mode,
+ &itself->just, QdRGB_Convert, &itself->foreColor,
+ QdRGB_Convert, &itself->backColor);
+}
+
+/*
+** Parse/generate ControlID records
+*/
+static PyObject *
+PyControlID_New(ControlID *itself)
+{
+
+ return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id);
+}
+
+static int
+PyControlID_Convert(PyObject *v, ControlID *itself)
+{
+ return PyArg_ParseTuple(v, "O&l", PyMac_GetOSType, &itself->signature, &itself->id);
+}
+
+
+/* TrackControl and HandleControlClick callback support */
+static PyObject *tracker;
+static ControlActionUPP mytracker_upp;
+static ControlUserPaneDrawUPP mydrawproc_upp;
+static ControlUserPaneIdleUPP myidleproc_upp;
+static ControlUserPaneHitTestUPP myhittestproc_upp;
+static ControlUserPaneTrackingUPP mytrackingproc_upp;
+
+staticforward int settrackfunc(PyObject *); /* forward */
+staticforward void clrtrackfunc(void); /* forward */
+staticforward int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *);
+
+static PyObject *Ctl_Error;
+
+/* ---------------------- Object type Control ----------------------- */
+
+PyTypeObject Control_Type;
+
+#define CtlObj_Check(x) ((x)->ob_type == &Control_Type)
+
+typedef struct ControlObject {
+ PyObject_HEAD
+ ControlHandle ob_itself;
+ PyObject *ob_callbackdict;
+} ControlObject;
+
+PyObject *CtlObj_New(ControlHandle itself)
+{
+ ControlObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(ControlObject, &Control_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ SetControlReference(itself, (long)it);
+ it->ob_callbackdict = NULL;
+ return (PyObject *)it;
+}
+CtlObj_Convert(PyObject *v, ControlHandle *p_itself)
+{
+ if (!CtlObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Control required");
+ return 0;
+ }
+ *p_itself = ((ControlObject *)v)->ob_itself;
+ return 1;
+}
+
+static void CtlObj_dealloc(ControlObject *self)
+{
+ Py_XDECREF(self->ob_callbackdict);
+ if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */
+ PyMem_DEL(self);
+}
+
+static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlPartCode hiliteState;
+ if (!PyArg_ParseTuple(_args, "h",
+ &hiliteState))
+ return NULL;
+ HiliteControl(_self->ob_itself,
+ hiliteState);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_ShowControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowControl(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_HideControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HideControl(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_IsControlActive(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlActive(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_IsControlVisible(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlVisible(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_ActivateControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ActivateControl(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_DeactivateControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DeactivateControl(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlVisibility(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean inIsVisible;
+ Boolean inDoDraw;
+ if (!PyArg_ParseTuple(_args, "bb",
+ &inIsVisible,
+ &inDoDraw))
+ return NULL;
+ _err = SetControlVisibility(_self->ob_itself,
+ inIsVisible,
+ inDoDraw);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ Draw1Control(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetBestControlRect(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect outRect;
+ SInt16 outBaseLineOffset;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetBestControlRect(_self->ob_itself,
+ &outRect,
+ &outBaseLineOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ PyMac_BuildRect, &outRect,
+ outBaseLineOffset);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlFontStyle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlFontStyleRec inStyle;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ControlFontStyle_Convert, &inStyle))
+ return NULL;
+ _err = SetControlFontStyle(_self->ob_itself,
+ &inStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_DrawControlInCurrentPort(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DrawControlInCurrentPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetUpControlBackground(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetUpControlBackground(_self->ob_itself,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetUpControlTextColor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inDepth;
+ Boolean inIsColorDevice;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inDepth,
+ &inIsColorDevice))
+ return NULL;
+ _err = SetUpControlTextColor(_self->ob_itself,
+ inDepth,
+ inIsColorDevice);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_DragControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point startPoint;
+ Rect limitRect;
+ Rect slopRect;
+ DragConstraint axis;
+ if (!PyArg_ParseTuple(_args, "O&O&O&H",
+ PyMac_GetPoint, &startPoint,
+ PyMac_GetRect, &limitRect,
+ PyMac_GetRect, &slopRect,
+ &axis))
+ return NULL;
+ DragControl(_self->ob_itself,
+ startPoint,
+ &limitRect,
+ &slopRect,
+ axis);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_TestControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlPartCode _rv;
+ Point testPoint;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &testPoint))
+ return NULL;
+ _rv = TestControl(_self->ob_itself,
+ testPoint);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_HandleControlContextualMenuClick(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point inWhere;
+ Boolean menuDisplayed;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &inWhere))
+ return NULL;
+ _err = HandleControlContextualMenuClick(_self->ob_itself,
+ inWhere,
+ &menuDisplayed);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ menuDisplayed);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_GetControlClickActivation(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point inWhere;
+ EventModifiers inModifiers;
+ ClickActivationResult outResult;
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetPoint, &inWhere,
+ &inModifiers))
+ return NULL;
+ _err = GetControlClickActivation(_self->ob_itself,
+ inWhere,
+ inModifiers,
+ &outResult);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outResult);
+ return _res;
+}
+#endif
+
+static PyObject *CtlObj_HandleControlKey(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ SInt16 inKeyCode;
+ SInt16 inCharCode;
+ EventModifiers inModifiers;
+ if (!PyArg_ParseTuple(_args, "hhH",
+ &inKeyCode,
+ &inCharCode,
+ &inModifiers))
+ return NULL;
+ _rv = HandleControlKey(_self->ob_itself,
+ inKeyCode,
+ inCharCode,
+ inModifiers);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_HandleControlSetCursor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point localPoint;
+ EventModifiers modifiers;
+ Boolean cursorWasSet;
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetPoint, &localPoint,
+ &modifiers))
+ return NULL;
+ _err = HandleControlSetCursor(_self->ob_itself,
+ localPoint,
+ modifiers,
+ &cursorWasSet);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ cursorWasSet);
+ return _res;
+}
+#endif
+
+static PyObject *CtlObj_MoveControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 h;
+ SInt16 v;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ MoveControl(_self->ob_itself,
+ h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SizeControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 w;
+ SInt16 h;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &w,
+ &h))
+ return NULL;
+ SizeControl(_self->ob_itself,
+ w,
+ h);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlTitle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 title;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, title))
+ return NULL;
+ SetControlTitle(_self->ob_itself,
+ title);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlTitle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 title;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetControlTitle(_self->ob_itself,
+ title);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, title);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlValue(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 newValue;
+ if (!PyArg_ParseTuple(_args, "h",
+ &newValue))
+ return NULL;
+ SetControlValue(_self->ob_itself,
+ newValue);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlMinimum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlMinimum(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlMinimum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 newMinimum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &newMinimum))
+ return NULL;
+ SetControlMinimum(_self->ob_itself,
+ newMinimum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlMaximum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlMaximum(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlMaximum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 newMaximum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &newMaximum))
+ return NULL;
+ SetControlMaximum(_self->ob_itself,
+ newMaximum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlViewSize(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlViewSize(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlViewSize(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 newViewSize;
+ if (!PyArg_ParseTuple(_args, "l",
+ &newViewSize))
+ return NULL;
+ SetControlViewSize(_self->ob_itself,
+ newViewSize);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControl32BitValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControl32BitValue(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControl32BitValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 newValue;
+ if (!PyArg_ParseTuple(_args, "l",
+ &newValue))
+ return NULL;
+ SetControl32BitValue(_self->ob_itself,
+ newValue);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControl32BitMaximum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControl32BitMaximum(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControl32BitMaximum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 newMaximum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &newMaximum))
+ return NULL;
+ SetControl32BitMaximum(_self->ob_itself,
+ newMaximum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControl32BitMinimum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControl32BitMinimum(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControl32BitMinimum(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 newMinimum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &newMinimum))
+ return NULL;
+ SetControl32BitMinimum(_self->ob_itself,
+ newMinimum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_IsValidControlHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsValidControlHandle(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_SetControlID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ControlID inID;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyControlID_Convert, &inID))
+ return NULL;
+ _err = SetControlID(_self->ob_itself,
+ &inID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_GetControlID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ControlID outID;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetControlID(_self->ob_itself,
+ &outID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyControlID_New, &outID);
+ return _res;
+}
+#endif
+
+static PyObject *CtlObj_RemoveControlProperty(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = RemoveControlProperty(_self->ob_itself,
+ propertyCreator,
+ propertyTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_GetControlPropertyAttributes(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributes;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetControlPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ &attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ attributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_ChangeControlPropertyAttributes(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributesToSet;
+ UInt32 attributesToClear;
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag,
+ &attributesToSet,
+ &attributesToClear))
+ return NULL;
+ _err = ChangeControlPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ attributesToSet,
+ attributesToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *CtlObj_GetControlRegion(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ControlPartCode inPart;
+ RgnHandle outRegion;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ ResObj_Convert, &outRegion))
+ return NULL;
+ _err = GetControlRegion(_self->ob_itself,
+ inPart,
+ outRegion);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlVariant(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlVariant _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlVariant(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlReference(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 data;
+ if (!PyArg_ParseTuple(_args, "l",
+ &data))
+ return NULL;
+ SetControlReference(_self->ob_itself,
+ data);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlReference(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlReference(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_GetAuxiliaryControlRecord(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ AuxCtlHandle acHndl;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetAuxiliaryControlRecord(_self->ob_itself,
+ &acHndl);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ ResObj_New, acHndl);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_SetControlColor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CCTabHandle newColorTable;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &newColorTable))
+ return NULL;
+ SetControlColor(_self->ob_itself,
+ newColorTable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *CtlObj_EmbedControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlHandle inContainer;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CtlObj_Convert, &inContainer))
+ return NULL;
+ _err = EmbedControl(_self->ob_itself,
+ inContainer);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_AutoEmbedControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = AutoEmbedControl(_self->ob_itself,
+ inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetSuperControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlHandle outParent;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetSuperControl(_self->ob_itself,
+ &outParent);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outParent);
+ return _res;
+}
+
+static PyObject *CtlObj_CountSubControls(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 outNumChildren;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CountSubControls(_self->ob_itself,
+ &outNumChildren);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outNumChildren);
+ return _res;
+}
+
+static PyObject *CtlObj_GetIndexedSubControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 inIndex;
+ ControlHandle outSubControl;
+ if (!PyArg_ParseTuple(_args, "H",
+ &inIndex))
+ return NULL;
+ _err = GetIndexedSubControl(_self->ob_itself,
+ inIndex,
+ &outSubControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outSubControl);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlSupervisor(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlHandle inBoss;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CtlObj_Convert, &inBoss))
+ return NULL;
+ _err = SetControlSupervisor(_self->ob_itself,
+ inBoss);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlFeatures(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt32 outFeatures;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetControlFeatures(_self->ob_itself,
+ &outFeatures);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outFeatures);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlDataSize(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size outMaxSize;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
+ return NULL;
+ _err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &outMaxSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outMaxSize);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_HandleControlDragTracking(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DragTrackingMessage inMessage;
+ DragReference inDrag;
+ Boolean outLikesDrag;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inMessage,
+ DragObj_Convert, &inDrag))
+ return NULL;
+ _err = HandleControlDragTracking(_self->ob_itself,
+ inMessage,
+ inDrag,
+ &outLikesDrag);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outLikesDrag);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_HandleControlDragReceive(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DragReference inDrag;
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &inDrag))
+ return NULL;
+ _err = HandleControlDragReceive(_self->ob_itself,
+ inDrag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_SetControlDragTrackingEnabled(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean tracks;
+ if (!PyArg_ParseTuple(_args, "b",
+ &tracks))
+ return NULL;
+ _err = SetControlDragTrackingEnabled(_self->ob_itself,
+ tracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_IsControlDragTrackingEnabled(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean tracks;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = IsControlDragTrackingEnabled(_self->ob_itself,
+ &tracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ tracks);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlBounds(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetControlBounds(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_IsControlHilited(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlHilited(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlHilite(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlHilite(_self->ob_itself);
+ _res = Py_BuildValue("H",
+ _rv);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlOwner(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlOwner(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlDataHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlDataHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlPopupMenuHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlPopupMenuHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlPopupMenuID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlPopupMenuID(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_SetControlDataHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle dataHandle;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &dataHandle))
+ return NULL;
+ SetControlDataHandle(_self->ob_itself,
+ dataHandle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_SetControlBounds(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &bounds))
+ return NULL;
+ SetControlBounds(_self->ob_itself,
+ &bounds);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_SetControlPopupMenuHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle popupMenu;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MenuObj_Convert, &popupMenu))
+ return NULL;
+ SetControlPopupMenuHandle(_self->ob_itself,
+ popupMenu);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_SetControlPopupMenuID(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ SetControlPopupMenuID(_self->ob_itself,
+ menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *CtlObj_GetBevelButtonMenuValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 outValue;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetBevelButtonMenuValue(_self->ob_itself,
+ &outValue);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outValue);
+ return _res;
+}
+
+static PyObject *CtlObj_SetBevelButtonMenuValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inValue;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inValue))
+ return NULL;
+ _err = SetBevelButtonMenuValue(_self->ob_itself,
+ inValue);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetBevelButtonMenuHandle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ MenuHandle outHandle;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetBevelButtonMenuHandle(_self->ob_itself,
+ &outHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, outHandle);
+ return _res;
+}
+
+static PyObject *CtlObj_SetBevelButtonTransform(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconTransformType transform;
+ if (!PyArg_ParseTuple(_args, "h",
+ &transform))
+ return NULL;
+ _err = SetBevelButtonTransform(_self->ob_itself,
+ transform);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetDisclosureTriangleLastValue(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inValue;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inValue))
+ return NULL;
+ _err = SetDisclosureTriangleLastValue(_self->ob_itself,
+ inValue);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetTabContentRect(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect outContentRect;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetTabContentRect(_self->ob_itself,
+ &outContentRect);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outContentRect);
+ return _res;
+}
+
+static PyObject *CtlObj_SetTabEnabled(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inTabToHilite;
+ Boolean inEnabled;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inTabToHilite,
+ &inEnabled))
+ return NULL;
+ _err = SetTabEnabled(_self->ob_itself,
+ inTabToHilite,
+ inEnabled);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetImageWellTransform(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconTransformType inTransform;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inTransform))
+ return NULL;
+ _err = SetImageWellTransform(_self->ob_itself,
+ inTransform);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_as_Resource(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *CtlObj_GetControlRect(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetControlRect(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *CtlObj_DisposeControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ if ( _self->ob_itself ) {
+ SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */
+ DisposeControl(_self->ob_itself);
+ _self->ob_itself = NULL;
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *CtlObj_TrackControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ ControlPartCode _rv;
+ Point startPoint;
+ ControlActionUPP upp = 0;
+ PyObject *callback = 0;
+
+ if (!PyArg_ParseTuple(_args, "O&|O",
+ PyMac_GetPoint, &startPoint, &callback))
+ return NULL;
+ if (callback && callback != Py_None) {
+ if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
+ upp = (ControlActionUPP)-1;
+ else {
+ settrackfunc(callback);
+ upp = mytracker_upp;
+ }
+ }
+ _rv = TrackControl(_self->ob_itself,
+ startPoint,
+ upp);
+ clrtrackfunc();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+
+}
+
+static PyObject *CtlObj_HandleControlClick(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ ControlPartCode _rv;
+ Point startPoint;
+ SInt16 modifiers;
+ ControlActionUPP upp = 0;
+ PyObject *callback = 0;
+
+ if (!PyArg_ParseTuple(_args, "O&h|O",
+ PyMac_GetPoint, &startPoint,
+ &modifiers,
+ &callback))
+ return NULL;
+ if (callback && callback != Py_None) {
+ if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
+ upp = (ControlActionUPP)-1;
+ else {
+ settrackfunc(callback);
+ upp = mytracker_upp;
+ }
+ }
+ _rv = HandleControlClick(_self->ob_itself,
+ startPoint,
+ modifiers,
+ upp);
+ clrtrackfunc();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+
+}
+
+static PyObject *CtlObj_SetControlData(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size bufferSize;
+ Ptr buffer;
+
+ if (!PyArg_ParseTuple(_args, "hO&s#",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ &buffer, &bufferSize))
+ return NULL;
+
+ _err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ bufferSize,
+ buffer);
+
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *CtlObj_GetControlData(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size bufferSize;
+ Ptr buffer;
+ Size outSize;
+
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
+ return NULL;
+
+ /* allocate a buffer for the data */
+ _err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &bufferSize);
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ buffer = PyMem_NEW(char, bufferSize);
+ if (buffer == NULL)
+ return PyErr_NoMemory();
+
+ _err = GetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ bufferSize,
+ buffer,
+ &outSize);
+
+ if (_err != noErr) {
+ PyMem_DEL(buffer);
+ return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("s#", buffer, outSize);
+ PyMem_DEL(buffer);
+ return _res;
+
+}
+
+static PyObject *CtlObj_SetControlData_Handle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Handle buffer;
+
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ OptResObj_Convert, &buffer))
+ return NULL;
+
+ _err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(buffer),
+ (Ptr)&buffer);
+
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyObject *CtlObj_GetControlData_Handle(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size bufferSize;
+ Handle hdl;
+
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
+ return NULL;
+
+ /* Check it is handle-sized */
+ _err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &bufferSize);
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ if (bufferSize != sizeof(Handle)) {
+ PyErr_SetString(Ctl_Error, "GetControlDataSize() != sizeof(Handle)");
+ return NULL;
+ }
+
+ _err = GetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(Handle),
+ (Ptr)&hdl,
+ &bufferSize);
+
+ if (_err != noErr) {
+ return PyMac_Error(_err);
+ }
+ return Py_BuildValue("O&", OptResObj_New, hdl);
+
+}
+
+static PyObject *CtlObj_SetControlData_Callback(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSErr _err;
+ ControlPartCode inPart;
+ ResType inTagName;
+ PyObject *callback;
+ UniversalProcPtr c_callback;
+
+ if (!PyArg_ParseTuple(_args, "hO&O",
+ &inPart,
+ PyMac_GetOSType, &inTagName,
+ &callback))
+ return NULL;
+
+ if ( setcallback((PyObject *)_self, inTagName, callback, &c_callback) < 0 )
+ return NULL;
+ _err = SetControlData(_self->ob_itself,
+ inPart,
+ inTagName,
+ sizeof(c_callback),
+ (Ptr)&c_callback);
+
+ if (_err != noErr)
+ return PyMac_Error(_err);
+ _res = Py_None;
+ return _res;
+
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_GetPopupData(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PopupPrivateDataHandle hdl;
+
+ if ( (*_self->ob_itself)->contrlData == NULL ) {
+ PyErr_SetString(Ctl_Error, "No contrlData handle in control");
+ return 0;
+ }
+ hdl = (PopupPrivateDataHandle)(*_self->ob_itself)->contrlData;
+ HLock((Handle)hdl);
+ _res = Py_BuildValue("O&i", MenuObj_New, (*hdl)->mHandle, (int)(*hdl)->mID);
+ HUnlock((Handle)hdl);
+ return _res;
+
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_SetPopupData(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PopupPrivateDataHandle hdl;
+ MenuHandle mHandle;
+ short mID;
+
+ if (!PyArg_ParseTuple(_args, "O&h", MenuObj_Convert, &mHandle, &mID) )
+ return 0;
+ if ( (*_self->ob_itself)->contrlData == NULL ) {
+ PyErr_SetString(Ctl_Error, "No contrlData handle in control");
+ return 0;
+ }
+ hdl = (PopupPrivateDataHandle)(*_self->ob_itself)->contrlData;
+ (*hdl)->mHandle = mHandle;
+ (*hdl)->mID = mID;
+ Py_INCREF(Py_None);
+ return Py_None;
+
+}
+#endif
+
+static PyMethodDef CtlObj_methods[] = {
+ {"HiliteControl", (PyCFunction)CtlObj_HiliteControl, 1,
+ "(ControlPartCode hiliteState) -> None"},
+ {"ShowControl", (PyCFunction)CtlObj_ShowControl, 1,
+ "() -> None"},
+ {"HideControl", (PyCFunction)CtlObj_HideControl, 1,
+ "() -> None"},
+ {"IsControlActive", (PyCFunction)CtlObj_IsControlActive, 1,
+ "() -> (Boolean _rv)"},
+ {"IsControlVisible", (PyCFunction)CtlObj_IsControlVisible, 1,
+ "() -> (Boolean _rv)"},
+ {"ActivateControl", (PyCFunction)CtlObj_ActivateControl, 1,
+ "() -> None"},
+ {"DeactivateControl", (PyCFunction)CtlObj_DeactivateControl, 1,
+ "() -> None"},
+ {"SetControlVisibility", (PyCFunction)CtlObj_SetControlVisibility, 1,
+ "(Boolean inIsVisible, Boolean inDoDraw) -> None"},
+ {"Draw1Control", (PyCFunction)CtlObj_Draw1Control, 1,
+ "() -> None"},
+ {"GetBestControlRect", (PyCFunction)CtlObj_GetBestControlRect, 1,
+ "() -> (Rect outRect, SInt16 outBaseLineOffset)"},
+ {"SetControlFontStyle", (PyCFunction)CtlObj_SetControlFontStyle, 1,
+ "(ControlFontStyleRec inStyle) -> None"},
+ {"DrawControlInCurrentPort", (PyCFunction)CtlObj_DrawControlInCurrentPort, 1,
+ "() -> None"},
+ {"SetUpControlBackground", (PyCFunction)CtlObj_SetUpControlBackground, 1,
+ "(SInt16 inDepth, Boolean inIsColorDevice) -> None"},
+ {"SetUpControlTextColor", (PyCFunction)CtlObj_SetUpControlTextColor, 1,
+ "(SInt16 inDepth, Boolean inIsColorDevice) -> None"},
+ {"DragControl", (PyCFunction)CtlObj_DragControl, 1,
+ "(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None"},
+ {"TestControl", (PyCFunction)CtlObj_TestControl, 1,
+ "(Point testPoint) -> (ControlPartCode _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"HandleControlContextualMenuClick", (PyCFunction)CtlObj_HandleControlContextualMenuClick, 1,
+ "(Point inWhere) -> (Boolean menuDisplayed)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetControlClickActivation", (PyCFunction)CtlObj_GetControlClickActivation, 1,
+ "(Point inWhere, EventModifiers inModifiers) -> (ClickActivationResult outResult)"},
+#endif
+ {"HandleControlKey", (PyCFunction)CtlObj_HandleControlKey, 1,
+ "(SInt16 inKeyCode, SInt16 inCharCode, EventModifiers inModifiers) -> (SInt16 _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"HandleControlSetCursor", (PyCFunction)CtlObj_HandleControlSetCursor, 1,
+ "(Point localPoint, EventModifiers modifiers) -> (Boolean cursorWasSet)"},
+#endif
+ {"MoveControl", (PyCFunction)CtlObj_MoveControl, 1,
+ "(SInt16 h, SInt16 v) -> None"},
+ {"SizeControl", (PyCFunction)CtlObj_SizeControl, 1,
+ "(SInt16 w, SInt16 h) -> None"},
+ {"SetControlTitle", (PyCFunction)CtlObj_SetControlTitle, 1,
+ "(Str255 title) -> None"},
+ {"GetControlTitle", (PyCFunction)CtlObj_GetControlTitle, 1,
+ "() -> (Str255 title)"},
+ {"GetControlValue", (PyCFunction)CtlObj_GetControlValue, 1,
+ "() -> (SInt16 _rv)"},
+ {"SetControlValue", (PyCFunction)CtlObj_SetControlValue, 1,
+ "(SInt16 newValue) -> None"},
+ {"GetControlMinimum", (PyCFunction)CtlObj_GetControlMinimum, 1,
+ "() -> (SInt16 _rv)"},
+ {"SetControlMinimum", (PyCFunction)CtlObj_SetControlMinimum, 1,
+ "(SInt16 newMinimum) -> None"},
+ {"GetControlMaximum", (PyCFunction)CtlObj_GetControlMaximum, 1,
+ "() -> (SInt16 _rv)"},
+ {"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1,
+ "(SInt16 newMaximum) -> None"},
+ {"GetControlViewSize", (PyCFunction)CtlObj_GetControlViewSize, 1,
+ "() -> (SInt32 _rv)"},
+ {"SetControlViewSize", (PyCFunction)CtlObj_SetControlViewSize, 1,
+ "(SInt32 newViewSize) -> None"},
+ {"GetControl32BitValue", (PyCFunction)CtlObj_GetControl32BitValue, 1,
+ "() -> (SInt32 _rv)"},
+ {"SetControl32BitValue", (PyCFunction)CtlObj_SetControl32BitValue, 1,
+ "(SInt32 newValue) -> None"},
+ {"GetControl32BitMaximum", (PyCFunction)CtlObj_GetControl32BitMaximum, 1,
+ "() -> (SInt32 _rv)"},
+ {"SetControl32BitMaximum", (PyCFunction)CtlObj_SetControl32BitMaximum, 1,
+ "(SInt32 newMaximum) -> None"},
+ {"GetControl32BitMinimum", (PyCFunction)CtlObj_GetControl32BitMinimum, 1,
+ "() -> (SInt32 _rv)"},
+ {"SetControl32BitMinimum", (PyCFunction)CtlObj_SetControl32BitMinimum, 1,
+ "(SInt32 newMinimum) -> None"},
+ {"IsValidControlHandle", (PyCFunction)CtlObj_IsValidControlHandle, 1,
+ "() -> (Boolean _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"SetControlID", (PyCFunction)CtlObj_SetControlID, 1,
+ "(ControlID inID) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetControlID", (PyCFunction)CtlObj_GetControlID, 1,
+ "() -> (ControlID outID)"},
+#endif
+ {"RemoveControlProperty", (PyCFunction)CtlObj_RemoveControlProperty, 1,
+ "(OSType propertyCreator, OSType propertyTag) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetControlPropertyAttributes", (PyCFunction)CtlObj_GetControlPropertyAttributes, 1,
+ "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeControlPropertyAttributes", (PyCFunction)CtlObj_ChangeControlPropertyAttributes, 1,
+ "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
+#endif
+ {"GetControlRegion", (PyCFunction)CtlObj_GetControlRegion, 1,
+ "(ControlPartCode inPart, RgnHandle outRegion) -> None"},
+ {"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1,
+ "() -> (ControlVariant _rv)"},
+ {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1,
+ "(SInt32 data) -> None"},
+ {"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1,
+ "() -> (SInt32 _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"GetAuxiliaryControlRecord", (PyCFunction)CtlObj_GetAuxiliaryControlRecord, 1,
+ "() -> (Boolean _rv, AuxCtlHandle acHndl)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SetControlColor", (PyCFunction)CtlObj_SetControlColor, 1,
+ "(CCTabHandle newColorTable) -> None"},
+#endif
+ {"EmbedControl", (PyCFunction)CtlObj_EmbedControl, 1,
+ "(ControlHandle inContainer) -> None"},
+ {"AutoEmbedControl", (PyCFunction)CtlObj_AutoEmbedControl, 1,
+ "(WindowPtr inWindow) -> None"},
+ {"GetSuperControl", (PyCFunction)CtlObj_GetSuperControl, 1,
+ "() -> (ControlHandle outParent)"},
+ {"CountSubControls", (PyCFunction)CtlObj_CountSubControls, 1,
+ "() -> (UInt16 outNumChildren)"},
+ {"GetIndexedSubControl", (PyCFunction)CtlObj_GetIndexedSubControl, 1,
+ "(UInt16 inIndex) -> (ControlHandle outSubControl)"},
+ {"SetControlSupervisor", (PyCFunction)CtlObj_SetControlSupervisor, 1,
+ "(ControlHandle inBoss) -> None"},
+ {"GetControlFeatures", (PyCFunction)CtlObj_GetControlFeatures, 1,
+ "() -> (UInt32 outFeatures)"},
+ {"GetControlDataSize", (PyCFunction)CtlObj_GetControlDataSize, 1,
+ "(ControlPartCode inPart, ResType inTagName) -> (Size outMaxSize)"},
+
+#if TARGET_API_MAC_CARBON
+ {"HandleControlDragTracking", (PyCFunction)CtlObj_HandleControlDragTracking, 1,
+ "(DragTrackingMessage inMessage, DragReference inDrag) -> (Boolean outLikesDrag)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"HandleControlDragReceive", (PyCFunction)CtlObj_HandleControlDragReceive, 1,
+ "(DragReference inDrag) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1,
+ "(Boolean tracks) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsControlDragTrackingEnabled", (PyCFunction)CtlObj_IsControlDragTrackingEnabled, 1,
+ "() -> (Boolean tracks)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlBounds", (PyCFunction)CtlObj_GetControlBounds, 1,
+ "() -> (Rect bounds)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"IsControlHilited", (PyCFunction)CtlObj_IsControlHilited, 1,
+ "() -> (Boolean _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlHilite", (PyCFunction)CtlObj_GetControlHilite, 1,
+ "() -> (UInt16 _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlOwner", (PyCFunction)CtlObj_GetControlOwner, 1,
+ "() -> (WindowPtr _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlDataHandle", (PyCFunction)CtlObj_GetControlDataHandle, 1,
+ "() -> (Handle _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlPopupMenuHandle", (PyCFunction)CtlObj_GetControlPopupMenuHandle, 1,
+ "() -> (MenuHandle _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlPopupMenuID", (PyCFunction)CtlObj_GetControlPopupMenuID, 1,
+ "() -> (short _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"SetControlDataHandle", (PyCFunction)CtlObj_SetControlDataHandle, 1,
+ "(Handle dataHandle) -> None"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"SetControlBounds", (PyCFunction)CtlObj_SetControlBounds, 1,
+ "(Rect bounds) -> None"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"SetControlPopupMenuHandle", (PyCFunction)CtlObj_SetControlPopupMenuHandle, 1,
+ "(MenuHandle popupMenu) -> None"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"SetControlPopupMenuID", (PyCFunction)CtlObj_SetControlPopupMenuID, 1,
+ "(short menuID) -> None"},
+#endif
+ {"GetBevelButtonMenuValue", (PyCFunction)CtlObj_GetBevelButtonMenuValue, 1,
+ "() -> (SInt16 outValue)"},
+ {"SetBevelButtonMenuValue", (PyCFunction)CtlObj_SetBevelButtonMenuValue, 1,
+ "(SInt16 inValue) -> None"},
+ {"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1,
+ "() -> (MenuHandle outHandle)"},
+ {"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1,
+ "(IconTransformType transform) -> None"},
+ {"SetDisclosureTriangleLastValue", (PyCFunction)CtlObj_SetDisclosureTriangleLastValue, 1,
+ "(SInt16 inValue) -> None"},
+ {"GetTabContentRect", (PyCFunction)CtlObj_GetTabContentRect, 1,
+ "() -> (Rect outContentRect)"},
+ {"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1,
+ "(SInt16 inTabToHilite, Boolean inEnabled) -> None"},
+ {"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1,
+ "(IconTransformType inTransform) -> None"},
+ {"as_Resource", (PyCFunction)CtlObj_as_Resource, 1,
+ "() -> (Handle _rv)"},
+ {"GetControlRect", (PyCFunction)CtlObj_GetControlRect, 1,
+ "() -> (Rect rect)"},
+ {"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1,
+ "() -> None"},
+ {"TrackControl", (PyCFunction)CtlObj_TrackControl, 1,
+ "(Point startPoint [,trackercallback]) -> (ControlPartCode _rv)"},
+ {"HandleControlClick", (PyCFunction)CtlObj_HandleControlClick, 1,
+ "(Point startPoint, Integer modifiers, [,trackercallback]) -> (ControlPartCode _rv)"},
+ {"SetControlData", (PyCFunction)CtlObj_SetControlData, 1,
+ "(stuff) -> None"},
+ {"GetControlData", (PyCFunction)CtlObj_GetControlData, 1,
+ "(part, type) -> String"},
+ {"SetControlData_Handle", (PyCFunction)CtlObj_SetControlData_Handle, 1,
+ "(ResObj) -> None"},
+ {"GetControlData_Handle", (PyCFunction)CtlObj_GetControlData_Handle, 1,
+ "(part, type) -> ResObj"},
+ {"SetControlData_Callback", (PyCFunction)CtlObj_SetControlData_Callback, 1,
+ "(callbackfunc) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"GetPopupData", (PyCFunction)CtlObj_GetPopupData, 1,
+ NULL},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SetPopupData", (PyCFunction)CtlObj_SetPopupData, 1,
+ NULL},
+#endif
+ {NULL, NULL, 0}
+};
+
+PyMethodChain CtlObj_chain = { CtlObj_methods, NULL };
+
+static PyObject *CtlObj_getattr(ControlObject *self, char *name)
+{
+ return Py_FindMethodInChain(&CtlObj_chain, (PyObject *)self, name);
+}
+
+#define CtlObj_setattr NULL
+
+static int CtlObj_compare(ControlObject *self, ControlObject *other)
+{
+ unsigned long v, w;
+
+ if (!CtlObj_Check((PyObject *)other))
+ {
+ v=(unsigned long)self;
+ w=(unsigned long)other;
+ }
+ else
+ {
+ v=(unsigned long)self->ob_itself;
+ w=(unsigned long)other->ob_itself;
+ }
+ if( v < w ) return -1;
+ if( v > w ) return 1;
+ return 0;
+}
+
+#define CtlObj_repr NULL
+
+static long CtlObj_hash(ControlObject *self)
+{
+ return (long)self->ob_itself;
+}
+
+PyTypeObject Control_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Control", /*tp_name*/
+ sizeof(ControlObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) CtlObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) CtlObj_getattr, /*tp_getattr*/
+ (setattrfunc) CtlObj_setattr, /*tp_setattr*/
+ (cmpfunc) CtlObj_compare, /*tp_compare*/
+ (reprfunc) CtlObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) CtlObj_hash, /*tp_hash*/
+};
+
+/* -------------------- End object type Control --------------------- */
+
+
+static PyObject *Ctl_NewControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ WindowPtr owningWindow;
+ Rect boundsRect;
+ Str255 controlTitle;
+ Boolean initiallyVisible;
+ SInt16 initialValue;
+ SInt16 minimumValue;
+ SInt16 maximumValue;
+ SInt16 procID;
+ SInt32 controlReference;
+ if (!PyArg_ParseTuple(_args, "O&O&O&bhhhhl",
+ WinObj_Convert, &owningWindow,
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, controlTitle,
+ &initiallyVisible,
+ &initialValue,
+ &minimumValue,
+ &maximumValue,
+ &procID,
+ &controlReference))
+ return NULL;
+ _rv = NewControl(owningWindow,
+ &boundsRect,
+ controlTitle,
+ initiallyVisible,
+ initialValue,
+ minimumValue,
+ maximumValue,
+ procID,
+ controlReference);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Ctl_GetNewControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ SInt16 resourceID;
+ WindowPtr owningWindow;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &resourceID,
+ WinObj_Convert, &owningWindow))
+ return NULL;
+ _rv = GetNewControl(resourceID,
+ owningWindow);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Ctl_DrawControls(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr theWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &theWindow))
+ return NULL;
+ DrawControls(theWindow);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_UpdateControls(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr theWindow;
+ RgnHandle updateRegion;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &theWindow,
+ ResObj_Convert, &updateRegion))
+ return NULL;
+ UpdateControls(theWindow,
+ updateRegion);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_FindControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlPartCode _rv;
+ Point testPoint;
+ WindowPtr theWindow;
+ ControlHandle theControl;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &testPoint,
+ WinObj_Convert, &theWindow))
+ return NULL;
+ _rv = FindControl(testPoint,
+ theWindow,
+ &theControl);
+ _res = Py_BuildValue("hO&",
+ _rv,
+ CtlObj_WhichControl, theControl);
+ return _res;
+}
+
+static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ Point inWhere;
+ WindowPtr inWindow;
+ SInt16 outPart;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &inWhere,
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _rv = FindControlUnderMouse(inWhere,
+ inWindow,
+ &outPart);
+ _res = Py_BuildValue("O&h",
+ CtlObj_New, _rv,
+ outPart);
+ return _res;
+}
+
+static PyObject *Ctl_IdleControls(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ IdleControls(inWindow);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Ctl_GetControlByID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ControlID inID;
+ ControlHandle outControl;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &inWindow,
+ PyControlID_Convert, &inID))
+ return NULL;
+ _err = GetControlByID(inWindow,
+ &inID,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outControl);
+ return _res;
+}
+#endif
+
+static PyObject *Ctl_DumpControlHierarchy(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ FSSpec inDumpFile;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &inWindow,
+ PyMac_GetFSSpec, &inDumpFile))
+ return NULL;
+ _err = DumpControlHierarchy(inWindow,
+ &inDumpFile);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_CreateRootControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ ControlHandle outControl;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = CreateRootControl(inWindow,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_GetRootControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ ControlHandle outControl;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = GetRootControl(inWindow,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_GetKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ ControlHandle outControl;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = GetKeyboardFocus(inWindow,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outControl);
+ return _res;
+}
+
+static PyObject *Ctl_SetKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ ControlHandle inControl;
+ ControlFocusPart inPart;
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ WinObj_Convert, &inWindow,
+ CtlObj_Convert, &inControl,
+ &inPart))
+ return NULL;
+ _err = SetKeyboardFocus(inWindow,
+ inControl,
+ inPart);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_AdvanceKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = AdvanceKeyboardFocus(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_ReverseKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = ReverseKeyboardFocus(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Ctl_ClearKeyboardFocus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
+ return NULL;
+ _err = ClearKeyboardFocus(inWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Ctl_SetAutomaticControlDragTrackingEnabledForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr theWindow;
+ Boolean tracks;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ WinObj_Convert, &theWindow,
+ &tracks))
+ return NULL;
+ _err = SetAutomaticControlDragTrackingEnabledForWindow(theWindow,
+ tracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Ctl_IsAutomaticControlDragTrackingEnabledForWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr theWindow;
+ Boolean tracks;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &theWindow))
+ return NULL;
+ _err = IsAutomaticControlDragTrackingEnabledForWindow(theWindow,
+ &tracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ tracks);
+ return _res;
+}
+#endif
+
+static PyObject *Ctl_as_Control(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ Handle h;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = as_Control(h);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef Ctl_methods[] = {
+ {"NewControl", (PyCFunction)Ctl_NewControl, 1,
+ "(WindowPtr owningWindow, Rect boundsRect, Str255 controlTitle, Boolean initiallyVisible, SInt16 initialValue, SInt16 minimumValue, SInt16 maximumValue, SInt16 procID, SInt32 controlReference) -> (ControlHandle _rv)"},
+ {"GetNewControl", (PyCFunction)Ctl_GetNewControl, 1,
+ "(SInt16 resourceID, WindowPtr owningWindow) -> (ControlHandle _rv)"},
+ {"DrawControls", (PyCFunction)Ctl_DrawControls, 1,
+ "(WindowPtr theWindow) -> None"},
+ {"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1,
+ "(WindowPtr theWindow, RgnHandle updateRegion) -> None"},
+ {"FindControl", (PyCFunction)Ctl_FindControl, 1,
+ "(Point testPoint, WindowPtr theWindow) -> (ControlPartCode _rv, ControlHandle theControl)"},
+ {"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1,
+ "(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)"},
+ {"IdleControls", (PyCFunction)Ctl_IdleControls, 1,
+ "(WindowPtr inWindow) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetControlByID", (PyCFunction)Ctl_GetControlByID, 1,
+ "(WindowPtr inWindow, ControlID inID) -> (ControlHandle outControl)"},
+#endif
+ {"DumpControlHierarchy", (PyCFunction)Ctl_DumpControlHierarchy, 1,
+ "(WindowPtr inWindow, FSSpec inDumpFile) -> None"},
+ {"CreateRootControl", (PyCFunction)Ctl_CreateRootControl, 1,
+ "(WindowPtr inWindow) -> (ControlHandle outControl)"},
+ {"GetRootControl", (PyCFunction)Ctl_GetRootControl, 1,
+ "(WindowPtr inWindow) -> (ControlHandle outControl)"},
+ {"GetKeyboardFocus", (PyCFunction)Ctl_GetKeyboardFocus, 1,
+ "(WindowPtr inWindow) -> (ControlHandle outControl)"},
+ {"SetKeyboardFocus", (PyCFunction)Ctl_SetKeyboardFocus, 1,
+ "(WindowPtr inWindow, ControlHandle inControl, ControlFocusPart inPart) -> None"},
+ {"AdvanceKeyboardFocus", (PyCFunction)Ctl_AdvanceKeyboardFocus, 1,
+ "(WindowPtr inWindow) -> None"},
+ {"ReverseKeyboardFocus", (PyCFunction)Ctl_ReverseKeyboardFocus, 1,
+ "(WindowPtr inWindow) -> None"},
+ {"ClearKeyboardFocus", (PyCFunction)Ctl_ClearKeyboardFocus, 1,
+ "(WindowPtr inWindow) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"SetAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_SetAutomaticControlDragTrackingEnabledForWindow, 1,
+ "(WindowPtr theWindow, Boolean tracks) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_IsAutomaticControlDragTrackingEnabledForWindow, 1,
+ "(WindowPtr theWindow) -> (Boolean tracks)"},
+#endif
+ {"as_Control", (PyCFunction)Ctl_as_Control, 1,
+ "(Handle h) -> (ControlHandle _rv)"},
+ {NULL, NULL, 0}
+};
+
+
+
+static PyObject *
+CtlObj_NewUnmanaged(ControlHandle itself)
+{
+ ControlObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(ControlObject, &Control_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_callbackdict = NULL;
+ return (PyObject *)it;
+}
+
+static PyObject *
+CtlObj_WhichControl(ControlHandle c)
+{
+ PyObject *it;
+
+ if (c == NULL)
+ it = Py_None;
+ else {
+ it = (PyObject *) GetControlReference(c);
+ /*
+ ** If the refcon is zero or doesn't point back to the Python object
+ ** the control is not ours. Return a temporary object.
+ */
+ if (it == NULL || ((ControlObject *)it)->ob_itself != c)
+ return CtlObj_NewUnmanaged(c);
+ }
+ Py_INCREF(it);
+ return it;
+}
+
+static int
+settrackfunc(PyObject *obj)
+{
+ if (tracker) {
+ PyErr_SetString(Ctl_Error, "Tracker function in use");
+ return 0;
+ }
+ tracker = obj;
+ Py_INCREF(tracker);
+}
+
+static void
+clrtrackfunc(void)
+{
+ Py_XDECREF(tracker);
+ tracker = 0;
+}
+
+static pascal void
+mytracker(ControlHandle ctl, short part)
+{
+ PyObject *args, *rv=0;
+
+ args = Py_BuildValue("(O&i)", CtlObj_WhichControl, ctl, (int)part);
+ if (args && tracker) {
+ rv = PyEval_CallObject(tracker, args);
+ Py_DECREF(args);
+ }
+ if (rv)
+ Py_DECREF(rv);
+ else
+ PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\n");
+}
+
+static int
+setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr *uppp)
+{
+ ControlObject *self = (ControlObject *)myself;
+ char keybuf[9];
+
+ if ( which == kControlUserPaneDrawProcTag )
+ *uppp = (UniversalProcPtr)mydrawproc_upp;
+ else if ( which == kControlUserPaneIdleProcTag )
+ *uppp = (UniversalProcPtr)myidleproc_upp;
+ else if ( which == kControlUserPaneHitTestProcTag )
+ *uppp = (UniversalProcPtr)myhittestproc_upp;
+ else if ( which == kControlUserPaneTrackingProcTag )
+ *uppp = (UniversalProcPtr)mytrackingproc_upp;
+ else
+ return -1;
+ /* Only now do we test for clearing of the callback: */
+ if ( callback == Py_None )
+ *uppp = NULL;
+ /* Create the dict if it doesn't exist yet (so we don't get such a dict for every control) */
+ if ( self->ob_callbackdict == NULL )
+ if ( (self->ob_callbackdict = PyDict_New()) == NULL )
+ return -1;
+ /* And store the Python callback */
+ sprintf(keybuf, "%x", which);
+ if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0)
+ return -1;
+ return 0;
+}
+
+static PyObject *
+callcallback(ControlObject *self, OSType which, PyObject *arglist)
+{
+ char keybuf[9];
+ PyObject *func, *rv;
+
+ sprintf(keybuf, "%x", which);
+ if ( self->ob_callbackdict == NULL ||
+ (func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) {
+ PySys_WriteStderr("Control callback %x without callback object\n", which);
+ return NULL;
+ }
+ rv = PyEval_CallObject(func, arglist);
+ if ( rv == NULL )
+ PySys_WriteStderr("Exception in control callback %x handler\n", which);
+ return rv;
+}
+
+static pascal void
+mydrawproc(ControlHandle control, SInt16 part)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("Oh", ctl_obj, part);
+ rv = callcallback(ctl_obj, kControlUserPaneDrawProcTag, arglist);
+ Py_XDECREF(arglist);
+ Py_XDECREF(rv);
+}
+
+static pascal void
+myidleproc(ControlHandle control)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("O", ctl_obj);
+ rv = callcallback(ctl_obj, kControlUserPaneIdleProcTag, arglist);
+ Py_XDECREF(arglist);
+ Py_XDECREF(rv);
+}
+
+static pascal ControlPartCode
+myhittestproc(ControlHandle control, Point where)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = -1;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, where);
+ rv = callcallback(ctl_obj, kControlUserPaneHitTestProcTag, arglist);
+ Py_XDECREF(arglist);
+ /* Ignore errors, nothing we can do about them */
+ if ( rv )
+ PyArg_Parse(rv, "h", &c_rv);
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+
+static pascal ControlPartCode
+mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc)
+{
+ ControlObject *ctl_obj;
+ PyObject *arglist, *rv;
+ short c_rv = -1;
+
+ ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
+ /* We cannot pass the actionProc without lots of work */
+ arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, startPt);
+ rv = callcallback(ctl_obj, kControlUserPaneTrackingProcTag, arglist);
+ Py_XDECREF(arglist);
+ if ( rv )
+ PyArg_Parse(rv, "h", &c_rv);
+ Py_XDECREF(rv);
+ return (ControlPartCode)c_rv;
+}
+
+
+void init_Ctl(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ mytracker_upp = NewControlActionUPP(mytracker);
+ mydrawproc_upp = NewControlUserPaneDrawUPP(mydrawproc);
+ myidleproc_upp = NewControlUserPaneIdleUPP(myidleproc);
+ myhittestproc_upp = NewControlUserPaneHitTestUPP(myhittestproc);
+ mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert);
+
+
+ m = Py_InitModule("_Ctl", Ctl_methods);
+ d = PyModule_GetDict(m);
+ Ctl_Error = PyMac_GetOSErrException();
+ if (Ctl_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Ctl_Error) != 0)
+ return;
+ Control_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Control_Type);
+ if (PyDict_SetItemString(d, "ControlType", (PyObject *)&Control_Type) != 0)
+ Py_FatalError("can't initialize ControlType");
+}
+
+/* ======================== End module _Ctl ========================= */
+
diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c
new file mode 100644
index 0000000..414c09f
--- /dev/null
+++ b/Mac/Modules/dlg/_Dlgmodule.c
@@ -0,0 +1,1434 @@
+
+/* ========================== Module _Dlg =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Dialogs.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DlgObj_New(DialogRef);
+extern PyObject *_DlgObj_WhichDialog(DialogRef);
+extern int _DlgObj_Convert(PyObject *, DialogRef *);
+
+#define DlgObj_New _DlgObj_New
+#define DlgObj_WhichDialog _DlgObj_WhichDialog
+#define DlgObj_Convert _DlgObj_Convert
+#endif
+
+#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+#define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH)
+#define SetPortDialogPort(dlg) SetPort(dlg)
+#define GetDialogPort(dlg) ((CGrafPtr)(dlg))
+#define GetDialogFromWindow(win) ((DialogRef)(win))
+#endif
+
+/* XXX Shouldn't this be a stack? */
+static PyObject *Dlg_FilterProc_callback = NULL;
+
+static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
+ EventRecord *event,
+ short *itemHit)
+{
+ Boolean rv;
+ PyObject *args, *res;
+ PyObject *callback = Dlg_FilterProc_callback;
+ if (callback == NULL)
+ return 0; /* Default behavior */
+ Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
+ args = Py_BuildValue("O&O&", DlgObj_WhichDialog, dialog, PyMac_BuildEventRecord, event);
+ if (args == NULL)
+ res = NULL;
+ else {
+ res = PyEval_CallObject(callback, args);
+ Py_DECREF(args);
+ }
+ if (res == NULL) {
+ PySys_WriteStderr("Exception in Dialog Filter\n");
+ PyErr_Print();
+ *itemHit = -1; /* Fake return item */
+ return 1; /* We handled it */
+ }
+ else {
+ Dlg_FilterProc_callback = callback;
+ if (PyInt_Check(res)) {
+ *itemHit = PyInt_AsLong(res);
+ rv = 1;
+ }
+ else
+ rv = PyObject_IsTrue(res);
+ }
+ Py_DECREF(res);
+ return rv;
+}
+
+static ModalFilterUPP
+Dlg_PassFilterProc(PyObject *callback)
+{
+ PyObject *tmp = Dlg_FilterProc_callback;
+ static ModalFilterUPP UnivFilterUpp = NULL;
+
+ Dlg_FilterProc_callback = NULL;
+ if (callback == Py_None) {
+ Py_XDECREF(tmp);
+ return NULL;
+ }
+ Py_INCREF(callback);
+ Dlg_FilterProc_callback = callback;
+ Py_XDECREF(tmp);
+ if ( UnivFilterUpp == NULL )
+ UnivFilterUpp = NewModalFilterUPP(&Dlg_UnivFilterProc);
+ return UnivFilterUpp;
+}
+
+static PyObject *Dlg_UserItemProc_callback = NULL;
+
+static pascal void Dlg_UnivUserItemProc(DialogPtr dialog,
+ short item)
+{
+ PyObject *args, *res;
+
+ if (Dlg_UserItemProc_callback == NULL)
+ return; /* Default behavior */
+ Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */
+ args = Py_BuildValue("O&h", DlgObj_WhichDialog, dialog, item);
+ if (args == NULL)
+ res = NULL;
+ else {
+ res = PyEval_CallObject(Dlg_UserItemProc_callback, args);
+ Py_DECREF(args);
+ }
+ if (res == NULL) {
+ PySys_WriteStderr("Exception in Dialog UserItem proc\n");
+ PyErr_Print();
+ }
+ Py_XDECREF(res);
+ return;
+}
+
+#if 0
+/*
+** Treating DialogObjects as WindowObjects is (I think) illegal under Carbon.
+** However, as they are still identical under MacOS9 Carbon this is a problem, even
+** if we neatly call GetDialogWindow() at the right places: there's one refcon field
+** and it points to the DialogObject, so WinObj_WhichWindow will smartly return the
+** dialog object, and therefore we still don't have a WindowObject.
+** I'll leave the chaining code in place for now, with this comment to warn the
+** unsuspecting victims (i.e. me, probably, in a few weeks:-)
+*/
+extern PyMethodChain WinObj_chain;
+#endif
+
+static PyObject *Dlg_Error;
+
+/* ----------------------- Object type Dialog ----------------------- */
+
+PyTypeObject Dialog_Type;
+
+#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
+
+typedef struct DialogObject {
+ PyObject_HEAD
+ DialogPtr ob_itself;
+} DialogObject;
+
+PyObject *DlgObj_New(DialogPtr itself)
+{
+ DialogObject *it;
+ if (itself == NULL) return Py_None;
+ it = PyObject_NEW(DialogObject, &Dialog_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ SetWRefCon(GetDialogWindow(itself), (long)it);
+ return (PyObject *)it;
+}
+DlgObj_Convert(PyObject *v, DialogPtr *p_itself)
+{
+ if (v == Py_None) { *p_itself = NULL; return 1; }
+ if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v);
+ return 1; }
+ if (!DlgObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Dialog required");
+ return 0;
+ }
+ *p_itself = ((DialogObject *)v)->ob_itself;
+ return 1;
+}
+
+static void DlgObj_dealloc(DialogObject *self)
+{
+ DisposeDialog(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *DlgObj_DrawDialog(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DrawDialog(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_UpdateDialog(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle updateRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &updateRgn))
+ return NULL;
+ UpdateDialog(_self->ob_itself,
+ updateRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_HideDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+ if (!PyArg_ParseTuple(_args, "h",
+ &itemNo))
+ return NULL;
+ HideDialogItem(_self->ob_itself,
+ itemNo);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_ShowDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+ if (!PyArg_ParseTuple(_args, "h",
+ &itemNo))
+ return NULL;
+ ShowDialogItem(_self->ob_itself,
+ itemNo);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_FindDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndexZeroBased _rv;
+ Point thePt;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePt))
+ return NULL;
+ _rv = FindDialogItem(_self->ob_itself,
+ thePt);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_DialogCut(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DialogCut(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_DialogPaste(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DialogPaste(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_DialogCopy(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DialogCopy(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_DialogDelete(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DialogDelete(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+ DialogItemType itemType;
+ Handle item;
+ Rect box;
+ if (!PyArg_ParseTuple(_args, "h",
+ &itemNo))
+ return NULL;
+ GetDialogItem(_self->ob_itself,
+ itemNo,
+ &itemType,
+ &item,
+ &box);
+ _res = Py_BuildValue("hO&O&",
+ itemType,
+ OptResObj_New, item,
+ PyMac_BuildRect, &box);
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+ DialogItemType itemType;
+ Handle item;
+ Rect box;
+ if (!PyArg_ParseTuple(_args, "hhO&O&",
+ &itemNo,
+ &itemType,
+ ResObj_Convert, &item,
+ PyMac_GetRect, &box))
+ return NULL;
+ SetDialogItem(_self->ob_itself,
+ itemNo,
+ itemType,
+ item,
+ &box);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SelectDialogItemText(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex itemNo;
+ SInt16 strtSel;
+ SInt16 endSel;
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &itemNo,
+ &strtSel,
+ &endSel))
+ return NULL;
+ SelectDialogItemText(_self->ob_itself,
+ itemNo,
+ strtSel,
+ endSel);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_AppendDITL(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle theHandle;
+ DITLMethod method;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &theHandle,
+ &method))
+ return NULL;
+ AppendDITL(_self->ob_itself,
+ theHandle,
+ method);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_CountDITL(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountDITL(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_ShortenDITL(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex numberItems;
+ if (!PyArg_ParseTuple(_args, "h",
+ &numberItems))
+ return NULL;
+ ShortenDITL(_self->ob_itself,
+ numberItems);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *DlgObj_InsertDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DialogItemIndex afterItem;
+ DialogItemType itemType;
+ Handle itemHandle;
+ Rect box;
+ if (!PyArg_ParseTuple(_args, "hhO&O&",
+ &afterItem,
+ &itemType,
+ ResObj_Convert, &itemHandle,
+ PyMac_GetRect, &box))
+ return NULL;
+ _err = InsertDialogItem(_self->ob_itself,
+ afterItem,
+ itemType,
+ itemHandle,
+ &box);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *DlgObj_RemoveDialogItems(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DialogItemIndex itemNo;
+ DialogItemIndex amountToRemove;
+ Boolean disposeItemData;
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &itemNo,
+ &amountToRemove,
+ &disposeItemData))
+ return NULL;
+ _err = RemoveDialogItems(_self->ob_itself,
+ itemNo,
+ amountToRemove,
+ disposeItemData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *DlgObj_StdFilterProc(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord event;
+ DialogItemIndex itemHit;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = StdFilterProc(_self->ob_itself,
+ &event,
+ &itemHit);
+ _res = Py_BuildValue("bO&h",
+ _rv,
+ PyMac_BuildEventRecord, &event,
+ itemHit);
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogDefaultItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DialogItemIndex newItem;
+ if (!PyArg_ParseTuple(_args, "h",
+ &newItem))
+ return NULL;
+ _err = SetDialogDefaultItem(_self->ob_itself,
+ newItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogCancelItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DialogItemIndex newItem;
+ if (!PyArg_ParseTuple(_args, "h",
+ &newItem))
+ return NULL;
+ _err = SetDialogCancelItem(_self->ob_itself,
+ newItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogTracksCursor(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean tracks;
+ if (!PyArg_ParseTuple(_args, "b",
+ &tracks))
+ return NULL;
+ _err = SetDialogTracksCursor(_self->ob_itself,
+ tracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_AutoSizeDialog(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = AutoSizeDialog(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogItemAsControl(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItemNo;
+ ControlHandle outControl;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItemNo))
+ return NULL;
+ _err = GetDialogItemAsControl(_self->ob_itself,
+ inItemNo,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+
+static PyObject *DlgObj_MoveDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItemNo;
+ SInt16 inHoriz;
+ SInt16 inVert;
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &inItemNo,
+ &inHoriz,
+ &inVert))
+ return NULL;
+ _err = MoveDialogItem(_self->ob_itself,
+ inItemNo,
+ inHoriz,
+ inVert);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SizeDialogItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItemNo;
+ SInt16 inWidth;
+ SInt16 inHeight;
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &inItemNo,
+ &inWidth,
+ &inHeight))
+ return NULL;
+ _err = SizeDialogItem(_self->ob_itself,
+ inItemNo,
+ inWidth,
+ inHeight);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_AppendDialogItemList(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 ditlID;
+ DITLMethod method;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &ditlID,
+ &method))
+ return NULL;
+ _err = AppendDialogItemList(_self->ob_itself,
+ ditlID,
+ method);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_SetDialogTimeout(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 inButtonToPress;
+ UInt32 inSecondsToWait;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inButtonToPress,
+ &inSecondsToWait))
+ return NULL;
+ _err = SetDialogTimeout(_self->ob_itself,
+ inButtonToPress,
+ inSecondsToWait);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogTimeout(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outButtonToPress;
+ UInt32 outSecondsToWait;
+ UInt32 outSecondsRemaining;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDialogTimeout(_self->ob_itself,
+ &outButtonToPress,
+ &outSecondsToWait,
+ &outSecondsRemaining);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hll",
+ outButtonToPress,
+ outSecondsToWait,
+ outSecondsRemaining);
+ return _res;
+}
+
+static PyObject *DlgObj_SetModalDialogEventMask(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ EventMask inMask;
+ if (!PyArg_ParseTuple(_args, "H",
+ &inMask))
+ return NULL;
+ _err = SetModalDialogEventMask(_self->ob_itself,
+ inMask);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetModalDialogEventMask(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ EventMask outMask;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetModalDialogEventMask(_self->ob_itself,
+ &outMask);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outMask);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogWindow(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogWindow(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogTextEditHandle(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogTextEditHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogDefaultItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogDefaultItem(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogCancelItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogCancelItem(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogKeyboardFocusItem(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogKeyboardFocusItem(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *DlgObj_SetPortDialogPort(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SetPortDialogPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DlgObj_GetDialogPort(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDialogPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *DlgObj_SetGrafPortOfDialog(DialogObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SetGrafPortOfDialog(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyMethodDef DlgObj_methods[] = {
+ {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1,
+ "() -> None"},
+ {"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1,
+ "(RgnHandle updateRgn) -> None"},
+ {"HideDialogItem", (PyCFunction)DlgObj_HideDialogItem, 1,
+ "(DialogItemIndex itemNo) -> None"},
+ {"ShowDialogItem", (PyCFunction)DlgObj_ShowDialogItem, 1,
+ "(DialogItemIndex itemNo) -> None"},
+ {"FindDialogItem", (PyCFunction)DlgObj_FindDialogItem, 1,
+ "(Point thePt) -> (DialogItemIndexZeroBased _rv)"},
+ {"DialogCut", (PyCFunction)DlgObj_DialogCut, 1,
+ "() -> None"},
+ {"DialogPaste", (PyCFunction)DlgObj_DialogPaste, 1,
+ "() -> None"},
+ {"DialogCopy", (PyCFunction)DlgObj_DialogCopy, 1,
+ "() -> None"},
+ {"DialogDelete", (PyCFunction)DlgObj_DialogDelete, 1,
+ "() -> None"},
+ {"GetDialogItem", (PyCFunction)DlgObj_GetDialogItem, 1,
+ "(DialogItemIndex itemNo) -> (DialogItemType itemType, Handle item, Rect box)"},
+ {"SetDialogItem", (PyCFunction)DlgObj_SetDialogItem, 1,
+ "(DialogItemIndex itemNo, DialogItemType itemType, Handle item, Rect box) -> None"},
+ {"SelectDialogItemText", (PyCFunction)DlgObj_SelectDialogItemText, 1,
+ "(DialogItemIndex itemNo, SInt16 strtSel, SInt16 endSel) -> None"},
+ {"AppendDITL", (PyCFunction)DlgObj_AppendDITL, 1,
+ "(Handle theHandle, DITLMethod method) -> None"},
+ {"CountDITL", (PyCFunction)DlgObj_CountDITL, 1,
+ "() -> (DialogItemIndex _rv)"},
+ {"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1,
+ "(DialogItemIndex numberItems) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"InsertDialogItem", (PyCFunction)DlgObj_InsertDialogItem, 1,
+ "(DialogItemIndex afterItem, DialogItemType itemType, Handle itemHandle, Rect box) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"RemoveDialogItems", (PyCFunction)DlgObj_RemoveDialogItems, 1,
+ "(DialogItemIndex itemNo, DialogItemIndex amountToRemove, Boolean disposeItemData) -> None"},
+#endif
+ {"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1,
+ "() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"},
+ {"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1,
+ "(DialogItemIndex newItem) -> None"},
+ {"SetDialogCancelItem", (PyCFunction)DlgObj_SetDialogCancelItem, 1,
+ "(DialogItemIndex newItem) -> None"},
+ {"SetDialogTracksCursor", (PyCFunction)DlgObj_SetDialogTracksCursor, 1,
+ "(Boolean tracks) -> None"},
+ {"AutoSizeDialog", (PyCFunction)DlgObj_AutoSizeDialog, 1,
+ "() -> None"},
+ {"GetDialogItemAsControl", (PyCFunction)DlgObj_GetDialogItemAsControl, 1,
+ "(SInt16 inItemNo) -> (ControlHandle outControl)"},
+ {"MoveDialogItem", (PyCFunction)DlgObj_MoveDialogItem, 1,
+ "(SInt16 inItemNo, SInt16 inHoriz, SInt16 inVert) -> None"},
+ {"SizeDialogItem", (PyCFunction)DlgObj_SizeDialogItem, 1,
+ "(SInt16 inItemNo, SInt16 inWidth, SInt16 inHeight) -> None"},
+ {"AppendDialogItemList", (PyCFunction)DlgObj_AppendDialogItemList, 1,
+ "(SInt16 ditlID, DITLMethod method) -> None"},
+ {"SetDialogTimeout", (PyCFunction)DlgObj_SetDialogTimeout, 1,
+ "(SInt16 inButtonToPress, UInt32 inSecondsToWait) -> None"},
+ {"GetDialogTimeout", (PyCFunction)DlgObj_GetDialogTimeout, 1,
+ "() -> (SInt16 outButtonToPress, UInt32 outSecondsToWait, UInt32 outSecondsRemaining)"},
+ {"SetModalDialogEventMask", (PyCFunction)DlgObj_SetModalDialogEventMask, 1,
+ "(EventMask inMask) -> None"},
+ {"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1,
+ "() -> (EventMask outMask)"},
+ {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1,
+ "() -> (WindowPtr _rv)"},
+ {"GetDialogTextEditHandle", (PyCFunction)DlgObj_GetDialogTextEditHandle, 1,
+ "() -> (TEHandle _rv)"},
+ {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1,
+ "() -> (SInt16 _rv)"},
+ {"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1,
+ "() -> (SInt16 _rv)"},
+ {"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1,
+ "() -> (SInt16 _rv)"},
+ {"SetPortDialogPort", (PyCFunction)DlgObj_SetPortDialogPort, 1,
+ "() -> None"},
+ {"GetDialogPort", (PyCFunction)DlgObj_GetDialogPort, 1,
+ "() -> (CGrafPtr _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1,
+ "() -> None"},
+#endif
+ {NULL, NULL, 0}
+};
+
+PyMethodChain DlgObj_chain = { DlgObj_methods, NULL };
+
+static PyObject *DlgObj_getattr(DialogObject *self, char *name)
+{
+ return Py_FindMethodInChain(&DlgObj_chain, (PyObject *)self, name);
+}
+
+#define DlgObj_setattr NULL
+
+static int DlgObj_compare(DialogObject *self, DialogObject *other)
+{
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+#define DlgObj_repr NULL
+
+static int DlgObj_hash(DialogObject *self)
+{
+ return (int)self->ob_itself;
+}
+
+PyTypeObject Dialog_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Dialog", /*tp_name*/
+ sizeof(DialogObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) DlgObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) DlgObj_getattr, /*tp_getattr*/
+ (setattrfunc) DlgObj_setattr, /*tp_setattr*/
+ (cmpfunc) DlgObj_compare, /*tp_compare*/
+ (reprfunc) DlgObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) DlgObj_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type Dialog --------------------- */
+
+
+static PyObject *Dlg_NewDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ Rect boundsRect;
+ Str255 title;
+ Boolean visible;
+ SInt16 procID;
+ WindowPtr behind;
+ Boolean goAwayFlag;
+ SInt32 refCon;
+ Handle items;
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&",
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, title,
+ &visible,
+ &procID,
+ WinObj_Convert, &behind,
+ &goAwayFlag,
+ &refCon,
+ ResObj_Convert, &items))
+ return NULL;
+ _rv = NewDialog((void *)0,
+ &boundsRect,
+ title,
+ visible,
+ procID,
+ behind,
+ goAwayFlag,
+ refCon,
+ items);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_GetNewDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ SInt16 dialogID;
+ WindowPtr behind;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &dialogID,
+ WinObj_Convert, &behind))
+ return NULL;
+ _rv = GetNewDialog(dialogID,
+ (void *)0,
+ behind);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_NewColorDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ Rect boundsRect;
+ Str255 title;
+ Boolean visible;
+ SInt16 procID;
+ WindowPtr behind;
+ Boolean goAwayFlag;
+ SInt32 refCon;
+ Handle items;
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&",
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, title,
+ &visible,
+ &procID,
+ WinObj_Convert, &behind,
+ &goAwayFlag,
+ &refCon,
+ ResObj_Convert, &items))
+ return NULL;
+ _rv = NewColorDialog((void *)0,
+ &boundsRect,
+ title,
+ visible,
+ procID,
+ behind,
+ goAwayFlag,
+ refCon,
+ items);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_ModalDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyObject* modalFilter;
+ DialogItemIndex itemHit;
+ if (!PyArg_ParseTuple(_args, "O",
+ &modalFilter))
+ return NULL;
+ ModalDialog(Dlg_PassFilterProc(modalFilter),
+ &itemHit);
+ _res = Py_BuildValue("h",
+ itemHit);
+ return _res;
+}
+
+static PyObject *Dlg_IsDialogEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEvent))
+ return NULL;
+ _rv = IsDialogEvent(&theEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_DialogSelect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+ DialogPtr theDialog;
+ DialogItemIndex itemHit;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEvent))
+ return NULL;
+ _rv = DialogSelect(&theEvent,
+ &theDialog,
+ &itemHit);
+ _res = Py_BuildValue("bO&h",
+ _rv,
+ DlgObj_WhichDialog, theDialog,
+ itemHit);
+ return _res;
+}
+
+static PyObject *Dlg_Alert(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ SInt16 alertID;
+ PyObject* modalFilter;
+ if (!PyArg_ParseTuple(_args, "hO",
+ &alertID,
+ &modalFilter))
+ return NULL;
+ _rv = Alert(alertID,
+ Dlg_PassFilterProc(modalFilter));
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_StopAlert(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ SInt16 alertID;
+ PyObject* modalFilter;
+ if (!PyArg_ParseTuple(_args, "hO",
+ &alertID,
+ &modalFilter))
+ return NULL;
+ _rv = StopAlert(alertID,
+ Dlg_PassFilterProc(modalFilter));
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_NoteAlert(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ SInt16 alertID;
+ PyObject* modalFilter;
+ if (!PyArg_ParseTuple(_args, "hO",
+ &alertID,
+ &modalFilter))
+ return NULL;
+ _rv = NoteAlert(alertID,
+ Dlg_PassFilterProc(modalFilter));
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_CautionAlert(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogItemIndex _rv;
+ SInt16 alertID;
+ PyObject* modalFilter;
+ if (!PyArg_ParseTuple(_args, "hO",
+ &alertID,
+ &modalFilter))
+ return NULL;
+ _rv = CautionAlert(alertID,
+ Dlg_PassFilterProc(modalFilter));
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_ParamText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 param0;
+ Str255 param1;
+ Str255 param2;
+ Str255 param3;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ PyMac_GetStr255, param0,
+ PyMac_GetStr255, param1,
+ PyMac_GetStr255, param2,
+ PyMac_GetStr255, param3))
+ return NULL;
+ ParamText(param0,
+ param1,
+ param2,
+ param3);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Dlg_GetDialogItemText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle item;
+ Str255 text;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &item))
+ return NULL;
+ GetDialogItemText(item,
+ text);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, text);
+ return _res;
+}
+
+static PyObject *Dlg_SetDialogItemText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle item;
+ Str255 text;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &item,
+ PyMac_GetStr255, text))
+ return NULL;
+ SetDialogItemText(item,
+ text);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Dlg_GetAlertStage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetAlertStage();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Dlg_SetDialogFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 fontNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &fontNum))
+ return NULL;
+ SetDialogFont(fontNum);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Dlg_ResetAlertStage(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ResetAlertStage();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Dlg_GetParamText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 param0;
+ Str255 param1;
+ Str255 param2;
+ Str255 param3;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ PyMac_GetStr255, param0,
+ PyMac_GetStr255, param1,
+ PyMac_GetStr255, param2,
+ PyMac_GetStr255, param3))
+ return NULL;
+ GetParamText(param0,
+ param1,
+ param2,
+ param3);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Dlg_NewFeaturesDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ Rect inBoundsRect;
+ Str255 inTitle;
+ Boolean inIsVisible;
+ SInt16 inProcID;
+ WindowPtr inBehind;
+ Boolean inGoAwayFlag;
+ SInt32 inRefCon;
+ Handle inItemListHandle;
+ UInt32 inFlags;
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&l",
+ PyMac_GetRect, &inBoundsRect,
+ PyMac_GetStr255, inTitle,
+ &inIsVisible,
+ &inProcID,
+ WinObj_Convert, &inBehind,
+ &inGoAwayFlag,
+ &inRefCon,
+ ResObj_Convert, &inItemListHandle,
+ &inFlags))
+ return NULL;
+ _rv = NewFeaturesDialog((void *)0,
+ &inBoundsRect,
+ inTitle,
+ inIsVisible,
+ inProcID,
+ inBehind,
+ inGoAwayFlag,
+ inRefCon,
+ inItemListHandle,
+ inFlags);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_GetDialogFromWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DialogPtr _rv;
+ WindowPtr window;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &window))
+ return NULL;
+ _rv = GetDialogFromWindow(window);
+ _res = Py_BuildValue("O&",
+ DlgObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Dlg_SetUserItemHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PyObject *new = NULL;
+
+
+ if (!PyArg_ParseTuple(_args, "|O", &new))
+ return NULL;
+
+ if (Dlg_UserItemProc_callback && new && new != Py_None) {
+ PyErr_SetString(Dlg_Error, "Another UserItemProc is already installed");
+ return NULL;
+ }
+
+ if (new == NULL || new == Py_None) {
+ new = NULL;
+ _res = Py_None;
+ Py_INCREF(Py_None);
+ } else {
+ Py_INCREF(new);
+ _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemUPP(Dlg_UnivUserItemProc));
+ }
+
+ Dlg_UserItemProc_callback = new;
+ return _res;
+
+}
+
+static PyMethodDef Dlg_methods[] = {
+ {"NewDialog", (PyCFunction)Dlg_NewDialog, 1,
+ "(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)"},
+ {"GetNewDialog", (PyCFunction)Dlg_GetNewDialog, 1,
+ "(SInt16 dialogID, WindowPtr behind) -> (DialogPtr _rv)"},
+ {"NewColorDialog", (PyCFunction)Dlg_NewColorDialog, 1,
+ "(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)"},
+ {"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1,
+ "(PyObject* modalFilter) -> (DialogItemIndex itemHit)"},
+ {"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1,
+ "(EventRecord theEvent) -> (Boolean _rv)"},
+ {"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1,
+ "(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, DialogItemIndex itemHit)"},
+ {"Alert", (PyCFunction)Dlg_Alert, 1,
+ "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"},
+ {"StopAlert", (PyCFunction)Dlg_StopAlert, 1,
+ "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"},
+ {"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1,
+ "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"},
+ {"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1,
+ "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"},
+ {"ParamText", (PyCFunction)Dlg_ParamText, 1,
+ "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"},
+ {"GetDialogItemText", (PyCFunction)Dlg_GetDialogItemText, 1,
+ "(Handle item) -> (Str255 text)"},
+ {"SetDialogItemText", (PyCFunction)Dlg_SetDialogItemText, 1,
+ "(Handle item, Str255 text) -> None"},
+ {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1,
+ "() -> (SInt16 _rv)"},
+ {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1,
+ "(SInt16 fontNum) -> None"},
+ {"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1,
+ "() -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetParamText", (PyCFunction)Dlg_GetParamText, 1,
+ "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"},
+#endif
+ {"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1,
+ "(Rect inBoundsRect, Str255 inTitle, Boolean inIsVisible, SInt16 inProcID, WindowPtr inBehind, Boolean inGoAwayFlag, SInt32 inRefCon, Handle inItemListHandle, UInt32 inFlags) -> (DialogPtr _rv)"},
+ {"GetDialogFromWindow", (PyCFunction)Dlg_GetDialogFromWindow, 1,
+ "(WindowPtr window) -> (DialogPtr _rv)"},
+ {"SetUserItemHandler", (PyCFunction)Dlg_SetUserItemHandler, 1,
+ NULL},
+ {NULL, NULL, 0}
+};
+
+
+
+/* Return the WindowPtr corresponding to a DialogObject */
+#if 0
+WindowPtr
+DlgObj_ConvertToWindow(PyObject *self)
+{
+ if ( DlgObj_Check(self) )
+ return GetDialogWindow(((DialogObject *)self)->ob_itself);
+ return NULL;
+}
+#endif
+/* Return the object corresponding to the dialog, or None */
+
+PyObject *
+DlgObj_WhichDialog(DialogPtr d)
+{
+ PyObject *it;
+
+ if (d == NULL) {
+ it = Py_None;
+ Py_INCREF(it);
+ } else {
+ WindowPtr w = GetDialogWindow(d);
+
+ it = (PyObject *) GetWRefCon(w);
+ if (it == NULL || ((DialogObject *)it)->ob_itself != d || !DlgObj_Check(it)) {
+#if 0
+ /* Should do this, but we don't have an ob_freeit for dialogs yet. */
+ it = WinObj_New(w);
+ ((WindowObject *)it)->ob_freeit = NULL;
+#else
+ it = Py_None;
+ Py_INCREF(it);
+#endif
+ } else {
+ Py_INCREF(it);
+ }
+ }
+ return it;
+}
+
+
+void init_Dlg(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_WhichDialog);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DialogPtr, DlgObj_Convert);
+
+
+ m = Py_InitModule("_Dlg", Dlg_methods);
+ d = PyModule_GetDict(m);
+ Dlg_Error = PyMac_GetOSErrException();
+ if (Dlg_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Dlg_Error) != 0)
+ return;
+ Dialog_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Dialog_Type);
+ if (PyDict_SetItemString(d, "DialogType", (PyObject *)&Dialog_Type) != 0)
+ Py_FatalError("can't initialize DialogType");
+}
+
+/* ======================== End module _Dlg ========================= */
+
diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c
new file mode 100644
index 0000000..877854f
--- /dev/null
+++ b/Mac/Modules/drag/_Dragmodule.c
@@ -0,0 +1,1012 @@
+
+/* ========================== Module _Drag ========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Drag.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+/* Callback glue routines */
+DragTrackingHandlerUPP dragglue_TrackingHandlerUPP;
+DragReceiveHandlerUPP dragglue_ReceiveHandlerUPP;
+DragSendDataUPP dragglue_SendDataUPP;
+#if 0
+DragInputUPP dragglue_InputUPP;
+DragDrawingUPP dragglue_DrawingUPP;
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DragObj_New(DragRef);
+extern int _DragObj_Convert(PyObject *, DragRef *);
+
+#define DragObj_New _DragObj_New
+#define DragObj_Convert _DragObj_Convert
+#endif
+
+static PyObject *Drag_Error;
+
+/* ---------------------- Object type DragObj ----------------------- */
+
+PyTypeObject DragObj_Type;
+
+#define DragObj_Check(x) ((x)->ob_type == &DragObj_Type)
+
+typedef struct DragObjObject {
+ PyObject_HEAD
+ DragRef ob_itself;
+ PyObject *sendproc;
+} DragObjObject;
+
+PyObject *DragObj_New(DragRef itself)
+{
+ DragObjObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Drag_Error,"Cannot create null Drag");
+ return NULL;
+ }
+ it = PyObject_NEW(DragObjObject, &DragObj_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->sendproc = NULL;
+ return (PyObject *)it;
+}
+DragObj_Convert(PyObject *v, DragRef *p_itself)
+{
+ if (!DragObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "DragObj required");
+ return 0;
+ }
+ *p_itself = ((DragObjObject *)v)->ob_itself;
+ return 1;
+}
+
+static void DragObj_dealloc(DragObjObject *self)
+{
+ Py_XDECREF(self->sendproc);
+ PyMem_DEL(self);
+}
+
+static PyObject *DragObj_DisposeDrag(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DisposeDrag(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_AddDragItemFlavor(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ FlavorFlags theFlags;
+ if (!PyArg_ParseTuple(_args, "lO&z#l",
+ &theItemRef,
+ PyMac_GetOSType, &theType,
+ &dataPtr__in__, &dataPtr__in_len__,
+ &theFlags))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = AddDragItemFlavor(_self->ob_itself,
+ theItemRef,
+ theType,
+ dataPtr__in__, dataPtr__len__,
+ theFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *DragObj_SetDragItemFlavorData(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ char *dataPtr__in__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ UInt32 dataOffset;
+ if (!PyArg_ParseTuple(_args, "lO&z#l",
+ &theItemRef,
+ PyMac_GetOSType, &theType,
+ &dataPtr__in__, &dataPtr__in_len__,
+ &dataOffset))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = SetDragItemFlavorData(_self->ob_itself,
+ theItemRef,
+ theType,
+ dataPtr__in__, dataPtr__len__,
+ dataOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *DragObj_SetDragImage(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ PixMapHandle imagePixMap;
+ RgnHandle imageRgn;
+ Point imageOffsetPt;
+ DragImageFlags theImageFlags;
+ if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ ResObj_Convert, &imagePixMap,
+ ResObj_Convert, &imageRgn,
+ PyMac_GetPoint, &imageOffsetPt,
+ &theImageFlags))
+ return NULL;
+ _err = SetDragImage(_self->ob_itself,
+ imagePixMap,
+ imageRgn,
+ imageOffsetPt,
+ theImageFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_ChangeDragBehaviors(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DragBehaviors inBehaviorsToSet;
+ DragBehaviors inBehaviorsToClear;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &inBehaviorsToSet,
+ &inBehaviorsToClear))
+ return NULL;
+ _err = ChangeDragBehaviors(_self->ob_itself,
+ inBehaviorsToSet,
+ inBehaviorsToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_TrackDrag(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ EventRecord theEvent;
+ RgnHandle theRegion;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetEventRecord, &theEvent,
+ ResObj_Convert, &theRegion))
+ return NULL;
+ _err = TrackDrag(_self->ob_itself,
+ &theEvent,
+ theRegion);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_CountDragItems(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 numItems;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CountDragItems(_self->ob_itself,
+ &numItems);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ numItems);
+ return _res;
+}
+
+static PyObject *DragObj_GetDragItemReferenceNumber(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 index;
+ ItemReference theItemRef;
+ if (!PyArg_ParseTuple(_args, "H",
+ &index))
+ return NULL;
+ _err = GetDragItemReferenceNumber(_self->ob_itself,
+ index,
+ &theItemRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ theItemRef);
+ return _res;
+}
+
+static PyObject *DragObj_CountDragItemFlavors(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ UInt16 numFlavors;
+ if (!PyArg_ParseTuple(_args, "l",
+ &theItemRef))
+ return NULL;
+ _err = CountDragItemFlavors(_self->ob_itself,
+ theItemRef,
+ &numFlavors);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ numFlavors);
+ return _res;
+}
+
+static PyObject *DragObj_GetFlavorType(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ UInt16 index;
+ FlavorType theType;
+ if (!PyArg_ParseTuple(_args, "lH",
+ &theItemRef,
+ &index))
+ return NULL;
+ _err = GetFlavorType(_self->ob_itself,
+ theItemRef,
+ index,
+ &theType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, theType);
+ return _res;
+}
+
+static PyObject *DragObj_GetFlavorFlags(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ FlavorFlags theFlags;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &theItemRef,
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _err = GetFlavorFlags(_self->ob_itself,
+ theItemRef,
+ theType,
+ &theFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ theFlags);
+ return _res;
+}
+
+static PyObject *DragObj_GetFlavorDataSize(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ Size dataSize;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &theItemRef,
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _err = GetFlavorDataSize(_self->ob_itself,
+ theItemRef,
+ theType,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ dataSize);
+ return _res;
+}
+
+static PyObject *DragObj_GetFlavorData(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ FlavorType theType;
+ char *dataPtr__out__;
+ long dataPtr__len__;
+ int dataPtr__in_len__;
+ UInt32 dataOffset;
+ if (!PyArg_ParseTuple(_args, "lO&il",
+ &theItemRef,
+ PyMac_GetOSType, &theType,
+ &dataPtr__in_len__,
+ &dataOffset))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ _err = GetFlavorData(_self->ob_itself,
+ theItemRef,
+ theType,
+ dataPtr__out__, &dataPtr__len__,
+ dataOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s#",
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *DragObj_GetDragItemBounds(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ Rect itemBounds;
+ if (!PyArg_ParseTuple(_args, "l",
+ &theItemRef))
+ return NULL;
+ _err = GetDragItemBounds(_self->ob_itself,
+ theItemRef,
+ &itemBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &itemBounds);
+ return _res;
+}
+
+static PyObject *DragObj_SetDragItemBounds(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ItemReference theItemRef;
+ Rect itemBounds;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &theItemRef,
+ PyMac_GetRect, &itemBounds))
+ return NULL;
+ _err = SetDragItemBounds(_self->ob_itself,
+ theItemRef,
+ &itemBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_GetDropLocation(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEDesc dropLocation;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDropLocation(_self->ob_itself,
+ &dropLocation);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ AEDesc_New, &dropLocation);
+ return _res;
+}
+
+static PyObject *DragObj_SetDropLocation(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ AEDesc dropLocation;
+ if (!PyArg_ParseTuple(_args, "O&",
+ AEDesc_Convert, &dropLocation))
+ return NULL;
+ _err = SetDropLocation(_self->ob_itself,
+ &dropLocation);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_GetDragAttributes(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DragAttributes flags;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDragAttributes(_self->ob_itself,
+ &flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ flags);
+ return _res;
+}
+
+static PyObject *DragObj_GetDragMouse(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Point mouse;
+ Point globalPinnedMouse;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDragMouse(_self->ob_itself,
+ &mouse,
+ &globalPinnedMouse);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildPoint, mouse,
+ PyMac_BuildPoint, globalPinnedMouse);
+ return _res;
+}
+
+static PyObject *DragObj_SetDragMouse(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Point globalPinnedMouse;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &globalPinnedMouse))
+ return NULL;
+ _err = SetDragMouse(_self->ob_itself,
+ globalPinnedMouse);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_GetDragOrigin(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Point globalInitialMouse;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDragOrigin(_self->ob_itself,
+ &globalInitialMouse);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, globalInitialMouse);
+ return _res;
+}
+
+static PyObject *DragObj_GetDragModifiers(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 modifiers;
+ SInt16 mouseDownModifiers;
+ SInt16 mouseUpModifiers;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDragModifiers(_self->ob_itself,
+ &modifiers,
+ &mouseDownModifiers,
+ &mouseUpModifiers);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hhh",
+ modifiers,
+ mouseDownModifiers,
+ mouseUpModifiers);
+ return _res;
+}
+
+static PyObject *DragObj_ShowDragHilite(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle hiliteFrame;
+ Boolean inside;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ ResObj_Convert, &hiliteFrame,
+ &inside))
+ return NULL;
+ _err = ShowDragHilite(_self->ob_itself,
+ hiliteFrame,
+ inside);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_HideDragHilite(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HideDragHilite(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_DragPreScroll(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 dH;
+ SInt16 dV;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dH,
+ &dV))
+ return NULL;
+ _err = DragPreScroll(_self->ob_itself,
+ dH,
+ dV);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_DragPostScroll(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DragPostScroll(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *DragObj_UpdateDragHilite(DragObjObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle updateRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &updateRgn))
+ return NULL;
+ _err = UpdateDragHilite(_self->ob_itself,
+ updateRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef DragObj_methods[] = {
+ {"DisposeDrag", (PyCFunction)DragObj_DisposeDrag, 1,
+ "() -> None"},
+ {"AddDragItemFlavor", (PyCFunction)DragObj_AddDragItemFlavor, 1,
+ "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None"},
+ {"SetDragItemFlavorData", (PyCFunction)DragObj_SetDragItemFlavorData, 1,
+ "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None"},
+ {"SetDragImage", (PyCFunction)DragObj_SetDragImage, 1,
+ "(PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None"},
+ {"ChangeDragBehaviors", (PyCFunction)DragObj_ChangeDragBehaviors, 1,
+ "(DragBehaviors inBehaviorsToSet, DragBehaviors inBehaviorsToClear) -> None"},
+ {"TrackDrag", (PyCFunction)DragObj_TrackDrag, 1,
+ "(EventRecord theEvent, RgnHandle theRegion) -> None"},
+ {"CountDragItems", (PyCFunction)DragObj_CountDragItems, 1,
+ "() -> (UInt16 numItems)"},
+ {"GetDragItemReferenceNumber", (PyCFunction)DragObj_GetDragItemReferenceNumber, 1,
+ "(UInt16 index) -> (ItemReference theItemRef)"},
+ {"CountDragItemFlavors", (PyCFunction)DragObj_CountDragItemFlavors, 1,
+ "(ItemReference theItemRef) -> (UInt16 numFlavors)"},
+ {"GetFlavorType", (PyCFunction)DragObj_GetFlavorType, 1,
+ "(ItemReference theItemRef, UInt16 index) -> (FlavorType theType)"},
+ {"GetFlavorFlags", (PyCFunction)DragObj_GetFlavorFlags, 1,
+ "(ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)"},
+ {"GetFlavorDataSize", (PyCFunction)DragObj_GetFlavorDataSize, 1,
+ "(ItemReference theItemRef, FlavorType theType) -> (Size dataSize)"},
+ {"GetFlavorData", (PyCFunction)DragObj_GetFlavorData, 1,
+ "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)"},
+ {"GetDragItemBounds", (PyCFunction)DragObj_GetDragItemBounds, 1,
+ "(ItemReference theItemRef) -> (Rect itemBounds)"},
+ {"SetDragItemBounds", (PyCFunction)DragObj_SetDragItemBounds, 1,
+ "(ItemReference theItemRef, Rect itemBounds) -> None"},
+ {"GetDropLocation", (PyCFunction)DragObj_GetDropLocation, 1,
+ "() -> (AEDesc dropLocation)"},
+ {"SetDropLocation", (PyCFunction)DragObj_SetDropLocation, 1,
+ "(AEDesc dropLocation) -> None"},
+ {"GetDragAttributes", (PyCFunction)DragObj_GetDragAttributes, 1,
+ "() -> (DragAttributes flags)"},
+ {"GetDragMouse", (PyCFunction)DragObj_GetDragMouse, 1,
+ "() -> (Point mouse, Point globalPinnedMouse)"},
+ {"SetDragMouse", (PyCFunction)DragObj_SetDragMouse, 1,
+ "(Point globalPinnedMouse) -> None"},
+ {"GetDragOrigin", (PyCFunction)DragObj_GetDragOrigin, 1,
+ "() -> (Point globalInitialMouse)"},
+ {"GetDragModifiers", (PyCFunction)DragObj_GetDragModifiers, 1,
+ "() -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)"},
+ {"ShowDragHilite", (PyCFunction)DragObj_ShowDragHilite, 1,
+ "(RgnHandle hiliteFrame, Boolean inside) -> None"},
+ {"HideDragHilite", (PyCFunction)DragObj_HideDragHilite, 1,
+ "() -> None"},
+ {"DragPreScroll", (PyCFunction)DragObj_DragPreScroll, 1,
+ "(SInt16 dH, SInt16 dV) -> None"},
+ {"DragPostScroll", (PyCFunction)DragObj_DragPostScroll, 1,
+ "() -> None"},
+ {"UpdateDragHilite", (PyCFunction)DragObj_UpdateDragHilite, 1,
+ "(RgnHandle updateRgn) -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain DragObj_chain = { DragObj_methods, NULL };
+
+static PyObject *DragObj_getattr(DragObjObject *self, char *name)
+{
+ return Py_FindMethodInChain(&DragObj_chain, (PyObject *)self, name);
+}
+
+#define DragObj_setattr NULL
+
+#define DragObj_compare NULL
+
+#define DragObj_repr NULL
+
+#define DragObj_hash NULL
+
+PyTypeObject DragObj_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "DragObj", /*tp_name*/
+ sizeof(DragObjObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) DragObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) DragObj_getattr, /*tp_getattr*/
+ (setattrfunc) DragObj_setattr, /*tp_setattr*/
+ (cmpfunc) DragObj_compare, /*tp_compare*/
+ (reprfunc) DragObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) DragObj_hash, /*tp_hash*/
+};
+
+/* -------------------- End object type DragObj --------------------- */
+
+
+static PyObject *Drag_NewDrag(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DragRef theDrag;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NewDrag(&theDrag);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ DragObj_New, theDrag);
+ return _res;
+}
+
+static PyObject *Drag_GetDragHiliteColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr window;
+ RGBColor color;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &window))
+ return NULL;
+ _err = GetDragHiliteColor(window,
+ &color);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &color);
+ return _res;
+}
+
+static PyObject *Drag_WaitMouseMoved(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point initialMouse;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &initialMouse))
+ return NULL;
+ _rv = WaitMouseMoved(initialMouse);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Drag_ZoomRects(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect fromRect;
+ Rect toRect;
+ SInt16 zoomSteps;
+ ZoomAcceleration acceleration;
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ PyMac_GetRect, &fromRect,
+ PyMac_GetRect, &toRect,
+ &zoomSteps,
+ &acceleration))
+ return NULL;
+ _err = ZoomRects(&fromRect,
+ &toRect,
+ zoomSteps,
+ acceleration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Drag_ZoomRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle region;
+ Point zoomDistance;
+ SInt16 zoomSteps;
+ ZoomAcceleration acceleration;
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ ResObj_Convert, &region,
+ PyMac_GetPoint, &zoomDistance,
+ &zoomSteps,
+ &acceleration))
+ return NULL;
+ _err = ZoomRegion(region,
+ zoomDistance,
+ zoomSteps,
+ acceleration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Drag_InstallTrackingHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PyObject *callback;
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
+ return NULL;
+ Py_INCREF(callback); /* Cannot decref later, too bad */
+ _err = InstallTrackingHandler(dragglue_TrackingHandlerUPP, theWindow, (void *)callback);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ return Py_None;
+
+}
+
+static PyObject *Drag_InstallReceiveHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PyObject *callback;
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) )
+ return NULL;
+ Py_INCREF(callback); /* Cannot decref later, too bad */
+ _err = InstallReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow, (void *)callback);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ return Py_None;
+
+}
+
+static PyObject *Drag_RemoveTrackingHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
+ return NULL;
+ _err = RemoveTrackingHandler(dragglue_TrackingHandlerUPP, theWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ return Py_None;
+
+}
+
+static PyObject *Drag_RemoveReceiveHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ WindowPtr theWindow = NULL;
+ OSErr _err;
+
+ if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
+ return NULL;
+ _err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ return Py_None;
+
+}
+
+static PyMethodDef Drag_methods[] = {
+ {"NewDrag", (PyCFunction)Drag_NewDrag, 1,
+ "() -> (DragRef theDrag)"},
+ {"GetDragHiliteColor", (PyCFunction)Drag_GetDragHiliteColor, 1,
+ "(WindowPtr window) -> (RGBColor color)"},
+ {"WaitMouseMoved", (PyCFunction)Drag_WaitMouseMoved, 1,
+ "(Point initialMouse) -> (Boolean _rv)"},
+ {"ZoomRects", (PyCFunction)Drag_ZoomRects, 1,
+ "(Rect fromRect, Rect toRect, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None"},
+ {"ZoomRegion", (PyCFunction)Drag_ZoomRegion, 1,
+ "(RgnHandle region, Point zoomDistance, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None"},
+ {"InstallTrackingHandler", (PyCFunction)Drag_InstallTrackingHandler, 1,
+ NULL},
+ {"InstallReceiveHandler", (PyCFunction)Drag_InstallReceiveHandler, 1,
+ NULL},
+ {"RemoveTrackingHandler", (PyCFunction)Drag_RemoveTrackingHandler, 1,
+ NULL},
+ {"RemoveReceiveHandler", (PyCFunction)Drag_RemoveReceiveHandler, 1,
+ NULL},
+ {NULL, NULL, 0}
+};
+
+
+
+static pascal OSErr
+dragglue_TrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow,
+ void *handlerRefCon, DragReference theDrag)
+{
+ PyObject *args, *rv;
+ int i;
+
+ args = Py_BuildValue("hO&O&", theMessage, DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ fprintf(stderr, "Drag: Exception in TrackingHandler\n");
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+static pascal OSErr
+dragglue_ReceiveHandler(WindowPtr theWindow, void *handlerRefCon,
+ DragReference theDrag)
+{
+ PyObject *args, *rv;
+ int i;
+
+ args = Py_BuildValue("O&O&", DragObj_New, theDrag, WinObj_WhichWindow, theWindow);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject((PyObject *)handlerRefCon, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ fprintf(stderr, "Drag: Exception in ReceiveHandler\n");
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+static pascal OSErr
+dragglue_SendData(FlavorType theType, void *dragSendRefCon,
+ ItemReference theItem, DragReference theDrag)
+{
+ DragObjObject *self = (DragObjObject *)dragSendRefCon;
+ PyObject *args, *rv;
+ int i;
+
+ if ( self->sendproc == NULL )
+ return -1;
+ args = Py_BuildValue("O&l", PyMac_BuildOSType, theType, theItem);
+ if ( args == NULL )
+ return -1;
+ rv = PyEval_CallObject(self->sendproc, args);
+ Py_DECREF(args);
+ if ( rv == NULL ) {
+ fprintf(stderr, "Drag: Exception in SendDataHandler\n");
+ return -1;
+ }
+ i = -1;
+ if ( rv == Py_None )
+ i = 0;
+ else
+ PyArg_Parse(rv, "l", &i);
+ Py_DECREF(rv);
+ return i;
+}
+
+#if 0
+static pascal OSErr
+dragglue_Input(Point *mouse, short *modifiers,
+ void *dragSendRefCon, DragReference theDrag)
+{
+ return 0;
+}
+
+static pascal OSErr
+dragglue_Drawing(xxxx
+ void *dragSendRefCon, DragReference theDrag)
+{
+ return 0;
+}
+#endif
+
+
+
+void init_Drag(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert);
+
+
+ m = Py_InitModule("_Drag", Drag_methods);
+ d = PyModule_GetDict(m);
+ Drag_Error = PyMac_GetOSErrException();
+ if (Drag_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Drag_Error) != 0)
+ return;
+ DragObj_Type.ob_type = &PyType_Type;
+ Py_INCREF(&DragObj_Type);
+ if (PyDict_SetItemString(d, "DragObjType", (PyObject *)&DragObj_Type) != 0)
+ Py_FatalError("can't initialize DragObjType");
+
+ dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler);
+ dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler);
+ dragglue_SendDataUPP = NewDragSendDataUPP(dragglue_SendData);
+#if 0
+ dragglue_InputUPP = NewDragInputUPP(dragglue_Input);
+ dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
+#endif
+
+
+}
+
+/* ======================== End module _Drag ======================== */
+
diff --git a/Mac/Modules/evt/_Evtmodule.c b/Mac/Modules/evt/_Evtmodule.c
new file mode 100644
index 0000000..6cd9464
--- /dev/null
+++ b/Mac/Modules/evt/_Evtmodule.c
@@ -0,0 +1,459 @@
+
+/* ========================== Module _Evt =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Events.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+
+static PyObject *Evt_Error;
+
+static PyObject *Evt_GetMouse(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point mouseLoc;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMouse(&mouseLoc);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, mouseLoc);
+ return _res;
+}
+
+static PyObject *Evt_Button(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = Button();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_StillDown(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = StillDown();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_WaitMouseUp(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = WaitMouseUp();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_TickCount(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TickCount();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_GetCaretTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCaretTime();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_GetKeys(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ KeyMap theKeys__out__;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetKeys(theKeys__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&theKeys__out__, (int)sizeof(KeyMap));
+ theKeys__error__: ;
+ return _res;
+}
+
+static PyObject *Evt_GetDblTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDblTime();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_SetEventMask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventMask value;
+ if (!PyArg_ParseTuple(_args, "H",
+ &value))
+ return NULL;
+ SetEventMask(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_GetNextEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventMask eventMask;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "H",
+ &eventMask))
+ return NULL;
+ _rv = GetNextEvent(eventMask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Evt_EventAvail(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventMask eventMask;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "H",
+ &eventMask))
+ return NULL;
+ _rv = EventAvail(eventMask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Evt_PostEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ EventKind eventNum;
+ UInt32 eventMsg;
+ if (!PyArg_ParseTuple(_args, "Hl",
+ &eventNum,
+ &eventMsg))
+ return NULL;
+ _err = PostEvent(eventNum,
+ eventMsg);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Evt_OSEventAvail(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventMask mask;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "H",
+ &mask))
+ return NULL;
+ _rv = OSEventAvail(mask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Evt_GetOSEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventMask mask;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "H",
+ &mask))
+ return NULL;
+ _rv = GetOSEvent(mask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+#endif
+
+static PyObject *Evt_FlushEvents(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventMask whichMask;
+ EventMask stopMask;
+ if (!PyArg_ParseTuple(_args, "HH",
+ &whichMask,
+ &stopMask))
+ return NULL;
+ FlushEvents(whichMask,
+ stopMask);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Evt_SystemClick(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventRecord theEvent;
+ WindowPtr theWindow;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetEventRecord, &theEvent,
+ WinObj_Convert, &theWindow))
+ return NULL;
+ SystemClick(&theEvent,
+ theWindow);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Evt_SystemTask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SystemTask();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Evt_SystemEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEvent))
+ return NULL;
+ _rv = SystemEvent(&theEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Evt_GetGlobalMouse(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point globalMouse;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetGlobalMouse(&globalMouse);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, globalMouse);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Evt_GetCurrentKeyModifiers(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCurrentKeyModifiers();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Evt_CheckEventQueueForUserCancel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CheckEventQueueForUserCancel();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *Evt_WaitNextEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ Boolean _rv;
+ EventMask eventMask;
+ EventRecord theEvent;
+ UInt32 sleep;
+ Handle mouseregion = (Handle)0;
+
+ if (!PyArg_ParseTuple(_args, "Hl|O&",
+ &eventMask,
+ &sleep,
+ OptResObj_Convert, &mouseregion))
+ return NULL;
+ _rv = WaitNextEvent(eventMask,
+ &theEvent,
+ sleep,
+ (RgnHandle)mouseregion);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+
+}
+
+static PyMethodDef Evt_methods[] = {
+ {"GetMouse", (PyCFunction)Evt_GetMouse, 1,
+ "() -> (Point mouseLoc)"},
+ {"Button", (PyCFunction)Evt_Button, 1,
+ "() -> (Boolean _rv)"},
+ {"StillDown", (PyCFunction)Evt_StillDown, 1,
+ "() -> (Boolean _rv)"},
+ {"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1,
+ "() -> (Boolean _rv)"},
+ {"TickCount", (PyCFunction)Evt_TickCount, 1,
+ "() -> (UInt32 _rv)"},
+ {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
+ "() -> (UInt32 _rv)"},
+ {"GetKeys", (PyCFunction)Evt_GetKeys, 1,
+ "() -> (KeyMap theKeys)"},
+ {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
+ "() -> (UInt32 _rv)"},
+ {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
+ "(EventMask value) -> None"},
+ {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
+ "(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
+ {"EventAvail", (PyCFunction)Evt_EventAvail, 1,
+ "(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
+ {"PostEvent", (PyCFunction)Evt_PostEvent, 1,
+ "(EventKind eventNum, UInt32 eventMsg) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1,
+ "(EventMask mask) -> (Boolean _rv, EventRecord theEvent)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"GetOSEvent", (PyCFunction)Evt_GetOSEvent, 1,
+ "(EventMask mask) -> (Boolean _rv, EventRecord theEvent)"},
+#endif
+ {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1,
+ "(EventMask whichMask, EventMask stopMask) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SystemClick", (PyCFunction)Evt_SystemClick, 1,
+ "(EventRecord theEvent, WindowPtr theWindow) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SystemTask", (PyCFunction)Evt_SystemTask, 1,
+ "() -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SystemEvent", (PyCFunction)Evt_SystemEvent, 1,
+ "(EventRecord theEvent) -> (Boolean _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetGlobalMouse", (PyCFunction)Evt_GetGlobalMouse, 1,
+ "() -> (Point globalMouse)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetCurrentKeyModifiers", (PyCFunction)Evt_GetCurrentKeyModifiers, 1,
+ "() -> (UInt32 _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"CheckEventQueueForUserCancel", (PyCFunction)Evt_CheckEventQueueForUserCancel, 1,
+ "() -> (Boolean _rv)"},
+#endif
+ {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
+ "(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Evt(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_Evt", Evt_methods);
+ d = PyModule_GetDict(m);
+ Evt_Error = PyMac_GetOSErrException();
+ if (Evt_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Evt_Error) != 0)
+ return;
+}
+
+/* ======================== End module _Evt ========================= */
+
diff --git a/Mac/Modules/fm/_Fmmodule.c b/Mac/Modules/fm/_Fmmodule.c
new file mode 100644
index 0000000..9cafebc
--- /dev/null
+++ b/Mac/Modules/fm/_Fmmodule.c
@@ -0,0 +1,359 @@
+
+/* =========================== Module _Fm =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Fonts.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+
+/*
+** Parse/generate ComponentDescriptor records
+*/
+static PyObject *
+FMRec_New(FMetricRec *itself)
+{
+
+ return Py_BuildValue("O&O&O&O&O&",
+ PyMac_BuildFixed, itself->ascent,
+ PyMac_BuildFixed, itself->descent,
+ PyMac_BuildFixed, itself->leading,
+ PyMac_BuildFixed, itself->widMax,
+ ResObj_New, itself->wTabHandle);
+}
+
+#if 0
+/* Not needed... */
+static int
+FMRec_Convert(PyObject *v, FMetricRec *p_itself)
+{
+ return PyArg_ParseTuple(v, "O&O&O&O&O&",
+ PyMac_GetFixed, &itself->ascent,
+ PyMac_GetFixed, &itself->descent,
+ PyMac_GetFixed, &itself->leading,
+ PyMac_GetFixed, &itself->widMax,
+ ResObj_Convert, &itself->wTabHandle);
+}
+#endif
+
+
+static PyObject *Fm_Error;
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Fm_InitFonts(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InitFonts();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Fm_GetFontName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short familyID;
+ Str255 name;
+ if (!PyArg_ParseTuple(_args, "h",
+ &familyID))
+ return NULL;
+ GetFontName(familyID,
+ name);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, name);
+ return _res;
+}
+
+static PyObject *Fm_GetFNum(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 name;
+ short familyID;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, name))
+ return NULL;
+ GetFNum(name,
+ &familyID);
+ _res = Py_BuildValue("h",
+ familyID);
+ return _res;
+}
+
+static PyObject *Fm_RealFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short fontNum;
+ short size;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &fontNum,
+ &size))
+ return NULL;
+ _rv = RealFont(fontNum,
+ size);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Fm_SetFontLock(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean lockFlag;
+ if (!PyArg_ParseTuple(_args, "b",
+ &lockFlag))
+ return NULL;
+ SetFontLock(lockFlag);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Fm_SetFScaleDisable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean fscaleDisable;
+ if (!PyArg_ParseTuple(_args, "b",
+ &fscaleDisable))
+ return NULL;
+ SetFScaleDisable(fscaleDisable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Fm_FontMetrics(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ FMetricRec theMetrics;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ FontMetrics(&theMetrics);
+ _res = Py_BuildValue("O&",
+ FMRec_New, &theMetrics);
+ return _res;
+}
+
+static PyObject *Fm_SetFractEnable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean fractEnable;
+ if (!PyArg_ParseTuple(_args, "b",
+ &fractEnable))
+ return NULL;
+ SetFractEnable(fractEnable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Fm_GetDefFontSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDefFontSize();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_IsOutline(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point numer;
+ Point denom;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &numer,
+ PyMac_GetPoint, &denom))
+ return NULL;
+ _rv = IsOutline(numer,
+ denom);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_SetOutlinePreferred(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean outlinePreferred;
+ if (!PyArg_ParseTuple(_args, "b",
+ &outlinePreferred))
+ return NULL;
+ SetOutlinePreferred(outlinePreferred);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Fm_GetOutlinePreferred(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetOutlinePreferred();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_SetPreserveGlyph(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean preserveGlyph;
+ if (!PyArg_ParseTuple(_args, "b",
+ &preserveGlyph))
+ return NULL;
+ SetPreserveGlyph(preserveGlyph);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Fm_GetPreserveGlyph(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPreserveGlyph();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Fm_FlushFonts(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = FlushFonts();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Fm_GetSysFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetSysFont();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Fm_GetAppFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetAppFont();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef Fm_methods[] = {
+
+#if !TARGET_API_MAC_CARBON
+ {"InitFonts", (PyCFunction)Fm_InitFonts, 1,
+ "() -> None"},
+#endif
+ {"GetFontName", (PyCFunction)Fm_GetFontName, 1,
+ "(short familyID) -> (Str255 name)"},
+ {"GetFNum", (PyCFunction)Fm_GetFNum, 1,
+ "(Str255 name) -> (short familyID)"},
+ {"RealFont", (PyCFunction)Fm_RealFont, 1,
+ "(short fontNum, short size) -> (Boolean _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SetFontLock", (PyCFunction)Fm_SetFontLock, 1,
+ "(Boolean lockFlag) -> None"},
+#endif
+ {"SetFScaleDisable", (PyCFunction)Fm_SetFScaleDisable, 1,
+ "(Boolean fscaleDisable) -> None"},
+ {"FontMetrics", (PyCFunction)Fm_FontMetrics, 1,
+ "() -> (FMetricRec theMetrics)"},
+ {"SetFractEnable", (PyCFunction)Fm_SetFractEnable, 1,
+ "(Boolean fractEnable) -> None"},
+ {"GetDefFontSize", (PyCFunction)Fm_GetDefFontSize, 1,
+ "() -> (short _rv)"},
+ {"IsOutline", (PyCFunction)Fm_IsOutline, 1,
+ "(Point numer, Point denom) -> (Boolean _rv)"},
+ {"SetOutlinePreferred", (PyCFunction)Fm_SetOutlinePreferred, 1,
+ "(Boolean outlinePreferred) -> None"},
+ {"GetOutlinePreferred", (PyCFunction)Fm_GetOutlinePreferred, 1,
+ "() -> (Boolean _rv)"},
+ {"SetPreserveGlyph", (PyCFunction)Fm_SetPreserveGlyph, 1,
+ "(Boolean preserveGlyph) -> None"},
+ {"GetPreserveGlyph", (PyCFunction)Fm_GetPreserveGlyph, 1,
+ "() -> (Boolean _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"FlushFonts", (PyCFunction)Fm_FlushFonts, 1,
+ "() -> None"},
+#endif
+ {"GetSysFont", (PyCFunction)Fm_GetSysFont, 1,
+ "() -> (short _rv)"},
+ {"GetAppFont", (PyCFunction)Fm_GetAppFont, 1,
+ "() -> (short _rv)"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Fm(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_Fm", Fm_methods);
+ d = PyModule_GetDict(m);
+ Fm_Error = PyMac_GetOSErrException();
+ if (Fm_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Fm_Error) != 0)
+ return;
+}
+
+/* ========================= End module _Fm ========================= */
+
diff --git a/Mac/Modules/help/_Helpmodule.c b/Mac/Modules/help/_Helpmodule.c
new file mode 100644
index 0000000..7a2836d
--- /dev/null
+++ b/Mac/Modules/help/_Helpmodule.c
@@ -0,0 +1,300 @@
+
+/* ========================== Module _Help ========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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 <Balloons.h>
+
+static PyObject *Help_Error;
+
+static PyObject *Help_HMGetHelpMenuHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ MenuHandle mh;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMGetHelpMenuHandle(&mh);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, mh);
+ return _res;
+}
+
+static PyObject *Help_HMRemoveBalloon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMRemoveBalloon();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMIsBalloon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = HMIsBalloon();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Help_HMGetBalloons(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = HMGetBalloons();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Help_HMSetBalloons(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean flag;
+ if (!PyArg_ParseTuple(_args, "b",
+ &flag))
+ return NULL;
+ _err = HMSetBalloons(flag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMSetFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 font;
+ if (!PyArg_ParseTuple(_args, "h",
+ &font))
+ return NULL;
+ _err = HMSetFont(font);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMSetFontSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 fontSize;
+ if (!PyArg_ParseTuple(_args, "H",
+ &fontSize))
+ return NULL;
+ _err = HMSetFontSize(fontSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMGetFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 font;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMGetFont(&font);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ font);
+ return _res;
+}
+
+static PyObject *Help_HMGetFontSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 fontSize;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMGetFontSize(&fontSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ fontSize);
+ return _res;
+}
+
+static PyObject *Help_HMSetDialogResID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 resID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &resID))
+ return NULL;
+ _err = HMSetDialogResID(resID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMSetMenuResID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 menuID;
+ SInt16 resID;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &menuID,
+ &resID))
+ return NULL;
+ _err = HMSetMenuResID(menuID,
+ resID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMScanTemplateItems(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 whichID;
+ SInt16 whichResFile;
+ ResType whichType;
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &whichID,
+ &whichResFile,
+ PyMac_GetOSType, &whichType))
+ return NULL;
+ _err = HMScanTemplateItems(whichID,
+ whichResFile,
+ whichType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Help_HMGetDialogResID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 resID;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMGetDialogResID(&resID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resID);
+ return _res;
+}
+
+static PyObject *Help_HMGetMenuResID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 menuID;
+ SInt16 resID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ _err = HMGetMenuResID(menuID,
+ &resID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resID);
+ return _res;
+}
+
+static PyObject *Help_HMGetBalloonWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ WindowPtr window;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HMGetBalloonWindow(&window);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, window);
+ return _res;
+}
+
+static PyMethodDef Help_methods[] = {
+ {"HMGetHelpMenuHandle", (PyCFunction)Help_HMGetHelpMenuHandle, 1,
+ "() -> (MenuHandle mh)"},
+ {"HMRemoveBalloon", (PyCFunction)Help_HMRemoveBalloon, 1,
+ "() -> None"},
+ {"HMIsBalloon", (PyCFunction)Help_HMIsBalloon, 1,
+ "() -> (Boolean _rv)"},
+ {"HMGetBalloons", (PyCFunction)Help_HMGetBalloons, 1,
+ "() -> (Boolean _rv)"},
+ {"HMSetBalloons", (PyCFunction)Help_HMSetBalloons, 1,
+ "(Boolean flag) -> None"},
+ {"HMSetFont", (PyCFunction)Help_HMSetFont, 1,
+ "(SInt16 font) -> None"},
+ {"HMSetFontSize", (PyCFunction)Help_HMSetFontSize, 1,
+ "(UInt16 fontSize) -> None"},
+ {"HMGetFont", (PyCFunction)Help_HMGetFont, 1,
+ "() -> (SInt16 font)"},
+ {"HMGetFontSize", (PyCFunction)Help_HMGetFontSize, 1,
+ "() -> (UInt16 fontSize)"},
+ {"HMSetDialogResID", (PyCFunction)Help_HMSetDialogResID, 1,
+ "(SInt16 resID) -> None"},
+ {"HMSetMenuResID", (PyCFunction)Help_HMSetMenuResID, 1,
+ "(SInt16 menuID, SInt16 resID) -> None"},
+ {"HMScanTemplateItems", (PyCFunction)Help_HMScanTemplateItems, 1,
+ "(SInt16 whichID, SInt16 whichResFile, ResType whichType) -> None"},
+ {"HMGetDialogResID", (PyCFunction)Help_HMGetDialogResID, 1,
+ "() -> (SInt16 resID)"},
+ {"HMGetMenuResID", (PyCFunction)Help_HMGetMenuResID, 1,
+ "(SInt16 menuID) -> (SInt16 resID)"},
+ {"HMGetBalloonWindow", (PyCFunction)Help_HMGetBalloonWindow, 1,
+ "() -> (WindowPtr window)"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Help(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_Help", Help_methods);
+ d = PyModule_GetDict(m);
+ Help_Error = PyMac_GetOSErrException();
+ if (Help_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Help_Error) != 0)
+ return;
+}
+
+/* ======================== End module _Help ======================== */
+
diff --git a/Mac/Modules/icn/_Icnmodule.c b/Mac/Modules/icn/_Icnmodule.c
new file mode 100644
index 0000000..a9af768
--- /dev/null
+++ b/Mac/Modules/icn/_Icnmodule.c
@@ -0,0 +1,1417 @@
+
+/* ========================== Module _Icn =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Icons.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+
+static PyObject *Icn_Error;
+
+static PyObject *Icn_GetCIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CIconHandle _rv;
+ SInt16 iconID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &iconID))
+ return NULL;
+ _rv = GetCIcon(iconID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Icn_PlotCIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect theRect;
+ CIconHandle theIcon;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &theRect,
+ ResObj_Convert, &theIcon))
+ return NULL;
+ PlotCIcon(&theRect,
+ theIcon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_DisposeCIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CIconHandle theIcon;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIcon))
+ return NULL;
+ DisposeCIcon(theIcon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ SInt16 iconID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &iconID))
+ return NULL;
+ _rv = GetIcon(iconID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Icn_PlotIcon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect theRect;
+ Handle theIcon;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &theRect,
+ ResObj_Convert, &theIcon))
+ return NULL;
+ PlotIcon(&theRect,
+ theIcon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PlotIconID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ SInt16 theResID;
+ if (!PyArg_ParseTuple(_args, "O&hhh",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ &theResID))
+ return NULL;
+ _err = PlotIconID(&theRect,
+ align,
+ transform,
+ theResID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_NewIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef theIconSuite;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NewIconSuite(&theIconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconSuite);
+ return _res;
+}
+
+static PyObject *Icn_AddIconToSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle theIconData;
+ IconSuiteRef theSuite;
+ ResType theType;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &theIconData,
+ ResObj_Convert, &theSuite,
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _err = AddIconToSuite(theIconData,
+ theSuite,
+ theType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconFromSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle theIconData;
+ IconSuiteRef theSuite;
+ ResType theType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &theSuite,
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _err = GetIconFromSuite(&theIconData,
+ theSuite,
+ theType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconData);
+ return _res;
+}
+
+static PyObject *Icn_GetIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef theIconSuite;
+ SInt16 theResID;
+ IconSelectorValue selector;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &theResID,
+ &selector))
+ return NULL;
+ _err = GetIconSuite(&theIconSuite,
+ theResID,
+ selector);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconSuite);
+ return _res;
+}
+
+static PyObject *Icn_DisposeIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef theIconSuite;
+ Boolean disposeData;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ ResObj_Convert, &theIconSuite,
+ &disposeData))
+ return NULL;
+ _err = DisposeIconSuite(theIconSuite,
+ disposeData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PlotIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ IconSuiteRef theIconSuite;
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theIconSuite))
+ return NULL;
+ _err = PlotIconSuite(&theRect,
+ align,
+ transform,
+ theIconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_LoadIconCache(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ IconCacheRef theIconCache;
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theIconCache))
+ return NULL;
+ _err = LoadIconCache(&theRect,
+ align,
+ transform,
+ theIconCache);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetLabel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 labelNumber;
+ RGBColor labelColor;
+ Str255 labelString;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &labelNumber,
+ PyMac_GetStr255, labelString))
+ return NULL;
+ _err = GetLabel(labelNumber,
+ &labelColor,
+ labelString);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &labelColor);
+ return _res;
+}
+
+static PyObject *Icn_PtInIconID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point testPt;
+ Rect iconRect;
+ IconAlignmentType align;
+ SInt16 iconID;
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ PyMac_GetPoint, &testPt,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconID))
+ return NULL;
+ _rv = PtInIconID(testPt,
+ &iconRect,
+ align,
+ iconID);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_PtInIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point testPt;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconSuiteRef theIconSuite;
+ if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ PyMac_GetPoint, &testPt,
+ PyMac_GetRect, &iconRect,
+ &align,
+ ResObj_Convert, &theIconSuite))
+ return NULL;
+ _rv = PtInIconSuite(testPt,
+ &iconRect,
+ align,
+ theIconSuite);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_RectInIconID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect testRect;
+ Rect iconRect;
+ IconAlignmentType align;
+ SInt16 iconID;
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ PyMac_GetRect, &testRect,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconID))
+ return NULL;
+ _rv = RectInIconID(&testRect,
+ &iconRect,
+ align,
+ iconID);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_RectInIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect testRect;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconSuiteRef theIconSuite;
+ if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ PyMac_GetRect, &testRect,
+ PyMac_GetRect, &iconRect,
+ &align,
+ ResObj_Convert, &theIconSuite))
+ return NULL;
+ _rv = RectInIconSuite(&testRect,
+ &iconRect,
+ align,
+ theIconSuite);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_IconIDToRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle theRgn;
+ Rect iconRect;
+ IconAlignmentType align;
+ SInt16 iconID;
+ if (!PyArg_ParseTuple(_args, "O&O&hh",
+ ResObj_Convert, &theRgn,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconID))
+ return NULL;
+ _err = IconIDToRgn(theRgn,
+ &iconRect,
+ align,
+ iconID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_IconSuiteToRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle theRgn;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconSuiteRef theIconSuite;
+ if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ ResObj_Convert, &theRgn,
+ PyMac_GetRect, &iconRect,
+ &align,
+ ResObj_Convert, &theIconSuite))
+ return NULL;
+ _err = IconSuiteToRgn(theRgn,
+ &iconRect,
+ align,
+ theIconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_SetSuiteLabel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef theSuite;
+ SInt16 theLabel;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &theSuite,
+ &theLabel))
+ return NULL;
+ _err = SetSuiteLabel(theSuite,
+ theLabel);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetSuiteLabel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ IconSuiteRef theSuite;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theSuite))
+ return NULL;
+ _rv = GetSuiteLabel(theSuite);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_PlotIconHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ Handle theIcon;
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theIcon))
+ return NULL;
+ _err = PlotIconHandle(&theRect,
+ align,
+ transform,
+ theIcon);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PlotSICNHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ Handle theSICN;
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theSICN))
+ return NULL;
+ _err = PlotSICNHandle(&theRect,
+ align,
+ transform,
+ theSICN);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PlotCIconHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ CIconHandle theCIcon;
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ ResObj_Convert, &theCIcon))
+ return NULL;
+ _err = PlotCIconHandle(&theRect,
+ align,
+ transform,
+ theCIcon);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Icn_IconServicesTerminate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ IconServicesTerminate();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Icn_IconRefToIconFamily(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ IconSelectorValue whichIcons;
+ IconFamilyHandle iconFamily;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &theIconRef,
+ &whichIcons))
+ return NULL;
+ _err = IconRefToIconFamily(theIconRef,
+ whichIcons,
+ &iconFamily);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconFamily);
+ return _res;
+}
+
+static PyObject *Icn_IconFamilyToIconSuite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconFamilyHandle iconFamily;
+ IconSelectorValue whichIcons;
+ IconSuiteRef iconSuite;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &iconFamily,
+ &whichIcons))
+ return NULL;
+ _err = IconFamilyToIconSuite(iconFamily,
+ whichIcons,
+ &iconSuite);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconSuite);
+ return _res;
+}
+
+static PyObject *Icn_IconSuiteToIconFamily(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSuiteRef iconSuite;
+ IconSelectorValue whichIcons;
+ IconFamilyHandle iconFamily;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &iconSuite,
+ &whichIcons))
+ return NULL;
+ _err = IconSuiteToIconFamily(iconSuite,
+ whichIcons,
+ &iconFamily);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconFamily);
+ return _res;
+}
+
+static PyObject *Icn_SetIconFamilyData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconFamilyHandle iconFamily;
+ OSType iconType;
+ Handle h;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &iconFamily,
+ PyMac_GetOSType, &iconType,
+ ResObj_Convert, &h))
+ return NULL;
+ _err = SetIconFamilyData(iconFamily,
+ iconType,
+ h);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconFamilyData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconFamilyHandle iconFamily;
+ OSType iconType;
+ Handle h;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &iconFamily,
+ PyMac_GetOSType, &iconType,
+ ResObj_Convert, &h))
+ return NULL;
+ _err = GetIconFamilyData(iconFamily,
+ iconType,
+ h);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconRefOwners(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ UInt16 owners;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = GetIconRefOwners(theIconRef,
+ &owners);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ owners);
+ return _res;
+}
+
+static PyObject *Icn_AcquireIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = AcquireIconRef(theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_ReleaseIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = ReleaseIconRef(theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconRefFromFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec theFile;
+ IconRef theIconRef;
+ SInt16 theLabel;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &theFile))
+ return NULL;
+ _err = GetIconRefFromFile(&theFile,
+ &theIconRef,
+ &theLabel);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ ResObj_New, theIconRef,
+ theLabel);
+ return _res;
+}
+
+static PyObject *Icn_GetIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ OSType creator;
+ OSType iconType;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &vRefNum,
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType))
+ return NULL;
+ _err = GetIconRef(vRefNum,
+ creator,
+ iconType,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_GetIconRefFromFolder(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ SInt32 parentFolderID;
+ SInt32 folderID;
+ SInt8 attributes;
+ SInt8 accessPrivileges;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "hllbb",
+ &vRefNum,
+ &parentFolderID,
+ &folderID,
+ &attributes,
+ &accessPrivileges))
+ return NULL;
+ _err = GetIconRefFromFolder(vRefNum,
+ parentFolderID,
+ folderID,
+ attributes,
+ accessPrivileges,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_RegisterIconRefFromIconFamily(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+ IconFamilyHandle iconFamily;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType,
+ ResObj_Convert, &iconFamily))
+ return NULL;
+ _err = RegisterIconRefFromIconFamily(creator,
+ iconType,
+ iconFamily,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_RegisterIconRefFromResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+ FSSpec resourceFile;
+ SInt16 resourceID;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&O&O&h",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType,
+ PyMac_GetFSSpec, &resourceFile,
+ &resourceID))
+ return NULL;
+ _err = RegisterIconRefFromResource(creator,
+ iconType,
+ &resourceFile,
+ resourceID,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
+static PyObject *Icn_UnregisterIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType))
+ return NULL;
+ _err = UnregisterIconRef(creator,
+ iconType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_UpdateIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = UpdateIconRef(theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_OverrideIconRefFromResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ FSSpec resourceFile;
+ SInt16 resourceID;
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ ResObj_Convert, &theIconRef,
+ PyMac_GetFSSpec, &resourceFile,
+ &resourceID))
+ return NULL;
+ _err = OverrideIconRefFromResource(theIconRef,
+ &resourceFile,
+ resourceID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_OverrideIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef oldIconRef;
+ IconRef newIconRef;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &oldIconRef,
+ ResObj_Convert, &newIconRef))
+ return NULL;
+ _err = OverrideIconRef(oldIconRef,
+ newIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_RemoveIconRefOverride(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = RemoveIconRefOverride(theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_CompositeIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef backgroundIconRef;
+ IconRef foregroundIconRef;
+ IconRef compositeIconRef;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &backgroundIconRef,
+ ResObj_Convert, &foregroundIconRef))
+ return NULL;
+ _err = CompositeIconRef(backgroundIconRef,
+ foregroundIconRef,
+ &compositeIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, compositeIconRef);
+ return _res;
+}
+
+static PyObject *Icn_IsIconRefComposite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconRef compositeIconRef;
+ IconRef backgroundIconRef;
+ IconRef foregroundIconRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &compositeIconRef))
+ return NULL;
+ _err = IsIconRefComposite(compositeIconRef,
+ &backgroundIconRef,
+ &foregroundIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, backgroundIconRef,
+ ResObj_New, foregroundIconRef);
+ return _res;
+}
+
+static PyObject *Icn_IsValidIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _rv = IsValidIconRef(theIconRef);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_PlotIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect theRect;
+ IconAlignmentType align;
+ IconTransformType transform;
+ IconServicesUsageFlags theIconServicesUsageFlags;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&hhlO&",
+ PyMac_GetRect, &theRect,
+ &align,
+ &transform,
+ &theIconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = PlotIconRef(&theRect,
+ align,
+ transform,
+ theIconServicesUsageFlags,
+ theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_PtInIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point testPt;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconServicesUsageFlags theIconServicesUsageFlags;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&",
+ PyMac_GetPoint, &testPt,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &theIconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _rv = PtInIconRef(&testPt,
+ &iconRect,
+ align,
+ theIconServicesUsageFlags,
+ theIconRef);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_RectInIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect testRect;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconServicesUsageFlags iconServicesUsageFlags;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&",
+ PyMac_GetRect, &testRect,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _rv = RectInIconRef(&testRect,
+ &iconRect,
+ align,
+ iconServicesUsageFlags,
+ theIconRef);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Icn_IconRefToRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle theRgn;
+ Rect iconRect;
+ IconAlignmentType align;
+ IconServicesUsageFlags iconServicesUsageFlags;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&",
+ ResObj_Convert, &theRgn,
+ PyMac_GetRect, &iconRect,
+ &align,
+ &iconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = IconRefToRgn(theRgn,
+ &iconRect,
+ align,
+ iconServicesUsageFlags,
+ theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetIconSizesFromIconRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconSelectorValue iconSelectorInput;
+ IconSelectorValue iconSelectorOutputPtr;
+ IconServicesUsageFlags iconServicesUsageFlags;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &iconSelectorInput,
+ &iconServicesUsageFlags,
+ ResObj_Convert, &theIconRef))
+ return NULL;
+ _err = GetIconSizesFromIconRef(iconSelectorInput,
+ &iconSelectorOutputPtr,
+ iconServicesUsageFlags,
+ theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ iconSelectorOutputPtr);
+ return _res;
+}
+
+static PyObject *Icn_FlushIconRefs(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType))
+ return NULL;
+ _err = FlushIconRefs(creator,
+ iconType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_FlushIconRefsByVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &vRefNum))
+ return NULL;
+ _err = FlushIconRefsByVolume(vRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_SetCustomIconsEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ Boolean enableCustomIcons;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &vRefNum,
+ &enableCustomIcons))
+ return NULL;
+ _err = SetCustomIconsEnabled(vRefNum,
+ enableCustomIcons);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Icn_GetCustomIconsEnabled(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 vRefNum;
+ Boolean customIconsEnabled;
+ if (!PyArg_ParseTuple(_args, "h",
+ &vRefNum))
+ return NULL;
+ _err = GetCustomIconsEnabled(vRefNum,
+ &customIconsEnabled);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ customIconsEnabled);
+ return _res;
+}
+
+static PyObject *Icn_IsIconRefMaskEmpty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ IconRef iconRef;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &iconRef))
+ return NULL;
+ _rv = IsIconRefMaskEmpty(iconRef);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Icn_GetIconRefVariant(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ IconRef _rv;
+ IconRef inIconRef;
+ OSType inVariant;
+ IconTransformType outTransform;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &inIconRef,
+ PyMac_GetOSType, &inVariant))
+ return NULL;
+ _rv = GetIconRefVariant(inIconRef,
+ inVariant,
+ &outTransform);
+ _res = Py_BuildValue("O&h",
+ ResObj_New, _rv,
+ outTransform);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Icn_RegisterIconRefFromIconFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType creator;
+ OSType iconType;
+ FSSpec iconFile;
+ IconRef theIconRef;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType,
+ PyMac_GetFSSpec, &iconFile))
+ return NULL;
+ _err = RegisterIconRefFromIconFile(creator,
+ iconType,
+ &iconFile,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Icn_ReadIconFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec iconFile;
+ IconFamilyHandle iconFamily;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &iconFile))
+ return NULL;
+ _err = ReadIconFile(&iconFile,
+ &iconFamily);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconFamily);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Icn_WriteIconFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconFamilyHandle iconFamily;
+ FSSpec iconFile;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &iconFamily,
+ PyMac_GetFSSpec, &iconFile))
+ return NULL;
+ _err = WriteIconFile(iconFamily,
+ &iconFile);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyMethodDef Icn_methods[] = {
+ {"GetCIcon", (PyCFunction)Icn_GetCIcon, 1,
+ "(SInt16 iconID) -> (CIconHandle _rv)"},
+ {"PlotCIcon", (PyCFunction)Icn_PlotCIcon, 1,
+ "(Rect theRect, CIconHandle theIcon) -> None"},
+ {"DisposeCIcon", (PyCFunction)Icn_DisposeCIcon, 1,
+ "(CIconHandle theIcon) -> None"},
+ {"GetIcon", (PyCFunction)Icn_GetIcon, 1,
+ "(SInt16 iconID) -> (Handle _rv)"},
+ {"PlotIcon", (PyCFunction)Icn_PlotIcon, 1,
+ "(Rect theRect, Handle theIcon) -> None"},
+ {"PlotIconID", (PyCFunction)Icn_PlotIconID, 1,
+ "(Rect theRect, IconAlignmentType align, IconTransformType transform, SInt16 theResID) -> None"},
+ {"NewIconSuite", (PyCFunction)Icn_NewIconSuite, 1,
+ "() -> (IconSuiteRef theIconSuite)"},
+ {"AddIconToSuite", (PyCFunction)Icn_AddIconToSuite, 1,
+ "(Handle theIconData, IconSuiteRef theSuite, ResType theType) -> None"},
+ {"GetIconFromSuite", (PyCFunction)Icn_GetIconFromSuite, 1,
+ "(IconSuiteRef theSuite, ResType theType) -> (Handle theIconData)"},
+ {"GetIconSuite", (PyCFunction)Icn_GetIconSuite, 1,
+ "(SInt16 theResID, IconSelectorValue selector) -> (IconSuiteRef theIconSuite)"},
+ {"DisposeIconSuite", (PyCFunction)Icn_DisposeIconSuite, 1,
+ "(IconSuiteRef theIconSuite, Boolean disposeData) -> None"},
+ {"PlotIconSuite", (PyCFunction)Icn_PlotIconSuite, 1,
+ "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconSuiteRef theIconSuite) -> None"},
+ {"LoadIconCache", (PyCFunction)Icn_LoadIconCache, 1,
+ "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconCacheRef theIconCache) -> None"},
+ {"GetLabel", (PyCFunction)Icn_GetLabel, 1,
+ "(SInt16 labelNumber, Str255 labelString) -> (RGBColor labelColor)"},
+ {"PtInIconID", (PyCFunction)Icn_PtInIconID, 1,
+ "(Point testPt, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)"},
+ {"PtInIconSuite", (PyCFunction)Icn_PtInIconSuite, 1,
+ "(Point testPt, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)"},
+ {"RectInIconID", (PyCFunction)Icn_RectInIconID, 1,
+ "(Rect testRect, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)"},
+ {"RectInIconSuite", (PyCFunction)Icn_RectInIconSuite, 1,
+ "(Rect testRect, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)"},
+ {"IconIDToRgn", (PyCFunction)Icn_IconIDToRgn, 1,
+ "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> None"},
+ {"IconSuiteToRgn", (PyCFunction)Icn_IconSuiteToRgn, 1,
+ "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> None"},
+ {"SetSuiteLabel", (PyCFunction)Icn_SetSuiteLabel, 1,
+ "(IconSuiteRef theSuite, SInt16 theLabel) -> None"},
+ {"GetSuiteLabel", (PyCFunction)Icn_GetSuiteLabel, 1,
+ "(IconSuiteRef theSuite) -> (SInt16 _rv)"},
+ {"PlotIconHandle", (PyCFunction)Icn_PlotIconHandle, 1,
+ "(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon) -> None"},
+ {"PlotSICNHandle", (PyCFunction)Icn_PlotSICNHandle, 1,
+ "(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN) -> None"},
+ {"PlotCIconHandle", (PyCFunction)Icn_PlotCIconHandle, 1,
+ "(Rect theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"IconServicesTerminate", (PyCFunction)Icn_IconServicesTerminate, 1,
+ "() -> None"},
+#endif
+ {"IconRefToIconFamily", (PyCFunction)Icn_IconRefToIconFamily, 1,
+ "(IconRef theIconRef, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)"},
+ {"IconFamilyToIconSuite", (PyCFunction)Icn_IconFamilyToIconSuite, 1,
+ "(IconFamilyHandle iconFamily, IconSelectorValue whichIcons) -> (IconSuiteRef iconSuite)"},
+ {"IconSuiteToIconFamily", (PyCFunction)Icn_IconSuiteToIconFamily, 1,
+ "(IconSuiteRef iconSuite, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)"},
+ {"SetIconFamilyData", (PyCFunction)Icn_SetIconFamilyData, 1,
+ "(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None"},
+ {"GetIconFamilyData", (PyCFunction)Icn_GetIconFamilyData, 1,
+ "(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None"},
+ {"GetIconRefOwners", (PyCFunction)Icn_GetIconRefOwners, 1,
+ "(IconRef theIconRef) -> (UInt16 owners)"},
+ {"AcquireIconRef", (PyCFunction)Icn_AcquireIconRef, 1,
+ "(IconRef theIconRef) -> None"},
+ {"ReleaseIconRef", (PyCFunction)Icn_ReleaseIconRef, 1,
+ "(IconRef theIconRef) -> None"},
+ {"GetIconRefFromFile", (PyCFunction)Icn_GetIconRefFromFile, 1,
+ "(FSSpec theFile) -> (IconRef theIconRef, SInt16 theLabel)"},
+ {"GetIconRef", (PyCFunction)Icn_GetIconRef, 1,
+ "(SInt16 vRefNum, OSType creator, OSType iconType) -> (IconRef theIconRef)"},
+ {"GetIconRefFromFolder", (PyCFunction)Icn_GetIconRefFromFolder, 1,
+ "(SInt16 vRefNum, SInt32 parentFolderID, SInt32 folderID, SInt8 attributes, SInt8 accessPrivileges) -> (IconRef theIconRef)"},
+ {"RegisterIconRefFromIconFamily", (PyCFunction)Icn_RegisterIconRefFromIconFamily, 1,
+ "(OSType creator, OSType iconType, IconFamilyHandle iconFamily) -> (IconRef theIconRef)"},
+ {"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1,
+ "(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)"},
+ {"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1,
+ "(OSType creator, OSType iconType) -> None"},
+ {"UpdateIconRef", (PyCFunction)Icn_UpdateIconRef, 1,
+ "(IconRef theIconRef) -> None"},
+ {"OverrideIconRefFromResource", (PyCFunction)Icn_OverrideIconRefFromResource, 1,
+ "(IconRef theIconRef, FSSpec resourceFile, SInt16 resourceID) -> None"},
+ {"OverrideIconRef", (PyCFunction)Icn_OverrideIconRef, 1,
+ "(IconRef oldIconRef, IconRef newIconRef) -> None"},
+ {"RemoveIconRefOverride", (PyCFunction)Icn_RemoveIconRefOverride, 1,
+ "(IconRef theIconRef) -> None"},
+ {"CompositeIconRef", (PyCFunction)Icn_CompositeIconRef, 1,
+ "(IconRef backgroundIconRef, IconRef foregroundIconRef) -> (IconRef compositeIconRef)"},
+ {"IsIconRefComposite", (PyCFunction)Icn_IsIconRefComposite, 1,
+ "(IconRef compositeIconRef) -> (IconRef backgroundIconRef, IconRef foregroundIconRef)"},
+ {"IsValidIconRef", (PyCFunction)Icn_IsValidIconRef, 1,
+ "(IconRef theIconRef) -> (Boolean _rv)"},
+ {"PlotIconRef", (PyCFunction)Icn_PlotIconRef, 1,
+ "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> None"},
+ {"PtInIconRef", (PyCFunction)Icn_PtInIconRef, 1,
+ "(Point testPt, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)"},
+ {"RectInIconRef", (PyCFunction)Icn_RectInIconRef, 1,
+ "(Rect testRect, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)"},
+ {"IconRefToRgn", (PyCFunction)Icn_IconRefToRgn, 1,
+ "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> None"},
+ {"GetIconSizesFromIconRef", (PyCFunction)Icn_GetIconSizesFromIconRef, 1,
+ "(IconSelectorValue iconSelectorInput, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (IconSelectorValue iconSelectorOutputPtr)"},
+ {"FlushIconRefs", (PyCFunction)Icn_FlushIconRefs, 1,
+ "(OSType creator, OSType iconType) -> None"},
+ {"FlushIconRefsByVolume", (PyCFunction)Icn_FlushIconRefsByVolume, 1,
+ "(SInt16 vRefNum) -> None"},
+ {"SetCustomIconsEnabled", (PyCFunction)Icn_SetCustomIconsEnabled, 1,
+ "(SInt16 vRefNum, Boolean enableCustomIcons) -> None"},
+ {"GetCustomIconsEnabled", (PyCFunction)Icn_GetCustomIconsEnabled, 1,
+ "(SInt16 vRefNum) -> (Boolean customIconsEnabled)"},
+ {"IsIconRefMaskEmpty", (PyCFunction)Icn_IsIconRefMaskEmpty, 1,
+ "(IconRef iconRef) -> (Boolean _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetIconRefVariant", (PyCFunction)Icn_GetIconRefVariant, 1,
+ "(IconRef inIconRef, OSType inVariant) -> (IconRef _rv, IconTransformType outTransform)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"RegisterIconRefFromIconFile", (PyCFunction)Icn_RegisterIconRefFromIconFile, 1,
+ "(OSType creator, OSType iconType, FSSpec iconFile) -> (IconRef theIconRef)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ReadIconFile", (PyCFunction)Icn_ReadIconFile, 1,
+ "(FSSpec iconFile) -> (IconFamilyHandle iconFamily)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1,
+ "(IconFamilyHandle iconFamily, FSSpec iconFile) -> None"},
+#endif
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Icn(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_Icn", Icn_methods);
+ d = PyModule_GetDict(m);
+ Icn_Error = PyMac_GetOSErrException();
+ if (Icn_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Icn_Error) != 0)
+ return;
+}
+
+/* ======================== End module _Icn ========================= */
+
diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c
new file mode 100644
index 0000000..950a666
--- /dev/null
+++ b/Mac/Modules/list/_Listmodule.c
@@ -0,0 +1,1009 @@
+
+/* ========================== Module _List ========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Lists.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ListObj_New(ListHandle);
+extern int _ListObj_Convert(PyObject *, ListHandle *);
+
+#define ListObj_New _ListObj_New
+#define ListObj_Convert _ListObj_Convert
+#endif
+
+#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+#define GetListPort(list) ((CGrafPtr)(*(list))->port)
+#define GetListVerticalScrollBar(list) ((*(list))->vScroll)
+#define GetListHorizontalScrollBar(list) ((*(list))->hScroll)
+#define GetListActive(list) ((*(list))->lActive)
+#define GetListClickTime(list) ((*(list))->clikTime)
+#define GetListRefCon(list) ((*(list))->refCon)
+#define GetListDefinition(list) ((*(list))->listDefProc) /* XXX Is this indeed the same? */
+#define GetListUserHandle(list) ((*(list))->userHandle)
+#define GetListDataHandle(list) ((*(list))->cells)
+#define GetListFlags(list) ((*(list))->listFlags)
+#define GetListSelectionFlags(list) ((*(list))->selFlags)
+#define SetListViewBounds(list, bounds) (((*(list))->rView) = *(bounds))
+
+#define SetListPort(list, port) (((*(list))->port) = (GrafPtr)(port))
+#define SetListCellIndent(list, ind) (((*(list))->indent) = *(ind))
+#define SetListClickTime(list, time) (((*(list))->clikTime) = (time))
+#define SetListLastClick(list, click) (((*(list)->lastClick) = *(click))
+#define SetListRefCon(list, refcon) (((*(list))->refCon) = (refcon))
+#define SetListUserHandle(list, handle) (((*(list))->userHandle) = (handle))
+#define SetListFlags(list, flags) (((*(list))->listFlags) = (flags))
+#define SetListSelectionFlags(list, flags) (((*(list))->selFlags) = (flags))
+
+#endif
+
+#define as_List(x) ((ListHandle)x)
+#define as_Resource(lh) ((Handle)lh)
+
+static PyObject *List_Error;
+
+/* ------------------------ Object type List ------------------------ */
+
+PyTypeObject List_Type;
+
+#define ListObj_Check(x) ((x)->ob_type == &List_Type)
+
+typedef struct ListObject {
+ PyObject_HEAD
+ ListHandle ob_itself;
+ int ob_must_be_disposed;
+} ListObject;
+
+PyObject *ListObj_New(ListHandle itself)
+{
+ ListObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(List_Error,"Cannot create null List");
+ return NULL;
+ }
+ it = PyObject_NEW(ListObject, &List_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_must_be_disposed = 1;
+ return (PyObject *)it;
+}
+ListObj_Convert(PyObject *v, ListHandle *p_itself)
+{
+ if (!ListObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "List required");
+ return 0;
+ }
+ *p_itself = ((ListObject *)v)->ob_itself;
+ return 1;
+}
+
+static void ListObj_dealloc(ListObject *self)
+{
+ if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *ListObj_LAddColumn(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short count;
+ short colNum;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &count,
+ &colNum))
+ return NULL;
+ _rv = LAddColumn(count,
+ colNum,
+ _self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_LAddRow(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short count;
+ short rowNum;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &count,
+ &rowNum))
+ return NULL;
+ _rv = LAddRow(count,
+ rowNum,
+ _self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_LDelColumn(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short count;
+ short colNum;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &count,
+ &colNum))
+ return NULL;
+ LDelColumn(count,
+ colNum,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LDelRow(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short count;
+ short rowNum;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &count,
+ &rowNum))
+ return NULL;
+ LDelRow(count,
+ rowNum,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LGetSelect(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Boolean next;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "bO&",
+ &next,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ _rv = LGetSelect(next,
+ &theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildPoint, theCell);
+ return _res;
+}
+
+static PyObject *ListObj_LLastClick(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = LLastClick(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, _rv);
+ return _res;
+}
+
+static PyObject *ListObj_LNextCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Boolean hNext;
+ Boolean vNext;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "bbO&",
+ &hNext,
+ &vNext,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ _rv = LNextCell(hNext,
+ vNext,
+ &theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildPoint, theCell);
+ return _res;
+}
+
+static PyObject *ListObj_LSize(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short listWidth;
+ short listHeight;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &listWidth,
+ &listHeight))
+ return NULL;
+ LSize(listWidth,
+ listHeight,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LSetDrawingMode(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean drawIt;
+ if (!PyArg_ParseTuple(_args, "b",
+ &drawIt))
+ return NULL;
+ LSetDrawingMode(drawIt,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LScroll(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dCols;
+ short dRows;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dCols,
+ &dRows))
+ return NULL;
+ LScroll(dCols,
+ dRows,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LAutoScroll(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ LAutoScroll(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LUpdate(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle theRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theRgn))
+ return NULL;
+ LUpdate(theRgn,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LActivate(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean act;
+ if (!PyArg_ParseTuple(_args, "b",
+ &act))
+ return NULL;
+ LActivate(act,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LCellSize(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point cSize;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &cSize))
+ return NULL;
+ LCellSize(cSize,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LClick(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ short modifiers;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetPoint, &pt,
+ &modifiers))
+ return NULL;
+ _rv = LClick(pt,
+ modifiers,
+ _self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *ListObj_LAddToCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *dataPtr__in__;
+ short dataPtr__len__;
+ int dataPtr__in_len__;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "s#O&",
+ &dataPtr__in__, &dataPtr__in_len__,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ LAddToCell(dataPtr__in__, dataPtr__len__,
+ theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *ListObj_LClrCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LClrCell(theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LGetCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *dataPtr__out__;
+ short dataPtr__len__;
+ int dataPtr__in_len__;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "iO&",
+ &dataPtr__in_len__,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto dataPtr__error__;
+ }
+ dataPtr__len__ = dataPtr__in_len__;
+ LGetCell(dataPtr__out__, &dataPtr__len__,
+ theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("s#",
+ dataPtr__out__, (int)dataPtr__len__);
+ free(dataPtr__out__);
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *ListObj_LRect(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect cellRect;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LRect(&cellRect,
+ theCell,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &cellRect);
+ return _res;
+}
+
+static PyObject *ListObj_LSetCell(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *dataPtr__in__;
+ short dataPtr__len__;
+ int dataPtr__in_len__;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "s#O&",
+ &dataPtr__in__, &dataPtr__in_len__,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ dataPtr__len__ = dataPtr__in_len__;
+ LSetCell(dataPtr__in__, dataPtr__len__,
+ theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ dataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *ListObj_LSetSelect(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean setIt;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "bO&",
+ &setIt,
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LSetSelect(setIt,
+ theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_LDraw(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point theCell;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &theCell))
+ return NULL;
+ LDraw(theCell,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ListObj_as_Resource(ListObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef ListObj_methods[] = {
+ {"LAddColumn", (PyCFunction)ListObj_LAddColumn, 1,
+ "(short count, short colNum) -> (short _rv)"},
+ {"LAddRow", (PyCFunction)ListObj_LAddRow, 1,
+ "(short count, short rowNum) -> (short _rv)"},
+ {"LDelColumn", (PyCFunction)ListObj_LDelColumn, 1,
+ "(short count, short colNum) -> None"},
+ {"LDelRow", (PyCFunction)ListObj_LDelRow, 1,
+ "(short count, short rowNum) -> None"},
+ {"LGetSelect", (PyCFunction)ListObj_LGetSelect, 1,
+ "(Boolean next, Point theCell) -> (Boolean _rv, Point theCell)"},
+ {"LLastClick", (PyCFunction)ListObj_LLastClick, 1,
+ "() -> (Point _rv)"},
+ {"LNextCell", (PyCFunction)ListObj_LNextCell, 1,
+ "(Boolean hNext, Boolean vNext, Point theCell) -> (Boolean _rv, Point theCell)"},
+ {"LSize", (PyCFunction)ListObj_LSize, 1,
+ "(short listWidth, short listHeight) -> None"},
+ {"LSetDrawingMode", (PyCFunction)ListObj_LSetDrawingMode, 1,
+ "(Boolean drawIt) -> None"},
+ {"LScroll", (PyCFunction)ListObj_LScroll, 1,
+ "(short dCols, short dRows) -> None"},
+ {"LAutoScroll", (PyCFunction)ListObj_LAutoScroll, 1,
+ "() -> None"},
+ {"LUpdate", (PyCFunction)ListObj_LUpdate, 1,
+ "(RgnHandle theRgn) -> None"},
+ {"LActivate", (PyCFunction)ListObj_LActivate, 1,
+ "(Boolean act) -> None"},
+ {"LCellSize", (PyCFunction)ListObj_LCellSize, 1,
+ "(Point cSize) -> None"},
+ {"LClick", (PyCFunction)ListObj_LClick, 1,
+ "(Point pt, short modifiers) -> (Boolean _rv)"},
+ {"LAddToCell", (PyCFunction)ListObj_LAddToCell, 1,
+ "(Buffer dataPtr, Point theCell) -> None"},
+ {"LClrCell", (PyCFunction)ListObj_LClrCell, 1,
+ "(Point theCell) -> None"},
+ {"LGetCell", (PyCFunction)ListObj_LGetCell, 1,
+ "(Buffer dataPtr, Point theCell) -> (Buffer dataPtr)"},
+ {"LRect", (PyCFunction)ListObj_LRect, 1,
+ "(Point theCell) -> (Rect cellRect)"},
+ {"LSetCell", (PyCFunction)ListObj_LSetCell, 1,
+ "(Buffer dataPtr, Point theCell) -> None"},
+ {"LSetSelect", (PyCFunction)ListObj_LSetSelect, 1,
+ "(Boolean setIt, Point theCell) -> None"},
+ {"LDraw", (PyCFunction)ListObj_LDraw, 1,
+ "(Point theCell) -> None"},
+ {"as_Resource", (PyCFunction)ListObj_as_Resource, 1,
+ "() -> (Handle _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain ListObj_chain = { ListObj_methods, NULL };
+
+static PyObject *ListObj_getattr(ListObject *self, char *name)
+{
+ {
+ /* XXXX Should we HLock() here?? */
+ if ( strcmp(name, "listFlags") == 0 )
+ return Py_BuildValue("l", (long)(*self->ob_itself)->listFlags & 0xff);
+ if ( strcmp(name, "selFlags") == 0 )
+ return Py_BuildValue("l", (long)(*self->ob_itself)->selFlags & 0xff);
+ }
+ return Py_FindMethodInChain(&ListObj_chain, (PyObject *)self, name);
+}
+
+static int
+ListObj_setattr(ListObject *self, char *name, PyObject *value)
+{
+ long intval;
+
+ if ( value == NULL || !PyInt_Check(value) )
+ return -1;
+ intval = PyInt_AsLong(value);
+ if (strcmp(name, "listFlags") == 0 ) {
+ /* XXXX Should we HLock the handle here?? */
+ (*self->ob_itself)->listFlags = intval;
+ return 0;
+ }
+ if (strcmp(name, "selFlags") == 0 ) {
+ (*self->ob_itself)->selFlags = intval;
+ return 0;
+ }
+ return -1;
+}
+
+
+#define ListObj_compare NULL
+
+#define ListObj_repr NULL
+
+#define ListObj_hash NULL
+
+PyTypeObject List_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "List", /*tp_name*/
+ sizeof(ListObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) ListObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) ListObj_getattr, /*tp_getattr*/
+ (setattrfunc) ListObj_setattr, /*tp_setattr*/
+ (cmpfunc) ListObj_compare, /*tp_compare*/
+ (reprfunc) ListObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) ListObj_hash, /*tp_hash*/
+};
+
+/* ---------------------- End object type List ---------------------- */
+
+
+static PyObject *List_LNew(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle _rv;
+ Rect rView;
+ Rect dataBounds;
+ Point cSize;
+ short theProc;
+ WindowPtr theWindow;
+ Boolean drawIt;
+ Boolean hasGrow;
+ Boolean scrollHoriz;
+ Boolean scrollVert;
+ if (!PyArg_ParseTuple(_args, "O&O&O&hO&bbbb",
+ PyMac_GetRect, &rView,
+ PyMac_GetRect, &dataBounds,
+ PyMac_GetPoint, &cSize,
+ &theProc,
+ WinObj_Convert, &theWindow,
+ &drawIt,
+ &hasGrow,
+ &scrollHoriz,
+ &scrollVert))
+ return NULL;
+ _rv = LNew(&rView,
+ &dataBounds,
+ cSize,
+ theProc,
+ theWindow,
+ drawIt,
+ hasGrow,
+ scrollHoriz,
+ scrollVert);
+ _res = Py_BuildValue("O&",
+ ListObj_New, _rv);
+ return _res;
+}
+
+static PyObject *List_GetListPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListPort(list);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *List_GetListVerticalScrollBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListVerticalScrollBar(list);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *List_GetListHorizontalScrollBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ControlHandle _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListHorizontalScrollBar(list);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *List_GetListActive(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListActive(list);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *List_GetListClickTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListClickTime(list);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *List_GetListRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListRefCon(list);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *List_GetListDefinition(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListDefinition(list);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *List_GetListUserHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListUserHandle(list);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *List_GetListDataHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DataHandle _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListDataHandle(list);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *List_GetListFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OptionBits _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListFlags(list);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *List_GetListSelectionFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OptionBits _rv;
+ ListHandle list;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ListObj_Convert, &list))
+ return NULL;
+ _rv = GetListSelectionFlags(list);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *List_SetListViewBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ Rect view;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ListObj_Convert, &list,
+ PyMac_GetRect, &view))
+ return NULL;
+ SetListViewBounds(list,
+ &view);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ListObj_Convert, &list,
+ GrafObj_Convert, &port))
+ return NULL;
+ SetListPort(list,
+ port);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListCellIndent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ Point indent;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ListObj_Convert, &list,
+ PyMac_GetPoint, &indent))
+ return NULL;
+ SetListCellIndent(list,
+ &indent);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListClickTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ SInt32 time;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ListObj_Convert, &list,
+ &time))
+ return NULL;
+ SetListClickTime(list,
+ time);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ SInt32 refCon;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ListObj_Convert, &list,
+ &refCon))
+ return NULL;
+ SetListRefCon(list,
+ refCon);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListUserHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ Handle userHandle;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ListObj_Convert, &list,
+ ResObj_Convert, &userHandle))
+ return NULL;
+ SetListUserHandle(list,
+ userHandle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ OptionBits listFlags;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ListObj_Convert, &list,
+ &listFlags))
+ return NULL;
+ SetListFlags(list,
+ listFlags);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_SetListSelectionFlags(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ListHandle list;
+ OptionBits selectionFlags;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ListObj_Convert, &list,
+ &selectionFlags))
+ return NULL;
+ SetListSelectionFlags(list,
+ selectionFlags);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *List_as_List(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ Handle h;
+ ListObject *l;
+ if (!PyArg_ParseTuple(_args, "O&", ResObj_Convert, &h))
+ return NULL;
+ l = (ListObject *)ListObj_New(as_List(h));
+ l->ob_must_be_disposed = 0;
+ return Py_BuildValue("O", l);
+
+}
+
+static PyMethodDef List_methods[] = {
+ {"LNew", (PyCFunction)List_LNew, 1,
+ "(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)"},
+ {"GetListPort", (PyCFunction)List_GetListPort, 1,
+ "(ListHandle list) -> (CGrafPtr _rv)"},
+ {"GetListVerticalScrollBar", (PyCFunction)List_GetListVerticalScrollBar, 1,
+ "(ListHandle list) -> (ControlHandle _rv)"},
+ {"GetListHorizontalScrollBar", (PyCFunction)List_GetListHorizontalScrollBar, 1,
+ "(ListHandle list) -> (ControlHandle _rv)"},
+ {"GetListActive", (PyCFunction)List_GetListActive, 1,
+ "(ListHandle list) -> (Boolean _rv)"},
+ {"GetListClickTime", (PyCFunction)List_GetListClickTime, 1,
+ "(ListHandle list) -> (SInt32 _rv)"},
+ {"GetListRefCon", (PyCFunction)List_GetListRefCon, 1,
+ "(ListHandle list) -> (SInt32 _rv)"},
+ {"GetListDefinition", (PyCFunction)List_GetListDefinition, 1,
+ "(ListHandle list) -> (Handle _rv)"},
+ {"GetListUserHandle", (PyCFunction)List_GetListUserHandle, 1,
+ "(ListHandle list) -> (Handle _rv)"},
+ {"GetListDataHandle", (PyCFunction)List_GetListDataHandle, 1,
+ "(ListHandle list) -> (DataHandle _rv)"},
+ {"GetListFlags", (PyCFunction)List_GetListFlags, 1,
+ "(ListHandle list) -> (OptionBits _rv)"},
+ {"GetListSelectionFlags", (PyCFunction)List_GetListSelectionFlags, 1,
+ "(ListHandle list) -> (OptionBits _rv)"},
+ {"SetListViewBounds", (PyCFunction)List_SetListViewBounds, 1,
+ "(ListHandle list, Rect view) -> None"},
+ {"SetListPort", (PyCFunction)List_SetListPort, 1,
+ "(ListHandle list, CGrafPtr port) -> None"},
+ {"SetListCellIndent", (PyCFunction)List_SetListCellIndent, 1,
+ "(ListHandle list, Point indent) -> None"},
+ {"SetListClickTime", (PyCFunction)List_SetListClickTime, 1,
+ "(ListHandle list, SInt32 time) -> None"},
+ {"SetListRefCon", (PyCFunction)List_SetListRefCon, 1,
+ "(ListHandle list, SInt32 refCon) -> None"},
+ {"SetListUserHandle", (PyCFunction)List_SetListUserHandle, 1,
+ "(ListHandle list, Handle userHandle) -> None"},
+ {"SetListFlags", (PyCFunction)List_SetListFlags, 1,
+ "(ListHandle list, OptionBits listFlags) -> None"},
+ {"SetListSelectionFlags", (PyCFunction)List_SetListSelectionFlags, 1,
+ "(ListHandle list, OptionBits selectionFlags) -> None"},
+ {"as_List", (PyCFunction)List_as_List, 1,
+ "(Resource)->List.\nReturns List object (which is not auto-freed!)"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_List(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert);
+
+
+ m = Py_InitModule("_List", List_methods);
+ d = PyModule_GetDict(m);
+ List_Error = PyMac_GetOSErrException();
+ if (List_Error == NULL ||
+ PyDict_SetItemString(d, "Error", List_Error) != 0)
+ return;
+ List_Type.ob_type = &PyType_Type;
+ Py_INCREF(&List_Type);
+ if (PyDict_SetItemString(d, "ListType", (PyObject *)&List_Type) != 0)
+ Py_FatalError("can't initialize ListType");
+}
+
+/* ======================== End module _List ======================== */
+
diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c
new file mode 100644
index 0000000..4cc6bc4
--- /dev/null
+++ b/Mac/Modules/menu/_Menumodule.c
@@ -0,0 +1,2566 @@
+
+/* ========================== Module _Menu ========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
+#include <Menus.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+
+extern PyObject *_MenuObj_New(MenuHandle);
+extern int _MenuObj_Convert(PyObject *, MenuHandle *);
+
+#define MenuObj_New _MenuObj_New
+#define MenuObj_Convert _MenuObj_Convert
+#endif
+
+#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+#define GetMenuID(menu) ((*(menu))->menuID)
+#define GetMenuWidth(menu) ((*(menu))->menuWidth)
+#define GetMenuHeight(menu) ((*(menu))->menuHeight)
+
+#define SetMenuID(menu, id) ((*(menu))->menuID = (id))
+#define SetMenuWidth(menu, width) ((*(menu))->menuWidth = (width))
+#define SetMenuHeight(menu, height) ((*(menu))->menuHeight = (height))
+#endif
+
+#define as_Menu(h) ((MenuHandle)h)
+#define as_Resource(h) ((Handle)h)
+
+static PyObject *Menu_Error;
+
+/* ------------------------ Object type Menu ------------------------ */
+
+PyTypeObject Menu_Type;
+
+#define MenuObj_Check(x) ((x)->ob_type == &Menu_Type)
+
+typedef struct MenuObject {
+ PyObject_HEAD
+ MenuHandle ob_itself;
+} MenuObject;
+
+PyObject *MenuObj_New(MenuHandle itself)
+{
+ MenuObject *it;
+ it = PyObject_NEW(MenuObject, &Menu_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+MenuObj_Convert(PyObject *v, MenuHandle *p_itself)
+{
+ if (!MenuObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Menu required");
+ return 0;
+ }
+ *p_itself = ((MenuObject *)v)->ob_itself;
+ return 1;
+}
+
+static void MenuObj_dealloc(MenuObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ PyMem_DEL(self);
+}
+
+static PyObject *MenuObj_DisposeMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisposeMenu(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_CalcMenuSize(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CalcMenuSize(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_CountMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountMenuItems(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_CountMItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountMItems(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *MenuObj_GetMenuFont(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 outFontID;
+ UInt16 outFontSize;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMenuFont(_self->ob_itself,
+ &outFontID,
+ &outFontSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hH",
+ outFontID,
+ outFontSize);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuFont(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 inFontID;
+ UInt16 inFontSize;
+ if (!PyArg_ParseTuple(_args, "hH",
+ &inFontID,
+ &inFontSize))
+ return NULL;
+ _err = SetMenuFont(_self->ob_itself,
+ inFontID,
+ inFontSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuExcludesMarkColumn(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean excludesMark;
+ if (!PyArg_ParseTuple(_args, "b",
+ &excludesMark))
+ return NULL;
+ _err = SetMenuExcludesMarkColumn(_self->ob_itself,
+ excludesMark);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_MacAppendMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 data;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, data))
+ return NULL;
+ MacAppendMenu(_self->ob_itself,
+ data);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertResMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short afterItem;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &afterItem))
+ return NULL;
+ InsertResMenu(_self->ob_itself,
+ theType,
+ afterItem);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_AppendResMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ AppendResMenu(_self->ob_itself,
+ theType);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_MacInsertMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 itemString;
+ short afterItem;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, itemString,
+ &afterItem))
+ return NULL;
+ MacInsertMenuItem(_self->ob_itself,
+ itemString,
+ afterItem);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DeleteMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ DeleteMenuItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertFontResMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short afterItem;
+ short scriptFilter;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &afterItem,
+ &scriptFilter))
+ return NULL;
+ InsertFontResMenu(_self->ob_itself,
+ afterItem,
+ scriptFilter);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertIntlResMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short afterItem;
+ short scriptFilter;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetOSType, &theType,
+ &afterItem,
+ &scriptFilter))
+ return NULL;
+ InsertIntlResMenu(_self->ob_itself,
+ theType,
+ afterItem,
+ scriptFilter);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_AppendMenuItemText(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Str255 inString;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, inString))
+ return NULL;
+ _err = AppendMenuItemText(_self->ob_itself,
+ inString);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertMenuItemText(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Str255 inString;
+ MenuItemIndex afterItem;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, inString,
+ &afterItem))
+ return NULL;
+ _err = InsertMenuItemText(_self->ob_itself,
+ inString,
+ afterItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_PopUpMenuSelect(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ short top;
+ short left;
+ short popUpItem;
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &top,
+ &left,
+ &popUpItem))
+ return NULL;
+ _rv = PopUpMenuSelect(_self->ob_itself,
+ top,
+ left,
+ popUpItem);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_MacInsertMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID beforeID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &beforeID))
+ return NULL;
+ MacInsertMenu(_self->ob_itself,
+ beforeID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_MacCheckMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Boolean checked;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &item,
+ &checked))
+ return NULL;
+ MacCheckMenuItem(_self->ob_itself,
+ item,
+ checked);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_CheckItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Boolean checked;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &item,
+ &checked))
+ return NULL;
+ CheckItem(_self->ob_itself,
+ item,
+ checked);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *MenuObj_SetMenuItemText(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Str255 itemString;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &item,
+ PyMac_GetStr255, itemString))
+ return NULL;
+ SetMenuItemText(_self->ob_itself,
+ item,
+ itemString);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemText(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Str255 itemString;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetMenuItemText(_self->ob_itself,
+ item,
+ itemString);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, itemString);
+ return _res;
+}
+
+static PyObject *MenuObj_SetItemMark(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ CharParameter markChar;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &item,
+ &markChar))
+ return NULL;
+ SetItemMark(_self->ob_itself,
+ item,
+ markChar);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetItemMark(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ CharParameter markChar;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetItemMark(_self->ob_itself,
+ item,
+ &markChar);
+ _res = Py_BuildValue("h",
+ markChar);
+ return _res;
+}
+
+static PyObject *MenuObj_SetItemCmd(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ CharParameter cmdChar;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &item,
+ &cmdChar))
+ return NULL;
+ SetItemCmd(_self->ob_itself,
+ item,
+ cmdChar);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetItemCmd(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ CharParameter cmdChar;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetItemCmd(_self->ob_itself,
+ item,
+ &cmdChar);
+ _res = Py_BuildValue("h",
+ cmdChar);
+ return _res;
+}
+
+static PyObject *MenuObj_SetItemIcon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ short iconIndex;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &item,
+ &iconIndex))
+ return NULL;
+ SetItemIcon(_self->ob_itself,
+ item,
+ iconIndex);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetItemIcon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ short iconIndex;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetItemIcon(_self->ob_itself,
+ item,
+ &iconIndex);
+ _res = Py_BuildValue("h",
+ iconIndex);
+ return _res;
+}
+
+static PyObject *MenuObj_SetItemStyle(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ StyleParameter chStyle;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &item,
+ &chStyle))
+ return NULL;
+ SetItemStyle(_self->ob_itself,
+ item,
+ chStyle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetItemStyle(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Style chStyle;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ GetItemStyle(_self->ob_itself,
+ item,
+ &chStyle);
+ _res = Py_BuildValue("b",
+ chStyle);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_DisableItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ DisableItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_EnableItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ EnableItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *MenuObj_SetMenuItemCommandID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ MenuCommand inCommandID;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inItem,
+ &inCommandID))
+ return NULL;
+ _err = SetMenuItemCommandID(_self->ob_itself,
+ inItem,
+ inCommandID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemCommandID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ MenuCommand outCommandID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemCommandID(_self->ob_itself,
+ inItem,
+ &outCommandID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outCommandID);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemModifiers(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt8 inModifiers;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inItem,
+ &inModifiers))
+ return NULL;
+ _err = SetMenuItemModifiers(_self->ob_itself,
+ inItem,
+ inModifiers);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemModifiers(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt8 outModifiers;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemModifiers(_self->ob_itself,
+ inItem,
+ &outModifiers);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outModifiers);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemIconHandle(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt8 inIconType;
+ Handle inIconHandle;
+ if (!PyArg_ParseTuple(_args, "hbO&",
+ &inItem,
+ &inIconType,
+ ResObj_Convert, &inIconHandle))
+ return NULL;
+ _err = SetMenuItemIconHandle(_self->ob_itself,
+ inItem,
+ inIconType,
+ inIconHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemIconHandle(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt8 outIconType;
+ Handle outIconHandle;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemIconHandle(_self->ob_itself,
+ inItem,
+ &outIconType,
+ &outIconHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("bO&",
+ outIconType,
+ ResObj_New, outIconHandle);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemTextEncoding(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ TextEncoding inScriptID;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inItem,
+ &inScriptID))
+ return NULL;
+ _err = SetMenuItemTextEncoding(_self->ob_itself,
+ inItem,
+ inScriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemTextEncoding(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ TextEncoding outScriptID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemTextEncoding(_self->ob_itself,
+ inItem,
+ &outScriptID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outScriptID);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ MenuID inHierID;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &inItem,
+ &inHierID))
+ return NULL;
+ _err = SetMenuItemHierarchicalID(_self->ob_itself,
+ inItem,
+ inHierID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ MenuID outHierID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemHierarchicalID(_self->ob_itself,
+ inItem,
+ &outHierID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outHierID);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemFontID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ SInt16 inFontID;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &inItem,
+ &inFontID))
+ return NULL;
+ _err = SetMenuItemFontID(_self->ob_itself,
+ inItem,
+ inFontID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemFontID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ SInt16 outFontID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemFontID(_self->ob_itself,
+ inItem,
+ &outFontID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outFontID);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemRefCon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt32 inRefCon;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inItem,
+ &inRefCon))
+ return NULL;
+ _err = SetMenuItemRefCon(_self->ob_itself,
+ inItem,
+ inRefCon);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemRefCon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt32 outRefCon;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemRefCon(_self->ob_itself,
+ inItem,
+ &outRefCon);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outRefCon);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_SetMenuItemRefCon2(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt32 inRefCon2;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inItem,
+ &inRefCon2))
+ return NULL;
+ _err = SetMenuItemRefCon2(_self->ob_itself,
+ inItem,
+ inRefCon2);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuItemRefCon2(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ UInt32 outRefCon2;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemRefCon2(_self->ob_itself,
+ inItem,
+ &outRefCon2);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outRefCon2);
+ return _res;
+}
+#endif
+
+static PyObject *MenuObj_SetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ SInt16 inGlyph;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &inItem,
+ &inGlyph))
+ return NULL;
+ _err = SetMenuItemKeyGlyph(_self->ob_itself,
+ inItem,
+ inGlyph);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SInt16 inItem;
+ SInt16 outGlyph;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inItem))
+ return NULL;
+ _err = GetMenuItemKeyGlyph(_self->ob_itself,
+ inItem,
+ &outGlyph);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ outGlyph);
+ return _res;
+}
+
+static PyObject *MenuObj_MacEnableMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ MacEnableMenuItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DisableMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ DisableMenuItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsMenuItemEnabled(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _rv = IsMenuItemEnabled(_self->ob_itself,
+ item);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_EnableMenuItemIcon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ EnableMenuItemIcon(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_DisableMenuItemIcon(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ DisableMenuItemIcon(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_IsMenuItemIconEnabled(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _rv = IsMenuItemIconEnabled(_self->ob_itself,
+ item);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributes;
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &item,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetMenuItemPropertyAttributes(_self->ob_itself,
+ item,
+ propertyCreator,
+ propertyTag,
+ &attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ attributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_ChangeMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributesToSet;
+ UInt32 attributesToClear;
+ if (!PyArg_ParseTuple(_args, "hO&O&ll",
+ &item,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag,
+ &attributesToSet,
+ &attributesToClear))
+ return NULL;
+ _err = ChangeMenuItemPropertyAttributes(_self->ob_itself,
+ item,
+ propertyCreator,
+ propertyTag,
+ attributesToSet,
+ attributesToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuAttributes outAttributes;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMenuAttributes(_self->ob_itself,
+ &outAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outAttributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_ChangeMenuAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuAttributes setTheseAttributes;
+ MenuAttributes clearTheseAttributes;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &setTheseAttributes,
+ &clearTheseAttributes))
+ return NULL;
+ _err = ChangeMenuAttributes(_self->ob_itself,
+ setTheseAttributes,
+ clearTheseAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuItemAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ MenuItemAttributes outAttributes;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _err = GetMenuItemAttributes(_self->ob_itself,
+ item,
+ &outAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outAttributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_ChangeMenuItemAttributes(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ MenuItemAttributes setTheseAttributes;
+ MenuItemAttributes clearTheseAttributes;
+ if (!PyArg_ParseTuple(_args, "hll",
+ &item,
+ &setTheseAttributes,
+ &clearTheseAttributes))
+ return NULL;
+ _err = ChangeMenuItemAttributes(_self->ob_itself,
+ item,
+ setTheseAttributes,
+ clearTheseAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_DisableAllMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisableAllMenuItems(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_EnableAllMenuItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ EnableAllMenuItems(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_MenuHasEnabledItems(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MenuHasEnabledItems(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_CountMenuItemsWithCommandID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ItemCount _rv;
+ MenuCommand commandID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &commandID))
+ return NULL;
+ _rv = CountMenuItemsWithCommandID(_self->ob_itself,
+ commandID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetIndMenuItemWithCommandID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand commandID;
+ UInt32 itemIndex;
+ MenuHandle outMenu;
+ MenuItemIndex outIndex;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &commandID,
+ &itemIndex))
+ return NULL;
+ _err = GetIndMenuItemWithCommandID(_self->ob_itself,
+ commandID,
+ itemIndex,
+ &outMenu,
+ &outIndex);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ MenuObj_New, outMenu,
+ outIndex);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_EnableMenuCommand(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuCommand commandID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &commandID))
+ return NULL;
+ EnableMenuCommand(_self->ob_itself,
+ commandID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_DisableMenuCommand(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuCommand commandID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &commandID))
+ return NULL;
+ DisableMenuCommand(_self->ob_itself,
+ commandID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_IsMenuCommandEnabled(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuCommand commandID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &commandID))
+ return NULL;
+ _rv = IsMenuCommandEnabled(_self->ob_itself,
+ commandID);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuCommandPropertySize(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand commandID;
+ OSType propertyCreator;
+ OSType propertyTag;
+ ByteCount size;
+ if (!PyArg_ParseTuple(_args, "lO&O&",
+ &commandID,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetMenuCommandPropertySize(_self->ob_itself,
+ commandID,
+ propertyCreator,
+ propertyTag,
+ &size);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ size);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_RemoveMenuCommandProperty(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand commandID;
+ OSType propertyCreator;
+ OSType propertyTag;
+ if (!PyArg_ParseTuple(_args, "lO&O&",
+ &commandID,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = RemoveMenuCommandProperty(_self->ob_itself,
+ commandID,
+ propertyCreator,
+ propertyTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_CreateStandardFontMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex afterItem;
+ MenuID firstHierMenuID;
+ OptionBits options;
+ ItemCount outHierMenuCount;
+ if (!PyArg_ParseTuple(_args, "hhl",
+ &afterItem,
+ &firstHierMenuID,
+ &options))
+ return NULL;
+ _err = CreateStandardFontMenu(_self->ob_itself,
+ afterItem,
+ firstHierMenuID,
+ options,
+ &outHierMenuCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outHierMenuCount);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_UpdateStandardFontMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ItemCount outHierMenuCount;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UpdateStandardFontMenu(_self->ob_itself,
+ &outHierMenuCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outHierMenuCount);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetFontFamilyFromMenuSelection(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ FMFontFamily outFontFamily;
+ FMFontStyle outStyle;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _err = GetFontFamilyFromMenuSelection(_self->ob_itself,
+ item,
+ &outFontFamily,
+ &outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hh",
+ outFontFamily,
+ outStyle);
+ return _res;
+}
+#endif
+
+static PyObject *MenuObj_GetMenuID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuID(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuWidth(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuWidth(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuHeight(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuHeight(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuID(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ SetMenuID(_self->ob_itself,
+ menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuWidth(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 width;
+ if (!PyArg_ParseTuple(_args, "h",
+ &width))
+ return NULL;
+ SetMenuWidth(_self->ob_itself,
+ width);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuHeight(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt16 height;
+ if (!PyArg_ParseTuple(_args, "h",
+ &height))
+ return NULL;
+ SetMenuHeight(_self->ob_itself,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_as_Resource(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_AppendMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 data;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, data))
+ return NULL;
+ AppendMenu(_self->ob_itself,
+ data);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertMenu(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short beforeID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &beforeID))
+ return NULL;
+ InsertMenu(_self->ob_itself,
+ beforeID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_InsertMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 itemString;
+ short afterItem;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, itemString,
+ &afterItem))
+ return NULL;
+ InsertMenuItem(_self->ob_itself,
+ itemString,
+ afterItem);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_EnableMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt16 item;
+ if (!PyArg_ParseTuple(_args, "H",
+ &item))
+ return NULL;
+ EnableMenuItem(_self->ob_itself,
+ item);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_CheckMenuItem(MenuObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short item;
+ Boolean checked;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &item,
+ &checked))
+ return NULL;
+ CheckMenuItem(_self->ob_itself,
+ item,
+ checked);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef MenuObj_methods[] = {
+ {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1,
+ "() -> None"},
+ {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
+ "() -> None"},
+ {"CountMenuItems", (PyCFunction)MenuObj_CountMenuItems, 1,
+ "() -> (short _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1,
+ "() -> (short _rv)"},
+#endif
+ {"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1,
+ "() -> (SInt16 outFontID, UInt16 outFontSize)"},
+ {"SetMenuFont", (PyCFunction)MenuObj_SetMenuFont, 1,
+ "(SInt16 inFontID, UInt16 inFontSize) -> None"},
+ {"GetMenuExcludesMarkColumn", (PyCFunction)MenuObj_GetMenuExcludesMarkColumn, 1,
+ "() -> (Boolean _rv)"},
+ {"SetMenuExcludesMarkColumn", (PyCFunction)MenuObj_SetMenuExcludesMarkColumn, 1,
+ "(Boolean excludesMark) -> None"},
+ {"MacAppendMenu", (PyCFunction)MenuObj_MacAppendMenu, 1,
+ "(Str255 data) -> None"},
+ {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1,
+ "(ResType theType, short afterItem) -> None"},
+ {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1,
+ "(ResType theType) -> None"},
+ {"MacInsertMenuItem", (PyCFunction)MenuObj_MacInsertMenuItem, 1,
+ "(Str255 itemString, short afterItem) -> None"},
+ {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1,
+ "(short item) -> None"},
+ {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1,
+ "(short afterItem, short scriptFilter) -> None"},
+ {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1,
+ "(ResType theType, short afterItem, short scriptFilter) -> None"},
+ {"AppendMenuItemText", (PyCFunction)MenuObj_AppendMenuItemText, 1,
+ "(Str255 inString) -> None"},
+ {"InsertMenuItemText", (PyCFunction)MenuObj_InsertMenuItemText, 1,
+ "(Str255 inString, MenuItemIndex afterItem) -> None"},
+ {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1,
+ "(short top, short left, short popUpItem) -> (long _rv)"},
+ {"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1,
+ "(MenuID beforeID) -> None"},
+ {"MacCheckMenuItem", (PyCFunction)MenuObj_MacCheckMenuItem, 1,
+ "(short item, Boolean checked) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"CheckItem", (PyCFunction)MenuObj_CheckItem, 1,
+ "(short item, Boolean checked) -> None"},
+#endif
+ {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1,
+ "(short item, Str255 itemString) -> None"},
+ {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1,
+ "(short item) -> (Str255 itemString)"},
+ {"SetItemMark", (PyCFunction)MenuObj_SetItemMark, 1,
+ "(short item, CharParameter markChar) -> None"},
+ {"GetItemMark", (PyCFunction)MenuObj_GetItemMark, 1,
+ "(short item) -> (CharParameter markChar)"},
+ {"SetItemCmd", (PyCFunction)MenuObj_SetItemCmd, 1,
+ "(short item, CharParameter cmdChar) -> None"},
+ {"GetItemCmd", (PyCFunction)MenuObj_GetItemCmd, 1,
+ "(short item) -> (CharParameter cmdChar)"},
+ {"SetItemIcon", (PyCFunction)MenuObj_SetItemIcon, 1,
+ "(short item, short iconIndex) -> None"},
+ {"GetItemIcon", (PyCFunction)MenuObj_GetItemIcon, 1,
+ "(short item) -> (short iconIndex)"},
+ {"SetItemStyle", (PyCFunction)MenuObj_SetItemStyle, 1,
+ "(short item, StyleParameter chStyle) -> None"},
+ {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1,
+ "(short item) -> (Style chStyle)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"DisableItem", (PyCFunction)MenuObj_DisableItem, 1,
+ "(short item) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"EnableItem", (PyCFunction)MenuObj_EnableItem, 1,
+ "(short item) -> None"},
+#endif
+ {"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1,
+ "(SInt16 inItem, MenuCommand inCommandID) -> None"},
+ {"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1,
+ "(SInt16 inItem) -> (MenuCommand outCommandID)"},
+ {"SetMenuItemModifiers", (PyCFunction)MenuObj_SetMenuItemModifiers, 1,
+ "(SInt16 inItem, UInt8 inModifiers) -> None"},
+ {"GetMenuItemModifiers", (PyCFunction)MenuObj_GetMenuItemModifiers, 1,
+ "(SInt16 inItem) -> (UInt8 outModifiers)"},
+ {"SetMenuItemIconHandle", (PyCFunction)MenuObj_SetMenuItemIconHandle, 1,
+ "(SInt16 inItem, UInt8 inIconType, Handle inIconHandle) -> None"},
+ {"GetMenuItemIconHandle", (PyCFunction)MenuObj_GetMenuItemIconHandle, 1,
+ "(SInt16 inItem) -> (UInt8 outIconType, Handle outIconHandle)"},
+ {"SetMenuItemTextEncoding", (PyCFunction)MenuObj_SetMenuItemTextEncoding, 1,
+ "(SInt16 inItem, TextEncoding inScriptID) -> None"},
+ {"GetMenuItemTextEncoding", (PyCFunction)MenuObj_GetMenuItemTextEncoding, 1,
+ "(SInt16 inItem) -> (TextEncoding outScriptID)"},
+ {"SetMenuItemHierarchicalID", (PyCFunction)MenuObj_SetMenuItemHierarchicalID, 1,
+ "(SInt16 inItem, MenuID inHierID) -> None"},
+ {"GetMenuItemHierarchicalID", (PyCFunction)MenuObj_GetMenuItemHierarchicalID, 1,
+ "(SInt16 inItem) -> (MenuID outHierID)"},
+ {"SetMenuItemFontID", (PyCFunction)MenuObj_SetMenuItemFontID, 1,
+ "(SInt16 inItem, SInt16 inFontID) -> None"},
+ {"GetMenuItemFontID", (PyCFunction)MenuObj_GetMenuItemFontID, 1,
+ "(SInt16 inItem) -> (SInt16 outFontID)"},
+ {"SetMenuItemRefCon", (PyCFunction)MenuObj_SetMenuItemRefCon, 1,
+ "(SInt16 inItem, UInt32 inRefCon) -> None"},
+ {"GetMenuItemRefCon", (PyCFunction)MenuObj_GetMenuItemRefCon, 1,
+ "(SInt16 inItem) -> (UInt32 outRefCon)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SetMenuItemRefCon2", (PyCFunction)MenuObj_SetMenuItemRefCon2, 1,
+ "(SInt16 inItem, UInt32 inRefCon2) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"GetMenuItemRefCon2", (PyCFunction)MenuObj_GetMenuItemRefCon2, 1,
+ "(SInt16 inItem) -> (UInt32 outRefCon2)"},
+#endif
+ {"SetMenuItemKeyGlyph", (PyCFunction)MenuObj_SetMenuItemKeyGlyph, 1,
+ "(SInt16 inItem, SInt16 inGlyph) -> None"},
+ {"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1,
+ "(SInt16 inItem) -> (SInt16 outGlyph)"},
+ {"MacEnableMenuItem", (PyCFunction)MenuObj_MacEnableMenuItem, 1,
+ "(MenuItemIndex item) -> None"},
+ {"DisableMenuItem", (PyCFunction)MenuObj_DisableMenuItem, 1,
+ "(MenuItemIndex item) -> None"},
+ {"IsMenuItemEnabled", (PyCFunction)MenuObj_IsMenuItemEnabled, 1,
+ "(MenuItemIndex item) -> (Boolean _rv)"},
+ {"EnableMenuItemIcon", (PyCFunction)MenuObj_EnableMenuItemIcon, 1,
+ "(MenuItemIndex item) -> None"},
+ {"DisableMenuItemIcon", (PyCFunction)MenuObj_DisableMenuItemIcon, 1,
+ "(MenuItemIndex item) -> None"},
+ {"IsMenuItemIconEnabled", (PyCFunction)MenuObj_IsMenuItemIconEnabled, 1,
+ "(MenuItemIndex item) -> (Boolean _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetMenuItemPropertyAttributes", (PyCFunction)MenuObj_GetMenuItemPropertyAttributes, 1,
+ "(MenuItemIndex item, OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeMenuItemPropertyAttributes", (PyCFunction)MenuObj_ChangeMenuItemPropertyAttributes, 1,
+ "(MenuItemIndex item, OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetMenuAttributes", (PyCFunction)MenuObj_GetMenuAttributes, 1,
+ "() -> (MenuAttributes outAttributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeMenuAttributes", (PyCFunction)MenuObj_ChangeMenuAttributes, 1,
+ "(MenuAttributes setTheseAttributes, MenuAttributes clearTheseAttributes) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetMenuItemAttributes", (PyCFunction)MenuObj_GetMenuItemAttributes, 1,
+ "(MenuItemIndex item) -> (MenuItemAttributes outAttributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeMenuItemAttributes", (PyCFunction)MenuObj_ChangeMenuItemAttributes, 1,
+ "(MenuItemIndex item, MenuItemAttributes setTheseAttributes, MenuItemAttributes clearTheseAttributes) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"DisableAllMenuItems", (PyCFunction)MenuObj_DisableAllMenuItems, 1,
+ "() -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"EnableAllMenuItems", (PyCFunction)MenuObj_EnableAllMenuItems, 1,
+ "() -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"MenuHasEnabledItems", (PyCFunction)MenuObj_MenuHasEnabledItems, 1,
+ "() -> (Boolean _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"CountMenuItemsWithCommandID", (PyCFunction)MenuObj_CountMenuItemsWithCommandID, 1,
+ "(MenuCommand commandID) -> (ItemCount _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetIndMenuItemWithCommandID", (PyCFunction)MenuObj_GetIndMenuItemWithCommandID, 1,
+ "(MenuCommand commandID, UInt32 itemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"EnableMenuCommand", (PyCFunction)MenuObj_EnableMenuCommand, 1,
+ "(MenuCommand commandID) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"DisableMenuCommand", (PyCFunction)MenuObj_DisableMenuCommand, 1,
+ "(MenuCommand commandID) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsMenuCommandEnabled", (PyCFunction)MenuObj_IsMenuCommandEnabled, 1,
+ "(MenuCommand commandID) -> (Boolean _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetMenuCommandPropertySize", (PyCFunction)MenuObj_GetMenuCommandPropertySize, 1,
+ "(MenuCommand commandID, OSType propertyCreator, OSType propertyTag) -> (ByteCount size)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"RemoveMenuCommandProperty", (PyCFunction)MenuObj_RemoveMenuCommandProperty, 1,
+ "(MenuCommand commandID, OSType propertyCreator, OSType propertyTag) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"CreateStandardFontMenu", (PyCFunction)MenuObj_CreateStandardFontMenu, 1,
+ "(MenuItemIndex afterItem, MenuID firstHierMenuID, OptionBits options) -> (ItemCount outHierMenuCount)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"UpdateStandardFontMenu", (PyCFunction)MenuObj_UpdateStandardFontMenu, 1,
+ "() -> (ItemCount outHierMenuCount)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetFontFamilyFromMenuSelection", (PyCFunction)MenuObj_GetFontFamilyFromMenuSelection, 1,
+ "(MenuItemIndex item) -> (FMFontFamily outFontFamily, FMFontStyle outStyle)"},
+#endif
+ {"GetMenuID", (PyCFunction)MenuObj_GetMenuID, 1,
+ "() -> (MenuID _rv)"},
+ {"GetMenuWidth", (PyCFunction)MenuObj_GetMenuWidth, 1,
+ "() -> (SInt16 _rv)"},
+ {"GetMenuHeight", (PyCFunction)MenuObj_GetMenuHeight, 1,
+ "() -> (SInt16 _rv)"},
+ {"SetMenuID", (PyCFunction)MenuObj_SetMenuID, 1,
+ "(MenuID menuID) -> None"},
+ {"SetMenuWidth", (PyCFunction)MenuObj_SetMenuWidth, 1,
+ "(SInt16 width) -> None"},
+ {"SetMenuHeight", (PyCFunction)MenuObj_SetMenuHeight, 1,
+ "(SInt16 height) -> None"},
+ {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1,
+ "() -> (Handle _rv)"},
+ {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
+ "(Str255 data) -> None"},
+ {"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1,
+ "(short beforeID) -> None"},
+ {"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1,
+ "(Str255 itemString, short afterItem) -> None"},
+ {"EnableMenuItem", (PyCFunction)MenuObj_EnableMenuItem, 1,
+ "(UInt16 item) -> None"},
+ {"CheckMenuItem", (PyCFunction)MenuObj_CheckMenuItem, 1,
+ "(short item, Boolean checked) -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain MenuObj_chain = { MenuObj_methods, NULL };
+
+static PyObject *MenuObj_getattr(MenuObject *self, char *name)
+{
+ return Py_FindMethodInChain(&MenuObj_chain, (PyObject *)self, name);
+}
+
+#define MenuObj_setattr NULL
+
+#define MenuObj_compare NULL
+
+#define MenuObj_repr NULL
+
+#define MenuObj_hash NULL
+
+PyTypeObject Menu_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Menu", /*tp_name*/
+ sizeof(MenuObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) MenuObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) MenuObj_getattr, /*tp_getattr*/
+ (setattrfunc) MenuObj_setattr, /*tp_setattr*/
+ (cmpfunc) MenuObj_compare, /*tp_compare*/
+ (reprfunc) MenuObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) MenuObj_hash, /*tp_hash*/
+};
+
+/* ---------------------- End object type Menu ---------------------- */
+
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Menu_InitProcMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short resID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &resID))
+ return NULL;
+ InitProcMenu(resID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Menu_InitMenus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InitMenus();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Menu_NewMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ MenuID menuID;
+ Str255 menuTitle;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &menuID,
+ PyMac_GetStr255, menuTitle))
+ return NULL;
+ _rv = NewMenu(menuID,
+ menuTitle);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_MacGetMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ short resourceID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &resourceID))
+ return NULL;
+ _rv = MacGetMenu(resourceID);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Menu_CreateNewMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuID menuID;
+ MenuAttributes menuAttributes;
+ MenuHandle outMenuRef;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &menuID,
+ &menuAttributes))
+ return NULL;
+ _err = CreateNewMenu(menuID,
+ menuAttributes,
+ &outMenuRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, outMenuRef);
+ return _res;
+}
+#endif
+
+static PyObject *Menu_MenuKey(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ CharParameter ch;
+ if (!PyArg_ParseTuple(_args, "h",
+ &ch))
+ return NULL;
+ _rv = MenuKey(ch);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_MenuSelect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ Point startPt;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &startPt))
+ return NULL;
+ _rv = MenuSelect(startPt);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_MenuChoice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MenuChoice();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_MenuEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ EventRecord inEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &inEvent))
+ return NULL;
+ _rv = MenuEvent(&inEvent);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_GetMBarHeight(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMBarHeight();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_MacDrawMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacDrawMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_InvalMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InvalMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_HiliteMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ HiliteMenu(menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_GetNewMBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuBarHandle _rv;
+ short menuBarID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuBarID))
+ return NULL;
+ _rv = GetNewMBar(menuBarID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_GetMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuBarHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuBar();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_SetMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuBarHandle mbar;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &mbar))
+ return NULL;
+ SetMenuBar(mbar);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Menu_DuplicateMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuBarHandle mbar;
+ MenuBarHandle outBar;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &mbar))
+ return NULL;
+ _err = DuplicateMenuBar(mbar,
+ &outBar);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, outBar);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Menu_DisposeMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuBarHandle mbar;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &mbar))
+ return NULL;
+ _err = DisposeMenuBar(mbar);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Menu_GetMenuHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ MenuID menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ _rv = GetMenuHandle(menuID);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_MacDeleteMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ MacDeleteMenu(menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_ClearMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClearMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_SetMenuFlashCount(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short count;
+ if (!PyArg_ParseTuple(_args, "h",
+ &count))
+ return NULL;
+ SetMenuFlashCount(count);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Menu_SetMenuFlash(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short count;
+ if (!PyArg_ParseTuple(_args, "h",
+ &count))
+ return NULL;
+ SetMenuFlash(count);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Menu_FlashMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ FlashMenuBar(menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Menu_SystemEdit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short editCmd;
+ if (!PyArg_ParseTuple(_args, "h",
+ &editCmd))
+ return NULL;
+ _rv = SystemEdit(editCmd);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Menu_SystemMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long menuResult;
+ if (!PyArg_ParseTuple(_args, "l",
+ &menuResult))
+ return NULL;
+ SystemMenu(menuResult);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Menu_IsMenuBarVisible(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsMenuBarVisible();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Menu_ShowMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_HideMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HideMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_DeleteMCEntries(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+ short menuItem;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &menuID,
+ &menuItem))
+ return NULL;
+ DeleteMCEntries(menuID,
+ menuItem);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_InitContextualMenus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = InitContextualMenus();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_IsShowContextualMenuClick(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord inEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &inEvent))
+ return NULL;
+ _rv = IsShowContextualMenuClick(&inEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Menu_OpenDeskAcc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 name;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, name))
+ return NULL;
+ OpenDeskAcc(name);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Menu_as_Menu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ Handle h;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = as_Menu(h);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_GetMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MenuHandle _rv;
+ short resourceID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &resourceID))
+ return NULL;
+ _rv = GetMenu(resourceID);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Menu_DeleteMenu(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ DeleteMenu(menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Menu_DrawMenuBar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DrawMenuBar();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef Menu_methods[] = {
+
+#if !TARGET_API_MAC_CARBON
+ {"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1,
+ "(short resID) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"InitMenus", (PyCFunction)Menu_InitMenus, 1,
+ "() -> None"},
+#endif
+ {"NewMenu", (PyCFunction)Menu_NewMenu, 1,
+ "(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)"},
+ {"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1,
+ "(short resourceID) -> (MenuHandle _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"CreateNewMenu", (PyCFunction)Menu_CreateNewMenu, 1,
+ "(MenuID menuID, MenuAttributes menuAttributes) -> (MenuHandle outMenuRef)"},
+#endif
+ {"MenuKey", (PyCFunction)Menu_MenuKey, 1,
+ "(CharParameter ch) -> (long _rv)"},
+ {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1,
+ "(Point startPt) -> (long _rv)"},
+ {"MenuChoice", (PyCFunction)Menu_MenuChoice, 1,
+ "() -> (long _rv)"},
+ {"MenuEvent", (PyCFunction)Menu_MenuEvent, 1,
+ "(EventRecord inEvent) -> (UInt32 _rv)"},
+ {"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1,
+ "() -> (short _rv)"},
+ {"MacDrawMenuBar", (PyCFunction)Menu_MacDrawMenuBar, 1,
+ "() -> None"},
+ {"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1,
+ "() -> None"},
+ {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1,
+ "(MenuID menuID) -> None"},
+ {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1,
+ "(short menuBarID) -> (MenuBarHandle _rv)"},
+ {"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1,
+ "() -> (MenuBarHandle _rv)"},
+ {"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1,
+ "(MenuBarHandle mbar) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"DuplicateMenuBar", (PyCFunction)Menu_DuplicateMenuBar, 1,
+ "(MenuBarHandle mbar) -> (MenuBarHandle outBar)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"DisposeMenuBar", (PyCFunction)Menu_DisposeMenuBar, 1,
+ "(MenuBarHandle mbar) -> None"},
+#endif
+ {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1,
+ "(MenuID menuID) -> (MenuHandle _rv)"},
+ {"MacDeleteMenu", (PyCFunction)Menu_MacDeleteMenu, 1,
+ "(MenuID menuID) -> None"},
+ {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1,
+ "() -> None"},
+ {"SetMenuFlashCount", (PyCFunction)Menu_SetMenuFlashCount, 1,
+ "(short count) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1,
+ "(short count) -> None"},
+#endif
+ {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1,
+ "(MenuID menuID) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SystemEdit", (PyCFunction)Menu_SystemEdit, 1,
+ "(short editCmd) -> (Boolean _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SystemMenu", (PyCFunction)Menu_SystemMenu, 1,
+ "(long menuResult) -> None"},
+#endif
+ {"IsMenuBarVisible", (PyCFunction)Menu_IsMenuBarVisible, 1,
+ "() -> (Boolean _rv)"},
+ {"ShowMenuBar", (PyCFunction)Menu_ShowMenuBar, 1,
+ "() -> None"},
+ {"HideMenuBar", (PyCFunction)Menu_HideMenuBar, 1,
+ "() -> None"},
+ {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1,
+ "(MenuID menuID, short menuItem) -> None"},
+ {"InitContextualMenus", (PyCFunction)Menu_InitContextualMenus, 1,
+ "() -> None"},
+ {"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1,
+ "(EventRecord inEvent) -> (Boolean _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1,
+ "(Str255 name) -> None"},
+#endif
+ {"as_Menu", (PyCFunction)Menu_as_Menu, 1,
+ "(Handle h) -> (MenuHandle _rv)"},
+ {"GetMenu", (PyCFunction)Menu_GetMenu, 1,
+ "(short resourceID) -> (MenuHandle _rv)"},
+ {"DeleteMenu", (PyCFunction)Menu_DeleteMenu, 1,
+ "(short menuID) -> None"},
+ {"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1,
+ "() -> None"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Menu(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert);
+
+
+ m = Py_InitModule("_Menu", Menu_methods);
+ d = PyModule_GetDict(m);
+ Menu_Error = PyMac_GetOSErrException();
+ if (Menu_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Menu_Error) != 0)
+ return;
+ Menu_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Menu_Type);
+ if (PyDict_SetItemString(d, "MenuType", (PyObject *)&Menu_Type) != 0)
+ Py_FatalError("can't initialize MenuType");
+}
+
+/* ======================== End module _Menu ======================== */
+
diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c
new file mode 100644
index 0000000..7e74e1f
--- /dev/null
+++ b/Mac/Modules/mlte/_Mltemodule.c
@@ -0,0 +1,1392 @@
+
+/* ========================== Module _Mlte ========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <MacTextEditor.h>
+#else
+#include <xxxx.h>
+#endif
+
+/* For now we declare them forward here. They'll go to mactoolbox later */
+staticforward PyObject *TXNObj_New(TXNObject);
+staticforward int TXNObj_Convert(PyObject *, TXNObject *);
+staticforward PyObject *TXNFontMenuObj_New(TXNFontMenuObject);
+staticforward int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *);
+
+// ADD declarations
+#ifdef NOTYET_USE_TOOLBOX_OBJECT_GLUE
+//extern PyObject *_CFTypeRefObj_New(CFTypeRef);
+//extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
+
+//#define CFTypeRefObj_New _CFTypeRefObj_New
+//#define CFTypeRefObj_Convert _CFTypeRefObj_Convert
+#endif
+
+/*
+** Parse an optional fsspec
+*/
+static int
+OptFSSpecPtr_Convert(PyObject *v, FSSpec **p_itself)
+{
+ static FSSpec fss;
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ *p_itself = &fss;
+ return PyMac_GetFSSpec(v, *p_itself);
+}
+
+/*
+** Parse an optional rect
+*/
+static int
+OptRectPtr_Convert(PyObject *v, Rect **p_itself)
+{
+ static Rect r;
+
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ *p_itself = &r;
+ return PyMac_GetRect(v, *p_itself);
+}
+
+/*
+** Parse an optional GWorld
+*/
+static int
+OptGWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
+{
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ return GWorldObj_Convert(v, p_itself);
+}
+
+
+static PyObject *Mlte_Error;
+
+/* --------------------- Object type TXNObject ---------------------- */
+
+PyTypeObject TXNObject_Type;
+
+#define TXNObj_Check(x) ((x)->ob_type == &TXNObject_Type)
+
+typedef struct TXNObjectObject {
+ PyObject_HEAD
+ TXNObject ob_itself;
+} TXNObjectObject;
+
+PyObject *TXNObj_New(TXNObject itself)
+{
+ TXNObjectObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(TXNObjectObject, &TXNObject_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+TXNObj_Convert(PyObject *v, TXNObject *p_itself)
+{
+ if (!TXNObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "TXNObject required");
+ return 0;
+ }
+ *p_itself = ((TXNObjectObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TXNObj_dealloc(TXNObjectObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ PyMem_DEL(self);
+}
+
+static PyObject *TXNObj_TXNDeleteObject(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(TXNDeleteObject);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNDeleteObject(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNResizeFrame(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 iWidth;
+ UInt32 iHeight;
+ TXNFrameID iTXNFrameID;
+ PyMac_PRECHECK(TXNResizeFrame);
+ if (!PyArg_ParseTuple(_args, "lll",
+ &iWidth,
+ &iHeight,
+ &iTXNFrameID))
+ return NULL;
+ TXNResizeFrame(_self->ob_itself,
+ iWidth,
+ iHeight,
+ iTXNFrameID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSetFrameBounds(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 iTop;
+ SInt32 iLeft;
+ SInt32 iBottom;
+ SInt32 iRight;
+ TXNFrameID iTXNFrameID;
+ PyMac_PRECHECK(TXNSetFrameBounds);
+ if (!PyArg_ParseTuple(_args, "lllll",
+ &iTop,
+ &iLeft,
+ &iBottom,
+ &iRight,
+ &iTXNFrameID))
+ return NULL;
+ TXNSetFrameBounds(_self->ob_itself,
+ iTop,
+ iLeft,
+ iBottom,
+ iRight,
+ iTXNFrameID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNKeyDown(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventRecord iEvent;
+ PyMac_PRECHECK(TXNKeyDown);
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &iEvent))
+ return NULL;
+ TXNKeyDown(_self->ob_itself,
+ &iEvent);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNAdjustCursor(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle ioCursorRgn;
+ PyMac_PRECHECK(TXNAdjustCursor);
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &ioCursorRgn))
+ return NULL;
+ TXNAdjustCursor(_self->ob_itself,
+ ioCursorRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNClick(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventRecord iEvent;
+ PyMac_PRECHECK(TXNClick);
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &iEvent))
+ return NULL;
+ TXNClick(_self->ob_itself,
+ &iEvent);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_OSX
+
+static PyObject *TXNObj_TXNTSMCheck(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord iEvent;
+ PyMac_PRECHECK(TXNTSMCheck);
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &iEvent))
+ return NULL;
+ _rv = TXNTSMCheck(_self->ob_itself,
+ &iEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *TXNObj_TXNSelectAll(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(TXNSelectAll);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNSelectAll(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNFocus(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean iBecomingFocused;
+ PyMac_PRECHECK(TXNFocus);
+ if (!PyArg_ParseTuple(_args, "b",
+ &iBecomingFocused))
+ return NULL;
+ TXNFocus(_self->ob_itself,
+ iBecomingFocused);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNUpdate(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(TXNUpdate);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNUpdate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDraw(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GWorldPtr iDrawPort;
+ PyMac_PRECHECK(TXNDraw);
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptGWorldObj_Convert, &iDrawPort))
+ return NULL;
+ TXNDraw(_self->ob_itself,
+ iDrawPort);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNForceUpdate(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(TXNForceUpdate);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNForceUpdate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetSleepTicks(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UInt32 _rv;
+ PyMac_PRECHECK(TXNGetSleepTicks);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNGetSleepTicks(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNIdle(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(TXNIdle);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNIdle(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGrowWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ EventRecord iEvent;
+ PyMac_PRECHECK(TXNGrowWindow);
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &iEvent))
+ return NULL;
+ TXNGrowWindow(_self->ob_itself,
+ &iEvent);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNZoomWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short iPart;
+ PyMac_PRECHECK(TXNZoomWindow);
+ if (!PyArg_ParseTuple(_args, "h",
+ &iPart))
+ return NULL;
+ TXNZoomWindow(_self->ob_itself,
+ iPart);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCanUndo(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ TXNActionKey oTXNActionKey;
+ PyMac_PRECHECK(TXNCanUndo);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNCanUndo(_self->ob_itself,
+ &oTXNActionKey);
+ _res = Py_BuildValue("bl",
+ _rv,
+ oTXNActionKey);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNUndo(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(TXNUndo);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNUndo(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCanRedo(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ TXNActionKey oTXNActionKey;
+ PyMac_PRECHECK(TXNCanRedo);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNCanRedo(_self->ob_itself,
+ &oTXNActionKey);
+ _res = Py_BuildValue("bl",
+ _rv,
+ oTXNActionKey);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNRedo(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(TXNRedo);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNRedo(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCut(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNCut);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNCut(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCopy(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNCopy);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNCopy(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPaste(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNPaste);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNPaste(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNClear(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNClear);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNClear(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetSelection(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TXNOffset oStartOffset;
+ TXNOffset oEndOffset;
+ PyMac_PRECHECK(TXNGetSelection);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNGetSelection(_self->ob_itself,
+ &oStartOffset,
+ &oEndOffset);
+ _res = Py_BuildValue("ll",
+ oStartOffset,
+ oEndOffset);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNShowSelection(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean iShowEnd;
+ PyMac_PRECHECK(TXNShowSelection);
+ if (!PyArg_ParseTuple(_args, "b",
+ &iShowEnd))
+ return NULL;
+ TXNShowSelection(_self->ob_itself,
+ iShowEnd);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNIsSelectionEmpty(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PyMac_PRECHECK(TXNIsSelectionEmpty);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNIsSelectionEmpty(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSetSelection(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+ PyMac_PRECHECK(TXNSetSelection);
+ if (!PyArg_ParseTuple(_args, "ll",
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ _err = TXNSetSelection(_self->ob_itself,
+ iStartOffset,
+ iEndOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNCountRunsInRange(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 iStartOffset;
+ UInt32 iEndOffset;
+ ItemCount oRunCount;
+ PyMac_PRECHECK(TXNCountRunsInRange);
+ if (!PyArg_ParseTuple(_args, "ll",
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ _err = TXNCountRunsInRange(_self->ob_itself,
+ iStartOffset,
+ iEndOffset,
+ &oRunCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ oRunCount);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDataSize(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ByteCount _rv;
+ PyMac_PRECHECK(TXNDataSize);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNDataSize(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetData(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+ Handle oDataHandle;
+ PyMac_PRECHECK(TXNGetData);
+ if (!PyArg_ParseTuple(_args, "ll",
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ _err = TXNGetData(_self->ob_itself,
+ iStartOffset,
+ iEndOffset,
+ &oDataHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, oDataHandle);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetDataEncoded(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+ Handle oDataHandle;
+ TXNDataType iEncoding;
+ PyMac_PRECHECK(TXNGetDataEncoded);
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &iStartOffset,
+ &iEndOffset,
+ PyMac_GetOSType, &iEncoding))
+ return NULL;
+ _err = TXNGetDataEncoded(_self->ob_itself,
+ iStartOffset,
+ iEndOffset,
+ &oDataHandle,
+ iEncoding);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, oDataHandle);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSetDataFromFile(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 iFileRefNum;
+ OSType iFileType;
+ ByteCount iFileLength;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+ PyMac_PRECHECK(TXNSetDataFromFile);
+ if (!PyArg_ParseTuple(_args, "hO&lll",
+ &iFileRefNum,
+ PyMac_GetOSType, &iFileType,
+ &iFileLength,
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ _err = TXNSetDataFromFile(_self->ob_itself,
+ iFileRefNum,
+ iFileType,
+ iFileLength,
+ iStartOffset,
+ iEndOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSetData(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNDataType iDataType;
+ void * *iDataPtr__in__;
+ ByteCount iDataPtr__len__;
+ int iDataPtr__in_len__;
+ TXNOffset iStartOffset;
+ TXNOffset iEndOffset;
+ PyMac_PRECHECK(TXNSetData);
+ if (!PyArg_ParseTuple(_args, "O&s#ll",
+ PyMac_GetOSType, &iDataType,
+ &iDataPtr__in__, &iDataPtr__in_len__,
+ &iStartOffset,
+ &iEndOffset))
+ return NULL;
+ iDataPtr__len__ = iDataPtr__in_len__;
+ _err = TXNSetData(_self->ob_itself,
+ iDataType,
+ iDataPtr__in__, iDataPtr__len__,
+ iStartOffset,
+ iEndOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ iDataPtr__error__: ;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetChangeCount(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ItemCount _rv;
+ PyMac_PRECHECK(TXNGetChangeCount);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNGetChangeCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNSave(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType iType;
+ OSType iResType;
+ TXNPermanentTextEncodingType iPermanentEncoding;
+ FSSpec iFileSpecification;
+ SInt16 iDataReference;
+ SInt16 iResourceReference;
+ PyMac_PRECHECK(TXNSave);
+ if (!PyArg_ParseTuple(_args, "O&O&lO&hh",
+ PyMac_GetOSType, &iType,
+ PyMac_GetOSType, &iResType,
+ &iPermanentEncoding,
+ PyMac_GetFSSpec, &iFileSpecification,
+ &iDataReference,
+ &iResourceReference))
+ return NULL;
+ _err = TXNSave(_self->ob_itself,
+ iType,
+ iResType,
+ iPermanentEncoding,
+ &iFileSpecification,
+ iDataReference,
+ iResourceReference);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNRevert(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNRevert);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNRevert(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPageSetup(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNPageSetup);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNPageSetup(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPrint(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNPrint);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNPrint(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNGetViewRect(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect oViewRect;
+ PyMac_PRECHECK(TXNGetViewRect);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNGetViewRect(_self->ob_itself,
+ &oViewRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &oViewRect);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNAttachObjectToWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ GWorldPtr iWindow;
+ Boolean iIsActualWindow;
+ PyMac_PRECHECK(TXNAttachObjectToWindow);
+ if (!PyArg_ParseTuple(_args, "O&b",
+ GWorldObj_Convert, &iWindow,
+ &iIsActualWindow))
+ return NULL;
+ _err = TXNAttachObjectToWindow(_self->ob_itself,
+ iWindow,
+ iIsActualWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNIsObjectAttachedToWindow(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PyMac_PRECHECK(TXNIsObjectAttachedToWindow);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNIsObjectAttachedToWindow(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDragTracker(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TXNFrameID iTXNFrameID;
+ DragTrackingMessage iMessage;
+ WindowPtr iWindow;
+ DragReference iDragReference;
+ Boolean iDifferentObjectSameWindow;
+ PyMac_PRECHECK(TXNDragTracker);
+ if (!PyArg_ParseTuple(_args, "lhO&O&b",
+ &iTXNFrameID,
+ &iMessage,
+ WinObj_Convert, &iWindow,
+ DragObj_Convert, &iDragReference,
+ &iDifferentObjectSameWindow))
+ return NULL;
+ _err = TXNDragTracker(_self->ob_itself,
+ iTXNFrameID,
+ iMessage,
+ iWindow,
+ iDragReference,
+ iDifferentObjectSameWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDragReceiver(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TXNFrameID iTXNFrameID;
+ WindowPtr iWindow;
+ DragReference iDragReference;
+ Boolean iDifferentObjectSameWindow;
+ PyMac_PRECHECK(TXNDragReceiver);
+ if (!PyArg_ParseTuple(_args, "lO&O&b",
+ &iTXNFrameID,
+ WinObj_Convert, &iWindow,
+ DragObj_Convert, &iDragReference,
+ &iDifferentObjectSameWindow))
+ return NULL;
+ _err = TXNDragReceiver(_self->ob_itself,
+ iTXNFrameID,
+ iWindow,
+ iDragReference,
+ iDifferentObjectSameWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNActivate(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNFrameID iTXNFrameID;
+ TXNScrollBarState iActiveState;
+ PyMac_PRECHECK(TXNActivate);
+ if (!PyArg_ParseTuple(_args, "ll",
+ &iTXNFrameID,
+ &iActiveState))
+ return NULL;
+ _err = TXNActivate(_self->ob_itself,
+ iTXNFrameID,
+ iActiveState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNDoFontMenuSelection(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNFontMenuObject iTXNFontMenuObject;
+ SInt16 iMenuID;
+ SInt16 iMenuItem;
+ PyMac_PRECHECK(TXNDoFontMenuSelection);
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ TXNFontMenuObj_Convert, &iTXNFontMenuObject,
+ &iMenuID,
+ &iMenuItem))
+ return NULL;
+ _err = TXNDoFontMenuSelection(_self->ob_itself,
+ iTXNFontMenuObject,
+ iMenuID,
+ iMenuItem);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TXNObj_TXNPrepareFontMenu(TXNObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ TXNFontMenuObject iTXNFontMenuObject;
+ PyMac_PRECHECK(TXNPrepareFontMenu);
+ if (!PyArg_ParseTuple(_args, "O&",
+ TXNFontMenuObj_Convert, &iTXNFontMenuObject))
+ return NULL;
+ _err = TXNPrepareFontMenu(_self->ob_itself,
+ iTXNFontMenuObject);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef TXNObj_methods[] = {
+ {"TXNDeleteObject", (PyCFunction)TXNObj_TXNDeleteObject, 1,
+ "() -> None"},
+ {"TXNResizeFrame", (PyCFunction)TXNObj_TXNResizeFrame, 1,
+ "(UInt32 iWidth, UInt32 iHeight, TXNFrameID iTXNFrameID) -> None"},
+ {"TXNSetFrameBounds", (PyCFunction)TXNObj_TXNSetFrameBounds, 1,
+ "(SInt32 iTop, SInt32 iLeft, SInt32 iBottom, SInt32 iRight, TXNFrameID iTXNFrameID) -> None"},
+ {"TXNKeyDown", (PyCFunction)TXNObj_TXNKeyDown, 1,
+ "(EventRecord iEvent) -> None"},
+ {"TXNAdjustCursor", (PyCFunction)TXNObj_TXNAdjustCursor, 1,
+ "(RgnHandle ioCursorRgn) -> None"},
+ {"TXNClick", (PyCFunction)TXNObj_TXNClick, 1,
+ "(EventRecord iEvent) -> None"},
+
+#if !TARGET_API_MAC_OSX
+ {"TXNTSMCheck", (PyCFunction)TXNObj_TXNTSMCheck, 1,
+ "(EventRecord iEvent) -> (Boolean _rv)"},
+#endif
+ {"TXNSelectAll", (PyCFunction)TXNObj_TXNSelectAll, 1,
+ "() -> None"},
+ {"TXNFocus", (PyCFunction)TXNObj_TXNFocus, 1,
+ "(Boolean iBecomingFocused) -> None"},
+ {"TXNUpdate", (PyCFunction)TXNObj_TXNUpdate, 1,
+ "() -> None"},
+ {"TXNDraw", (PyCFunction)TXNObj_TXNDraw, 1,
+ "(GWorldPtr iDrawPort) -> None"},
+ {"TXNForceUpdate", (PyCFunction)TXNObj_TXNForceUpdate, 1,
+ "() -> None"},
+ {"TXNGetSleepTicks", (PyCFunction)TXNObj_TXNGetSleepTicks, 1,
+ "() -> (UInt32 _rv)"},
+ {"TXNIdle", (PyCFunction)TXNObj_TXNIdle, 1,
+ "() -> None"},
+ {"TXNGrowWindow", (PyCFunction)TXNObj_TXNGrowWindow, 1,
+ "(EventRecord iEvent) -> None"},
+ {"TXNZoomWindow", (PyCFunction)TXNObj_TXNZoomWindow, 1,
+ "(short iPart) -> None"},
+ {"TXNCanUndo", (PyCFunction)TXNObj_TXNCanUndo, 1,
+ "() -> (Boolean _rv, TXNActionKey oTXNActionKey)"},
+ {"TXNUndo", (PyCFunction)TXNObj_TXNUndo, 1,
+ "() -> None"},
+ {"TXNCanRedo", (PyCFunction)TXNObj_TXNCanRedo, 1,
+ "() -> (Boolean _rv, TXNActionKey oTXNActionKey)"},
+ {"TXNRedo", (PyCFunction)TXNObj_TXNRedo, 1,
+ "() -> None"},
+ {"TXNCut", (PyCFunction)TXNObj_TXNCut, 1,
+ "() -> None"},
+ {"TXNCopy", (PyCFunction)TXNObj_TXNCopy, 1,
+ "() -> None"},
+ {"TXNPaste", (PyCFunction)TXNObj_TXNPaste, 1,
+ "() -> None"},
+ {"TXNClear", (PyCFunction)TXNObj_TXNClear, 1,
+ "() -> None"},
+ {"TXNGetSelection", (PyCFunction)TXNObj_TXNGetSelection, 1,
+ "() -> (TXNOffset oStartOffset, TXNOffset oEndOffset)"},
+ {"TXNShowSelection", (PyCFunction)TXNObj_TXNShowSelection, 1,
+ "(Boolean iShowEnd) -> None"},
+ {"TXNIsSelectionEmpty", (PyCFunction)TXNObj_TXNIsSelectionEmpty, 1,
+ "() -> (Boolean _rv)"},
+ {"TXNSetSelection", (PyCFunction)TXNObj_TXNSetSelection, 1,
+ "(TXNOffset iStartOffset, TXNOffset iEndOffset) -> None"},
+ {"TXNCountRunsInRange", (PyCFunction)TXNObj_TXNCountRunsInRange, 1,
+ "(UInt32 iStartOffset, UInt32 iEndOffset) -> (ItemCount oRunCount)"},
+ {"TXNDataSize", (PyCFunction)TXNObj_TXNDataSize, 1,
+ "() -> (ByteCount _rv)"},
+ {"TXNGetData", (PyCFunction)TXNObj_TXNGetData, 1,
+ "(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (Handle oDataHandle)"},
+ {"TXNGetDataEncoded", (PyCFunction)TXNObj_TXNGetDataEncoded, 1,
+ "(TXNOffset iStartOffset, TXNOffset iEndOffset, TXNDataType iEncoding) -> (Handle oDataHandle)"},
+ {"TXNSetDataFromFile", (PyCFunction)TXNObj_TXNSetDataFromFile, 1,
+ "(SInt16 iFileRefNum, OSType iFileType, ByteCount iFileLength, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None"},
+ {"TXNSetData", (PyCFunction)TXNObj_TXNSetData, 1,
+ "(TXNDataType iDataType, Buffer iDataPtr, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None"},
+ {"TXNGetChangeCount", (PyCFunction)TXNObj_TXNGetChangeCount, 1,
+ "() -> (ItemCount _rv)"},
+ {"TXNSave", (PyCFunction)TXNObj_TXNSave, 1,
+ "(OSType iType, OSType iResType, TXNPermanentTextEncodingType iPermanentEncoding, FSSpec iFileSpecification, SInt16 iDataReference, SInt16 iResourceReference) -> None"},
+ {"TXNRevert", (PyCFunction)TXNObj_TXNRevert, 1,
+ "() -> None"},
+ {"TXNPageSetup", (PyCFunction)TXNObj_TXNPageSetup, 1,
+ "() -> None"},
+ {"TXNPrint", (PyCFunction)TXNObj_TXNPrint, 1,
+ "() -> None"},
+ {"TXNGetViewRect", (PyCFunction)TXNObj_TXNGetViewRect, 1,
+ "() -> (Rect oViewRect)"},
+ {"TXNAttachObjectToWindow", (PyCFunction)TXNObj_TXNAttachObjectToWindow, 1,
+ "(GWorldPtr iWindow, Boolean iIsActualWindow) -> None"},
+ {"TXNIsObjectAttachedToWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToWindow, 1,
+ "() -> (Boolean _rv)"},
+ {"TXNDragTracker", (PyCFunction)TXNObj_TXNDragTracker, 1,
+ "(TXNFrameID iTXNFrameID, DragTrackingMessage iMessage, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None"},
+ {"TXNDragReceiver", (PyCFunction)TXNObj_TXNDragReceiver, 1,
+ "(TXNFrameID iTXNFrameID, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None"},
+ {"TXNActivate", (PyCFunction)TXNObj_TXNActivate, 1,
+ "(TXNFrameID iTXNFrameID, TXNScrollBarState iActiveState) -> None"},
+ {"TXNDoFontMenuSelection", (PyCFunction)TXNObj_TXNDoFontMenuSelection, 1,
+ "(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None"},
+ {"TXNPrepareFontMenu", (PyCFunction)TXNObj_TXNPrepareFontMenu, 1,
+ "(TXNFontMenuObject iTXNFontMenuObject) -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain TXNObj_chain = { TXNObj_methods, NULL };
+
+static PyObject *TXNObj_getattr(TXNObjectObject *self, char *name)
+{
+ return Py_FindMethodInChain(&TXNObj_chain, (PyObject *)self, name);
+}
+
+#define TXNObj_setattr NULL
+
+#define TXNObj_compare NULL
+
+#define TXNObj_repr NULL
+
+#define TXNObj_hash NULL
+
+PyTypeObject TXNObject_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "TXNObject", /*tp_name*/
+ sizeof(TXNObjectObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TXNObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) TXNObj_getattr, /*tp_getattr*/
+ (setattrfunc) TXNObj_setattr, /*tp_setattr*/
+ (cmpfunc) TXNObj_compare, /*tp_compare*/
+ (reprfunc) TXNObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TXNObj_hash, /*tp_hash*/
+};
+
+/* ------------------- End object type TXNObject -------------------- */
+
+
+/* ----------------- Object type TXNFontMenuObject ------------------ */
+
+PyTypeObject TXNFontMenuObject_Type;
+
+#define TXNFontMenuObj_Check(x) ((x)->ob_type == &TXNFontMenuObject_Type)
+
+typedef struct TXNFontMenuObjectObject {
+ PyObject_HEAD
+ TXNFontMenuObject ob_itself;
+} TXNFontMenuObjectObject;
+
+PyObject *TXNFontMenuObj_New(TXNFontMenuObject itself)
+{
+ TXNFontMenuObjectObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(TXNFontMenuObjectObject, &TXNFontMenuObject_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+TXNFontMenuObj_Convert(PyObject *v, TXNFontMenuObject *p_itself)
+{
+ if (!TXNFontMenuObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "TXNFontMenuObject required");
+ return 0;
+ }
+ *p_itself = ((TXNFontMenuObjectObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TXNFontMenuObj_dealloc(TXNFontMenuObjectObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ PyMem_DEL(self);
+}
+
+static PyObject *TXNFontMenuObj_TXNGetFontMenuHandle(TXNFontMenuObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle oFontMenuHandle;
+ PyMac_PRECHECK(TXNGetFontMenuHandle);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNGetFontMenuHandle(_self->ob_itself,
+ &oFontMenuHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, oFontMenuHandle);
+ return _res;
+}
+
+static PyObject *TXNFontMenuObj_TXNDisposeFontMenuObject(TXNFontMenuObjectObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNDisposeFontMenuObject);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNDisposeFontMenuObject(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef TXNFontMenuObj_methods[] = {
+ {"TXNGetFontMenuHandle", (PyCFunction)TXNFontMenuObj_TXNGetFontMenuHandle, 1,
+ "() -> (MenuHandle oFontMenuHandle)"},
+ {"TXNDisposeFontMenuObject", (PyCFunction)TXNFontMenuObj_TXNDisposeFontMenuObject, 1,
+ "() -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain TXNFontMenuObj_chain = { TXNFontMenuObj_methods, NULL };
+
+static PyObject *TXNFontMenuObj_getattr(TXNFontMenuObjectObject *self, char *name)
+{
+ return Py_FindMethodInChain(&TXNFontMenuObj_chain, (PyObject *)self, name);
+}
+
+#define TXNFontMenuObj_setattr NULL
+
+#define TXNFontMenuObj_compare NULL
+
+#define TXNFontMenuObj_repr NULL
+
+#define TXNFontMenuObj_hash NULL
+
+PyTypeObject TXNFontMenuObject_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "TXNFontMenuObject", /*tp_name*/
+ sizeof(TXNFontMenuObjectObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TXNFontMenuObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) TXNFontMenuObj_getattr, /*tp_getattr*/
+ (setattrfunc) TXNFontMenuObj_setattr, /*tp_setattr*/
+ (cmpfunc) TXNFontMenuObj_compare, /*tp_compare*/
+ (reprfunc) TXNFontMenuObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TXNFontMenuObj_hash, /*tp_hash*/
+};
+
+/* --------------- End object type TXNFontMenuObject ---------------- */
+
+
+static PyObject *Mlte_TXNNewObject(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSSpec * iFileSpec;
+ WindowPtr iWindow;
+ Rect * iFrame;
+ TXNFrameOptions iFrameOptions;
+ TXNFrameType iFrameType;
+ TXNFileType iFileType;
+ TXNPermanentTextEncodingType iPermanentEncoding;
+ TXNObject oTXNObject;
+ TXNFrameID oTXNFrameID;
+ PyMac_PRECHECK(TXNNewObject);
+ if (!PyArg_ParseTuple(_args, "O&O&O&llO&l",
+ OptFSSpecPtr_Convert, &iFileSpec,
+ WinObj_Convert, &iWindow,
+ OptRectPtr_Convert, &iFrame,
+ &iFrameOptions,
+ &iFrameType,
+ PyMac_GetOSType, &iFileType,
+ &iPermanentEncoding))
+ return NULL;
+ _err = TXNNewObject(iFileSpec,
+ iWindow,
+ iFrame,
+ iFrameOptions,
+ iFrameType,
+ iFileType,
+ iPermanentEncoding,
+ &oTXNObject,
+ &oTXNFrameID,
+ (TXNObjectRefcon)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&l",
+ TXNObj_New, oTXNObject,
+ oTXNFrameID);
+ return _res;
+}
+
+static PyObject *Mlte_TXNTerminateTextension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PyMac_PRECHECK(TXNTerminateTextension);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TXNTerminateTextension();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Mlte_TXNIsScrapPastable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PyMac_PRECHECK(TXNIsScrapPastable);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNIsScrapPastable();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Mlte_TXNConvertToPublicScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNConvertToPublicScrap);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNConvertToPublicScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Mlte_TXNConvertFromPublicScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ PyMac_PRECHECK(TXNConvertFromPublicScrap);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TXNConvertFromPublicScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Mlte_TXNNewFontMenuObject(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuHandle iFontMenuHandle;
+ SInt16 iMenuID;
+ SInt16 iStartHierMenuID;
+ TXNFontMenuObject oTXNFontMenuObject;
+ PyMac_PRECHECK(TXNNewFontMenuObject);
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ MenuObj_Convert, &iFontMenuHandle,
+ &iMenuID,
+ &iStartHierMenuID))
+ return NULL;
+ _err = TXNNewFontMenuObject(iFontMenuHandle,
+ iMenuID,
+ iStartHierMenuID,
+ &oTXNFontMenuObject);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ TXNFontMenuObj_New, oTXNFontMenuObject);
+ return _res;
+}
+
+static PyObject *Mlte_TXNVersionInformation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TXNVersionValue _rv;
+ TXNFeatureBits oFeatureFlags;
+ PyMac_PRECHECK(TXNVersionInformation);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TXNVersionInformation(&oFeatureFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ oFeatureFlags);
+ return _res;
+}
+
+static PyObject *Mlte_TXNInitTextension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ OSStatus _err;
+ TXNMacOSPreferredFontDescription * iDefaultFonts = NULL;
+ ItemCount iCountDefaultFonts = 0;
+ TXNInitOptions iUsageFlags;
+ PyMac_PRECHECK(TXNInitTextension);
+ if (!PyArg_ParseTuple(_args, "l", &iUsageFlags))
+ return NULL;
+ _err = TXNInitTextension(iDefaultFonts,
+ iCountDefaultFonts,
+ iUsageFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyMethodDef Mlte_methods[] = {
+ {"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1,
+ "(FSSpec * iFileSpec, WindowPtr iWindow, Rect * iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)"},
+ {"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1,
+ "() -> None"},
+ {"TXNIsScrapPastable", (PyCFunction)Mlte_TXNIsScrapPastable, 1,
+ "() -> (Boolean _rv)"},
+ {"TXNConvertToPublicScrap", (PyCFunction)Mlte_TXNConvertToPublicScrap, 1,
+ "() -> None"},
+ {"TXNConvertFromPublicScrap", (PyCFunction)Mlte_TXNConvertFromPublicScrap, 1,
+ "() -> None"},
+ {"TXNNewFontMenuObject", (PyCFunction)Mlte_TXNNewFontMenuObject, 1,
+ "(MenuHandle iFontMenuHandle, SInt16 iMenuID, SInt16 iStartHierMenuID) -> (TXNFontMenuObject oTXNFontMenuObject)"},
+ {"TXNVersionInformation", (PyCFunction)Mlte_TXNVersionInformation, 1,
+ "() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)"},
+ {"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1,
+ "(TXNInitOptions) -> None"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Mlte(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ // PyMac_INIT_TOOLBOX_OBJECT_NEW(xxxx);
+
+
+ m = Py_InitModule("_Mlte", Mlte_methods);
+ d = PyModule_GetDict(m);
+ Mlte_Error = PyMac_GetOSErrException();
+ if (Mlte_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Mlte_Error) != 0)
+ return;
+ TXNObject_Type.ob_type = &PyType_Type;
+ Py_INCREF(&TXNObject_Type);
+ if (PyDict_SetItemString(d, "TXNObjectType", (PyObject *)&TXNObject_Type) != 0)
+ Py_FatalError("can't initialize TXNObjectType");
+ TXNFontMenuObject_Type.ob_type = &PyType_Type;
+ Py_INCREF(&TXNFontMenuObject_Type);
+ if (PyDict_SetItemString(d, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type) != 0)
+ Py_FatalError("can't initialize TXNFontMenuObjectType");
+}
+
+/* ======================== End module _Mlte ======================== */
+
diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c
new file mode 100644
index 0000000..4d27c95
--- /dev/null
+++ b/Mac/Modules/qd/_Qdmodule.c
@@ -0,0 +1,5695 @@
+
+/* =========================== Module _Qd =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <QuickDraw.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_GrafObj_New(GrafPtr);
+extern int _GrafObj_Convert(PyObject *, GrafPtr *);
+extern PyObject *_BMObj_New(BitMapPtr);
+extern int _BMObj_Convert(PyObject *, BitMapPtr *);
+extern PyObject *_QdRGB_New(RGBColorPtr);
+extern int _QdRGB_Convert(PyObject *, RGBColorPtr);
+
+#define GrafObj_New _GrafObj_New
+#define GrafObj_Convert _GrafObj_Convert
+#define BMObj_New _BMObj_New
+#define BMObj_Convert _BMObj_Convert
+#define QdRGB_New _QdRGB_New
+#define QdRGB_Convert _QdRGB_Convert
+#endif
+
+#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+#define GetPortBitMapForCopyBits(port) ((const struct BitMap *)&((GrafPort *)(port))->portBits)
+#define GetPortPixMap(port) (((CGrafPtr)(port))->portPixMap)
+#define GetPortBounds(port, bounds) (*(bounds) = (port)->portRect, (bounds))
+#define GetPortForeColor(port, color) (*(color) = (port)->rgbFgColor, (color))
+#define GetPortBackColor(port, color) (*(color) = (port)->rgbBkColor, (color))
+#define GetPortOpColor(port, color) (*(color) = (*(GVarHandle)((port)->grafVars))->rgbOpColor, (color))
+#define GetPortHiliteColor(port, color) (*(color) = (*(GVarHandle)((port)->grafVars))->rgbHiliteColor, (color))
+#define GetPortTextFont(port) ((port)->txFont)
+#define GetPortTextFace(port) ((port)->txFace)
+#define GetPortTextMode(port) ((port)->txMode)
+#define GetPortTextSize(port) ((port)->txSize)
+#define GetPortChExtra(port) ((port)->chExtra)
+#define GetPortFracHPenLocation(port) ((port)->pnLocHFrac)
+#define GetPortSpExtra(port) ((port)->spExtra)
+#define GetPortPenVisibility(port) ((port)->pnVis)
+#define GetPortVisibleRegion(port, rgn) ((rgn) = (port)->visRgn, (rgn))
+#define GetPortClipRegion(port, rgn) ((rgn) = (port)->clipRgn, (rgn))
+#define GetPortBackPixPat(port, pat) ((pat) = (port)->bkPixPat, (pat))
+#define GetPortPenPixPat(port, pat) ((pat) = (port)->pnPixPat, (pat))
+#define GetPortFillPixPat(port, pat) ((pat) = (port)->fillPixPat, (pat))
+#define GetPortPenSize(port, pensize) (*(pensize) = (port)->pnSize, (pensize))
+#define GetPortPenMode(port) ((port)->pnMode)
+#define GetPortPenLocation(port, location) ((*location) = (port)->pnLoc, (location))
+#define IsPortRegionBeingDefined(port) (!!((port)->rgnSave))
+#define IsPortPictureBeingDefined(port) (!!((port)->picSave))
+/* #define IsPortOffscreen(port) */
+/* #define IsPortColor(port) */
+
+#define SetPortBounds(port, bounds) ((port)->portRect = *(bounds))
+#define SetPortOpColor(port, color) ((*(GVarHandle)((port)->grafVars))->rgbOpColor = *(color))
+#define SetPortVisibleRegion(port, rgn) ((port)->visRgn = (rgn))
+#define SetPortClipRegion(port, rgn) ((port)->clipRgn = (rgn))
+#define SetPortBackPixPat(port, pat) ((port)->bkPixPat = (pat))
+#define SetPortPenPixPat(port, pat) ((port)->pnPixPat = (pat))
+#define SetPortFillPixPat(port, pat) ((port)->fillPixPat = (pat))
+#define SetPortPenSize(port, pensize) ((port)->pnSize = (pensize))
+#define SetPortPenMode(port, mode) ((port)->pnMode = (mode))
+#define SetPortFracHPenLocation(port, frac) ((port)->pnLocHFrac = (frac))
+
+/* On pixmaps */
+#define GetPixBounds(pixmap, rect) (*(rect) = (*(pixmap))->bounds, (rect))
+#define GetPixDepth(pixmap) ((*(pixmap))->pixelSize)
+
+/* On regions */
+#define GetRegionBounds(rgn, rect) (*(rect) = (*(rgn))->rgnBBox, (rect))
+
+/* On QD Globals */
+#define GetQDGlobalsRandomSeed() (qd.randSeed)
+#define GetQDGlobalsScreenBits(bits) (*(bits) = qd.screenBits, (bits))
+#define GetQDGlobalsArrow(crsr) (*(crsr) = qd.arrow, (crsr))
+#define GetQDGlobalsDarkGray(pat) (*(pat) = qd.dkGray, (pat))
+#define GetQDGlobalsLightGray(pat) (*(pat) = qd.ltGray, (pat))
+#define GetQDGlobalsGray(pat) (*(pat) = qd.gray, (pat))
+#define GetQDGlobalsBlack(pat) (*(pat) = qd.black, (pat))
+#define GetQDGlobalsWhite(pat) (*(pat) = qd.white, (pat))
+#define GetQDGlobalsThePort() ((CGrafPtr)qd.thePort)
+
+#define SetQDGlobalsRandomSeed(seed) (qd.randSeed = (seed))
+#define SetQDGlobalsArrow(crsr) (qd.arrow = *(crsr))
+
+#endif /* ACCESSOR_CALLS_ARE_FUNCTIONS */
+
+#if !TARGET_API_MAC_CARBON
+#define QDFlushPortBuffer(port, rgn) /* pass */
+#define QDIsPortBufferDirty(port) 0
+#define QDIsPortBuffered(port) 0
+#endif /* !TARGET_API_MAC_CARBON */
+
+staticforward PyObject *BMObj_NewCopied(BitMapPtr);
+
+/*
+** Parse/generate RGB records
+*/
+PyObject *QdRGB_New(RGBColorPtr itself)
+{
+
+ return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
+}
+
+QdRGB_Convert(PyObject *v, RGBColorPtr p_itself)
+{
+ long red, green, blue;
+
+ if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
+ return 0;
+ p_itself->red = (unsigned short)red;
+ p_itself->green = (unsigned short)green;
+ p_itself->blue = (unsigned short)blue;
+ return 1;
+}
+
+/*
+** Generate FontInfo records
+*/
+static
+PyObject *QdFI_New(FontInfo *itself)
+{
+
+ return Py_BuildValue("hhhh", itself->ascent, itself->descent,
+ itself->widMax, itself->leading);
+}
+
+static PyObject *Qd_Error;
+
+/* ---------------------- Object type GrafPort ---------------------- */
+
+PyTypeObject GrafPort_Type;
+
+#define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type)
+
+typedef struct GrafPortObject {
+ PyObject_HEAD
+ GrafPtr ob_itself;
+} GrafPortObject;
+
+PyObject *GrafObj_New(GrafPtr itself)
+{
+ GrafPortObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+GrafObj_Convert(PyObject *v, GrafPtr *p_itself)
+{
+#if 1
+ {
+ WindowRef win;
+ if (WinObj_Convert(v, &win) && v) {
+ *p_itself = (GrafPtr)GetWindowPort(win);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+#else
+ if (DlgObj_Check(v)) {
+ DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
+ *p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));
+ return 1;
+ }
+ if (WinObj_Check(v)) {
+ WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;
+ *p_itself = (GrafPtr)GetWindowPort(win);
+ return 1;
+ }
+#endif
+ if (!GrafObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "GrafPort required");
+ return 0;
+ }
+ *p_itself = ((GrafPortObject *)v)->ob_itself;
+ return 1;
+}
+
+static void GrafObj_dealloc(GrafPortObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ PyMem_DEL(self);
+}
+
+static PyMethodDef GrafObj_methods[] = {
+ {NULL, NULL, 0}
+};
+
+PyMethodChain GrafObj_chain = { GrafObj_methods, NULL };
+
+static PyObject *GrafObj_getattr(GrafPortObject *self, char *name)
+{
+#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+
+ { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
+
+ if ( strcmp(name, "data") == 0 )
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
+
+ if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
+ /* Color-only attributes */
+
+ if ( strcmp(name, "portBits") == 0 )
+ /* XXXX Do we need HLock() stuff here?? */
+ return BMObj_New((BitMapPtr)*itself_color->portPixMap);
+ if ( strcmp(name, "grafVars") == 0 )
+ return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
+ if ( strcmp(name, "chExtra") == 0 )
+ return Py_BuildValue("h", itself_color->chExtra);
+ if ( strcmp(name, "pnLocHFrac") == 0 )
+ return Py_BuildValue("h", itself_color->pnLocHFrac);
+ if ( strcmp(name, "bkPixPat") == 0 )
+ return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
+ if ( strcmp(name, "rgbFgColor") == 0 )
+ return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
+ if ( strcmp(name, "rgbBkColor") == 0 )
+ return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
+ if ( strcmp(name, "pnPixPat") == 0 )
+ return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
+ if ( strcmp(name, "fillPixPat") == 0 )
+ return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
+ } else {
+ /* Mono-only attributes */
+ if ( strcmp(name, "portBits") == 0 )
+ return BMObj_New(&self->ob_itself->portBits);
+ if ( strcmp(name, "bkPat") == 0 )
+ return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
+ if ( strcmp(name, "fillPat") == 0 )
+ return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
+ if ( strcmp(name, "pnPat") == 0 )
+ return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
+ }
+ /*
+ ** Accessible for both color/mono windows.
+ ** portVersion is really color-only, but we put it here
+ ** for convenience
+ */
+ if ( strcmp(name, "portVersion") == 0 )
+ return Py_BuildValue("h", itself_color->portVersion);
+ if ( strcmp(name, "device") == 0 )
+ return PyInt_FromLong((long)self->ob_itself->device);
+ if ( strcmp(name, "portRect") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
+ if ( strcmp(name, "visRgn") == 0 )
+ return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
+ if ( strcmp(name, "clipRgn") == 0 )
+ return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
+ if ( strcmp(name, "pnLoc") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
+ if ( strcmp(name, "pnSize") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
+ if ( strcmp(name, "pnMode") == 0 )
+ return Py_BuildValue("h", self->ob_itself->pnMode);
+ if ( strcmp(name, "pnVis") == 0 )
+ return Py_BuildValue("h", self->ob_itself->pnVis);
+ if ( strcmp(name, "txFont") == 0 )
+ return Py_BuildValue("h", self->ob_itself->txFont);
+ if ( strcmp(name, "txFace") == 0 )
+ return Py_BuildValue("h", (short)self->ob_itself->txFace);
+ if ( strcmp(name, "txMode") == 0 )
+ return Py_BuildValue("h", self->ob_itself->txMode);
+ if ( strcmp(name, "txSize") == 0 )
+ return Py_BuildValue("h", self->ob_itself->txSize);
+ if ( strcmp(name, "spExtra") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
+ /* XXXX Add more, as needed */
+ /* This one is so we can compare grafports: */
+ if ( strcmp(name, "_id") == 0 )
+ return Py_BuildValue("l", (long)self->ob_itself);
+ }
+#else
+
+ { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
+ if ( strcmp(name, "portBits") == 0 )
+ return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color));
+ if ( strcmp(name, "chExtra") == 0 )
+ return Py_BuildValue("h", GetPortChExtra(itself_color));
+ if ( strcmp(name, "pnLocHFrac") == 0 )
+ return Py_BuildValue("h", GetPortFracHPenLocation(itself_color));
+ if ( strcmp(name, "bkPixPat") == 0 ) {
+ PixPatHandle h=0;
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortBackPixPat(itself_color, h));
+ }
+ if ( strcmp(name, "rgbFgColor") == 0 ) {
+ RGBColor c;
+ return Py_BuildValue("O&", QdRGB_New, GetPortForeColor(itself_color, &c));
+ }
+ if ( strcmp(name, "rgbBkColor") == 0 ) {
+ RGBColor c;
+ return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c));
+ }
+ if ( strcmp(name, "pnPixPat") == 0 ) {
+ PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
+
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h));
+ }
+ if ( strcmp(name, "fillPixPat") == 0 ) {
+ PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h));
+ }
+ if ( strcmp(name, "portRect") == 0 ) {
+ Rect r;
+ return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r));
+ }
+ if ( strcmp(name, "visRgn") == 0 ) {
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h));
+ }
+ if ( strcmp(name, "clipRgn") == 0 ) {
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h));
+ }
+ if ( strcmp(name, "pnLoc") == 0 ) {
+ Point p;
+ return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenLocation(itself_color, &p));
+ }
+ if ( strcmp(name, "pnSize") == 0 ) {
+ Point p;
+ return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenSize(itself_color, &p));
+ }
+ if ( strcmp(name, "pnMode") == 0 )
+ return Py_BuildValue("h", GetPortPenMode(itself_color));
+ if ( strcmp(name, "pnVis") == 0 )
+ return Py_BuildValue("h", GetPortPenVisibility(itself_color));
+ if ( strcmp(name, "txFont") == 0 )
+ return Py_BuildValue("h", GetPortTextFont(itself_color));
+ if ( strcmp(name, "txFace") == 0 )
+ return Py_BuildValue("h", (short)GetPortTextFace(itself_color));
+ if ( strcmp(name, "txMode") == 0 )
+ return Py_BuildValue("h", GetPortTextMode(itself_color));
+ if ( strcmp(name, "txSize") == 0 )
+ return Py_BuildValue("h", GetPortTextSize(itself_color));
+ if ( strcmp(name, "spExtra") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildFixed, GetPortSpExtra(itself_color));
+ /* XXXX Add more, as needed */
+ /* This one is so we can compare grafports: */
+ if ( strcmp(name, "_id") == 0 )
+ return Py_BuildValue("l", (long)self->ob_itself);
+ }
+#endif
+ return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
+}
+
+#define GrafObj_setattr NULL
+
+#define GrafObj_compare NULL
+
+#define GrafObj_repr NULL
+
+#define GrafObj_hash NULL
+
+PyTypeObject GrafPort_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "GrafPort", /*tp_name*/
+ sizeof(GrafPortObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) GrafObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) GrafObj_getattr, /*tp_getattr*/
+ (setattrfunc) GrafObj_setattr, /*tp_setattr*/
+ (cmpfunc) GrafObj_compare, /*tp_compare*/
+ (reprfunc) GrafObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) GrafObj_hash, /*tp_hash*/
+};
+
+/* -------------------- End object type GrafPort -------------------- */
+
+
+/* ----------------------- Object type BitMap ----------------------- */
+
+PyTypeObject BitMap_Type;
+
+#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
+
+typedef struct BitMapObject {
+ PyObject_HEAD
+ BitMapPtr ob_itself;
+ PyObject *referred_object;
+ BitMap *referred_bitmap;
+} BitMapObject;
+
+PyObject *BMObj_New(BitMapPtr itself)
+{
+ BitMapObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(BitMapObject, &BitMap_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->referred_object = NULL;
+ it->referred_bitmap = NULL;
+ return (PyObject *)it;
+}
+BMObj_Convert(PyObject *v, BitMapPtr *p_itself)
+{
+ if (!BMObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "BitMap required");
+ return 0;
+ }
+ *p_itself = ((BitMapObject *)v)->ob_itself;
+ return 1;
+}
+
+static void BMObj_dealloc(BitMapObject *self)
+{
+ Py_XDECREF(self->referred_object);
+ if (self->referred_bitmap) free(self->referred_bitmap);
+ PyMem_DEL(self);
+}
+
+static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int from, length;
+ char *cp;
+
+ if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
+ return NULL;
+ cp = _self->ob_itself->baseAddr+from;
+ return PyString_FromStringAndSize(cp, length);
+
+}
+
+static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int from, length;
+ char *cp, *icp;
+
+ if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
+ return NULL;
+ cp = _self->ob_itself->baseAddr+from;
+ memcpy(cp, icp, length);
+ Py_INCREF(Py_None);
+ return Py_None;
+
+}
+
+static PyMethodDef BMObj_methods[] = {
+ {"getdata", (PyCFunction)BMObj_getdata, 1,
+ "(int start, int size) -> string. Return bytes from the bitmap"},
+ {"putdata", (PyCFunction)BMObj_putdata, 1,
+ "(int start, string data). Store bytes into the bitmap"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain BMObj_chain = { BMObj_methods, NULL };
+
+static PyObject *BMObj_getattr(BitMapObject *self, char *name)
+{
+ if ( strcmp(name, "baseAddr") == 0 )
+ return PyInt_FromLong((long)self->ob_itself->baseAddr);
+ if ( strcmp(name, "rowBytes") == 0 )
+ return PyInt_FromLong((long)self->ob_itself->rowBytes);
+ if ( strcmp(name, "bounds") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
+ /* XXXX Add more, as needed */
+ if ( strcmp(name, "bitmap_data") == 0 )
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
+ if ( strcmp(name, "pixmap_data") == 0 )
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
+
+ return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
+}
+
+#define BMObj_setattr NULL
+
+#define BMObj_compare NULL
+
+#define BMObj_repr NULL
+
+#define BMObj_hash NULL
+
+PyTypeObject BitMap_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "BitMap", /*tp_name*/
+ sizeof(BitMapObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) BMObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) BMObj_getattr, /*tp_getattr*/
+ (setattrfunc) BMObj_setattr, /*tp_setattr*/
+ (cmpfunc) BMObj_compare, /*tp_compare*/
+ (reprfunc) BMObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) BMObj_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type BitMap --------------------- */
+
+
+/* ------------------ Object type QDGlobalsAccess ------------------- */
+
+staticforward PyTypeObject QDGlobalsAccess_Type;
+
+#define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
+
+typedef struct QDGlobalsAccessObject {
+ PyObject_HEAD
+} QDGlobalsAccessObject;
+
+static PyObject *QDGA_New(void)
+{
+ QDGlobalsAccessObject *it;
+ it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type);
+ if (it == NULL) return NULL;
+ return (PyObject *)it;
+}
+
+static void QDGA_dealloc(QDGlobalsAccessObject *self)
+{
+ PyMem_DEL(self);
+}
+
+static PyMethodDef QDGA_methods[] = {
+ {NULL, NULL, 0}
+};
+
+static PyMethodChain QDGA_chain = { QDGA_methods, NULL };
+
+static PyObject *QDGA_getattr(QDGlobalsAccessObject *self, char *name)
+{
+#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+
+ if ( strcmp(name, "arrow") == 0 )
+ return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
+ if ( strcmp(name, "black") == 0 )
+ return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
+ if ( strcmp(name, "white") == 0 )
+ return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
+ if ( strcmp(name, "gray") == 0 )
+ return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
+ if ( strcmp(name, "ltGray") == 0 )
+ return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
+ if ( strcmp(name, "dkGray") == 0 )
+ return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
+ if ( strcmp(name, "screenBits") == 0 )
+ return BMObj_New(&qd.screenBits);
+ if ( strcmp(name, "thePort") == 0 )
+ return GrafObj_New(qd.thePort);
+ if ( strcmp(name, "randSeed") == 0 )
+ return Py_BuildValue("l", &qd.randSeed);
+
+#else
+
+ if ( strcmp(name, "arrow") == 0 ) {
+ Cursor rv;
+ GetQDGlobalsArrow(&rv);
+ return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
+ }
+ if ( strcmp(name, "black") == 0 ) {
+ Pattern rv;
+ GetQDGlobalsBlack(&rv);
+ return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
+ }
+ if ( strcmp(name, "white") == 0 ) {
+ Pattern rv;
+ GetQDGlobalsWhite(&rv);
+ return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
+ }
+ if ( strcmp(name, "gray") == 0 ) {
+ Pattern rv;
+ GetQDGlobalsGray(&rv);
+ return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
+ }
+ if ( strcmp(name, "ltGray") == 0 ) {
+ Pattern rv;
+ GetQDGlobalsLightGray(&rv);
+ return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
+ }
+ if ( strcmp(name, "dkGray") == 0 ) {
+ Pattern rv;
+ GetQDGlobalsDarkGray(&rv);
+ return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
+ }
+ if ( strcmp(name, "screenBits") == 0 ) {
+ BitMap rv;
+ GetQDGlobalsScreenBits(&rv);
+ return BMObj_NewCopied(&rv);
+ }
+ if ( strcmp(name, "thePort") == 0 )
+ return GrafObj_New(GetQDGlobalsThePort());
+ if ( strcmp(name, "randSeed") == 0 )
+ return Py_BuildValue("l", GetQDGlobalsRandomSeed());
+
+#endif
+ return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
+}
+
+#define QDGA_setattr NULL
+
+#define QDGA_compare NULL
+
+#define QDGA_repr NULL
+
+#define QDGA_hash NULL
+
+staticforward PyTypeObject QDGlobalsAccess_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "QDGlobalsAccess", /*tp_name*/
+ sizeof(QDGlobalsAccessObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) QDGA_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) QDGA_getattr, /*tp_getattr*/
+ (setattrfunc) QDGA_setattr, /*tp_setattr*/
+ (cmpfunc) QDGA_compare, /*tp_compare*/
+ (reprfunc) QDGA_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) QDGA_hash, /*tp_hash*/
+};
+
+/* ---------------- End object type QDGlobalsAccess ----------------- */
+
+
+static PyObject *Qd_MacSetPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ MacSetPort(port);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr port;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPort(&port);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, port);
+ return _res;
+}
+
+static PyObject *Qd_GrafDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short device;
+ if (!PyArg_ParseTuple(_args, "h",
+ &device))
+ return NULL;
+ GrafDevice(device);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr bm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ BMObj_Convert, &bm))
+ return NULL;
+ SetPortBits(bm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PortSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short width;
+ short height;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &width,
+ &height))
+ return NULL;
+ PortSize(width,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MovePortTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short leftGlobal;
+ short topGlobal;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &leftGlobal,
+ &topGlobal))
+ return NULL;
+ MovePortTo(leftGlobal,
+ topGlobal);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetOrigin(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ SetOrigin(h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ SetClip(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetClip(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ GetClip(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ClipRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ ClipRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BackPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ BackPat(pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_InitCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InitCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacSetCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Cursor *crsr__in__;
+ int crsr__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&crsr__in__, &crsr__in_len__))
+ return NULL;
+ if (crsr__in_len__ != sizeof(Cursor))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
+ goto crsr__error__;
+ }
+ MacSetCursor(crsr__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ crsr__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_HideCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HideCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacShowCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacShowCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ObscureCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ObscureCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_HidePen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ HidePen();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ShowPen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowPen();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetPen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPen(&pt);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_GetPenState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PenState pnState__out__;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPenState(&pnState__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&pnState__out__, (int)sizeof(PenState));
+ pnState__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_SetPenState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PenState *pnState__in__;
+ int pnState__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&pnState__in__, &pnState__in_len__))
+ return NULL;
+ if (pnState__in_len__ != sizeof(PenState))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
+ goto pnState__error__;
+ }
+ SetPenState(pnState__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pnState__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_PenSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short width;
+ short height;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &width,
+ &height))
+ return NULL;
+ PenSize(width,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PenMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+ if (!PyArg_ParseTuple(_args, "h",
+ &mode))
+ return NULL;
+ PenMode(mode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PenPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ PenPat(pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_PenNormal(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ PenNormal();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MoveTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ MoveTo(h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_Move(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
+ return NULL;
+ Move(dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacLineTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ MacLineTo(h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_Line(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
+ return NULL;
+ Line(dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ForeColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long color;
+ if (!PyArg_ParseTuple(_args, "l",
+ &color))
+ return NULL;
+ ForeColor(color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BackColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long color;
+ if (!PyArg_ParseTuple(_args, "l",
+ &color))
+ return NULL;
+ BackColor(color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ColorBit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short whichBit;
+ if (!PyArg_ParseTuple(_args, "h",
+ &whichBit))
+ return NULL;
+ ColorBit(whichBit);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacSetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short left;
+ short top;
+ short right;
+ short bottom;
+ if (!PyArg_ParseTuple(_args, "hhhh",
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ MacSetRect(&r,
+ left,
+ top,
+ right,
+ bottom);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_MacOffsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ MacOffsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_MacInsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ MacInsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_SectRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect src1;
+ Rect src2;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &src1,
+ PyMac_GetRect, &src2))
+ return NULL;
+ _rv = SectRect(&src1,
+ &src2,
+ &dstRect);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildRect, &dstRect);
+ return _res;
+}
+
+static PyObject *Qd_MacUnionRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect src1;
+ Rect src2;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &src1,
+ PyMac_GetRect, &src2))
+ return NULL;
+ MacUnionRect(&src1,
+ &src2,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &dstRect);
+ return _res;
+}
+
+static PyObject *Qd_MacEqualRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect rect1;
+ Rect rect2;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &rect1,
+ PyMac_GetRect, &rect2))
+ return NULL;
+ _rv = MacEqualRect(&rect1,
+ &rect2);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_EmptyRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ _rv = EmptyRect(&r);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacFrameRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ MacFrameRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ PaintRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ EraseRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacInvertRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ MacInvertRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacFillRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetRect, &r,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ MacFillRect(&r,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_FrameOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ FrameOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ PaintOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ EraseOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ InvertOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetRect, &r,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillOval(&r,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_FrameRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
+ return NULL;
+ FrameRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
+ return NULL;
+ PaintRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
+ return NULL;
+ EraseRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
+ return NULL;
+ InvertRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&hhs#",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillRoundRect(&r,
+ ovalWidth,
+ ovalHeight,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_FrameArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
+ return NULL;
+ FrameArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
+ return NULL;
+ PaintArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
+ return NULL;
+ EraseArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
+ return NULL;
+ InvertArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&hhs#",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillArc(&r,
+ startAngle,
+ arcAngle,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_NewRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = NewRgn();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_OpenRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ OpenRgn();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CloseRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ CloseRgn(dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BitMapToRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle region;
+ BitMapPtr bMap;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &region,
+ BMObj_Convert, &bMap))
+ return NULL;
+ _err = BitMapToRegion(region,
+ bMap);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DisposeRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ DisposeRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacCopyRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgn;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcRgn,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ MacCopyRgn(srcRgn,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetEmptyRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ SetEmptyRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacSetRectRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short left;
+ short top;
+ short right;
+ short bottom;
+ if (!PyArg_ParseTuple(_args, "O&hhhh",
+ ResObj_Convert, &rgn,
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ MacSetRectRgn(rgn,
+ left,
+ top,
+ right,
+ bottom);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RectRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgn,
+ PyMac_GetRect, &r))
+ return NULL;
+ RectRgn(rgn,
+ &r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacOffsetRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &rgn,
+ &dh,
+ &dv))
+ return NULL;
+ MacOffsetRgn(rgn,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InsetRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &rgn,
+ &dh,
+ &dv))
+ return NULL;
+ InsetRgn(rgn,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SectRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ SectRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacUnionRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ MacUnionRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DiffRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ DiffRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacXorRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ MacXorRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RectInRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect r;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ ResObj_Convert, &rgn))
+ return NULL;
+ _rv = RectInRgn(&r,
+ rgn);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacEqualRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RgnHandle rgnA;
+ RgnHandle rgnB;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgnA,
+ ResObj_Convert, &rgnB))
+ return NULL;
+ _rv = MacEqualRgn(rgnA,
+ rgnB);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_EmptyRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ _rv = EmptyRgn(rgn);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacFrameRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ MacFrameRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacPaintRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ MacPaintRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EraseRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ EraseRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacInvertRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ MacInvertRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacFillRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ ResObj_Convert, &rgn,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ MacFillRgn(rgn,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_ScrollRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+ RgnHandle updateRgn;
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv,
+ ResObj_Convert, &updateRgn))
+ return NULL;
+ ScrollRect(&r,
+ dh,
+ dv,
+ updateRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CopyBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr srcBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
+ return NULL;
+ CopyBits(srcBits,
+ dstBits,
+ &srcRect,
+ &dstRect,
+ mode,
+ maskRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CopyMask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr srcBits;
+ BitMapPtr maskBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect maskRect;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &maskBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &maskRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ CopyMask(srcBits,
+ maskBits,
+ dstBits,
+ &srcRect,
+ &maskRect,
+ &dstRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_OpenPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ Rect picFrame;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &picFrame))
+ return NULL;
+ _rv = OpenPicture(&picFrame);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_PicComment(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short kind;
+ short dataSize;
+ Handle dataHandle;
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &kind,
+ &dataSize,
+ ResObj_Convert, &dataHandle))
+ return NULL;
+ PicComment(kind,
+ dataSize,
+ dataHandle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ClosePicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClosePicture();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DrawPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle myPicture;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &myPicture,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ DrawPicture(myPicture,
+ &dstRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_KillPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle myPicture;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &myPicture))
+ return NULL;
+ KillPicture(myPicture);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_OpenPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = OpenPoly();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_ClosePoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClosePoly();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_KillPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ KillPoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_OffsetPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &poly,
+ &dh,
+ &dv))
+ return NULL;
+ OffsetPoly(poly,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FramePoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ FramePoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ PaintPoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ErasePoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ ErasePoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ InvertPoly(poly);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ ResObj_Convert, &poly,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillPoly(poly,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_SetPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ short h;
+ short v;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ SetPt(&pt,
+ h,
+ v);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_LocalToGlobal(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ LocalToGlobal(&pt);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_GlobalToLocal(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ GlobalToLocal(&pt);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_Random(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = Random();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacGetPixel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short h;
+ short v;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ _rv = MacGetPixel(h,
+ v);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_ScalePt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ Rect srcRect;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ ScalePt(&pt,
+ &srcRect,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_MapPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ Rect srcRect;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ MapPt(&pt,
+ &srcRect,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
+ return _res;
+}
+
+static PyObject *Qd_MapRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Rect srcRect;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetRect, &r,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ MapRect(&r,
+ &srcRect,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_MapRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ Rect srcRect;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &rgn,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ MapRgn(rgn,
+ &srcRect,
+ &dstRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MapPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ Rect srcRect;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &poly,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
+ return NULL;
+ MapPoly(poly,
+ &srcRect,
+ &dstRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_StdBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr srcBits;
+ Rect srcRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
+ return NULL;
+ StdBits(srcBits,
+ &srcRect,
+ &dstRect,
+ mode,
+ maskRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_AddPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point src;
+ Point dst;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &src,
+ PyMac_GetPoint, &dst))
+ return NULL;
+ AddPt(src,
+ &dst);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, dst);
+ return _res;
+}
+
+static PyObject *Qd_EqualPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt1;
+ Point pt2;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt1,
+ PyMac_GetPoint, &pt2))
+ return NULL;
+ _rv = EqualPt(pt1,
+ pt2);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacPtInRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &r))
+ return NULL;
+ _rv = MacPtInRect(pt,
+ &r);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_Pt2Rect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt1;
+ Point pt2;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt1,
+ PyMac_GetPoint, &pt2))
+ return NULL;
+ Pt2Rect(pt1,
+ pt2,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &dstRect);
+ return _res;
+}
+
+static PyObject *Qd_PtToAngle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Point pt;
+ short angle;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ PyMac_GetPoint, &pt))
+ return NULL;
+ PtToAngle(&r,
+ pt,
+ &angle);
+ _res = Py_BuildValue("h",
+ angle);
+ return _res;
+}
+
+static PyObject *Qd_SubPt(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point src;
+ Point dst;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &src,
+ PyMac_GetPoint, &dst))
+ return NULL;
+ SubPt(src,
+ &dst);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, dst);
+ return _res;
+}
+
+static PyObject *Qd_PtInRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt,
+ ResObj_Convert, &rgn))
+ return NULL;
+ _rv = PtInRgn(pt,
+ rgn);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_NewPixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = NewPixMap();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_DisposePixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ DisposePixMap(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CopyPixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle srcPM;
+ PixMapHandle dstPM;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcPM,
+ ResObj_Convert, &dstPM))
+ return NULL;
+ CopyPixMap(srcPM,
+ dstPM);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_NewPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = NewPixPat();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_DisposePixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pp))
+ return NULL;
+ DisposePixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_CopyPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle srcPP;
+ PixPatHandle dstPP;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcPP,
+ ResObj_Convert, &dstPP))
+ return NULL;
+ CopyPixPat(srcPP,
+ dstPP);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PenPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pp))
+ return NULL;
+ PenPixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_BackPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pp))
+ return NULL;
+ BackPixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ short patID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &patID))
+ return NULL;
+ _rv = GetPixPat(patID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_MakeRGBPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle pp;
+ RGBColor myColor;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &pp,
+ QdRGB_Convert, &myColor))
+ return NULL;
+ MakeRGBPat(pp,
+ &myColor);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCRect(&r,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCOval(&r,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCRoundRect(&r,
+ ovalWidth,
+ ovalHeight,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCArc(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCArc(&r,
+ startAngle,
+ arcAngle,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgn,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCRgn(rgn,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillCPoly(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PolyHandle poly;
+ PixPatHandle pp;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &poly,
+ ResObj_Convert, &pp))
+ return NULL;
+ FillCPoly(poly,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RGBForeColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ RGBForeColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_RGBBackColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ RGBBackColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetCPixel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+ RGBColor cPix;
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &h,
+ &v,
+ QdRGB_Convert, &cPix))
+ return NULL;
+ SetCPixel(h,
+ v,
+ &cPix);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortPix(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ SetPortPix(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetCPixel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+ RGBColor cPix;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ GetCPixel(h,
+ v,
+ &cPix);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &cPix);
+ return _res;
+}
+
+static PyObject *Qd_GetForeColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetForeColor(&color);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &color);
+ return _res;
+}
+
+static PyObject *Qd_GetBackColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetBackColor(&color);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &color);
+ return _res;
+}
+
+static PyObject *Qd_OpColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ OpColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_HiliteColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor color;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ HiliteColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DisposeCTable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle cTable;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &cTable))
+ return NULL;
+ DisposeCTable(cTable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetCTable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle _rv;
+ short ctID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &ctID))
+ return NULL;
+ _rv = GetCTable(ctID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetCCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CCrsrHandle _rv;
+ short crsrID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &crsrID))
+ return NULL;
+ _rv = GetCCursor(crsrID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetCCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CCrsrHandle cCrsr;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &cCrsr))
+ return NULL;
+ SetCCursor(cCrsr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_AllocCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ AllocCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DisposeCCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CCrsrHandle cCrsr;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &cCrsr))
+ return NULL;
+ DisposeCCursor(cCrsr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetMaxDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ Rect globalRect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &globalRect))
+ return NULL;
+ _rv = GetMaxDevice(&globalRect);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetCTSeed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCTSeed();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetDeviceList(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDeviceList();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetMainDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMainDevice();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetNextDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ GDHandle curDevice;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &curDevice))
+ return NULL;
+ _rv = GetNextDevice(curDevice);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_TestDeviceAttribute(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ GDHandle gdh;
+ short attribute;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &gdh,
+ &attribute))
+ return NULL;
+ _rv = TestDeviceAttribute(gdh,
+ attribute);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetDeviceAttribute(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle gdh;
+ short attribute;
+ Boolean value;
+ if (!PyArg_ParseTuple(_args, "O&hb",
+ ResObj_Convert, &gdh,
+ &attribute,
+ &value))
+ return NULL;
+ SetDeviceAttribute(gdh,
+ attribute,
+ value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InitGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short qdRefNum;
+ long mode;
+ GDHandle gdh;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &qdRefNum,
+ &mode,
+ ResObj_Convert, &gdh))
+ return NULL;
+ InitGDevice(qdRefNum,
+ mode,
+ gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_NewGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ short refNum;
+ long mode;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &refNum,
+ &mode))
+ return NULL;
+ _rv = NewGDevice(refNum,
+ mode);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_DisposeGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle gdh;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &gdh))
+ return NULL;
+ DisposeGDevice(gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle gd;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &gd))
+ return NULL;
+ SetGDevice(gd);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetGDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGDevice();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_Color2Index(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ RGBColor myColor;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &myColor))
+ return NULL;
+ _rv = Color2Index(&myColor);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_Index2Color(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long index;
+ RGBColor aColor;
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
+ return NULL;
+ Index2Color(index,
+ &aColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &aColor);
+ return _res;
+}
+
+static PyObject *Qd_InvertColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RGBColor myColor;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InvertColor(&myColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &myColor);
+ return _res;
+}
+
+static PyObject *Qd_RealColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RGBColor color;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
+ return NULL;
+ _rv = RealColor(&color);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetSubTable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle myColors;
+ short iTabRes;
+ CTabHandle targetTbl;
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ ResObj_Convert, &myColors,
+ &iTabRes,
+ ResObj_Convert, &targetTbl))
+ return NULL;
+ GetSubTable(myColors,
+ iTabRes,
+ targetTbl);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MakeITable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle cTabH;
+ ITabHandle iTabH;
+ short res;
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ ResObj_Convert, &cTabH,
+ ResObj_Convert, &iTabH,
+ &res))
+ return NULL;
+ MakeITable(cTabH,
+ iTabH,
+ res);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetClientID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short id;
+ if (!PyArg_ParseTuple(_args, "h",
+ &id))
+ return NULL;
+ SetClientID(id);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ProtectEntry(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short index;
+ Boolean protect;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &index,
+ &protect))
+ return NULL;
+ ProtectEntry(index,
+ protect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ReserveEntry(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short index;
+ Boolean reserve;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &index,
+ &reserve))
+ return NULL;
+ ReserveEntry(index,
+ reserve);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_QDError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = QDError();
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_CopyDeepMask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMapPtr srcBits;
+ BitMapPtr maskBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect maskRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &maskBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &maskRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
+ return NULL;
+ CopyDeepMask(srcBits,
+ maskBits,
+ dstBits,
+ &srcRect,
+ &maskRect,
+ &dstRect,
+ mode,
+ maskRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetPattern(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PatHandle _rv;
+ short patternID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &patternID))
+ return NULL;
+ _rv = GetPattern(patternID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_MacGetCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CursHandle _rv;
+ short cursorID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &cursorID))
+ return NULL;
+ _rv = MacGetCursor(cursorID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPicture(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ short pictureID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &pictureID))
+ return NULL;
+ _rv = GetPicture(pictureID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_DeltaPoint(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ Point ptA;
+ Point ptB;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &ptA,
+ PyMac_GetPoint, &ptB))
+ return NULL;
+ _rv = DeltaPoint(ptA,
+ ptB);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_ShieldCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect shieldRect;
+ Point offsetPt;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &shieldRect,
+ PyMac_GetPoint, &offsetPt))
+ return NULL;
+ ShieldCursor(&shieldRect,
+ offsetPt);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_ScreenRes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short scrnHRes;
+ short scrnVRes;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ScreenRes(&scrnHRes,
+ &scrnVRes);
+ _res = Py_BuildValue("hh",
+ scrnHRes,
+ scrnVRes);
+ return _res;
+}
+
+static PyObject *Qd_GetIndPattern(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern thePat__out__;
+ short patternListID;
+ short index;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &patternListID,
+ &index))
+ return NULL;
+ GetIndPattern(&thePat__out__,
+ patternListID,
+ index);
+ _res = Py_BuildValue("s#",
+ (char *)&thePat__out__, (int)sizeof(Pattern));
+ thePat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_SlopeFromAngle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ short angle;
+ if (!PyArg_ParseTuple(_args, "h",
+ &angle))
+ return NULL;
+ _rv = SlopeFromAngle(angle);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qd_AngleFromSlope(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Fixed slope;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &slope))
+ return NULL;
+ _rv = AngleFromSlope(slope);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortPixMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortPixMap(port);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortBitMapForCopyBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ const BitMap * _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortBitMapForCopyBits(port);
+ _res = Py_BuildValue("O&",
+ BMObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ Rect rect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ GetPortBounds(port,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *Qd_GetPortForeColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ RGBColor foreColor;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ GetPortForeColor(port,
+ &foreColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &foreColor);
+ return _res;
+}
+
+static PyObject *Qd_GetPortBackColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ RGBColor backColor;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ GetPortBackColor(port,
+ &backColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &backColor);
+ return _res;
+}
+
+static PyObject *Qd_GetPortOpColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ RGBColor opColor;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ GetPortOpColor(port,
+ &opColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &opColor);
+ return _res;
+}
+
+static PyObject *Qd_GetPortHiliteColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ RGBColor hiliteColor;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ GetPortHiliteColor(port,
+ &hiliteColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &hiliteColor);
+ return _res;
+}
+
+static PyObject *Qd_GetPortTextFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortTextFont(port);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortTextFace(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Style _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortTextFace(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortTextMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortTextMode(port);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortTextSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortTextSize(port);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortChExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortChExtra(port);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortFracHPenLocation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortFracHPenLocation(port);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortSpExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortSpExtra(port);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortPenVisibility(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortPenVisibility(port);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortVisibleRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ CGrafPtr port;
+ RgnHandle visRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &visRgn))
+ return NULL;
+ _rv = GetPortVisibleRegion(port,
+ visRgn);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortClipRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ CGrafPtr port;
+ RgnHandle clipRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &clipRgn))
+ return NULL;
+ _rv = GetPortClipRegion(port,
+ clipRgn);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortBackPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ CGrafPtr port;
+ PixPatHandle backPattern;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &backPattern))
+ return NULL;
+ _rv = GetPortBackPixPat(port,
+ backPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortPenPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ CGrafPtr port;
+ PixPatHandle penPattern;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &penPattern))
+ return NULL;
+ _rv = GetPortPenPixPat(port,
+ penPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortFillPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle _rv;
+ CGrafPtr port;
+ PixPatHandle fillPattern;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &fillPattern))
+ return NULL;
+ _rv = GetPortFillPixPat(port,
+ fillPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortPenSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ Point penSize;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ PyMac_GetPoint, &penSize))
+ return NULL;
+ GetPortPenSize(port,
+ &penSize);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, penSize);
+ return _res;
+}
+
+static PyObject *Qd_GetPortPenMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortPenMode(port);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetPortPenLocation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ Point penLocation;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ PyMac_GetPoint, &penLocation))
+ return NULL;
+ GetPortPenLocation(port,
+ &penLocation);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, penLocation);
+ return _res;
+}
+
+static PyObject *Qd_IsPortRegionBeingDefined(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = IsPortRegionBeingDefined(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_IsPortPictureBeingDefined(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = IsPortPictureBeingDefined(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Qd_IsPortOffscreen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = IsPortOffscreen(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Qd_IsPortColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = IsPortColor(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *Qd_SetPortBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ Rect rect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ PyMac_GetRect, &rect))
+ return NULL;
+ SetPortBounds(port,
+ &rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortOpColor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ RGBColor opColor;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ QdRGB_Convert, &opColor))
+ return NULL;
+ SetPortOpColor(port,
+ &opColor);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortVisibleRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ RgnHandle visRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &visRgn))
+ return NULL;
+ SetPortVisibleRegion(port,
+ visRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortClipRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ RgnHandle clipRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &clipRgn))
+ return NULL;
+ SetPortClipRegion(port,
+ clipRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortPenPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ PixPatHandle penPattern;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &penPattern))
+ return NULL;
+ SetPortPenPixPat(port,
+ penPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortBackPixPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ PixPatHandle backPattern;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ ResObj_Convert, &backPattern))
+ return NULL;
+ SetPortBackPixPat(port,
+ backPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortPenSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ Point penSize;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ PyMac_GetPoint, &penSize))
+ return NULL;
+ SetPortPenSize(port,
+ penSize);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortPenMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ SInt32 penMode;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ GrafObj_Convert, &port,
+ &penMode))
+ return NULL;
+ SetPortPenMode(port,
+ penMode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPortFracHPenLocation(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ short pnLocHFrac;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ GrafObj_Convert, &port,
+ &pnLocHFrac))
+ return NULL;
+ SetPortFracHPenLocation(port,
+ pnLocHFrac);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetPixBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pixMap;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pixMap))
+ return NULL;
+ GetPixBounds(pixMap,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *Qd_GetPixDepth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ PixMapHandle pixMap;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pixMap))
+ return NULL;
+ _rv = GetPixDepth(pixMap);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsRandomSeed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetQDGlobalsRandomSeed();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsScreenBits(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ BitMap screenBits;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsScreenBits(&screenBits);
+ _res = Py_BuildValue("O&",
+ BMObj_NewCopied, &screenBits);
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsArrow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Cursor arrow__out__;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsArrow(&arrow__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&arrow__out__, (int)sizeof(Cursor));
+ arrow__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsDarkGray(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern dkGray__out__;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsDarkGray(&dkGray__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&dkGray__out__, (int)sizeof(Pattern));
+ dkGray__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsLightGray(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern ltGray__out__;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsLightGray(&ltGray__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&ltGray__out__, (int)sizeof(Pattern));
+ ltGray__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsGray(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern gray__out__;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsGray(&gray__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&gray__out__, (int)sizeof(Pattern));
+ gray__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsBlack(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern black__out__;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsBlack(&black__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&black__out__, (int)sizeof(Pattern));
+ black__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsWhite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Pattern white__out__;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetQDGlobalsWhite(&white__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&white__out__, (int)sizeof(Pattern));
+ white__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetQDGlobalsThePort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetQDGlobalsThePort();
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetQDGlobalsRandomSeed(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long randomSeed;
+ if (!PyArg_ParseTuple(_args, "l",
+ &randomSeed))
+ return NULL;
+ SetQDGlobalsRandomSeed(randomSeed);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetQDGlobalsArrow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Cursor *arrow__in__;
+ int arrow__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&arrow__in__, &arrow__in_len__))
+ return NULL;
+ if (arrow__in_len__ != sizeof(Cursor))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
+ goto arrow__error__;
+ }
+ SetQDGlobalsArrow(arrow__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ arrow__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetRegionBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle region;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ GetRegionBounds(region,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Qd_IsRegionRectangular(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RgnHandle region;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ _rv = IsRegionRectangular(region);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Qd_CreateNewPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CreateNewPort();
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Qd_DisposePort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ DisposePort(port);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Qd_SetQDError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr err;
+ if (!PyArg_ParseTuple(_args, "h",
+ &err))
+ return NULL;
+ SetQDError(err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Qd_QDIsPortBuffered(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = QDIsPortBuffered(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_QDIsPortBufferDirty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = QDIsPortBufferDirty(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_QDFlushPortBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ RgnHandle region;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ OptResObj_Convert, &region))
+ return NULL;
+ QDFlushPortBuffer(port,
+ region);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TextFont(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short font;
+ if (!PyArg_ParseTuple(_args, "h",
+ &font))
+ return NULL;
+ TextFont(font);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TextFace(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ StyleParameter face;
+ if (!PyArg_ParseTuple(_args, "h",
+ &face))
+ return NULL;
+ TextFace(face);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TextMode(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+ if (!PyArg_ParseTuple(_args, "h",
+ &mode))
+ return NULL;
+ TextMode(mode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_TextSize(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short size;
+ if (!PyArg_ParseTuple(_args, "h",
+ &size))
+ return NULL;
+ TextSize(size);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SpaceExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed extra;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &extra))
+ return NULL;
+ SpaceExtra(extra);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DrawChar(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CharParameter ch;
+ if (!PyArg_ParseTuple(_args, "h",
+ &ch))
+ return NULL;
+ DrawChar(ch);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_DrawString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 s;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, s))
+ return NULL;
+ DrawString(s);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_MacDrawText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *textBuf__in__;
+ int textBuf__len__;
+ int textBuf__in_len__;
+ short firstByte;
+ short byteCount;
+ if (!PyArg_ParseTuple(_args, "s#hh",
+ &textBuf__in__, &textBuf__in_len__,
+ &firstByte,
+ &byteCount))
+ return NULL;
+ MacDrawText(textBuf__in__,
+ firstByte,
+ byteCount);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ textBuf__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_CharWidth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ CharParameter ch;
+ if (!PyArg_ParseTuple(_args, "h",
+ &ch))
+ return NULL;
+ _rv = CharWidth(ch);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_StringWidth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Str255 s;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, s))
+ return NULL;
+ _rv = StringWidth(s);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_TextWidth(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ char *textBuf__in__;
+ int textBuf__len__;
+ int textBuf__in_len__;
+ short firstByte;
+ short byteCount;
+ if (!PyArg_ParseTuple(_args, "s#hh",
+ &textBuf__in__, &textBuf__in_len__,
+ &firstByte,
+ &byteCount))
+ return NULL;
+ _rv = TextWidth(textBuf__in__,
+ firstByte,
+ byteCount);
+ _res = Py_BuildValue("h",
+ _rv);
+ textBuf__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetFontInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ FontInfo info;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetFontInfo(&info);
+ _res = Py_BuildValue("O&",
+ QdFI_New, &info);
+ return _res;
+}
+
+static PyObject *Qd_CharExtra(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed extra;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &extra))
+ return NULL;
+ CharExtra(extra);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr thePort;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &thePort))
+ return NULL;
+ SetPort(thePort);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_GetCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CursHandle _rv;
+ short cursorID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &cursorID))
+ return NULL;
+ _rv = GetCursor(cursorID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qd_SetCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Cursor *crsr__in__;
+ int crsr__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&crsr__in__, &crsr__in_len__))
+ return NULL;
+ if (crsr__in_len__ != sizeof(Cursor))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
+ goto crsr__error__;
+ }
+ SetCursor(crsr__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ crsr__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_ShowCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_LineTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short h;
+ short v;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ LineTo(h,
+ v);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short left;
+ short top;
+ short right;
+ short bottom;
+ if (!PyArg_ParseTuple(_args, "hhhh",
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ SetRect(&r,
+ left,
+ top,
+ right,
+ bottom);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_OffsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ OffsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_InsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ InsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_UnionRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect src1;
+ Rect src2;
+ Rect dstRect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &src1,
+ PyMac_GetRect, &src2))
+ return NULL;
+ UnionRect(&src1,
+ &src2,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &dstRect);
+ return _res;
+}
+
+static PyObject *Qd_EqualRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect rect1;
+ Rect rect2;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &rect1,
+ PyMac_GetRect, &rect2))
+ return NULL;
+ _rv = EqualRect(&rect1,
+ &rect2);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_FrameRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ FrameRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ InvertRect(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetRect, &r,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillRect(&r,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_CopyRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgn;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcRgn,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ CopyRgn(srcRgn,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_SetRectRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short left;
+ short top;
+ short right;
+ short bottom;
+ if (!PyArg_ParseTuple(_args, "O&hhhh",
+ ResObj_Convert, &rgn,
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ SetRectRgn(rgn,
+ left,
+ top,
+ right,
+ bottom);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_OffsetRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &rgn,
+ &dh,
+ &dv))
+ return NULL;
+ OffsetRgn(rgn,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_UnionRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ UnionRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_XorRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
+ return NULL;
+ XorRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_EqualRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ RgnHandle rgnA;
+ RgnHandle rgnB;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgnA,
+ ResObj_Convert, &rgnB))
+ return NULL;
+ _rv = EqualRgn(rgnA,
+ rgnB);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_FrameRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ FrameRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_PaintRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ PaintRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_InvertRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ InvertRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle rgn;
+ Pattern *pat__in__;
+ int pat__in_len__;
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ ResObj_Convert, &rgn,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillRgn(rgn,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_GetPixel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short h;
+ short v;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
+ return NULL;
+ _rv = GetPixel(h,
+ v);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_PtInRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &r))
+ return NULL;
+ _rv = PtInRect(pt,
+ &r);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qd_DrawText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *textBuf__in__;
+ int textBuf__len__;
+ int textBuf__in_len__;
+ short firstByte;
+ short byteCount;
+ if (!PyArg_ParseTuple(_args, "s#hh",
+ &textBuf__in__, &textBuf__in_len__,
+ &firstByte,
+ &byteCount))
+ return NULL;
+ DrawText(textBuf__in__,
+ firstByte,
+ byteCount);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ textBuf__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_BitMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ BitMap *ptr;
+ PyObject *source;
+ Rect bounds;
+ int rowbytes;
+ char *data;
+
+ if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
+ &bounds) )
+ return NULL;
+ data = PyString_AsString(source);
+ if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
+ return PyErr_NoMemory();
+ ptr->baseAddr = (Ptr)data;
+ ptr->rowBytes = rowbytes;
+ ptr->bounds = bounds;
+ if ( (_res = BMObj_New(ptr)) == NULL ) {
+ free(ptr);
+ return NULL;
+ }
+ ((BitMapObject *)_res)->referred_object = source;
+ Py_INCREF(source);
+ ((BitMapObject *)_res)->referred_bitmap = ptr;
+ return _res;
+
+}
+
+static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ BitMap *ptr;
+ PyObject *source;
+
+ if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
+ return NULL;
+ if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
+ PyErr_BadArgument();
+ return NULL;
+ }
+ ptr = (BitMapPtr)PyString_AsString(source);
+ if ( (_res = BMObj_New(ptr)) == NULL ) {
+ return NULL;
+ }
+ ((BitMapObject *)_res)->referred_object = source;
+ Py_INCREF(source);
+ return _res;
+
+}
+
+static PyMethodDef Qd_methods[] = {
+ {"MacSetPort", (PyCFunction)Qd_MacSetPort, 1,
+ "(GrafPtr port) -> None"},
+ {"GetPort", (PyCFunction)Qd_GetPort, 1,
+ "() -> (GrafPtr port)"},
+ {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
+ "(short device) -> None"},
+ {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
+ "(BitMapPtr bm) -> None"},
+ {"PortSize", (PyCFunction)Qd_PortSize, 1,
+ "(short width, short height) -> None"},
+ {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
+ "(short leftGlobal, short topGlobal) -> None"},
+ {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
+ "(short h, short v) -> None"},
+ {"SetClip", (PyCFunction)Qd_SetClip, 1,
+ "(RgnHandle rgn) -> None"},
+ {"GetClip", (PyCFunction)Qd_GetClip, 1,
+ "(RgnHandle rgn) -> None"},
+ {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
+ "(Rect r) -> None"},
+ {"BackPat", (PyCFunction)Qd_BackPat, 1,
+ "(Pattern pat) -> None"},
+ {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
+ "() -> None"},
+ {"MacSetCursor", (PyCFunction)Qd_MacSetCursor, 1,
+ "(Cursor crsr) -> None"},
+ {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
+ "() -> None"},
+ {"MacShowCursor", (PyCFunction)Qd_MacShowCursor, 1,
+ "() -> None"},
+ {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
+ "() -> None"},
+ {"HidePen", (PyCFunction)Qd_HidePen, 1,
+ "() -> None"},
+ {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
+ "() -> None"},
+ {"GetPen", (PyCFunction)Qd_GetPen, 1,
+ "() -> (Point pt)"},
+ {"GetPenState", (PyCFunction)Qd_GetPenState, 1,
+ "() -> (PenState pnState)"},
+ {"SetPenState", (PyCFunction)Qd_SetPenState, 1,
+ "(PenState pnState) -> None"},
+ {"PenSize", (PyCFunction)Qd_PenSize, 1,
+ "(short width, short height) -> None"},
+ {"PenMode", (PyCFunction)Qd_PenMode, 1,
+ "(short mode) -> None"},
+ {"PenPat", (PyCFunction)Qd_PenPat, 1,
+ "(Pattern pat) -> None"},
+ {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
+ "() -> None"},
+ {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
+ "(short h, short v) -> None"},
+ {"Move", (PyCFunction)Qd_Move, 1,
+ "(short dh, short dv) -> None"},
+ {"MacLineTo", (PyCFunction)Qd_MacLineTo, 1,
+ "(short h, short v) -> None"},
+ {"Line", (PyCFunction)Qd_Line, 1,
+ "(short dh, short dv) -> None"},
+ {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
+ "(long color) -> None"},
+ {"BackColor", (PyCFunction)Qd_BackColor, 1,
+ "(long color) -> None"},
+ {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
+ "(short whichBit) -> None"},
+ {"MacSetRect", (PyCFunction)Qd_MacSetRect, 1,
+ "(short left, short top, short right, short bottom) -> (Rect r)"},
+ {"MacOffsetRect", (PyCFunction)Qd_MacOffsetRect, 1,
+ "(Rect r, short dh, short dv) -> (Rect r)"},
+ {"MacInsetRect", (PyCFunction)Qd_MacInsetRect, 1,
+ "(Rect r, short dh, short dv) -> (Rect r)"},
+ {"SectRect", (PyCFunction)Qd_SectRect, 1,
+ "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
+ {"MacUnionRect", (PyCFunction)Qd_MacUnionRect, 1,
+ "(Rect src1, Rect src2) -> (Rect dstRect)"},
+ {"MacEqualRect", (PyCFunction)Qd_MacEqualRect, 1,
+ "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
+ {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
+ "(Rect r) -> (Boolean _rv)"},
+ {"MacFrameRect", (PyCFunction)Qd_MacFrameRect, 1,
+ "(Rect r) -> None"},
+ {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
+ "(Rect r) -> None"},
+ {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
+ "(Rect r) -> None"},
+ {"MacInvertRect", (PyCFunction)Qd_MacInvertRect, 1,
+ "(Rect r) -> None"},
+ {"MacFillRect", (PyCFunction)Qd_MacFillRect, 1,
+ "(Rect r, Pattern pat) -> None"},
+ {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
+ "(Rect r) -> None"},
+ {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
+ "(Rect r) -> None"},
+ {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
+ "(Rect r) -> None"},
+ {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
+ "(Rect r) -> None"},
+ {"FillOval", (PyCFunction)Qd_FillOval, 1,
+ "(Rect r, Pattern pat) -> None"},
+ {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
+ "(Rect r, short ovalWidth, short ovalHeight) -> None"},
+ {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
+ "(Rect r, short ovalWidth, short ovalHeight) -> None"},
+ {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
+ "(Rect r, short ovalWidth, short ovalHeight) -> None"},
+ {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
+ "(Rect r, short ovalWidth, short ovalHeight) -> None"},
+ {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
+ "(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None"},
+ {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
+ "(Rect r, short startAngle, short arcAngle) -> None"},
+ {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
+ "(Rect r, short startAngle, short arcAngle) -> None"},
+ {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
+ "(Rect r, short startAngle, short arcAngle) -> None"},
+ {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
+ "(Rect r, short startAngle, short arcAngle) -> None"},
+ {"FillArc", (PyCFunction)Qd_FillArc, 1,
+ "(Rect r, short startAngle, short arcAngle, Pattern pat) -> None"},
+ {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
+ "() -> None"},
+ {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
+ "(RgnHandle dstRgn) -> None"},
+ {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
+ "(RgnHandle region, BitMapPtr bMap) -> None"},
+ {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1,
+ "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
+ {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"MacSetRectRgn", (PyCFunction)Qd_MacSetRectRgn, 1,
+ "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
+ {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
+ "(RgnHandle rgn, Rect r) -> None"},
+ {"MacOffsetRgn", (PyCFunction)Qd_MacOffsetRgn, 1,
+ "(RgnHandle rgn, short dh, short dv) -> None"},
+ {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
+ "(RgnHandle rgn, short dh, short dv) -> None"},
+ {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
+ "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
+ {"MacUnionRgn", (PyCFunction)Qd_MacUnionRgn, 1,
+ "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
+ {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
+ "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
+ {"MacXorRgn", (PyCFunction)Qd_MacXorRgn, 1,
+ "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
+ {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
+ "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
+ {"MacEqualRgn", (PyCFunction)Qd_MacEqualRgn, 1,
+ "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
+ {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
+ "(RgnHandle rgn) -> (Boolean _rv)"},
+ {"MacFrameRgn", (PyCFunction)Qd_MacFrameRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"MacPaintRgn", (PyCFunction)Qd_MacPaintRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"MacInvertRgn", (PyCFunction)Qd_MacInvertRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"MacFillRgn", (PyCFunction)Qd_MacFillRgn, 1,
+ "(RgnHandle rgn, Pattern pat) -> None"},
+ {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
+ "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
+ {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
+ "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
+ {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
+ "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"},
+ {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
+ "(Rect picFrame) -> (PicHandle _rv)"},
+ {"PicComment", (PyCFunction)Qd_PicComment, 1,
+ "(short kind, short dataSize, Handle dataHandle) -> None"},
+ {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
+ "() -> None"},
+ {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
+ "(PicHandle myPicture, Rect dstRect) -> None"},
+ {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
+ "(PicHandle myPicture) -> None"},
+ {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
+ "() -> (PolyHandle _rv)"},
+ {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
+ "() -> None"},
+ {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
+ "(PolyHandle poly) -> None"},
+ {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
+ "(PolyHandle poly, short dh, short dv) -> None"},
+ {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
+ "(PolyHandle poly) -> None"},
+ {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
+ "(PolyHandle poly) -> None"},
+ {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
+ "(PolyHandle poly) -> None"},
+ {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
+ "(PolyHandle poly) -> None"},
+ {"FillPoly", (PyCFunction)Qd_FillPoly, 1,
+ "(PolyHandle poly, Pattern pat) -> None"},
+ {"SetPt", (PyCFunction)Qd_SetPt, 1,
+ "(short h, short v) -> (Point pt)"},
+ {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
+ "(Point pt) -> (Point pt)"},
+ {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
+ "(Point pt) -> (Point pt)"},
+ {"Random", (PyCFunction)Qd_Random, 1,
+ "() -> (short _rv)"},
+ {"MacGetPixel", (PyCFunction)Qd_MacGetPixel, 1,
+ "(short h, short v) -> (Boolean _rv)"},
+ {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
+ "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
+ {"MapPt", (PyCFunction)Qd_MapPt, 1,
+ "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
+ {"MapRect", (PyCFunction)Qd_MapRect, 1,
+ "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
+ {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
+ "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
+ {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
+ "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
+ {"StdBits", (PyCFunction)Qd_StdBits, 1,
+ "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
+ {"AddPt", (PyCFunction)Qd_AddPt, 1,
+ "(Point src, Point dst) -> (Point dst)"},
+ {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
+ "(Point pt1, Point pt2) -> (Boolean _rv)"},
+ {"MacPtInRect", (PyCFunction)Qd_MacPtInRect, 1,
+ "(Point pt, Rect r) -> (Boolean _rv)"},
+ {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
+ "(Point pt1, Point pt2) -> (Rect dstRect)"},
+ {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
+ "(Rect r, Point pt) -> (short angle)"},
+ {"SubPt", (PyCFunction)Qd_SubPt, 1,
+ "(Point src, Point dst) -> (Point dst)"},
+ {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
+ "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
+ {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
+ "() -> (PixMapHandle _rv)"},
+ {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
+ "(PixMapHandle pm) -> None"},
+ {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
+ "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
+ {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
+ "() -> (PixPatHandle _rv)"},
+ {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
+ "(PixPatHandle pp) -> None"},
+ {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
+ "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
+ {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
+ "(PixPatHandle pp) -> None"},
+ {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
+ "(PixPatHandle pp) -> None"},
+ {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
+ "(short patID) -> (PixPatHandle _rv)"},
+ {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
+ "(PixPatHandle pp, RGBColor myColor) -> None"},
+ {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
+ "(Rect r, PixPatHandle pp) -> None"},
+ {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
+ "(Rect r, PixPatHandle pp) -> None"},
+ {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
+ "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
+ {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
+ "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
+ {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
+ "(RgnHandle rgn, PixPatHandle pp) -> None"},
+ {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
+ "(PolyHandle poly, PixPatHandle pp) -> None"},
+ {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
+ "(RGBColor color) -> None"},
+ {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
+ "(RGBColor color) -> None"},
+ {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
+ "(short h, short v, RGBColor cPix) -> None"},
+ {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
+ "(PixMapHandle pm) -> None"},
+ {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
+ "(short h, short v) -> (RGBColor cPix)"},
+ {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
+ "() -> (RGBColor color)"},
+ {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
+ "() -> (RGBColor color)"},
+ {"OpColor", (PyCFunction)Qd_OpColor, 1,
+ "(RGBColor color) -> None"},
+ {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
+ "(RGBColor color) -> None"},
+ {"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1,
+ "(CTabHandle cTable) -> None"},
+ {"GetCTable", (PyCFunction)Qd_GetCTable, 1,
+ "(short ctID) -> (CTabHandle _rv)"},
+ {"GetCCursor", (PyCFunction)Qd_GetCCursor, 1,
+ "(short crsrID) -> (CCrsrHandle _rv)"},
+ {"SetCCursor", (PyCFunction)Qd_SetCCursor, 1,
+ "(CCrsrHandle cCrsr) -> None"},
+ {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
+ "() -> None"},
+ {"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1,
+ "(CCrsrHandle cCrsr) -> None"},
+ {"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1,
+ "(Rect globalRect) -> (GDHandle _rv)"},
+ {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
+ "() -> (long _rv)"},
+ {"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1,
+ "() -> (GDHandle _rv)"},
+ {"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1,
+ "() -> (GDHandle _rv)"},
+ {"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1,
+ "(GDHandle curDevice) -> (GDHandle _rv)"},
+ {"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1,
+ "(GDHandle gdh, short attribute) -> (Boolean _rv)"},
+ {"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1,
+ "(GDHandle gdh, short attribute, Boolean value) -> None"},
+ {"InitGDevice", (PyCFunction)Qd_InitGDevice, 1,
+ "(short qdRefNum, long mode, GDHandle gdh) -> None"},
+ {"NewGDevice", (PyCFunction)Qd_NewGDevice, 1,
+ "(short refNum, long mode) -> (GDHandle _rv)"},
+ {"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1,
+ "(GDHandle gdh) -> None"},
+ {"SetGDevice", (PyCFunction)Qd_SetGDevice, 1,
+ "(GDHandle gd) -> None"},
+ {"GetGDevice", (PyCFunction)Qd_GetGDevice, 1,
+ "() -> (GDHandle _rv)"},
+ {"Color2Index", (PyCFunction)Qd_Color2Index, 1,
+ "(RGBColor myColor) -> (long _rv)"},
+ {"Index2Color", (PyCFunction)Qd_Index2Color, 1,
+ "(long index) -> (RGBColor aColor)"},
+ {"InvertColor", (PyCFunction)Qd_InvertColor, 1,
+ "() -> (RGBColor myColor)"},
+ {"RealColor", (PyCFunction)Qd_RealColor, 1,
+ "(RGBColor color) -> (Boolean _rv)"},
+ {"GetSubTable", (PyCFunction)Qd_GetSubTable, 1,
+ "(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None"},
+ {"MakeITable", (PyCFunction)Qd_MakeITable, 1,
+ "(CTabHandle cTabH, ITabHandle iTabH, short res) -> None"},
+ {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
+ "(short id) -> None"},
+ {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
+ "(short index, Boolean protect) -> None"},
+ {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
+ "(short index, Boolean reserve) -> None"},
+ {"QDError", (PyCFunction)Qd_QDError, 1,
+ "() -> (short _rv)"},
+ {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
+ "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
+ {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
+ "(short patternID) -> (PatHandle _rv)"},
+ {"MacGetCursor", (PyCFunction)Qd_MacGetCursor, 1,
+ "(short cursorID) -> (CursHandle _rv)"},
+ {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
+ "(short pictureID) -> (PicHandle _rv)"},
+ {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
+ "(Point ptA, Point ptB) -> (long _rv)"},
+ {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
+ "(Rect shieldRect, Point offsetPt) -> None"},
+ {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
+ "() -> (short scrnHRes, short scrnVRes)"},
+ {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
+ "(short patternListID, short index) -> (Pattern thePat)"},
+ {"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
+ "(short angle) -> (Fixed _rv)"},
+ {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
+ "(Fixed slope) -> (short _rv)"},
+ {"GetPortPixMap", (PyCFunction)Qd_GetPortPixMap, 1,
+ "(CGrafPtr port) -> (PixMapHandle _rv)"},
+ {"GetPortBitMapForCopyBits", (PyCFunction)Qd_GetPortBitMapForCopyBits, 1,
+ "(CGrafPtr port) -> (const BitMap * _rv)"},
+ {"GetPortBounds", (PyCFunction)Qd_GetPortBounds, 1,
+ "(CGrafPtr port) -> (Rect rect)"},
+ {"GetPortForeColor", (PyCFunction)Qd_GetPortForeColor, 1,
+ "(CGrafPtr port) -> (RGBColor foreColor)"},
+ {"GetPortBackColor", (PyCFunction)Qd_GetPortBackColor, 1,
+ "(CGrafPtr port) -> (RGBColor backColor)"},
+ {"GetPortOpColor", (PyCFunction)Qd_GetPortOpColor, 1,
+ "(CGrafPtr port) -> (RGBColor opColor)"},
+ {"GetPortHiliteColor", (PyCFunction)Qd_GetPortHiliteColor, 1,
+ "(CGrafPtr port) -> (RGBColor hiliteColor)"},
+ {"GetPortTextFont", (PyCFunction)Qd_GetPortTextFont, 1,
+ "(CGrafPtr port) -> (short _rv)"},
+ {"GetPortTextFace", (PyCFunction)Qd_GetPortTextFace, 1,
+ "(CGrafPtr port) -> (Style _rv)"},
+ {"GetPortTextMode", (PyCFunction)Qd_GetPortTextMode, 1,
+ "(CGrafPtr port) -> (short _rv)"},
+ {"GetPortTextSize", (PyCFunction)Qd_GetPortTextSize, 1,
+ "(CGrafPtr port) -> (short _rv)"},
+ {"GetPortChExtra", (PyCFunction)Qd_GetPortChExtra, 1,
+ "(CGrafPtr port) -> (short _rv)"},
+ {"GetPortFracHPenLocation", (PyCFunction)Qd_GetPortFracHPenLocation, 1,
+ "(CGrafPtr port) -> (short _rv)"},
+ {"GetPortSpExtra", (PyCFunction)Qd_GetPortSpExtra, 1,
+ "(CGrafPtr port) -> (Fixed _rv)"},
+ {"GetPortPenVisibility", (PyCFunction)Qd_GetPortPenVisibility, 1,
+ "(CGrafPtr port) -> (short _rv)"},
+ {"GetPortVisibleRegion", (PyCFunction)Qd_GetPortVisibleRegion, 1,
+ "(CGrafPtr port, RgnHandle visRgn) -> (RgnHandle _rv)"},
+ {"GetPortClipRegion", (PyCFunction)Qd_GetPortClipRegion, 1,
+ "(CGrafPtr port, RgnHandle clipRgn) -> (RgnHandle _rv)"},
+ {"GetPortBackPixPat", (PyCFunction)Qd_GetPortBackPixPat, 1,
+ "(CGrafPtr port, PixPatHandle backPattern) -> (PixPatHandle _rv)"},
+ {"GetPortPenPixPat", (PyCFunction)Qd_GetPortPenPixPat, 1,
+ "(CGrafPtr port, PixPatHandle penPattern) -> (PixPatHandle _rv)"},
+ {"GetPortFillPixPat", (PyCFunction)Qd_GetPortFillPixPat, 1,
+ "(CGrafPtr port, PixPatHandle fillPattern) -> (PixPatHandle _rv)"},
+ {"GetPortPenSize", (PyCFunction)Qd_GetPortPenSize, 1,
+ "(CGrafPtr port, Point penSize) -> (Point penSize)"},
+ {"GetPortPenMode", (PyCFunction)Qd_GetPortPenMode, 1,
+ "(CGrafPtr port) -> (SInt32 _rv)"},
+ {"GetPortPenLocation", (PyCFunction)Qd_GetPortPenLocation, 1,
+ "(CGrafPtr port, Point penLocation) -> (Point penLocation)"},
+ {"IsPortRegionBeingDefined", (PyCFunction)Qd_IsPortRegionBeingDefined, 1,
+ "(CGrafPtr port) -> (Boolean _rv)"},
+ {"IsPortPictureBeingDefined", (PyCFunction)Qd_IsPortPictureBeingDefined, 1,
+ "(CGrafPtr port) -> (Boolean _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"IsPortOffscreen", (PyCFunction)Qd_IsPortOffscreen, 1,
+ "(CGrafPtr port) -> (Boolean _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsPortColor", (PyCFunction)Qd_IsPortColor, 1,
+ "(CGrafPtr port) -> (Boolean _rv)"},
+#endif
+ {"SetPortBounds", (PyCFunction)Qd_SetPortBounds, 1,
+ "(CGrafPtr port, Rect rect) -> None"},
+ {"SetPortOpColor", (PyCFunction)Qd_SetPortOpColor, 1,
+ "(CGrafPtr port, RGBColor opColor) -> None"},
+ {"SetPortVisibleRegion", (PyCFunction)Qd_SetPortVisibleRegion, 1,
+ "(CGrafPtr port, RgnHandle visRgn) -> None"},
+ {"SetPortClipRegion", (PyCFunction)Qd_SetPortClipRegion, 1,
+ "(CGrafPtr port, RgnHandle clipRgn) -> None"},
+ {"SetPortPenPixPat", (PyCFunction)Qd_SetPortPenPixPat, 1,
+ "(CGrafPtr port, PixPatHandle penPattern) -> None"},
+ {"SetPortBackPixPat", (PyCFunction)Qd_SetPortBackPixPat, 1,
+ "(CGrafPtr port, PixPatHandle backPattern) -> None"},
+ {"SetPortPenSize", (PyCFunction)Qd_SetPortPenSize, 1,
+ "(CGrafPtr port, Point penSize) -> None"},
+ {"SetPortPenMode", (PyCFunction)Qd_SetPortPenMode, 1,
+ "(CGrafPtr port, SInt32 penMode) -> None"},
+ {"SetPortFracHPenLocation", (PyCFunction)Qd_SetPortFracHPenLocation, 1,
+ "(CGrafPtr port, short pnLocHFrac) -> None"},
+ {"GetPixBounds", (PyCFunction)Qd_GetPixBounds, 1,
+ "(PixMapHandle pixMap) -> (Rect bounds)"},
+ {"GetPixDepth", (PyCFunction)Qd_GetPixDepth, 1,
+ "(PixMapHandle pixMap) -> (short _rv)"},
+ {"GetQDGlobalsRandomSeed", (PyCFunction)Qd_GetQDGlobalsRandomSeed, 1,
+ "() -> (long _rv)"},
+ {"GetQDGlobalsScreenBits", (PyCFunction)Qd_GetQDGlobalsScreenBits, 1,
+ "() -> (BitMap screenBits)"},
+ {"GetQDGlobalsArrow", (PyCFunction)Qd_GetQDGlobalsArrow, 1,
+ "() -> (Cursor arrow)"},
+ {"GetQDGlobalsDarkGray", (PyCFunction)Qd_GetQDGlobalsDarkGray, 1,
+ "() -> (Pattern dkGray)"},
+ {"GetQDGlobalsLightGray", (PyCFunction)Qd_GetQDGlobalsLightGray, 1,
+ "() -> (Pattern ltGray)"},
+ {"GetQDGlobalsGray", (PyCFunction)Qd_GetQDGlobalsGray, 1,
+ "() -> (Pattern gray)"},
+ {"GetQDGlobalsBlack", (PyCFunction)Qd_GetQDGlobalsBlack, 1,
+ "() -> (Pattern black)"},
+ {"GetQDGlobalsWhite", (PyCFunction)Qd_GetQDGlobalsWhite, 1,
+ "() -> (Pattern white)"},
+ {"GetQDGlobalsThePort", (PyCFunction)Qd_GetQDGlobalsThePort, 1,
+ "() -> (CGrafPtr _rv)"},
+ {"SetQDGlobalsRandomSeed", (PyCFunction)Qd_SetQDGlobalsRandomSeed, 1,
+ "(long randomSeed) -> None"},
+ {"SetQDGlobalsArrow", (PyCFunction)Qd_SetQDGlobalsArrow, 1,
+ "(Cursor arrow) -> None"},
+ {"GetRegionBounds", (PyCFunction)Qd_GetRegionBounds, 1,
+ "(RgnHandle region) -> (Rect bounds)"},
+
+#if TARGET_API_MAC_CARBON
+ {"IsRegionRectangular", (PyCFunction)Qd_IsRegionRectangular, 1,
+ "(RgnHandle region) -> (Boolean _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"CreateNewPort", (PyCFunction)Qd_CreateNewPort, 1,
+ "() -> (CGrafPtr _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"DisposePort", (PyCFunction)Qd_DisposePort, 1,
+ "(CGrafPtr port) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"SetQDError", (PyCFunction)Qd_SetQDError, 1,
+ "(OSErr err) -> None"},
+#endif
+ {"QDIsPortBuffered", (PyCFunction)Qd_QDIsPortBuffered, 1,
+ "(CGrafPtr port) -> (Boolean _rv)"},
+ {"QDIsPortBufferDirty", (PyCFunction)Qd_QDIsPortBufferDirty, 1,
+ "(CGrafPtr port) -> (Boolean _rv)"},
+ {"QDFlushPortBuffer", (PyCFunction)Qd_QDFlushPortBuffer, 1,
+ "(CGrafPtr port, RgnHandle region) -> None"},
+ {"TextFont", (PyCFunction)Qd_TextFont, 1,
+ "(short font) -> None"},
+ {"TextFace", (PyCFunction)Qd_TextFace, 1,
+ "(StyleParameter face) -> None"},
+ {"TextMode", (PyCFunction)Qd_TextMode, 1,
+ "(short mode) -> None"},
+ {"TextSize", (PyCFunction)Qd_TextSize, 1,
+ "(short size) -> None"},
+ {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
+ "(Fixed extra) -> None"},
+ {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
+ "(CharParameter ch) -> None"},
+ {"DrawString", (PyCFunction)Qd_DrawString, 1,
+ "(Str255 s) -> None"},
+ {"MacDrawText", (PyCFunction)Qd_MacDrawText, 1,
+ "(Buffer textBuf, short firstByte, short byteCount) -> None"},
+ {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
+ "(CharParameter ch) -> (short _rv)"},
+ {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
+ "(Str255 s) -> (short _rv)"},
+ {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
+ "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
+ {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
+ "() -> (FontInfo info)"},
+ {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
+ "(Fixed extra) -> None"},
+ {"SetPort", (PyCFunction)Qd_SetPort, 1,
+ "(GrafPtr thePort) -> None"},
+ {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
+ "(short cursorID) -> (CursHandle _rv)"},
+ {"SetCursor", (PyCFunction)Qd_SetCursor, 1,
+ "(Cursor crsr) -> None"},
+ {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
+ "() -> None"},
+ {"LineTo", (PyCFunction)Qd_LineTo, 1,
+ "(short h, short v) -> None"},
+ {"SetRect", (PyCFunction)Qd_SetRect, 1,
+ "(short left, short top, short right, short bottom) -> (Rect r)"},
+ {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
+ "(Rect r, short dh, short dv) -> (Rect r)"},
+ {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
+ "(Rect r, short dh, short dv) -> (Rect r)"},
+ {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
+ "(Rect src1, Rect src2) -> (Rect dstRect)"},
+ {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
+ "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
+ {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
+ "(Rect r) -> None"},
+ {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
+ "(Rect r) -> None"},
+ {"FillRect", (PyCFunction)Qd_FillRect, 1,
+ "(Rect r, Pattern pat) -> None"},
+ {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
+ "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
+ {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
+ "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
+ {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
+ "(RgnHandle rgn, short dh, short dv) -> None"},
+ {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
+ "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
+ {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
+ "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
+ {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
+ "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
+ {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
+ "(RgnHandle rgn) -> None"},
+ {"FillRgn", (PyCFunction)Qd_FillRgn, 1,
+ "(RgnHandle rgn, Pattern pat) -> None"},
+ {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
+ "(short h, short v) -> (Boolean _rv)"},
+ {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
+ "(Point pt, Rect r) -> (Boolean _rv)"},
+ {"DrawText", (PyCFunction)Qd_DrawText, 1,
+ "(Buffer textBuf, short firstByte, short byteCount) -> None"},
+ {"BitMap", (PyCFunction)Qd_BitMap, 1,
+ "Take (string, int, Rect) argument and create BitMap"},
+ {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
+ "Take string BitMap and turn into BitMap object"},
+ {NULL, NULL, 0}
+};
+
+
+
+/* Like BMObj_New, but the original bitmap data structure is copied (and
+** released when the object is released)
+*/
+PyObject *BMObj_NewCopied(BitMapPtr itself)
+{
+ BitMapObject *it;
+ BitMapPtr itself_copy;
+
+ if ((itself_copy=(BitMapPtr)malloc(sizeof(BitMap))) == NULL)
+ return PyErr_NoMemory();
+ *itself_copy = *itself;
+ it = (BitMapObject *)BMObj_New(itself_copy);
+ it->referred_bitmap = itself_copy;
+ return (PyObject *)it;
+}
+
+
+
+void init_Qd(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(BitMapPtr, BMObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BitMapPtr, BMObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafPtr, GrafObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafPtr, GrafObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColor, QdRGB_Convert);
+
+
+ m = Py_InitModule("_Qd", Qd_methods);
+ d = PyModule_GetDict(m);
+ Qd_Error = PyMac_GetOSErrException();
+ if (Qd_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Qd_Error) != 0)
+ return;
+ GrafPort_Type.ob_type = &PyType_Type;
+ Py_INCREF(&GrafPort_Type);
+ if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0)
+ Py_FatalError("can't initialize GrafPortType");
+ BitMap_Type.ob_type = &PyType_Type;
+ Py_INCREF(&BitMap_Type);
+ if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0)
+ Py_FatalError("can't initialize BitMapType");
+ QDGlobalsAccess_Type.ob_type = &PyType_Type;
+ Py_INCREF(&QDGlobalsAccess_Type);
+ if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0)
+ Py_FatalError("can't initialize QDGlobalsAccessType");
+
+ {
+ PyObject *o;
+
+ o = QDGA_New();
+ if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
+ return;
+ }
+
+
+}
+
+/* ========================= End module _Qd ========================= */
+
diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c
new file mode 100644
index 0000000..0e7162f
--- /dev/null
+++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c
@@ -0,0 +1,604 @@
+
+/* ========================= Module _Qdoffs ========================= */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <QDOffscreen.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_GWorldObj_New(GWorldPtr);
+extern int _GWorldObj_Convert(PyObject *, GWorldPtr *);
+
+#define GWorldObj_New _GWorldObj_New
+#define GWorldObj_Convert _GWorldObj_Convert
+#endif
+
+#define as_GrafPtr(gworld) ((GrafPtr)(gworld))
+
+
+static PyObject *Qdoffs_Error;
+
+/* ----------------------- Object type GWorld ----------------------- */
+
+PyTypeObject GWorld_Type;
+
+#define GWorldObj_Check(x) ((x)->ob_type == &GWorld_Type)
+
+typedef struct GWorldObject {
+ PyObject_HEAD
+ GWorldPtr ob_itself;
+} GWorldObject;
+
+PyObject *GWorldObj_New(GWorldPtr itself)
+{
+ GWorldObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(GWorldObject, &GWorld_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+GWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
+{
+ if (!GWorldObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "GWorld required");
+ return 0;
+ }
+ *p_itself = ((GWorldObject *)v)->ob_itself;
+ return 1;
+}
+
+static void GWorldObj_dealloc(GWorldObject *self)
+{
+ DisposeGWorld(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *GWorldObj_GetGWorldDevice(GWorldObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGWorldDevice(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GWorldObj_GetGWorldPixMap(GWorldObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGWorldPixMap(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *GWorldObj_as_GrafPtr(GWorldObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_GrafPtr(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef GWorldObj_methods[] = {
+ {"GetGWorldDevice", (PyCFunction)GWorldObj_GetGWorldDevice, 1,
+ "() -> (GDHandle _rv)"},
+ {"GetGWorldPixMap", (PyCFunction)GWorldObj_GetGWorldPixMap, 1,
+ "() -> (PixMapHandle _rv)"},
+ {"as_GrafPtr", (PyCFunction)GWorldObj_as_GrafPtr, 1,
+ "() -> (GrafPtr _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain GWorldObj_chain = { GWorldObj_methods, NULL };
+
+static PyObject *GWorldObj_getattr(GWorldObject *self, char *name)
+{
+ return Py_FindMethodInChain(&GWorldObj_chain, (PyObject *)self, name);
+}
+
+#define GWorldObj_setattr NULL
+
+#define GWorldObj_compare NULL
+
+#define GWorldObj_repr NULL
+
+#define GWorldObj_hash NULL
+
+PyTypeObject GWorld_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "GWorld", /*tp_name*/
+ sizeof(GWorldObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) GWorldObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) GWorldObj_getattr, /*tp_getattr*/
+ (setattrfunc) GWorldObj_setattr, /*tp_setattr*/
+ (cmpfunc) GWorldObj_compare, /*tp_compare*/
+ (reprfunc) GWorldObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) GWorldObj_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type GWorld --------------------- */
+
+
+static PyObject *Qdoffs_NewGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ QDErr _err;
+ GWorldPtr offscreenGWorld;
+ short PixelDepth;
+ Rect boundsRect;
+ CTabHandle cTable;
+ GDHandle aGDevice;
+ GWorldFlags flags;
+ if (!PyArg_ParseTuple(_args, "hO&O&O&l",
+ &PixelDepth,
+ PyMac_GetRect, &boundsRect,
+ OptResObj_Convert, &cTable,
+ OptResObj_Convert, &aGDevice,
+ &flags))
+ return NULL;
+ _err = NewGWorld(&offscreenGWorld,
+ PixelDepth,
+ &boundsRect,
+ cTable,
+ aGDevice,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ GWorldObj_New, offscreenGWorld);
+ return _res;
+}
+
+static PyObject *Qdoffs_LockPixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PixMapHandle pm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = LockPixels(pm);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_UnlockPixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ UnlockPixels(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_UpdateGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GWorldFlags _rv;
+ GWorldPtr offscreenGWorld;
+ short pixelDepth;
+ Rect boundsRect;
+ CTabHandle cTable;
+ GDHandle aGDevice;
+ GWorldFlags flags;
+ if (!PyArg_ParseTuple(_args, "hO&O&O&l",
+ &pixelDepth,
+ PyMac_GetRect, &boundsRect,
+ OptResObj_Convert, &cTable,
+ OptResObj_Convert, &aGDevice,
+ &flags))
+ return NULL;
+ _rv = UpdateGWorld(&offscreenGWorld,
+ pixelDepth,
+ &boundsRect,
+ cTable,
+ aGDevice,
+ flags);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ GWorldObj_New, offscreenGWorld);
+ return _res;
+}
+
+static PyObject *Qdoffs_GetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ GDHandle gdh;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetGWorld(&port,
+ &gdh);
+ _res = Py_BuildValue("O&O&",
+ GrafObj_New, port,
+ ResObj_New, gdh);
+ return _res;
+}
+
+static PyObject *Qdoffs_SetGWorld(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ GDHandle gdh;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ OptResObj_Convert, &gdh))
+ return NULL;
+ SetGWorld(port,
+ gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_CTabChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CTabHandle ctab;
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &ctab))
+ return NULL;
+ CTabChanged(ctab);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_PixPatChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle ppat;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &ppat))
+ return NULL;
+ PixPatChanged(ppat);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_PortChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ PortChanged(port);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_GDeviceChanged(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GDHandle gdh;
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, &gdh))
+ return NULL;
+ GDeviceChanged(gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_AllowPurgePixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ AllowPurgePixels(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_NoPurgePixels(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ NoPurgePixels(pm);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_GetPixelsState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GWorldFlags _rv;
+ PixMapHandle pm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = GetPixelsState(pm);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_SetPixelsState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle pm;
+ GWorldFlags state;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ ResObj_Convert, &pm,
+ &state))
+ return NULL;
+ SetPixelsState(pm,
+ state);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_GetPixRowBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ PixMapHandle pm;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
+ return NULL;
+ _rv = GetPixRowBytes(pm);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_NewScreenBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ QDErr _err;
+ Rect globalRect;
+ Boolean purgeable;
+ GDHandle gdh;
+ PixMapHandle offscreenPixMap;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetRect, &globalRect,
+ &purgeable))
+ return NULL;
+ _err = NewScreenBuffer(&globalRect,
+ purgeable,
+ &gdh,
+ &offscreenPixMap);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, gdh,
+ ResObj_New, offscreenPixMap);
+ return _res;
+}
+
+static PyObject *Qdoffs_DisposeScreenBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle offscreenPixMap;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &offscreenPixMap))
+ return NULL;
+ DisposeScreenBuffer(offscreenPixMap);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qdoffs_QDDone(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ GrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = QDDone(port);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_OffscreenVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = OffscreenVersion();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_NewTempScreenBuffer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ QDErr _err;
+ Rect globalRect;
+ Boolean purgeable;
+ GDHandle gdh;
+ PixMapHandle offscreenPixMap;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetRect, &globalRect,
+ &purgeable))
+ return NULL;
+ _err = NewTempScreenBuffer(&globalRect,
+ purgeable,
+ &gdh,
+ &offscreenPixMap);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, gdh,
+ ResObj_New, offscreenPixMap);
+ return _res;
+}
+
+static PyObject *Qdoffs_PixMap32Bit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ PixMapHandle pmHandle;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pmHandle))
+ return NULL;
+ _rv = PixMap32Bit(pmHandle);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qdoffs_GetPixMapBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PixMapHandle pm;
+ int from, length;
+ char *cp;
+
+ if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) )
+ return NULL;
+ cp = GetPixBaseAddr(pm)+from;
+ return PyString_FromStringAndSize(cp, length);
+
+}
+
+static PyObject *Qdoffs_PutPixMapBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ PixMapHandle pm;
+ int from, length;
+ char *cp, *icp;
+
+ if ( !PyArg_ParseTuple(_args, "O&is#", ResObj_Convert, &pm, &from, &icp, &length) )
+ return NULL;
+ cp = GetPixBaseAddr(pm)+from;
+ memcpy(cp, icp, length);
+ Py_INCREF(Py_None);
+ return Py_None;
+
+}
+
+static PyMethodDef Qdoffs_methods[] = {
+ {"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1,
+ "(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)"},
+ {"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1,
+ "(PixMapHandle pm) -> (Boolean _rv)"},
+ {"UnlockPixels", (PyCFunction)Qdoffs_UnlockPixels, 1,
+ "(PixMapHandle pm) -> None"},
+ {"UpdateGWorld", (PyCFunction)Qdoffs_UpdateGWorld, 1,
+ "(short pixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldFlags _rv, GWorldPtr offscreenGWorld)"},
+ {"GetGWorld", (PyCFunction)Qdoffs_GetGWorld, 1,
+ "() -> (CGrafPtr port, GDHandle gdh)"},
+ {"SetGWorld", (PyCFunction)Qdoffs_SetGWorld, 1,
+ "(CGrafPtr port, GDHandle gdh) -> None"},
+ {"CTabChanged", (PyCFunction)Qdoffs_CTabChanged, 1,
+ "(CTabHandle ctab) -> None"},
+ {"PixPatChanged", (PyCFunction)Qdoffs_PixPatChanged, 1,
+ "(PixPatHandle ppat) -> None"},
+ {"PortChanged", (PyCFunction)Qdoffs_PortChanged, 1,
+ "(GrafPtr port) -> None"},
+ {"GDeviceChanged", (PyCFunction)Qdoffs_GDeviceChanged, 1,
+ "(GDHandle gdh) -> None"},
+ {"AllowPurgePixels", (PyCFunction)Qdoffs_AllowPurgePixels, 1,
+ "(PixMapHandle pm) -> None"},
+ {"NoPurgePixels", (PyCFunction)Qdoffs_NoPurgePixels, 1,
+ "(PixMapHandle pm) -> None"},
+ {"GetPixelsState", (PyCFunction)Qdoffs_GetPixelsState, 1,
+ "(PixMapHandle pm) -> (GWorldFlags _rv)"},
+ {"SetPixelsState", (PyCFunction)Qdoffs_SetPixelsState, 1,
+ "(PixMapHandle pm, GWorldFlags state) -> None"},
+ {"GetPixRowBytes", (PyCFunction)Qdoffs_GetPixRowBytes, 1,
+ "(PixMapHandle pm) -> (long _rv)"},
+ {"NewScreenBuffer", (PyCFunction)Qdoffs_NewScreenBuffer, 1,
+ "(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)"},
+ {"DisposeScreenBuffer", (PyCFunction)Qdoffs_DisposeScreenBuffer, 1,
+ "(PixMapHandle offscreenPixMap) -> None"},
+ {"QDDone", (PyCFunction)Qdoffs_QDDone, 1,
+ "(GrafPtr port) -> (Boolean _rv)"},
+ {"OffscreenVersion", (PyCFunction)Qdoffs_OffscreenVersion, 1,
+ "() -> (long _rv)"},
+ {"NewTempScreenBuffer", (PyCFunction)Qdoffs_NewTempScreenBuffer, 1,
+ "(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)"},
+ {"PixMap32Bit", (PyCFunction)Qdoffs_PixMap32Bit, 1,
+ "(PixMapHandle pmHandle) -> (Boolean _rv)"},
+ {"GetPixMapBytes", (PyCFunction)Qdoffs_GetPixMapBytes, 1,
+ "(pixmap, int start, int size) -> string. Return bytes from the pixmap"},
+ {"PutPixMapBytes", (PyCFunction)Qdoffs_PutPixMapBytes, 1,
+ "(pixmap, int start, string data). Store bytes into the pixmap"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Qdoffs(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldPtr, GWorldObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert);
+
+
+ m = Py_InitModule("_Qdoffs", Qdoffs_methods);
+ d = PyModule_GetDict(m);
+ Qdoffs_Error = PyMac_GetOSErrException();
+ if (Qdoffs_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Qdoffs_Error) != 0)
+ return;
+ GWorld_Type.ob_type = &PyType_Type;
+ Py_INCREF(&GWorld_Type);
+ if (PyDict_SetItemString(d, "GWorldType", (PyObject *)&GWorld_Type) != 0)
+ Py_FatalError("can't initialize GWorldType");
+}
+
+/* ======================= End module _Qdoffs ======================= */
+
diff --git a/Mac/Modules/qt/_Qtmodule.c b/Mac/Modules/qt/_Qtmodule.c
new file mode 100644
index 0000000..d2f8f1a
--- /dev/null
+++ b/Mac/Modules/qt/_Qtmodule.c
@@ -0,0 +1,8426 @@
+
+/* =========================== Module _Qt =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Movies.h>
+#else
+/* #include <Carbon/Carbon.h> */
+#include <QuickTime/QuickTime.h>
+#endif
+
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TrackObj_New(Track);
+extern int _TrackObj_Convert(PyObject *, Track *);
+extern PyObject *_MovieObj_New(Movie);
+extern int _MovieObj_Convert(PyObject *, Movie *);
+extern PyObject *_MovieCtlObj_New(MovieController);
+extern int _MovieCtlObj_Convert(PyObject *, MovieController *);
+extern PyObject *_TimeBaseObj_New(TimeBase);
+extern int _TimeBaseObj_Convert(PyObject *, TimeBase *);
+extern PyObject *_UserDataObj_New(UserData);
+extern int _UserDataObj_Convert(PyObject *, UserData *);
+extern PyObject *_MediaObj_New(Media);
+extern int _MediaObj_Convert(PyObject *, Media *);
+
+#define TrackObj_New _TrackObj_New
+#define TrackObj_Convert _TrackObj_Convert
+#define MovieObj_New _MovieObj_New
+#define MovieObj_Convert _MovieObj_Convert
+#define MovieCtlObj_New _MovieCtlObj_New
+#define MovieCtlObj_Convert _MovieCtlObj_Convert
+#define TimeBaseObj_New _TimeBaseObj_New
+#define TimeBaseObj_Convert _TimeBaseObj_Convert
+#define UserDataObj_New _UserDataObj_New
+#define UserDataObj_Convert _UserDataObj_Convert
+#define MediaObj_New _MediaObj_New
+#define MediaObj_Convert _MediaObj_Convert
+#endif
+
+/* Macro to allow us to GetNextInterestingTime without duration */
+#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
+
+/*
+** Parse/generate time records
+*/
+static PyObject *
+QtTimeRecord_New(TimeRecord *itself)
+{
+ if (itself->base)
+ return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
+ TimeBaseObj_New, itself->base);
+ else
+ return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
+ Py_None);
+}
+
+static int
+QtTimeRecord_Convert(PyObject *v, TimeRecord *p_itself)
+{
+ PyObject *base = NULL;
+ if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
+ &base) )
+ return 0;
+ if ( base == NULL || base == Py_None )
+ p_itself->base = NULL;
+ else
+ if ( !TimeBaseObj_Convert(base, &p_itself->base) )
+ return 0;
+ return 1;
+}
+
+
+
+
+static PyObject *Qt_Error;
+
+/* ------------------ Object type MovieController ------------------- */
+
+PyTypeObject MovieController_Type;
+
+#define MovieCtlObj_Check(x) ((x)->ob_type == &MovieController_Type)
+
+typedef struct MovieControllerObject {
+ PyObject_HEAD
+ MovieController ob_itself;
+} MovieControllerObject;
+
+PyObject *MovieCtlObj_New(MovieController itself)
+{
+ MovieControllerObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create null MovieController");
+ return NULL;
+ }
+ it = PyObject_NEW(MovieControllerObject, &MovieController_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+MovieCtlObj_Convert(PyObject *v, MovieController *p_itself)
+{
+ if (!MovieCtlObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "MovieController required");
+ return 0;
+ }
+ *p_itself = ((MovieControllerObject *)v)->ob_itself;
+ return 1;
+}
+
+static void MovieCtlObj_dealloc(MovieControllerObject *self)
+{
+ DisposeMovieController(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *MovieCtlObj_MCSetMovie(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie theMovie;
+ WindowPtr movieWindow;
+ Point where;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ MovieObj_Convert, &theMovie,
+ WinObj_Convert, &movieWindow,
+ PyMac_GetPoint, &where))
+ return NULL;
+ _rv = MCSetMovie(_self->ob_itself,
+ theMovie,
+ movieWindow,
+ where);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetIndMovie(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ short index;
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _rv = MCGetIndMovie(_self->ob_itself,
+ index);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCRemoveAllMovies(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCRemoveAllMovies(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCRemoveAMovie(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie m;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &m))
+ return NULL;
+ _rv = MCRemoveAMovie(_self->ob_itself,
+ m);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCRemoveMovie(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCRemoveMovie(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCIsPlayerEvent(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ EventRecord e;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &e))
+ return NULL;
+ _rv = MCIsPlayerEvent(_self->ob_itself,
+ &e);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCDoAction(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ short action;
+ void * params;
+ if (!PyArg_ParseTuple(_args, "hs",
+ &action,
+ &params))
+ return NULL;
+ _rv = MCDoAction(_self->ob_itself,
+ action,
+ params);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetControllerAttached(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Boolean attach;
+ if (!PyArg_ParseTuple(_args, "b",
+ &attach))
+ return NULL;
+ _rv = MCSetControllerAttached(_self->ob_itself,
+ attach);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCIsControllerAttached(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCIsControllerAttached(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetControllerPort(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ CGrafPtr gp;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &gp))
+ return NULL;
+ _rv = MCSetControllerPort(_self->ob_itself,
+ gp);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetControllerPort(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetControllerPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetVisible(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Boolean visible;
+ if (!PyArg_ParseTuple(_args, "b",
+ &visible))
+ return NULL;
+ _rv = MCSetVisible(_self->ob_itself,
+ visible);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetVisible(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetVisible(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetControllerBoundsRect(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetControllerBoundsRect(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetControllerBoundsRect(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &bounds))
+ return NULL;
+ _rv = MCSetControllerBoundsRect(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetControllerBoundsRgn(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetControllerBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetWindowRgn(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ WindowPtr w;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &w))
+ return NULL;
+ _rv = MCGetWindowRgn(_self->ob_itself,
+ w);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCMovieChanged(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie m;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &m))
+ return NULL;
+ _rv = MCMovieChanged(_self->ob_itself,
+ m);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetDuration(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "l",
+ &duration))
+ return NULL;
+ _rv = MCSetDuration(_self->ob_itself,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetCurrentTime(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeScale scale;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetCurrentTime(_self->ob_itself,
+ &scale);
+ _res = Py_BuildValue("ll",
+ _rv,
+ scale);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCNewAttachedController(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie theMovie;
+ WindowPtr w;
+ Point where;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ MovieObj_Convert, &theMovie,
+ WinObj_Convert, &w,
+ PyMac_GetPoint, &where))
+ return NULL;
+ _rv = MCNewAttachedController(_self->ob_itself,
+ theMovie,
+ w,
+ where);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCDraw(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &w))
+ return NULL;
+ _rv = MCDraw(_self->ob_itself,
+ w);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCActivate(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ Boolean activate;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ WinObj_Convert, &w,
+ &activate))
+ return NULL;
+ _rv = MCActivate(_self->ob_itself,
+ w,
+ activate);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCIdle(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCIdle(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCKey(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ SInt8 key;
+ long modifiers;
+ if (!PyArg_ParseTuple(_args, "bl",
+ &key,
+ &modifiers))
+ return NULL;
+ _rv = MCKey(_self->ob_itself,
+ key,
+ modifiers);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCClick(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ Point where;
+ long when;
+ long modifiers;
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ WinObj_Convert, &w,
+ PyMac_GetPoint, &where,
+ &when,
+ &modifiers))
+ return NULL;
+ _rv = MCClick(_self->ob_itself,
+ w,
+ where,
+ when,
+ modifiers);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCEnableEditing(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Boolean enabled;
+ if (!PyArg_ParseTuple(_args, "b",
+ &enabled))
+ return NULL;
+ _rv = MCEnableEditing(_self->ob_itself,
+ enabled);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCIsEditingEnabled(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCIsEditingEnabled(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCCopy(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCCopy(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCCut(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCCut(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCPaste(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Movie srcMovie;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &srcMovie))
+ return NULL;
+ _rv = MCPaste(_self->ob_itself,
+ srcMovie);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCClear(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCClear(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCUndo(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCUndo(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCPositionController(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Rect movieRect;
+ Rect controllerRect;
+ long someFlags;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ PyMac_GetRect, &movieRect,
+ PyMac_GetRect, &controllerRect,
+ &someFlags))
+ return NULL;
+ _rv = MCPositionController(_self->ob_itself,
+ &movieRect,
+ &controllerRect,
+ someFlags);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetControllerInfo(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ long someFlags;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetControllerInfo(_self->ob_itself,
+ &someFlags);
+ _res = Py_BuildValue("ll",
+ _rv,
+ someFlags);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetClip(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ RgnHandle theClip;
+ RgnHandle movieClip;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &theClip,
+ ResObj_Convert, &movieClip))
+ return NULL;
+ _rv = MCSetClip(_self->ob_itself,
+ theClip,
+ movieClip);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetClip(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ RgnHandle theClip;
+ RgnHandle movieClip;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MCGetClip(_self->ob_itself,
+ &theClip,
+ &movieClip);
+ _res = Py_BuildValue("lO&O&",
+ _rv,
+ ResObj_New, theClip,
+ ResObj_New, movieClip);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCDrawBadge(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ RgnHandle movieRgn;
+ RgnHandle badgeRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &movieRgn))
+ return NULL;
+ _rv = MCDrawBadge(_self->ob_itself,
+ movieRgn,
+ &badgeRgn);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, badgeRgn);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCSetUpEditMenu(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ long modifiers;
+ MenuHandle mh;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &modifiers,
+ MenuObj_Convert, &mh))
+ return NULL;
+ _rv = MCSetUpEditMenu(_self->ob_itself,
+ modifiers,
+ mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetMenuString(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ long modifiers;
+ short item;
+ Str255 aString;
+ if (!PyArg_ParseTuple(_args, "lhO&",
+ &modifiers,
+ &item,
+ PyMac_GetStr255, aString))
+ return NULL;
+ _rv = MCGetMenuString(_self->ob_itself,
+ modifiers,
+ item,
+ aString);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCPtInController(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Point thePt;
+ Boolean inController;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePt))
+ return NULL;
+ _rv = MCPtInController(_self->ob_itself,
+ thePt,
+ &inController);
+ _res = Py_BuildValue("lb",
+ _rv,
+ inController);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCInvalidate(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ RgnHandle invalidRgn;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &w,
+ ResObj_Convert, &invalidRgn))
+ return NULL;
+ _rv = MCInvalidate(_self->ob_itself,
+ w,
+ invalidRgn);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCAdjustCursor(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ WindowPtr w;
+ Point where;
+ long modifiers;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ WinObj_Convert, &w,
+ PyMac_GetPoint, &where,
+ &modifiers))
+ return NULL;
+ _rv = MCAdjustCursor(_self->ob_itself,
+ w,
+ where,
+ modifiers);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieCtlObj_MCGetInterfaceElement(MovieControllerObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MCInterfaceElement whichElement;
+ void * element;
+ if (!PyArg_ParseTuple(_args, "ls",
+ &whichElement,
+ &element))
+ return NULL;
+ _rv = MCGetInterfaceElement(_self->ob_itself,
+ whichElement,
+ element);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyMethodDef MovieCtlObj_methods[] = {
+ {"MCSetMovie", (PyCFunction)MovieCtlObj_MCSetMovie, 1,
+ "(Movie theMovie, WindowPtr movieWindow, Point where) -> (ComponentResult _rv)"},
+ {"MCGetIndMovie", (PyCFunction)MovieCtlObj_MCGetIndMovie, 1,
+ "(short index) -> (Movie _rv)"},
+ {"MCRemoveAllMovies", (PyCFunction)MovieCtlObj_MCRemoveAllMovies, 1,
+ "() -> (ComponentResult _rv)"},
+ {"MCRemoveAMovie", (PyCFunction)MovieCtlObj_MCRemoveAMovie, 1,
+ "(Movie m) -> (ComponentResult _rv)"},
+ {"MCRemoveMovie", (PyCFunction)MovieCtlObj_MCRemoveMovie, 1,
+ "() -> (ComponentResult _rv)"},
+ {"MCIsPlayerEvent", (PyCFunction)MovieCtlObj_MCIsPlayerEvent, 1,
+ "(EventRecord e) -> (ComponentResult _rv)"},
+ {"MCDoAction", (PyCFunction)MovieCtlObj_MCDoAction, 1,
+ "(short action, void * params) -> (ComponentResult _rv)"},
+ {"MCSetControllerAttached", (PyCFunction)MovieCtlObj_MCSetControllerAttached, 1,
+ "(Boolean attach) -> (ComponentResult _rv)"},
+ {"MCIsControllerAttached", (PyCFunction)MovieCtlObj_MCIsControllerAttached, 1,
+ "() -> (ComponentResult _rv)"},
+ {"MCSetControllerPort", (PyCFunction)MovieCtlObj_MCSetControllerPort, 1,
+ "(CGrafPtr gp) -> (ComponentResult _rv)"},
+ {"MCGetControllerPort", (PyCFunction)MovieCtlObj_MCGetControllerPort, 1,
+ "() -> (CGrafPtr _rv)"},
+ {"MCSetVisible", (PyCFunction)MovieCtlObj_MCSetVisible, 1,
+ "(Boolean visible) -> (ComponentResult _rv)"},
+ {"MCGetVisible", (PyCFunction)MovieCtlObj_MCGetVisible, 1,
+ "() -> (ComponentResult _rv)"},
+ {"MCGetControllerBoundsRect", (PyCFunction)MovieCtlObj_MCGetControllerBoundsRect, 1,
+ "() -> (ComponentResult _rv, Rect bounds)"},
+ {"MCSetControllerBoundsRect", (PyCFunction)MovieCtlObj_MCSetControllerBoundsRect, 1,
+ "(Rect bounds) -> (ComponentResult _rv)"},
+ {"MCGetControllerBoundsRgn", (PyCFunction)MovieCtlObj_MCGetControllerBoundsRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"MCGetWindowRgn", (PyCFunction)MovieCtlObj_MCGetWindowRgn, 1,
+ "(WindowPtr w) -> (RgnHandle _rv)"},
+ {"MCMovieChanged", (PyCFunction)MovieCtlObj_MCMovieChanged, 1,
+ "(Movie m) -> (ComponentResult _rv)"},
+ {"MCSetDuration", (PyCFunction)MovieCtlObj_MCSetDuration, 1,
+ "(TimeValue duration) -> (ComponentResult _rv)"},
+ {"MCGetCurrentTime", (PyCFunction)MovieCtlObj_MCGetCurrentTime, 1,
+ "() -> (TimeValue _rv, TimeScale scale)"},
+ {"MCNewAttachedController", (PyCFunction)MovieCtlObj_MCNewAttachedController, 1,
+ "(Movie theMovie, WindowPtr w, Point where) -> (ComponentResult _rv)"},
+ {"MCDraw", (PyCFunction)MovieCtlObj_MCDraw, 1,
+ "(WindowPtr w) -> (ComponentResult _rv)"},
+ {"MCActivate", (PyCFunction)MovieCtlObj_MCActivate, 1,
+ "(WindowPtr w, Boolean activate) -> (ComponentResult _rv)"},
+ {"MCIdle", (PyCFunction)MovieCtlObj_MCIdle, 1,
+ "() -> (ComponentResult _rv)"},
+ {"MCKey", (PyCFunction)MovieCtlObj_MCKey, 1,
+ "(SInt8 key, long modifiers) -> (ComponentResult _rv)"},
+ {"MCClick", (PyCFunction)MovieCtlObj_MCClick, 1,
+ "(WindowPtr w, Point where, long when, long modifiers) -> (ComponentResult _rv)"},
+ {"MCEnableEditing", (PyCFunction)MovieCtlObj_MCEnableEditing, 1,
+ "(Boolean enabled) -> (ComponentResult _rv)"},
+ {"MCIsEditingEnabled", (PyCFunction)MovieCtlObj_MCIsEditingEnabled, 1,
+ "() -> (long _rv)"},
+ {"MCCopy", (PyCFunction)MovieCtlObj_MCCopy, 1,
+ "() -> (Movie _rv)"},
+ {"MCCut", (PyCFunction)MovieCtlObj_MCCut, 1,
+ "() -> (Movie _rv)"},
+ {"MCPaste", (PyCFunction)MovieCtlObj_MCPaste, 1,
+ "(Movie srcMovie) -> (ComponentResult _rv)"},
+ {"MCClear", (PyCFunction)MovieCtlObj_MCClear, 1,
+ "() -> (ComponentResult _rv)"},
+ {"MCUndo", (PyCFunction)MovieCtlObj_MCUndo, 1,
+ "() -> (ComponentResult _rv)"},
+ {"MCPositionController", (PyCFunction)MovieCtlObj_MCPositionController, 1,
+ "(Rect movieRect, Rect controllerRect, long someFlags) -> (ComponentResult _rv)"},
+ {"MCGetControllerInfo", (PyCFunction)MovieCtlObj_MCGetControllerInfo, 1,
+ "() -> (ComponentResult _rv, long someFlags)"},
+ {"MCSetClip", (PyCFunction)MovieCtlObj_MCSetClip, 1,
+ "(RgnHandle theClip, RgnHandle movieClip) -> (ComponentResult _rv)"},
+ {"MCGetClip", (PyCFunction)MovieCtlObj_MCGetClip, 1,
+ "() -> (ComponentResult _rv, RgnHandle theClip, RgnHandle movieClip)"},
+ {"MCDrawBadge", (PyCFunction)MovieCtlObj_MCDrawBadge, 1,
+ "(RgnHandle movieRgn) -> (ComponentResult _rv, RgnHandle badgeRgn)"},
+ {"MCSetUpEditMenu", (PyCFunction)MovieCtlObj_MCSetUpEditMenu, 1,
+ "(long modifiers, MenuHandle mh) -> (ComponentResult _rv)"},
+ {"MCGetMenuString", (PyCFunction)MovieCtlObj_MCGetMenuString, 1,
+ "(long modifiers, short item, Str255 aString) -> (ComponentResult _rv)"},
+ {"MCPtInController", (PyCFunction)MovieCtlObj_MCPtInController, 1,
+ "(Point thePt) -> (ComponentResult _rv, Boolean inController)"},
+ {"MCInvalidate", (PyCFunction)MovieCtlObj_MCInvalidate, 1,
+ "(WindowPtr w, RgnHandle invalidRgn) -> (ComponentResult _rv)"},
+ {"MCAdjustCursor", (PyCFunction)MovieCtlObj_MCAdjustCursor, 1,
+ "(WindowPtr w, Point where, long modifiers) -> (ComponentResult _rv)"},
+ {"MCGetInterfaceElement", (PyCFunction)MovieCtlObj_MCGetInterfaceElement, 1,
+ "(MCInterfaceElement whichElement, void * element) -> (ComponentResult _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain MovieCtlObj_chain = { MovieCtlObj_methods, NULL };
+
+static PyObject *MovieCtlObj_getattr(MovieControllerObject *self, char *name)
+{
+ return Py_FindMethodInChain(&MovieCtlObj_chain, (PyObject *)self, name);
+}
+
+#define MovieCtlObj_setattr NULL
+
+#define MovieCtlObj_compare NULL
+
+#define MovieCtlObj_repr NULL
+
+#define MovieCtlObj_hash NULL
+
+PyTypeObject MovieController_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "MovieController", /*tp_name*/
+ sizeof(MovieControllerObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) MovieCtlObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) MovieCtlObj_getattr, /*tp_getattr*/
+ (setattrfunc) MovieCtlObj_setattr, /*tp_setattr*/
+ (cmpfunc) MovieCtlObj_compare, /*tp_compare*/
+ (reprfunc) MovieCtlObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) MovieCtlObj_hash, /*tp_hash*/
+};
+
+/* ---------------- End object type MovieController ----------------- */
+
+
+/* ---------------------- Object type TimeBase ---------------------- */
+
+PyTypeObject TimeBase_Type;
+
+#define TimeBaseObj_Check(x) ((x)->ob_type == &TimeBase_Type)
+
+typedef struct TimeBaseObject {
+ PyObject_HEAD
+ TimeBase ob_itself;
+} TimeBaseObject;
+
+PyObject *TimeBaseObj_New(TimeBase itself)
+{
+ TimeBaseObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create null TimeBase");
+ return NULL;
+ }
+ it = PyObject_NEW(TimeBaseObject, &TimeBase_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+TimeBaseObj_Convert(PyObject *v, TimeBase *p_itself)
+{
+ if (!TimeBaseObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "TimeBase required");
+ return 0;
+ }
+ *p_itself = ((TimeBaseObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TimeBaseObj_dealloc(TimeBaseObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ PyMem_DEL(self);
+}
+
+static PyObject *TimeBaseObj_DisposeTimeBase(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisposeTimeBase(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeScale s;
+ TimeRecord tr;
+ if (!PyArg_ParseTuple(_args, "l",
+ &s))
+ return NULL;
+ _rv = GetTimeBaseTime(_self->ob_itself,
+ s,
+ &tr);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &tr);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord tr;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &tr))
+ return NULL;
+ SetTimeBaseTime(_self->ob_itself,
+ &tr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseValue(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue t;
+ TimeScale s;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &t,
+ &s))
+ return NULL;
+ SetTimeBaseValue(_self->ob_itself,
+ t,
+ s);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseRate(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseRate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseRate(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &r))
+ return NULL;
+ SetTimeBaseRate(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseStartTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeScale s;
+ TimeRecord tr;
+ if (!PyArg_ParseTuple(_args, "l",
+ &s))
+ return NULL;
+ _rv = GetTimeBaseStartTime(_self->ob_itself,
+ s,
+ &tr);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &tr);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseStartTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord tr;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &tr))
+ return NULL;
+ SetTimeBaseStartTime(_self->ob_itself,
+ &tr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseStopTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeScale s;
+ TimeRecord tr;
+ if (!PyArg_ParseTuple(_args, "l",
+ &s))
+ return NULL;
+ _rv = GetTimeBaseStopTime(_self->ob_itself,
+ s,
+ &tr);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &tr);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseStopTime(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord tr;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &tr))
+ return NULL;
+ SetTimeBaseStopTime(_self->ob_itself,
+ &tr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseFlags(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseFlags(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseFlags(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long timeBaseFlags;
+ if (!PyArg_ParseTuple(_args, "l",
+ &timeBaseFlags))
+ return NULL;
+ SetTimeBaseFlags(_self->ob_itself,
+ timeBaseFlags);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseMasterTimeBase(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase master;
+ TimeRecord slaveZero;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ TimeBaseObj_Convert, &master,
+ QtTimeRecord_Convert, &slaveZero))
+ return NULL;
+ SetTimeBaseMasterTimeBase(_self->ob_itself,
+ master,
+ &slaveZero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseMasterTimeBase(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseMasterTimeBase(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ TimeBaseObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseMasterClock(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component clockMeister;
+ TimeRecord slaveZero;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpObj_Convert, &clockMeister,
+ QtTimeRecord_Convert, &slaveZero))
+ return NULL;
+ SetTimeBaseMasterClock(_self->ob_itself,
+ clockMeister,
+ &slaveZero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseMasterClock(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentInstance _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseMasterClock(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseStatus(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ TimeRecord unpinnedTime;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseStatus(_self->ob_itself,
+ &unpinnedTime);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &unpinnedTime);
+ return _res;
+}
+
+static PyObject *TimeBaseObj_SetTimeBaseZero(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord zero;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &zero))
+ return NULL;
+ SetTimeBaseZero(_self->ob_itself,
+ &zero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TimeBaseObj_GetTimeBaseEffectiveRate(TimeBaseObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTimeBaseEffectiveRate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyMethodDef TimeBaseObj_methods[] = {
+ {"DisposeTimeBase", (PyCFunction)TimeBaseObj_DisposeTimeBase, 1,
+ "() -> None"},
+ {"GetTimeBaseTime", (PyCFunction)TimeBaseObj_GetTimeBaseTime, 1,
+ "(TimeScale s) -> (TimeValue _rv, TimeRecord tr)"},
+ {"SetTimeBaseTime", (PyCFunction)TimeBaseObj_SetTimeBaseTime, 1,
+ "(TimeRecord tr) -> None"},
+ {"SetTimeBaseValue", (PyCFunction)TimeBaseObj_SetTimeBaseValue, 1,
+ "(TimeValue t, TimeScale s) -> None"},
+ {"GetTimeBaseRate", (PyCFunction)TimeBaseObj_GetTimeBaseRate, 1,
+ "() -> (Fixed _rv)"},
+ {"SetTimeBaseRate", (PyCFunction)TimeBaseObj_SetTimeBaseRate, 1,
+ "(Fixed r) -> None"},
+ {"GetTimeBaseStartTime", (PyCFunction)TimeBaseObj_GetTimeBaseStartTime, 1,
+ "(TimeScale s) -> (TimeValue _rv, TimeRecord tr)"},
+ {"SetTimeBaseStartTime", (PyCFunction)TimeBaseObj_SetTimeBaseStartTime, 1,
+ "(TimeRecord tr) -> None"},
+ {"GetTimeBaseStopTime", (PyCFunction)TimeBaseObj_GetTimeBaseStopTime, 1,
+ "(TimeScale s) -> (TimeValue _rv, TimeRecord tr)"},
+ {"SetTimeBaseStopTime", (PyCFunction)TimeBaseObj_SetTimeBaseStopTime, 1,
+ "(TimeRecord tr) -> None"},
+ {"GetTimeBaseFlags", (PyCFunction)TimeBaseObj_GetTimeBaseFlags, 1,
+ "() -> (long _rv)"},
+ {"SetTimeBaseFlags", (PyCFunction)TimeBaseObj_SetTimeBaseFlags, 1,
+ "(long timeBaseFlags) -> None"},
+ {"SetTimeBaseMasterTimeBase", (PyCFunction)TimeBaseObj_SetTimeBaseMasterTimeBase, 1,
+ "(TimeBase master, TimeRecord slaveZero) -> None"},
+ {"GetTimeBaseMasterTimeBase", (PyCFunction)TimeBaseObj_GetTimeBaseMasterTimeBase, 1,
+ "() -> (TimeBase _rv)"},
+ {"SetTimeBaseMasterClock", (PyCFunction)TimeBaseObj_SetTimeBaseMasterClock, 1,
+ "(Component clockMeister, TimeRecord slaveZero) -> None"},
+ {"GetTimeBaseMasterClock", (PyCFunction)TimeBaseObj_GetTimeBaseMasterClock, 1,
+ "() -> (ComponentInstance _rv)"},
+ {"GetTimeBaseStatus", (PyCFunction)TimeBaseObj_GetTimeBaseStatus, 1,
+ "() -> (long _rv, TimeRecord unpinnedTime)"},
+ {"SetTimeBaseZero", (PyCFunction)TimeBaseObj_SetTimeBaseZero, 1,
+ "(TimeRecord zero) -> None"},
+ {"GetTimeBaseEffectiveRate", (PyCFunction)TimeBaseObj_GetTimeBaseEffectiveRate, 1,
+ "() -> (Fixed _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain TimeBaseObj_chain = { TimeBaseObj_methods, NULL };
+
+static PyObject *TimeBaseObj_getattr(TimeBaseObject *self, char *name)
+{
+ return Py_FindMethodInChain(&TimeBaseObj_chain, (PyObject *)self, name);
+}
+
+#define TimeBaseObj_setattr NULL
+
+#define TimeBaseObj_compare NULL
+
+#define TimeBaseObj_repr NULL
+
+#define TimeBaseObj_hash NULL
+
+PyTypeObject TimeBase_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "TimeBase", /*tp_name*/
+ sizeof(TimeBaseObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TimeBaseObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) TimeBaseObj_getattr, /*tp_getattr*/
+ (setattrfunc) TimeBaseObj_setattr, /*tp_setattr*/
+ (cmpfunc) TimeBaseObj_compare, /*tp_compare*/
+ (reprfunc) TimeBaseObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TimeBaseObj_hash, /*tp_hash*/
+};
+
+/* -------------------- End object type TimeBase -------------------- */
+
+
+/* ---------------------- Object type UserData ---------------------- */
+
+PyTypeObject UserData_Type;
+
+#define UserDataObj_Check(x) ((x)->ob_type == &UserData_Type)
+
+typedef struct UserDataObject {
+ PyObject_HEAD
+ UserData ob_itself;
+} UserDataObject;
+
+PyObject *UserDataObj_New(UserData itself)
+{
+ UserDataObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create null UserData");
+ return NULL;
+ }
+ it = PyObject_NEW(UserDataObject, &UserData_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+UserDataObj_Convert(PyObject *v, UserData *p_itself)
+{
+ if (!UserDataObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "UserData required");
+ return 0;
+ }
+ *p_itself = ((UserDataObject *)v)->ob_itself;
+ return 1;
+}
+
+static void UserDataObj_dealloc(UserDataObject *self)
+{
+ DisposeUserData(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *UserDataObj_GetUserData(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle data;
+ OSType udType;
+ long index;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &udType,
+ &index))
+ return NULL;
+ _err = GetUserData(_self->ob_itself,
+ data,
+ udType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_AddUserData(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle data;
+ OSType udType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &udType))
+ return NULL;
+ _err = AddUserData(_self->ob_itself,
+ data,
+ udType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_RemoveUserData(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType udType;
+ long index;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetOSType, &udType,
+ &index))
+ return NULL;
+ _err = RemoveUserData(_self->ob_itself,
+ udType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_CountUserDataType(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ OSType udType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &udType))
+ return NULL;
+ _rv = CountUserDataType(_self->ob_itself,
+ udType);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *UserDataObj_GetNextUserDataType(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ OSType udType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &udType))
+ return NULL;
+ _rv = GetNextUserDataType(_self->ob_itself,
+ udType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *UserDataObj_AddUserDataText(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle data;
+ OSType udType;
+ long index;
+ short itlRegionTag;
+ if (!PyArg_ParseTuple(_args, "O&O&lh",
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &udType,
+ &index,
+ &itlRegionTag))
+ return NULL;
+ _err = AddUserDataText(_self->ob_itself,
+ data,
+ udType,
+ index,
+ itlRegionTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_GetUserDataText(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle data;
+ OSType udType;
+ long index;
+ short itlRegionTag;
+ if (!PyArg_ParseTuple(_args, "O&O&lh",
+ ResObj_Convert, &data,
+ PyMac_GetOSType, &udType,
+ &index,
+ &itlRegionTag))
+ return NULL;
+ _err = GetUserDataText(_self->ob_itself,
+ data,
+ udType,
+ index,
+ itlRegionTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_RemoveUserDataText(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType udType;
+ long index;
+ short itlRegionTag;
+ if (!PyArg_ParseTuple(_args, "O&lh",
+ PyMac_GetOSType, &udType,
+ &index,
+ &itlRegionTag))
+ return NULL;
+ _err = RemoveUserDataText(_self->ob_itself,
+ udType,
+ index,
+ itlRegionTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *UserDataObj_PutUserDataIntoHandle(UserDataObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle h;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _err = PutUserDataIntoHandle(_self->ob_itself,
+ h);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef UserDataObj_methods[] = {
+ {"GetUserData", (PyCFunction)UserDataObj_GetUserData, 1,
+ "(Handle data, OSType udType, long index) -> None"},
+ {"AddUserData", (PyCFunction)UserDataObj_AddUserData, 1,
+ "(Handle data, OSType udType) -> None"},
+ {"RemoveUserData", (PyCFunction)UserDataObj_RemoveUserData, 1,
+ "(OSType udType, long index) -> None"},
+ {"CountUserDataType", (PyCFunction)UserDataObj_CountUserDataType, 1,
+ "(OSType udType) -> (short _rv)"},
+ {"GetNextUserDataType", (PyCFunction)UserDataObj_GetNextUserDataType, 1,
+ "(OSType udType) -> (long _rv)"},
+ {"AddUserDataText", (PyCFunction)UserDataObj_AddUserDataText, 1,
+ "(Handle data, OSType udType, long index, short itlRegionTag) -> None"},
+ {"GetUserDataText", (PyCFunction)UserDataObj_GetUserDataText, 1,
+ "(Handle data, OSType udType, long index, short itlRegionTag) -> None"},
+ {"RemoveUserDataText", (PyCFunction)UserDataObj_RemoveUserDataText, 1,
+ "(OSType udType, long index, short itlRegionTag) -> None"},
+ {"PutUserDataIntoHandle", (PyCFunction)UserDataObj_PutUserDataIntoHandle, 1,
+ "(Handle h) -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain UserDataObj_chain = { UserDataObj_methods, NULL };
+
+static PyObject *UserDataObj_getattr(UserDataObject *self, char *name)
+{
+ return Py_FindMethodInChain(&UserDataObj_chain, (PyObject *)self, name);
+}
+
+#define UserDataObj_setattr NULL
+
+#define UserDataObj_compare NULL
+
+#define UserDataObj_repr NULL
+
+#define UserDataObj_hash NULL
+
+PyTypeObject UserData_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "UserData", /*tp_name*/
+ sizeof(UserDataObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) UserDataObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) UserDataObj_getattr, /*tp_getattr*/
+ (setattrfunc) UserDataObj_setattr, /*tp_setattr*/
+ (cmpfunc) UserDataObj_compare, /*tp_compare*/
+ (reprfunc) UserDataObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) UserDataObj_hash, /*tp_hash*/
+};
+
+/* -------------------- End object type UserData -------------------- */
+
+
+/* ----------------------- Object type Media ------------------------ */
+
+PyTypeObject Media_Type;
+
+#define MediaObj_Check(x) ((x)->ob_type == &Media_Type)
+
+typedef struct MediaObject {
+ PyObject_HEAD
+ Media ob_itself;
+} MediaObject;
+
+PyObject *MediaObj_New(Media itself)
+{
+ MediaObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create null Media");
+ return NULL;
+ }
+ it = PyObject_NEW(MediaObject, &Media_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+MediaObj_Convert(PyObject *v, Media *p_itself)
+{
+ if (!MediaObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Media required");
+ return 0;
+ }
+ *p_itself = ((MediaObject *)v)->ob_itself;
+ return 1;
+}
+
+static void MediaObj_dealloc(MediaObject *self)
+{
+ DisposeTrackMedia(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *MediaObj_LoadMediaIntoRam(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ TimeValue duration;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "lll",
+ &time,
+ &duration,
+ &flags))
+ return NULL;
+ _err = LoadMediaIntoRam(_self->ob_itself,
+ time,
+ duration,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaTrack(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaTrack(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaCreationTime(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaCreationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaModificationTime(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaModificationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaTimeScale(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeScale _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaTimeScale(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaTimeScale(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeScale timeScale;
+ if (!PyArg_ParseTuple(_args, "l",
+ &timeScale))
+ return NULL;
+ SetMediaTimeScale(_self->ob_itself,
+ timeScale);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDuration(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaDuration(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaLanguage(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaLanguage(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaLanguage(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short language;
+ if (!PyArg_ParseTuple(_args, "h",
+ &language))
+ return NULL;
+ SetMediaLanguage(_self->ob_itself,
+ language);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaQuality(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaQuality(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaQuality(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short quality;
+ if (!PyArg_ParseTuple(_args, "h",
+ &quality))
+ return NULL;
+ SetMediaQuality(_self->ob_itself,
+ quality);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaHandlerDescription(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSType mediaType;
+ Str255 creatorName;
+ OSType creatorManufacturer;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, creatorName))
+ return NULL;
+ GetMediaHandlerDescription(_self->ob_itself,
+ &mediaType,
+ creatorName,
+ &creatorManufacturer);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildOSType, mediaType,
+ PyMac_BuildOSType, creatorManufacturer);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaUserData(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UserData _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaUserData(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaHandler(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MediaHandler _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaHandler(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaHandler(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ MediaHandlerComponent mH;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpObj_Convert, &mH))
+ return NULL;
+ _err = SetMediaHandler(_self->ob_itself,
+ mH);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_BeginMediaEdits(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = BeginMediaEdits(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_EndMediaEdits(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EndMediaEdits(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaDefaultDataRefIndex(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _err = SetMediaDefaultDataRefIndex(_self->ob_itself,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataHandlerDescription(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short index;
+ OSType dhType;
+ Str255 creatorName;
+ OSType creatorManufacturer;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &index,
+ PyMac_GetStr255, creatorName))
+ return NULL;
+ GetMediaDataHandlerDescription(_self->ob_itself,
+ index,
+ &dhType,
+ creatorName,
+ &creatorManufacturer);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildOSType, dhType,
+ PyMac_BuildOSType, creatorManufacturer);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataHandler(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ DataHandler _rv;
+ short index;
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _rv = GetMediaDataHandler(_self->ob_itself,
+ index);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaDataHandler(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ DataHandlerComponent dataHandler;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &index,
+ CmpObj_Convert, &dataHandler))
+ return NULL;
+ _err = SetMediaDataHandler(_self->ob_itself,
+ index,
+ dataHandler);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSampleDescriptionCount(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaSampleDescriptionCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSampleDescription(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long index;
+ SampleDescriptionHandle descH;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &index,
+ ResObj_Convert, &descH))
+ return NULL;
+ GetMediaSampleDescription(_self->ob_itself,
+ index,
+ descH);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaSampleDescription(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long index;
+ SampleDescriptionHandle descH;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &index,
+ ResObj_Convert, &descH))
+ return NULL;
+ _err = SetMediaSampleDescription(_self->ob_itself,
+ index,
+ descH);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSampleCount(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaSampleCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSyncSampleCount(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMediaSyncSampleCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_SampleNumToMediaTime(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long logicalSampleNum;
+ TimeValue sampleTime;
+ TimeValue sampleDuration;
+ if (!PyArg_ParseTuple(_args, "l",
+ &logicalSampleNum))
+ return NULL;
+ SampleNumToMediaTime(_self->ob_itself,
+ logicalSampleNum,
+ &sampleTime,
+ &sampleDuration);
+ _res = Py_BuildValue("ll",
+ sampleTime,
+ sampleDuration);
+ return _res;
+}
+
+static PyObject *MediaObj_MediaTimeToSampleNum(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue time;
+ long sampleNum;
+ TimeValue sampleTime;
+ TimeValue sampleDuration;
+ if (!PyArg_ParseTuple(_args, "l",
+ &time))
+ return NULL;
+ MediaTimeToSampleNum(_self->ob_itself,
+ time,
+ &sampleNum,
+ &sampleTime,
+ &sampleDuration);
+ _res = Py_BuildValue("lll",
+ sampleNum,
+ sampleTime,
+ sampleDuration);
+ return _res;
+}
+
+static PyObject *MediaObj_AddMediaSample(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataIn;
+ long inOffset;
+ unsigned long size;
+ TimeValue durationPerSample;
+ SampleDescriptionHandle sampleDescriptionH;
+ long numberOfSamples;
+ short sampleFlags;
+ TimeValue sampleTime;
+ if (!PyArg_ParseTuple(_args, "O&lllO&lh",
+ ResObj_Convert, &dataIn,
+ &inOffset,
+ &size,
+ &durationPerSample,
+ ResObj_Convert, &sampleDescriptionH,
+ &numberOfSamples,
+ &sampleFlags))
+ return NULL;
+ _err = AddMediaSample(_self->ob_itself,
+ dataIn,
+ inOffset,
+ size,
+ durationPerSample,
+ sampleDescriptionH,
+ numberOfSamples,
+ sampleFlags,
+ &sampleTime);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ sampleTime);
+ return _res;
+}
+
+static PyObject *MediaObj_AddMediaSampleReference(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long dataOffset;
+ unsigned long size;
+ TimeValue durationPerSample;
+ SampleDescriptionHandle sampleDescriptionH;
+ long numberOfSamples;
+ short sampleFlags;
+ TimeValue sampleTime;
+ if (!PyArg_ParseTuple(_args, "lllO&lh",
+ &dataOffset,
+ &size,
+ &durationPerSample,
+ ResObj_Convert, &sampleDescriptionH,
+ &numberOfSamples,
+ &sampleFlags))
+ return NULL;
+ _err = AddMediaSampleReference(_self->ob_itself,
+ dataOffset,
+ size,
+ durationPerSample,
+ sampleDescriptionH,
+ numberOfSamples,
+ sampleFlags,
+ &sampleTime);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ sampleTime);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSample(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataOut;
+ long maxSizeToGrow;
+ long size;
+ TimeValue time;
+ TimeValue sampleTime;
+ TimeValue durationPerSample;
+ SampleDescriptionHandle sampleDescriptionH;
+ long sampleDescriptionIndex;
+ long maxNumberOfSamples;
+ long numberOfSamples;
+ short sampleFlags;
+ if (!PyArg_ParseTuple(_args, "O&llO&l",
+ ResObj_Convert, &dataOut,
+ &maxSizeToGrow,
+ &time,
+ ResObj_Convert, &sampleDescriptionH,
+ &maxNumberOfSamples))
+ return NULL;
+ _err = GetMediaSample(_self->ob_itself,
+ dataOut,
+ maxSizeToGrow,
+ &size,
+ time,
+ &sampleTime,
+ &durationPerSample,
+ sampleDescriptionH,
+ &sampleDescriptionIndex,
+ maxNumberOfSamples,
+ &numberOfSamples,
+ &sampleFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("lllllh",
+ size,
+ sampleTime,
+ durationPerSample,
+ sampleDescriptionIndex,
+ numberOfSamples,
+ sampleFlags);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaSampleReference(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long dataOffset;
+ long size;
+ TimeValue time;
+ TimeValue sampleTime;
+ TimeValue durationPerSample;
+ SampleDescriptionHandle sampleDescriptionH;
+ long sampleDescriptionIndex;
+ long maxNumberOfSamples;
+ long numberOfSamples;
+ short sampleFlags;
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &time,
+ ResObj_Convert, &sampleDescriptionH,
+ &maxNumberOfSamples))
+ return NULL;
+ _err = GetMediaSampleReference(_self->ob_itself,
+ &dataOffset,
+ &size,
+ time,
+ &sampleTime,
+ &durationPerSample,
+ sampleDescriptionH,
+ &sampleDescriptionIndex,
+ maxNumberOfSamples,
+ &numberOfSamples,
+ &sampleFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("llllllh",
+ dataOffset,
+ size,
+ sampleTime,
+ durationPerSample,
+ sampleDescriptionIndex,
+ numberOfSamples,
+ sampleFlags);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaPreferredChunkSize(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long maxChunkSize;
+ if (!PyArg_ParseTuple(_args, "l",
+ &maxChunkSize))
+ return NULL;
+ _err = SetMediaPreferredChunkSize(_self->ob_itself,
+ maxChunkSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaPreferredChunkSize(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long maxChunkSize;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMediaPreferredChunkSize(_self->ob_itself,
+ &maxChunkSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ maxChunkSize);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaShadowSync(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long frameDiffSampleNum;
+ long syncSampleNum;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &frameDiffSampleNum,
+ &syncSampleNum))
+ return NULL;
+ _err = SetMediaShadowSync(_self->ob_itself,
+ frameDiffSampleNum,
+ syncSampleNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaShadowSync(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long frameDiffSampleNum;
+ long syncSampleNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &frameDiffSampleNum))
+ return NULL;
+ _err = GetMediaShadowSync(_self->ob_itself,
+ frameDiffSampleNum,
+ &syncSampleNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ syncSampleNum);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataSize(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ TimeValue startTime;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = GetMediaDataSize(_self->ob_itself,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataSize64(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+ wide dataSize;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = GetMediaDataSize64(_self->ob_itself,
+ startTime,
+ duration,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, dataSize);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaNextInterestingTime(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short interestingTimeFlags;
+ TimeValue time;
+ Fixed rate;
+ TimeValue interestingTime;
+ TimeValue interestingDuration;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &interestingTimeFlags,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ GetMediaNextInterestingTime(_self->ob_itself,
+ interestingTimeFlags,
+ time,
+ rate,
+ &interestingTime,
+ &interestingDuration);
+ _res = Py_BuildValue("ll",
+ interestingTime,
+ interestingDuration);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataRef(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ Handle dataRef;
+ OSType dataRefType;
+ long dataRefAttributes;
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ _err = GetMediaDataRef(_self->ob_itself,
+ index,
+ &dataRef,
+ &dataRefType,
+ &dataRefAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&l",
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType,
+ dataRefAttributes);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaDataRef(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ Handle dataRef;
+ OSType dataRefType;
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &index,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = SetMediaDataRef(_self->ob_itself,
+ index,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaDataRefAttributes(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ long dataRefAttributes;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &index,
+ &dataRefAttributes))
+ return NULL;
+ _err = SetMediaDataRefAttributes(_self->ob_itself,
+ index,
+ dataRefAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_AddMediaDataRef(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short index;
+ Handle dataRef;
+ OSType dataRefType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = AddMediaDataRef(_self->ob_itself,
+ &index,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ index);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaDataRefCount(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short count;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMediaDataRefCount(_self->ob_itself,
+ &count);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ count);
+ return _res;
+}
+
+static PyObject *MediaObj_SetMediaPlayHints(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long flags;
+ long flagsMask;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &flags,
+ &flagsMask))
+ return NULL;
+ SetMediaPlayHints(_self->ob_itself,
+ flags,
+ flagsMask);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaPlayHints(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long flags;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMediaPlayHints(_self->ob_itself,
+ &flags);
+ _res = Py_BuildValue("l",
+ flags);
+ return _res;
+}
+
+static PyObject *MediaObj_GetMediaNextInterestingTimeOnly(MediaObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short interestingTimeFlags;
+ TimeValue time;
+ Fixed rate;
+ TimeValue interestingTime;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &interestingTimeFlags,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ GetMediaNextInterestingTimeOnly(_self->ob_itself,
+ interestingTimeFlags,
+ time,
+ rate,
+ &interestingTime);
+ _res = Py_BuildValue("l",
+ interestingTime);
+ return _res;
+}
+
+static PyMethodDef MediaObj_methods[] = {
+ {"LoadMediaIntoRam", (PyCFunction)MediaObj_LoadMediaIntoRam, 1,
+ "(TimeValue time, TimeValue duration, long flags) -> None"},
+ {"GetMediaTrack", (PyCFunction)MediaObj_GetMediaTrack, 1,
+ "() -> (Track _rv)"},
+ {"GetMediaCreationTime", (PyCFunction)MediaObj_GetMediaCreationTime, 1,
+ "() -> (unsigned long _rv)"},
+ {"GetMediaModificationTime", (PyCFunction)MediaObj_GetMediaModificationTime, 1,
+ "() -> (unsigned long _rv)"},
+ {"GetMediaTimeScale", (PyCFunction)MediaObj_GetMediaTimeScale, 1,
+ "() -> (TimeScale _rv)"},
+ {"SetMediaTimeScale", (PyCFunction)MediaObj_SetMediaTimeScale, 1,
+ "(TimeScale timeScale) -> None"},
+ {"GetMediaDuration", (PyCFunction)MediaObj_GetMediaDuration, 1,
+ "() -> (TimeValue _rv)"},
+ {"GetMediaLanguage", (PyCFunction)MediaObj_GetMediaLanguage, 1,
+ "() -> (short _rv)"},
+ {"SetMediaLanguage", (PyCFunction)MediaObj_SetMediaLanguage, 1,
+ "(short language) -> None"},
+ {"GetMediaQuality", (PyCFunction)MediaObj_GetMediaQuality, 1,
+ "() -> (short _rv)"},
+ {"SetMediaQuality", (PyCFunction)MediaObj_SetMediaQuality, 1,
+ "(short quality) -> None"},
+ {"GetMediaHandlerDescription", (PyCFunction)MediaObj_GetMediaHandlerDescription, 1,
+ "(Str255 creatorName) -> (OSType mediaType, OSType creatorManufacturer)"},
+ {"GetMediaUserData", (PyCFunction)MediaObj_GetMediaUserData, 1,
+ "() -> (UserData _rv)"},
+ {"GetMediaHandler", (PyCFunction)MediaObj_GetMediaHandler, 1,
+ "() -> (MediaHandler _rv)"},
+ {"SetMediaHandler", (PyCFunction)MediaObj_SetMediaHandler, 1,
+ "(MediaHandlerComponent mH) -> None"},
+ {"BeginMediaEdits", (PyCFunction)MediaObj_BeginMediaEdits, 1,
+ "() -> None"},
+ {"EndMediaEdits", (PyCFunction)MediaObj_EndMediaEdits, 1,
+ "() -> None"},
+ {"SetMediaDefaultDataRefIndex", (PyCFunction)MediaObj_SetMediaDefaultDataRefIndex, 1,
+ "(short index) -> None"},
+ {"GetMediaDataHandlerDescription", (PyCFunction)MediaObj_GetMediaDataHandlerDescription, 1,
+ "(short index, Str255 creatorName) -> (OSType dhType, OSType creatorManufacturer)"},
+ {"GetMediaDataHandler", (PyCFunction)MediaObj_GetMediaDataHandler, 1,
+ "(short index) -> (DataHandler _rv)"},
+ {"SetMediaDataHandler", (PyCFunction)MediaObj_SetMediaDataHandler, 1,
+ "(short index, DataHandlerComponent dataHandler) -> None"},
+ {"GetMediaSampleDescriptionCount", (PyCFunction)MediaObj_GetMediaSampleDescriptionCount, 1,
+ "() -> (long _rv)"},
+ {"GetMediaSampleDescription", (PyCFunction)MediaObj_GetMediaSampleDescription, 1,
+ "(long index, SampleDescriptionHandle descH) -> None"},
+ {"SetMediaSampleDescription", (PyCFunction)MediaObj_SetMediaSampleDescription, 1,
+ "(long index, SampleDescriptionHandle descH) -> None"},
+ {"GetMediaSampleCount", (PyCFunction)MediaObj_GetMediaSampleCount, 1,
+ "() -> (long _rv)"},
+ {"GetMediaSyncSampleCount", (PyCFunction)MediaObj_GetMediaSyncSampleCount, 1,
+ "() -> (long _rv)"},
+ {"SampleNumToMediaTime", (PyCFunction)MediaObj_SampleNumToMediaTime, 1,
+ "(long logicalSampleNum) -> (TimeValue sampleTime, TimeValue sampleDuration)"},
+ {"MediaTimeToSampleNum", (PyCFunction)MediaObj_MediaTimeToSampleNum, 1,
+ "(TimeValue time) -> (long sampleNum, TimeValue sampleTime, TimeValue sampleDuration)"},
+ {"AddMediaSample", (PyCFunction)MediaObj_AddMediaSample, 1,
+ "(Handle dataIn, long inOffset, unsigned long size, TimeValue durationPerSample, SampleDescriptionHandle sampleDescriptionH, long numberOfSamples, short sampleFlags) -> (TimeValue sampleTime)"},
+ {"AddMediaSampleReference", (PyCFunction)MediaObj_AddMediaSampleReference, 1,
+ "(long dataOffset, unsigned long size, TimeValue durationPerSample, SampleDescriptionHandle sampleDescriptionH, long numberOfSamples, short sampleFlags) -> (TimeValue sampleTime)"},
+ {"GetMediaSample", (PyCFunction)MediaObj_GetMediaSample, 1,
+ "(Handle dataOut, long maxSizeToGrow, TimeValue time, SampleDescriptionHandle sampleDescriptionH, long maxNumberOfSamples) -> (long size, TimeValue sampleTime, TimeValue durationPerSample, long sampleDescriptionIndex, long numberOfSamples, short sampleFlags)"},
+ {"GetMediaSampleReference", (PyCFunction)MediaObj_GetMediaSampleReference, 1,
+ "(TimeValue time, SampleDescriptionHandle sampleDescriptionH, long maxNumberOfSamples) -> (long dataOffset, long size, TimeValue sampleTime, TimeValue durationPerSample, long sampleDescriptionIndex, long numberOfSamples, short sampleFlags)"},
+ {"SetMediaPreferredChunkSize", (PyCFunction)MediaObj_SetMediaPreferredChunkSize, 1,
+ "(long maxChunkSize) -> None"},
+ {"GetMediaPreferredChunkSize", (PyCFunction)MediaObj_GetMediaPreferredChunkSize, 1,
+ "() -> (long maxChunkSize)"},
+ {"SetMediaShadowSync", (PyCFunction)MediaObj_SetMediaShadowSync, 1,
+ "(long frameDiffSampleNum, long syncSampleNum) -> None"},
+ {"GetMediaShadowSync", (PyCFunction)MediaObj_GetMediaShadowSync, 1,
+ "(long frameDiffSampleNum) -> (long syncSampleNum)"},
+ {"GetMediaDataSize", (PyCFunction)MediaObj_GetMediaDataSize, 1,
+ "(TimeValue startTime, TimeValue duration) -> (long _rv)"},
+ {"GetMediaDataSize64", (PyCFunction)MediaObj_GetMediaDataSize64, 1,
+ "(TimeValue startTime, TimeValue duration) -> (wide dataSize)"},
+ {"GetMediaNextInterestingTime", (PyCFunction)MediaObj_GetMediaNextInterestingTime, 1,
+ "(short interestingTimeFlags, TimeValue time, Fixed rate) -> (TimeValue interestingTime, TimeValue interestingDuration)"},
+ {"GetMediaDataRef", (PyCFunction)MediaObj_GetMediaDataRef, 1,
+ "(short index) -> (Handle dataRef, OSType dataRefType, long dataRefAttributes)"},
+ {"SetMediaDataRef", (PyCFunction)MediaObj_SetMediaDataRef, 1,
+ "(short index, Handle dataRef, OSType dataRefType) -> None"},
+ {"SetMediaDataRefAttributes", (PyCFunction)MediaObj_SetMediaDataRefAttributes, 1,
+ "(short index, long dataRefAttributes) -> None"},
+ {"AddMediaDataRef", (PyCFunction)MediaObj_AddMediaDataRef, 1,
+ "(Handle dataRef, OSType dataRefType) -> (short index)"},
+ {"GetMediaDataRefCount", (PyCFunction)MediaObj_GetMediaDataRefCount, 1,
+ "() -> (short count)"},
+ {"SetMediaPlayHints", (PyCFunction)MediaObj_SetMediaPlayHints, 1,
+ "(long flags, long flagsMask) -> None"},
+ {"GetMediaPlayHints", (PyCFunction)MediaObj_GetMediaPlayHints, 1,
+ "() -> (long flags)"},
+ {"GetMediaNextInterestingTimeOnly", (PyCFunction)MediaObj_GetMediaNextInterestingTimeOnly, 1,
+ "(short interestingTimeFlags, TimeValue time, Fixed rate) -> (TimeValue interestingTime)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain MediaObj_chain = { MediaObj_methods, NULL };
+
+static PyObject *MediaObj_getattr(MediaObject *self, char *name)
+{
+ return Py_FindMethodInChain(&MediaObj_chain, (PyObject *)self, name);
+}
+
+#define MediaObj_setattr NULL
+
+#define MediaObj_compare NULL
+
+#define MediaObj_repr NULL
+
+#define MediaObj_hash NULL
+
+PyTypeObject Media_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Media", /*tp_name*/
+ sizeof(MediaObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) MediaObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) MediaObj_getattr, /*tp_getattr*/
+ (setattrfunc) MediaObj_setattr, /*tp_setattr*/
+ (cmpfunc) MediaObj_compare, /*tp_compare*/
+ (reprfunc) MediaObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) MediaObj_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type Media ---------------------- */
+
+
+/* ----------------------- Object type Track ------------------------ */
+
+PyTypeObject Track_Type;
+
+#define TrackObj_Check(x) ((x)->ob_type == &Track_Type)
+
+typedef struct TrackObject {
+ PyObject_HEAD
+ Track ob_itself;
+} TrackObject;
+
+PyObject *TrackObj_New(Track itself)
+{
+ TrackObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create null Track");
+ return NULL;
+ }
+ it = PyObject_NEW(TrackObject, &Track_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+TrackObj_Convert(PyObject *v, Track *p_itself)
+{
+ if (!TrackObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Track required");
+ return 0;
+ }
+ *p_itself = ((TrackObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TrackObj_dealloc(TrackObject *self)
+{
+ DisposeMovieTrack(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *TrackObj_LoadTrackIntoRam(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ TimeValue duration;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "lll",
+ &time,
+ &duration,
+ &flags))
+ return NULL;
+ _err = LoadTrackIntoRam(_self->ob_itself,
+ time,
+ duration,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackPict(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ TimeValue time;
+ if (!PyArg_ParseTuple(_args, "l",
+ &time))
+ return NULL;
+ _rv = GetTrackPict(_self->ob_itself,
+ time);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackClipRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackClipRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackClipRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle theClip;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theClip))
+ return NULL;
+ SetTrackClipRgn(_self->ob_itself,
+ theClip);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDisplayBoundsRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackDisplayBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackMovieBoundsRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackMovieBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackBoundsRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackMatte(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackMatte(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackMatte(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle theMatte;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theMatte))
+ return NULL;
+ SetTrackMatte(_self->ob_itself,
+ theMatte);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackID(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackID(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackMovie(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackMovie(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackCreationTime(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackCreationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackModificationTime(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackModificationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackEnabled(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackEnabled(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackEnabled(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean isEnabled;
+ if (!PyArg_ParseTuple(_args, "b",
+ &isEnabled))
+ return NULL;
+ SetTrackEnabled(_self->ob_itself,
+ isEnabled);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackUsage(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackUsage(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackUsage(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long usage;
+ if (!PyArg_ParseTuple(_args, "l",
+ &usage))
+ return NULL;
+ SetTrackUsage(_self->ob_itself,
+ usage);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDuration(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackDuration(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackOffset(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackOffset(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackOffset(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue movieOffsetTime;
+ if (!PyArg_ParseTuple(_args, "l",
+ &movieOffsetTime))
+ return NULL;
+ SetTrackOffset(_self->ob_itself,
+ movieOffsetTime);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackLayer(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackLayer(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackLayer(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short layer;
+ if (!PyArg_ParseTuple(_args, "h",
+ &layer))
+ return NULL;
+ SetTrackLayer(_self->ob_itself,
+ layer);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackAlternate(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackAlternate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackAlternate(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track alternateT;
+ if (!PyArg_ParseTuple(_args, "O&",
+ TrackObj_Convert, &alternateT))
+ return NULL;
+ SetTrackAlternate(_self->ob_itself,
+ alternateT);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackVolume(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackVolume(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackVolume(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short volume;
+ if (!PyArg_ParseTuple(_args, "h",
+ &volume))
+ return NULL;
+ SetTrackVolume(_self->ob_itself,
+ volume);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDimensions(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed width;
+ Fixed height;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetTrackDimensions(_self->ob_itself,
+ &width,
+ &height);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFixed, width,
+ PyMac_BuildFixed, height);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackDimensions(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed width;
+ Fixed height;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetFixed, &width,
+ PyMac_GetFixed, &height))
+ return NULL;
+ SetTrackDimensions(_self->ob_itself,
+ width,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackUserData(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UserData _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackUserData(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackSoundLocalizationSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle settings;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetTrackSoundLocalizationSettings(_self->ob_itself,
+ &settings);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, settings);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackSoundLocalizationSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle settings;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &settings))
+ return NULL;
+ _err = SetTrackSoundLocalizationSettings(_self->ob_itself,
+ settings);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_NewTrackMedia(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Media _rv;
+ OSType mediaType;
+ TimeScale timeScale;
+ Handle dataRef;
+ OSType dataRefType;
+ if (!PyArg_ParseTuple(_args, "O&lO&O&",
+ PyMac_GetOSType, &mediaType,
+ &timeScale,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _rv = NewTrackMedia(_self->ob_itself,
+ mediaType,
+ timeScale,
+ dataRef,
+ dataRefType);
+ _res = Py_BuildValue("O&",
+ MediaObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackMedia(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Media _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackMedia(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MediaObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_InsertMediaIntoTrack(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue trackStart;
+ TimeValue mediaTime;
+ TimeValue mediaDuration;
+ Fixed mediaRate;
+ if (!PyArg_ParseTuple(_args, "lllO&",
+ &trackStart,
+ &mediaTime,
+ &mediaDuration,
+ PyMac_GetFixed, &mediaRate))
+ return NULL;
+ _err = InsertMediaIntoTrack(_self->ob_itself,
+ trackStart,
+ mediaTime,
+ mediaDuration,
+ mediaRate);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_InsertTrackSegment(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track dstTrack;
+ TimeValue srcIn;
+ TimeValue srcDuration;
+ TimeValue dstIn;
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ TrackObj_Convert, &dstTrack,
+ &srcIn,
+ &srcDuration,
+ &dstIn))
+ return NULL;
+ _err = InsertTrackSegment(_self->ob_itself,
+ dstTrack,
+ srcIn,
+ srcDuration,
+ dstIn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_InsertEmptyTrackSegment(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue dstIn;
+ TimeValue dstDuration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &dstIn,
+ &dstDuration))
+ return NULL;
+ _err = InsertEmptyTrackSegment(_self->ob_itself,
+ dstIn,
+ dstDuration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_DeleteTrackSegment(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = DeleteTrackSegment(_self->ob_itself,
+ startTime,
+ duration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_ScaleTrackSegment(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue oldDuration;
+ TimeValue newDuration;
+ if (!PyArg_ParseTuple(_args, "lll",
+ &startTime,
+ &oldDuration,
+ &newDuration))
+ return NULL;
+ _err = ScaleTrackSegment(_self->ob_itself,
+ startTime,
+ oldDuration,
+ newDuration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_IsScrapMovie(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsScrapMovie(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_CopyTrackSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track dstTrack;
+ if (!PyArg_ParseTuple(_args, "O&",
+ TrackObj_Convert, &dstTrack))
+ return NULL;
+ _err = CopyTrackSettings(_self->ob_itself,
+ dstTrack);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_AddEmptyTrackToMovie(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie dstMovie;
+ Handle dataRef;
+ OSType dataRefType;
+ Track dstTrack;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ MovieObj_Convert, &dstMovie,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = AddEmptyTrackToMovie(_self->ob_itself,
+ dstMovie,
+ dataRef,
+ dataRefType,
+ &dstTrack);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, dstTrack);
+ return _res;
+}
+
+static PyObject *TrackObj_AddTrackReference(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track refTrack;
+ OSType refType;
+ long addedIndex;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ TrackObj_Convert, &refTrack,
+ PyMac_GetOSType, &refType))
+ return NULL;
+ _err = AddTrackReference(_self->ob_itself,
+ refTrack,
+ refType,
+ &addedIndex);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ addedIndex);
+ return _res;
+}
+
+static PyObject *TrackObj_DeleteTrackReference(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType refType;
+ long index;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetOSType, &refType,
+ &index))
+ return NULL;
+ _err = DeleteTrackReference(_self->ob_itself,
+ refType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackReference(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track refTrack;
+ OSType refType;
+ long index;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ TrackObj_Convert, &refTrack,
+ PyMac_GetOSType, &refType,
+ &index))
+ return NULL;
+ _err = SetTrackReference(_self->ob_itself,
+ refTrack,
+ refType,
+ index);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackReference(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ OSType refType;
+ long index;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetOSType, &refType,
+ &index))
+ return NULL;
+ _rv = GetTrackReference(_self->ob_itself,
+ refType,
+ index);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetNextTrackReferenceType(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSType _rv;
+ OSType refType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &refType))
+ return NULL;
+ _rv = GetNextTrackReferenceType(_self->ob_itself,
+ refType);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackReferenceCount(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ OSType refType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &refType))
+ return NULL;
+ _rv = GetTrackReferenceCount(_self->ob_itself,
+ refType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackEditRate(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ TimeValue atTime;
+ if (!PyArg_ParseTuple(_args, "l",
+ &atTime))
+ return NULL;
+ _rv = GetTrackEditRate(_self->ob_itself,
+ atTime);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDataSize(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ TimeValue startTime;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = GetTrackDataSize(_self->ob_itself,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackDataSize64(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+ wide dataSize;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = GetTrackDataSize64(_self->ob_itself,
+ startTime,
+ duration,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, dataSize);
+ return _res;
+}
+
+static PyObject *TrackObj_PtInTrack(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ _rv = PtInTrack(_self->ob_itself,
+ pt);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackNextInterestingTime(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short interestingTimeFlags;
+ TimeValue time;
+ Fixed rate;
+ TimeValue interestingTime;
+ TimeValue interestingDuration;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &interestingTimeFlags,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ GetTrackNextInterestingTime(_self->ob_itself,
+ interestingTimeFlags,
+ time,
+ rate,
+ &interestingTime,
+ &interestingDuration);
+ _res = Py_BuildValue("ll",
+ interestingTime,
+ interestingDuration);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackSegmentDisplayBoundsRgn(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ TimeValue time;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &time,
+ &duration))
+ return NULL;
+ _rv = GetTrackSegmentDisplayBoundsRgn(_self->ob_itself,
+ time,
+ duration);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackStatus(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTrackStatus(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TrackObj_SetTrackLoadSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue preloadTime;
+ TimeValue preloadDuration;
+ long preloadFlags;
+ long defaultHints;
+ if (!PyArg_ParseTuple(_args, "llll",
+ &preloadTime,
+ &preloadDuration,
+ &preloadFlags,
+ &defaultHints))
+ return NULL;
+ SetTrackLoadSettings(_self->ob_itself,
+ preloadTime,
+ preloadDuration,
+ preloadFlags,
+ defaultHints);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TrackObj_GetTrackLoadSettings(TrackObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue preloadTime;
+ TimeValue preloadDuration;
+ long preloadFlags;
+ long defaultHints;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetTrackLoadSettings(_self->ob_itself,
+ &preloadTime,
+ &preloadDuration,
+ &preloadFlags,
+ &defaultHints);
+ _res = Py_BuildValue("llll",
+ preloadTime,
+ preloadDuration,
+ preloadFlags,
+ defaultHints);
+ return _res;
+}
+
+static PyMethodDef TrackObj_methods[] = {
+ {"LoadTrackIntoRam", (PyCFunction)TrackObj_LoadTrackIntoRam, 1,
+ "(TimeValue time, TimeValue duration, long flags) -> None"},
+ {"GetTrackPict", (PyCFunction)TrackObj_GetTrackPict, 1,
+ "(TimeValue time) -> (PicHandle _rv)"},
+ {"GetTrackClipRgn", (PyCFunction)TrackObj_GetTrackClipRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"SetTrackClipRgn", (PyCFunction)TrackObj_SetTrackClipRgn, 1,
+ "(RgnHandle theClip) -> None"},
+ {"GetTrackDisplayBoundsRgn", (PyCFunction)TrackObj_GetTrackDisplayBoundsRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"GetTrackMovieBoundsRgn", (PyCFunction)TrackObj_GetTrackMovieBoundsRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"GetTrackBoundsRgn", (PyCFunction)TrackObj_GetTrackBoundsRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"GetTrackMatte", (PyCFunction)TrackObj_GetTrackMatte, 1,
+ "() -> (PixMapHandle _rv)"},
+ {"SetTrackMatte", (PyCFunction)TrackObj_SetTrackMatte, 1,
+ "(PixMapHandle theMatte) -> None"},
+ {"GetTrackID", (PyCFunction)TrackObj_GetTrackID, 1,
+ "() -> (long _rv)"},
+ {"GetTrackMovie", (PyCFunction)TrackObj_GetTrackMovie, 1,
+ "() -> (Movie _rv)"},
+ {"GetTrackCreationTime", (PyCFunction)TrackObj_GetTrackCreationTime, 1,
+ "() -> (unsigned long _rv)"},
+ {"GetTrackModificationTime", (PyCFunction)TrackObj_GetTrackModificationTime, 1,
+ "() -> (unsigned long _rv)"},
+ {"GetTrackEnabled", (PyCFunction)TrackObj_GetTrackEnabled, 1,
+ "() -> (Boolean _rv)"},
+ {"SetTrackEnabled", (PyCFunction)TrackObj_SetTrackEnabled, 1,
+ "(Boolean isEnabled) -> None"},
+ {"GetTrackUsage", (PyCFunction)TrackObj_GetTrackUsage, 1,
+ "() -> (long _rv)"},
+ {"SetTrackUsage", (PyCFunction)TrackObj_SetTrackUsage, 1,
+ "(long usage) -> None"},
+ {"GetTrackDuration", (PyCFunction)TrackObj_GetTrackDuration, 1,
+ "() -> (TimeValue _rv)"},
+ {"GetTrackOffset", (PyCFunction)TrackObj_GetTrackOffset, 1,
+ "() -> (TimeValue _rv)"},
+ {"SetTrackOffset", (PyCFunction)TrackObj_SetTrackOffset, 1,
+ "(TimeValue movieOffsetTime) -> None"},
+ {"GetTrackLayer", (PyCFunction)TrackObj_GetTrackLayer, 1,
+ "() -> (short _rv)"},
+ {"SetTrackLayer", (PyCFunction)TrackObj_SetTrackLayer, 1,
+ "(short layer) -> None"},
+ {"GetTrackAlternate", (PyCFunction)TrackObj_GetTrackAlternate, 1,
+ "() -> (Track _rv)"},
+ {"SetTrackAlternate", (PyCFunction)TrackObj_SetTrackAlternate, 1,
+ "(Track alternateT) -> None"},
+ {"GetTrackVolume", (PyCFunction)TrackObj_GetTrackVolume, 1,
+ "() -> (short _rv)"},
+ {"SetTrackVolume", (PyCFunction)TrackObj_SetTrackVolume, 1,
+ "(short volume) -> None"},
+ {"GetTrackDimensions", (PyCFunction)TrackObj_GetTrackDimensions, 1,
+ "() -> (Fixed width, Fixed height)"},
+ {"SetTrackDimensions", (PyCFunction)TrackObj_SetTrackDimensions, 1,
+ "(Fixed width, Fixed height) -> None"},
+ {"GetTrackUserData", (PyCFunction)TrackObj_GetTrackUserData, 1,
+ "() -> (UserData _rv)"},
+ {"GetTrackSoundLocalizationSettings", (PyCFunction)TrackObj_GetTrackSoundLocalizationSettings, 1,
+ "() -> (Handle settings)"},
+ {"SetTrackSoundLocalizationSettings", (PyCFunction)TrackObj_SetTrackSoundLocalizationSettings, 1,
+ "(Handle settings) -> None"},
+ {"NewTrackMedia", (PyCFunction)TrackObj_NewTrackMedia, 1,
+ "(OSType mediaType, TimeScale timeScale, Handle dataRef, OSType dataRefType) -> (Media _rv)"},
+ {"GetTrackMedia", (PyCFunction)TrackObj_GetTrackMedia, 1,
+ "() -> (Media _rv)"},
+ {"InsertMediaIntoTrack", (PyCFunction)TrackObj_InsertMediaIntoTrack, 1,
+ "(TimeValue trackStart, TimeValue mediaTime, TimeValue mediaDuration, Fixed mediaRate) -> None"},
+ {"InsertTrackSegment", (PyCFunction)TrackObj_InsertTrackSegment, 1,
+ "(Track dstTrack, TimeValue srcIn, TimeValue srcDuration, TimeValue dstIn) -> None"},
+ {"InsertEmptyTrackSegment", (PyCFunction)TrackObj_InsertEmptyTrackSegment, 1,
+ "(TimeValue dstIn, TimeValue dstDuration) -> None"},
+ {"DeleteTrackSegment", (PyCFunction)TrackObj_DeleteTrackSegment, 1,
+ "(TimeValue startTime, TimeValue duration) -> None"},
+ {"ScaleTrackSegment", (PyCFunction)TrackObj_ScaleTrackSegment, 1,
+ "(TimeValue startTime, TimeValue oldDuration, TimeValue newDuration) -> None"},
+ {"IsScrapMovie", (PyCFunction)TrackObj_IsScrapMovie, 1,
+ "() -> (Component _rv)"},
+ {"CopyTrackSettings", (PyCFunction)TrackObj_CopyTrackSettings, 1,
+ "(Track dstTrack) -> None"},
+ {"AddEmptyTrackToMovie", (PyCFunction)TrackObj_AddEmptyTrackToMovie, 1,
+ "(Movie dstMovie, Handle dataRef, OSType dataRefType) -> (Track dstTrack)"},
+ {"AddTrackReference", (PyCFunction)TrackObj_AddTrackReference, 1,
+ "(Track refTrack, OSType refType) -> (long addedIndex)"},
+ {"DeleteTrackReference", (PyCFunction)TrackObj_DeleteTrackReference, 1,
+ "(OSType refType, long index) -> None"},
+ {"SetTrackReference", (PyCFunction)TrackObj_SetTrackReference, 1,
+ "(Track refTrack, OSType refType, long index) -> None"},
+ {"GetTrackReference", (PyCFunction)TrackObj_GetTrackReference, 1,
+ "(OSType refType, long index) -> (Track _rv)"},
+ {"GetNextTrackReferenceType", (PyCFunction)TrackObj_GetNextTrackReferenceType, 1,
+ "(OSType refType) -> (OSType _rv)"},
+ {"GetTrackReferenceCount", (PyCFunction)TrackObj_GetTrackReferenceCount, 1,
+ "(OSType refType) -> (long _rv)"},
+ {"GetTrackEditRate", (PyCFunction)TrackObj_GetTrackEditRate, 1,
+ "(TimeValue atTime) -> (Fixed _rv)"},
+ {"GetTrackDataSize", (PyCFunction)TrackObj_GetTrackDataSize, 1,
+ "(TimeValue startTime, TimeValue duration) -> (long _rv)"},
+ {"GetTrackDataSize64", (PyCFunction)TrackObj_GetTrackDataSize64, 1,
+ "(TimeValue startTime, TimeValue duration) -> (wide dataSize)"},
+ {"PtInTrack", (PyCFunction)TrackObj_PtInTrack, 1,
+ "(Point pt) -> (Boolean _rv)"},
+ {"GetTrackNextInterestingTime", (PyCFunction)TrackObj_GetTrackNextInterestingTime, 1,
+ "(short interestingTimeFlags, TimeValue time, Fixed rate) -> (TimeValue interestingTime, TimeValue interestingDuration)"},
+ {"GetTrackSegmentDisplayBoundsRgn", (PyCFunction)TrackObj_GetTrackSegmentDisplayBoundsRgn, 1,
+ "(TimeValue time, TimeValue duration) -> (RgnHandle _rv)"},
+ {"GetTrackStatus", (PyCFunction)TrackObj_GetTrackStatus, 1,
+ "() -> (ComponentResult _rv)"},
+ {"SetTrackLoadSettings", (PyCFunction)TrackObj_SetTrackLoadSettings, 1,
+ "(TimeValue preloadTime, TimeValue preloadDuration, long preloadFlags, long defaultHints) -> None"},
+ {"GetTrackLoadSettings", (PyCFunction)TrackObj_GetTrackLoadSettings, 1,
+ "() -> (TimeValue preloadTime, TimeValue preloadDuration, long preloadFlags, long defaultHints)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain TrackObj_chain = { TrackObj_methods, NULL };
+
+static PyObject *TrackObj_getattr(TrackObject *self, char *name)
+{
+ return Py_FindMethodInChain(&TrackObj_chain, (PyObject *)self, name);
+}
+
+#define TrackObj_setattr NULL
+
+#define TrackObj_compare NULL
+
+#define TrackObj_repr NULL
+
+#define TrackObj_hash NULL
+
+PyTypeObject Track_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Track", /*tp_name*/
+ sizeof(TrackObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TrackObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) TrackObj_getattr, /*tp_getattr*/
+ (setattrfunc) TrackObj_setattr, /*tp_setattr*/
+ (cmpfunc) TrackObj_compare, /*tp_compare*/
+ (reprfunc) TrackObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TrackObj_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type Track ---------------------- */
+
+
+/* ----------------------- Object type Movie ------------------------ */
+
+PyTypeObject Movie_Type;
+
+#define MovieObj_Check(x) ((x)->ob_type == &Movie_Type)
+
+typedef struct MovieObject {
+ PyObject_HEAD
+ Movie ob_itself;
+} MovieObject;
+
+PyObject *MovieObj_New(Movie itself)
+{
+ MovieObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create null Movie");
+ return NULL;
+ }
+ it = PyObject_NEW(MovieObject, &Movie_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+MovieObj_Convert(PyObject *v, Movie *p_itself)
+{
+ if (!MovieObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Movie required");
+ return 0;
+ }
+ *p_itself = ((MovieObject *)v)->ob_itself;
+ return 1;
+}
+
+static void MovieObj_dealloc(MovieObject *self)
+{
+ DisposeMovie(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *MovieObj_MoviesTask(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long maxMilliSecToUse;
+ if (!PyArg_ParseTuple(_args, "l",
+ &maxMilliSecToUse))
+ return NULL;
+ MoviesTask(_self->ob_itself,
+ maxMilliSecToUse);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PrerollMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ Fixed Rate;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &time,
+ PyMac_GetFixed, &Rate))
+ return NULL;
+ _err = PrerollMovie(_self->ob_itself,
+ time,
+ Rate);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_AbortPrePrerollMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr err;
+ if (!PyArg_ParseTuple(_args, "h",
+ &err))
+ return NULL;
+ AbortPrePrerollMovie(_self->ob_itself,
+ err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_LoadMovieIntoRam(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ TimeValue duration;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "lll",
+ &time,
+ &duration,
+ &flags))
+ return NULL;
+ _err = LoadMovieIntoRam(_self->ob_itself,
+ time,
+ duration,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieActive(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean active;
+ if (!PyArg_ParseTuple(_args, "b",
+ &active))
+ return NULL;
+ SetMovieActive(_self->ob_itself,
+ active);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieActive(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieActive(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_StartMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ StartMovie(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_StopMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ StopMovie(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GoToBeginningOfMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GoToBeginningOfMovie(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GoToEndOfMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GoToEndOfMovie(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_IsMovieDone(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsMovieDone(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePreviewMode(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePreviewMode(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePreviewMode(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean usePreview;
+ if (!PyArg_ParseTuple(_args, "b",
+ &usePreview))
+ return NULL;
+ SetMoviePreviewMode(_self->ob_itself,
+ usePreview);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ShowMoviePoster(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowMoviePoster(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTimeBase(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieTimeBase(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ TimeBaseObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieMasterTimeBase(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase tb;
+ TimeRecord slaveZero;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ TimeBaseObj_Convert, &tb,
+ QtTimeRecord_Convert, &slaveZero))
+ return NULL;
+ SetMovieMasterTimeBase(_self->ob_itself,
+ tb,
+ &slaveZero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieMasterClock(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component clockMeister;
+ TimeRecord slaveZero;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ CmpObj_Convert, &clockMeister,
+ QtTimeRecord_Convert, &slaveZero))
+ return NULL;
+ SetMovieMasterClock(_self->ob_itself,
+ clockMeister,
+ &slaveZero);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieGWorld(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ GDHandle gdh;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieGWorld(_self->ob_itself,
+ &port,
+ &gdh);
+ _res = Py_BuildValue("O&O&",
+ GrafObj_New, port,
+ OptResObj_New, gdh);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieGWorld(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr port;
+ GDHandle gdh;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ GrafObj_Convert, &port,
+ OptResObj_Convert, &gdh))
+ return NULL;
+ SetMovieGWorld(_self->ob_itself,
+ port,
+ gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieNaturalBoundsRect(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect naturalBounds;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieNaturalBoundsRect(_self->ob_itself,
+ &naturalBounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &naturalBounds);
+ return _res;
+}
+
+static PyObject *MovieObj_GetNextTrackForCompositing(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ Track theTrack;
+ if (!PyArg_ParseTuple(_args, "O&",
+ TrackObj_Convert, &theTrack))
+ return NULL;
+ _rv = GetNextTrackForCompositing(_self->ob_itself,
+ theTrack);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetPrevTrackForCompositing(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ Track theTrack;
+ if (!PyArg_ParseTuple(_args, "O&",
+ TrackObj_Convert, &theTrack))
+ return NULL;
+ _rv = GetPrevTrackForCompositing(_self->ob_itself,
+ theTrack);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePict(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ TimeValue time;
+ if (!PyArg_ParseTuple(_args, "l",
+ &time))
+ return NULL;
+ _rv = GetMoviePict(_self->ob_itself,
+ time);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePosterPict(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePosterPict(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_UpdateMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UpdateMovie(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_InvalidateMovieRegion(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle invalidRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &invalidRgn))
+ return NULL;
+ _err = InvalidateMovieRegion(_self->ob_itself,
+ invalidRgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieBox(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect boxRect;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieBox(_self->ob_itself,
+ &boxRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &boxRect);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieBox(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect boxRect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &boxRect))
+ return NULL;
+ SetMovieBox(_self->ob_itself,
+ &boxRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDisplayClipRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieDisplayClipRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieDisplayClipRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle theClip;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theClip))
+ return NULL;
+ SetMovieDisplayClipRgn(_self->ob_itself,
+ theClip);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieClipRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieClipRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieClipRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle theClip;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theClip))
+ return NULL;
+ SetMovieClipRgn(_self->ob_itself,
+ theClip);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDisplayBoundsRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieDisplayBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieBoundsRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieBoundsRgn(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoHandle(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle publicMovie;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &publicMovie))
+ return NULL;
+ _err = PutMovieIntoHandle(_self->ob_itself,
+ publicMovie);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoDataFork(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short fRefNum;
+ long offset;
+ long maxSize;
+ if (!PyArg_ParseTuple(_args, "hll",
+ &fRefNum,
+ &offset,
+ &maxSize))
+ return NULL;
+ _err = PutMovieIntoDataFork(_self->ob_itself,
+ fRefNum,
+ offset,
+ maxSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoDataFork64(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long fRefNum;
+ wide offset;
+ unsigned long maxSize;
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &fRefNum,
+ PyMac_Getwide, &offset,
+ &maxSize))
+ return NULL;
+ _err = PutMovieIntoDataFork64(_self->ob_itself,
+ fRefNum,
+ &offset,
+ maxSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieCreationTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieCreationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieModificationTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieModificationTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTimeScale(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeScale _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieTimeScale(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieTimeScale(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeScale timeScale;
+ if (!PyArg_ParseTuple(_args, "l",
+ &timeScale))
+ return NULL;
+ SetMovieTimeScale(_self->ob_itself,
+ timeScale);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDuration(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieDuration(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieRate(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieRate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieRate(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed rate;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &rate))
+ return NULL;
+ SetMovieRate(_self->ob_itself,
+ rate);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePreferredRate(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePreferredRate(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePreferredRate(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Fixed rate;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &rate))
+ return NULL;
+ SetMoviePreferredRate(_self->ob_itself,
+ rate);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePreferredVolume(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePreferredVolume(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePreferredVolume(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short volume;
+ if (!PyArg_ParseTuple(_args, "h",
+ &volume))
+ return NULL;
+ SetMoviePreferredVolume(_self->ob_itself,
+ volume);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieVolume(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieVolume(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieVolume(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short volume;
+ if (!PyArg_ParseTuple(_args, "h",
+ &volume))
+ return NULL;
+ SetMovieVolume(_self->ob_itself,
+ volume);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePreviewTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue previewTime;
+ TimeValue previewDuration;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMoviePreviewTime(_self->ob_itself,
+ &previewTime,
+ &previewDuration);
+ _res = Py_BuildValue("ll",
+ previewTime,
+ previewDuration);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePreviewTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue previewTime;
+ TimeValue previewDuration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &previewTime,
+ &previewDuration))
+ return NULL;
+ SetMoviePreviewTime(_self->ob_itself,
+ previewTime,
+ previewDuration);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMoviePosterTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMoviePosterTime(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePosterTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue posterTime;
+ if (!PyArg_ParseTuple(_args, "l",
+ &posterTime))
+ return NULL;
+ SetMoviePosterTime(_self->ob_itself,
+ posterTime);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue selectionTime;
+ TimeValue selectionDuration;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieSelection(_self->ob_itself,
+ &selectionTime,
+ &selectionDuration);
+ _res = Py_BuildValue("ll",
+ selectionTime,
+ selectionDuration);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue selectionTime;
+ TimeValue selectionDuration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &selectionTime,
+ &selectionDuration))
+ return NULL;
+ SetMovieSelection(_self->ob_itself,
+ selectionTime,
+ selectionDuration);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieActiveSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue startTime;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ SetMovieActiveSegment(_self->ob_itself,
+ startTime,
+ duration);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieActiveSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue startTime;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetMovieActiveSegment(_self->ob_itself,
+ &startTime,
+ &duration);
+ _res = Py_BuildValue("ll",
+ startTime,
+ duration);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeRecord currentTime;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieTime(_self->ob_itself,
+ &currentTime);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QtTimeRecord_New, &currentTime);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord newtime;
+ if (!PyArg_ParseTuple(_args, "O&",
+ QtTimeRecord_Convert, &newtime))
+ return NULL;
+ SetMovieTime(_self->ob_itself,
+ &newtime);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieTimeValue(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue newtime;
+ if (!PyArg_ParseTuple(_args, "l",
+ &newtime))
+ return NULL;
+ SetMovieTimeValue(_self->ob_itself,
+ newtime);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieUserData(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ UserData _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieUserData(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTrackCount(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieTrackCount(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieTrack(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ long trackID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &trackID))
+ return NULL;
+ _rv = GetMovieTrack(_self->ob_itself,
+ trackID);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieIndTrack(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ long index;
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
+ return NULL;
+ _rv = GetMovieIndTrack(_self->ob_itself,
+ index);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieIndTrackType(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ long index;
+ OSType trackType;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "lO&l",
+ &index,
+ PyMac_GetOSType, &trackType,
+ &flags))
+ return NULL;
+ _rv = GetMovieIndTrackType(_self->ob_itself,
+ index,
+ trackType,
+ flags);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_NewMovieTrack(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Track _rv;
+ Fixed width;
+ Fixed height;
+ short trackVolume;
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ PyMac_GetFixed, &width,
+ PyMac_GetFixed, &height,
+ &trackVolume))
+ return NULL;
+ _rv = NewMovieTrack(_self->ob_itself,
+ width,
+ height,
+ trackVolume);
+ _res = Py_BuildValue("O&",
+ TrackObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetAutoTrackAlternatesEnabled(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean enable;
+ if (!PyArg_ParseTuple(_args, "b",
+ &enable))
+ return NULL;
+ SetAutoTrackAlternatesEnabled(_self->ob_itself,
+ enable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SelectMovieAlternates(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SelectMovieAlternates(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_InsertMovieSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie dstMovie;
+ TimeValue srcIn;
+ TimeValue srcDuration;
+ TimeValue dstIn;
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ MovieObj_Convert, &dstMovie,
+ &srcIn,
+ &srcDuration,
+ &dstIn))
+ return NULL;
+ _err = InsertMovieSegment(_self->ob_itself,
+ dstMovie,
+ srcIn,
+ srcDuration,
+ dstIn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_InsertEmptyMovieSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue dstIn;
+ TimeValue dstDuration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &dstIn,
+ &dstDuration))
+ return NULL;
+ _err = InsertEmptyMovieSegment(_self->ob_itself,
+ dstIn,
+ dstDuration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_DeleteMovieSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = DeleteMovieSegment(_self->ob_itself,
+ startTime,
+ duration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ScaleMovieSegment(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue oldDuration;
+ TimeValue newDuration;
+ if (!PyArg_ParseTuple(_args, "lll",
+ &startTime,
+ &oldDuration,
+ &newDuration))
+ return NULL;
+ _err = ScaleMovieSegment(_self->ob_itself,
+ startTime,
+ oldDuration,
+ newDuration);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_CutMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CutMovieSelection(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_CopyMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CopyMovieSelection(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_PasteMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie src;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &src))
+ return NULL;
+ PasteMovieSelection(_self->ob_itself,
+ src);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_AddMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie src;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &src))
+ return NULL;
+ AddMovieSelection(_self->ob_itself,
+ src);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ClearMovieSelection(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClearMovieSelection(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieIntoTypedHandle(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track targetTrack;
+ OSType handleType;
+ Handle publicMovie;
+ TimeValue start;
+ TimeValue dur;
+ long flags;
+ ComponentInstance userComp;
+ if (!PyArg_ParseTuple(_args, "O&O&O&lllO&",
+ TrackObj_Convert, &targetTrack,
+ PyMac_GetOSType, &handleType,
+ ResObj_Convert, &publicMovie,
+ &start,
+ &dur,
+ &flags,
+ CmpInstObj_Convert, &userComp))
+ return NULL;
+ _err = PutMovieIntoTypedHandle(_self->ob_itself,
+ targetTrack,
+ handleType,
+ publicMovie,
+ start,
+ dur,
+ flags,
+ userComp);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_CopyMovieSettings(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie dstMovie;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MovieObj_Convert, &dstMovie))
+ return NULL;
+ _err = CopyMovieSettings(_self->ob_itself,
+ dstMovie);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_ConvertMovieToFile(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Track onlyTrack;
+ FSSpec outputFile;
+ OSType fileType;
+ OSType creator;
+ ScriptCode scriptTag;
+ short resID;
+ long flags;
+ ComponentInstance userComp;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&hlO&",
+ TrackObj_Convert, &onlyTrack,
+ PyMac_GetFSSpec, &outputFile,
+ PyMac_GetOSType, &fileType,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &flags,
+ CmpInstObj_Convert, &userComp))
+ return NULL;
+ _err = ConvertMovieToFile(_self->ob_itself,
+ onlyTrack,
+ &outputFile,
+ fileType,
+ creator,
+ scriptTag,
+ &resID,
+ flags,
+ userComp);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resID);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDataSize(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ TimeValue startTime;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _rv = GetMovieDataSize(_self->ob_itself,
+ startTime,
+ duration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDataSize64(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue startTime;
+ TimeValue duration;
+ wide dataSize;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &startTime,
+ &duration))
+ return NULL;
+ _err = GetMovieDataSize64(_self->ob_itself,
+ startTime,
+ duration,
+ &dataSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_Buildwide, dataSize);
+ return _res;
+}
+
+static PyObject *MovieObj_PtInMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point pt;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ _rv = PtInMovie(_self->ob_itself,
+ pt);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieLanguage(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long language;
+ if (!PyArg_ParseTuple(_args, "l",
+ &language))
+ return NULL;
+ SetMovieLanguage(_self->ob_itself,
+ language);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieNextInterestingTime(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short interestingTimeFlags;
+ short numMediaTypes;
+ OSType whichMediaTypes;
+ TimeValue time;
+ Fixed rate;
+ TimeValue interestingTime;
+ TimeValue interestingDuration;
+ if (!PyArg_ParseTuple(_args, "hhO&lO&",
+ &interestingTimeFlags,
+ &numMediaTypes,
+ PyMac_GetOSType, &whichMediaTypes,
+ &time,
+ PyMac_GetFixed, &rate))
+ return NULL;
+ GetMovieNextInterestingTime(_self->ob_itself,
+ interestingTimeFlags,
+ numMediaTypes,
+ &whichMediaTypes,
+ time,
+ rate,
+ &interestingTime,
+ &interestingDuration);
+ _res = Py_BuildValue("ll",
+ interestingTime,
+ interestingDuration);
+ return _res;
+}
+
+static PyObject *MovieObj_AddMovieResource(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+ short resId;
+ Str255 resName;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &resRefNum,
+ PyMac_GetStr255, resName))
+ return NULL;
+ _err = AddMovieResource(_self->ob_itself,
+ resRefNum,
+ &resId,
+ resName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resId);
+ return _res;
+}
+
+static PyObject *MovieObj_UpdateMovieResource(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+ short resId;
+ Str255 resName;
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &resRefNum,
+ &resId,
+ PyMac_GetStr255, resName))
+ return NULL;
+ _err = UpdateMovieResource(_self->ob_itself,
+ resRefNum,
+ resId,
+ resName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_HasMovieChanged(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = HasMovieChanged(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_ClearMovieChanged(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClearMovieChanged(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMovieDefaultDataRef(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = SetMovieDefaultDataRef(_self->ob_itself,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieDefaultDataRef(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMovieDefaultDataRef(_self->ob_itself,
+ &dataRef,
+ &dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MovieObj_SetMovieAnchorDataRef(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = SetMovieAnchorDataRef(_self->ob_itself,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MovieObj_GetMovieAnchorDataRef(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataRefType;
+ long outFlags;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMovieAnchorDataRef(_self->ob_itself,
+ &dataRef,
+ &dataRefType,
+ &outFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&l",
+ ResObj_New, dataRef,
+ PyMac_BuildOSType, dataRefType,
+ outFlags);
+ return _res;
+}
+#endif
+
+static PyObject *MovieObj_SetMovieColorTable(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ CTabHandle ctab;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &ctab))
+ return NULL;
+ _err = SetMovieColorTable(_self->ob_itself,
+ ctab);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieColorTable(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ CTabHandle ctab;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMovieColorTable(_self->ob_itself,
+ &ctab);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, ctab);
+ return _res;
+}
+
+static PyObject *MovieObj_FlattenMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long movieFlattenFlags;
+ FSSpec theFile;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+ short resId;
+ Str255 resName;
+ if (!PyArg_ParseTuple(_args, "lO&O&hlO&",
+ &movieFlattenFlags,
+ PyMac_GetFSSpec, &theFile,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags,
+ PyMac_GetStr255, resName))
+ return NULL;
+ FlattenMovie(_self->ob_itself,
+ movieFlattenFlags,
+ &theFile,
+ creator,
+ scriptTag,
+ createMovieFileFlags,
+ &resId,
+ resName);
+ _res = Py_BuildValue("h",
+ resId);
+ return _res;
+}
+
+static PyObject *MovieObj_FlattenMovieData(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ long movieFlattenFlags;
+ FSSpec theFile;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+ if (!PyArg_ParseTuple(_args, "lO&O&hl",
+ &movieFlattenFlags,
+ PyMac_GetFSSpec, &theFile,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags))
+ return NULL;
+ _rv = FlattenMovieData(_self->ob_itself,
+ movieFlattenFlags,
+ &theFile,
+ creator,
+ scriptTag,
+ createMovieFileFlags);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_MovieSearchText(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Ptr text;
+ long size;
+ long searchFlags;
+ Track searchTrack;
+ TimeValue searchTime;
+ long searchOffset;
+ if (!PyArg_ParseTuple(_args, "sll",
+ &text,
+ &size,
+ &searchFlags))
+ return NULL;
+ _err = MovieSearchText(_self->ob_itself,
+ text,
+ size,
+ searchFlags,
+ &searchTrack,
+ &searchTime,
+ &searchOffset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&ll",
+ TrackObj_New, searchTrack,
+ searchTime,
+ searchOffset);
+ return _res;
+}
+
+static PyObject *MovieObj_GetPosterBox(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect boxRect;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetPosterBox(_self->ob_itself,
+ &boxRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &boxRect);
+ return _res;
+}
+
+static PyObject *MovieObj_SetPosterBox(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect boxRect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &boxRect))
+ return NULL;
+ SetPosterBox(_self->ob_itself,
+ &boxRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieSegmentDisplayBoundsRgn(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ TimeValue time;
+ TimeValue duration;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &time,
+ &duration))
+ return NULL;
+ _rv = GetMovieSegmentDisplayBoundsRgn(_self->ob_itself,
+ time,
+ duration);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_GetMovieStatus(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ Track firstProblemTrack;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieStatus(_self->ob_itself,
+ &firstProblemTrack);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ TrackObj_New, firstProblemTrack);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *MovieObj_GetMovieLoadState(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMovieLoadState(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *MovieObj_NewMovieController(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ MovieController _rv;
+ Rect movieRect;
+ long someFlags;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetRect, &movieRect,
+ &someFlags))
+ return NULL;
+ _rv = NewMovieController(_self->ob_itself,
+ &movieRect,
+ someFlags);
+ _res = Py_BuildValue("O&",
+ MovieCtlObj_New, _rv);
+ return _res;
+}
+
+static PyObject *MovieObj_PutMovieOnScrap(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long movieScrapFlags;
+ if (!PyArg_ParseTuple(_args, "l",
+ &movieScrapFlags))
+ return NULL;
+ _err = PutMovieOnScrap(_self->ob_itself,
+ movieScrapFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_SetMoviePlayHints(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long flags;
+ long flagsMask;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &flags,
+ &flagsMask))
+ return NULL;
+ SetMoviePlayHints(_self->ob_itself,
+ flags,
+ flagsMask);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MovieObj_GetMaxLoadedTimeInMovie(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ TimeValue time;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMaxLoadedTimeInMovie(_self->ob_itself,
+ &time);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ time);
+ return _res;
+}
+
+static PyObject *MovieObj_QTMovieNeedsTimeTable(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean needsTimeTable;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = QTMovieNeedsTimeTable(_self->ob_itself,
+ &needsTimeTable);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ needsTimeTable);
+ return _res;
+}
+
+static PyObject *MovieObj_QTGetDataRefMaxFileOffset(MovieObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType dataRefType;
+ Handle dataRef;
+ long offset;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &dataRefType,
+ ResObj_Convert, &dataRef))
+ return NULL;
+ _err = QTGetDataRefMaxFileOffset(_self->ob_itself,
+ dataRefType,
+ dataRef,
+ &offset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ offset);
+ return _res;
+}
+
+static PyMethodDef MovieObj_methods[] = {
+ {"MoviesTask", (PyCFunction)MovieObj_MoviesTask, 1,
+ "(long maxMilliSecToUse) -> None"},
+ {"PrerollMovie", (PyCFunction)MovieObj_PrerollMovie, 1,
+ "(TimeValue time, Fixed Rate) -> None"},
+ {"AbortPrePrerollMovie", (PyCFunction)MovieObj_AbortPrePrerollMovie, 1,
+ "(OSErr err) -> None"},
+ {"LoadMovieIntoRam", (PyCFunction)MovieObj_LoadMovieIntoRam, 1,
+ "(TimeValue time, TimeValue duration, long flags) -> None"},
+ {"SetMovieActive", (PyCFunction)MovieObj_SetMovieActive, 1,
+ "(Boolean active) -> None"},
+ {"GetMovieActive", (PyCFunction)MovieObj_GetMovieActive, 1,
+ "() -> (Boolean _rv)"},
+ {"StartMovie", (PyCFunction)MovieObj_StartMovie, 1,
+ "() -> None"},
+ {"StopMovie", (PyCFunction)MovieObj_StopMovie, 1,
+ "() -> None"},
+ {"GoToBeginningOfMovie", (PyCFunction)MovieObj_GoToBeginningOfMovie, 1,
+ "() -> None"},
+ {"GoToEndOfMovie", (PyCFunction)MovieObj_GoToEndOfMovie, 1,
+ "() -> None"},
+ {"IsMovieDone", (PyCFunction)MovieObj_IsMovieDone, 1,
+ "() -> (Boolean _rv)"},
+ {"GetMoviePreviewMode", (PyCFunction)MovieObj_GetMoviePreviewMode, 1,
+ "() -> (Boolean _rv)"},
+ {"SetMoviePreviewMode", (PyCFunction)MovieObj_SetMoviePreviewMode, 1,
+ "(Boolean usePreview) -> None"},
+ {"ShowMoviePoster", (PyCFunction)MovieObj_ShowMoviePoster, 1,
+ "() -> None"},
+ {"GetMovieTimeBase", (PyCFunction)MovieObj_GetMovieTimeBase, 1,
+ "() -> (TimeBase _rv)"},
+ {"SetMovieMasterTimeBase", (PyCFunction)MovieObj_SetMovieMasterTimeBase, 1,
+ "(TimeBase tb, TimeRecord slaveZero) -> None"},
+ {"SetMovieMasterClock", (PyCFunction)MovieObj_SetMovieMasterClock, 1,
+ "(Component clockMeister, TimeRecord slaveZero) -> None"},
+ {"GetMovieGWorld", (PyCFunction)MovieObj_GetMovieGWorld, 1,
+ "() -> (CGrafPtr port, GDHandle gdh)"},
+ {"SetMovieGWorld", (PyCFunction)MovieObj_SetMovieGWorld, 1,
+ "(CGrafPtr port, GDHandle gdh) -> None"},
+ {"GetMovieNaturalBoundsRect", (PyCFunction)MovieObj_GetMovieNaturalBoundsRect, 1,
+ "() -> (Rect naturalBounds)"},
+ {"GetNextTrackForCompositing", (PyCFunction)MovieObj_GetNextTrackForCompositing, 1,
+ "(Track theTrack) -> (Track _rv)"},
+ {"GetPrevTrackForCompositing", (PyCFunction)MovieObj_GetPrevTrackForCompositing, 1,
+ "(Track theTrack) -> (Track _rv)"},
+ {"GetMoviePict", (PyCFunction)MovieObj_GetMoviePict, 1,
+ "(TimeValue time) -> (PicHandle _rv)"},
+ {"GetMoviePosterPict", (PyCFunction)MovieObj_GetMoviePosterPict, 1,
+ "() -> (PicHandle _rv)"},
+ {"UpdateMovie", (PyCFunction)MovieObj_UpdateMovie, 1,
+ "() -> None"},
+ {"InvalidateMovieRegion", (PyCFunction)MovieObj_InvalidateMovieRegion, 1,
+ "(RgnHandle invalidRgn) -> None"},
+ {"GetMovieBox", (PyCFunction)MovieObj_GetMovieBox, 1,
+ "() -> (Rect boxRect)"},
+ {"SetMovieBox", (PyCFunction)MovieObj_SetMovieBox, 1,
+ "(Rect boxRect) -> None"},
+ {"GetMovieDisplayClipRgn", (PyCFunction)MovieObj_GetMovieDisplayClipRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"SetMovieDisplayClipRgn", (PyCFunction)MovieObj_SetMovieDisplayClipRgn, 1,
+ "(RgnHandle theClip) -> None"},
+ {"GetMovieClipRgn", (PyCFunction)MovieObj_GetMovieClipRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"SetMovieClipRgn", (PyCFunction)MovieObj_SetMovieClipRgn, 1,
+ "(RgnHandle theClip) -> None"},
+ {"GetMovieDisplayBoundsRgn", (PyCFunction)MovieObj_GetMovieDisplayBoundsRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"GetMovieBoundsRgn", (PyCFunction)MovieObj_GetMovieBoundsRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"PutMovieIntoHandle", (PyCFunction)MovieObj_PutMovieIntoHandle, 1,
+ "(Handle publicMovie) -> None"},
+ {"PutMovieIntoDataFork", (PyCFunction)MovieObj_PutMovieIntoDataFork, 1,
+ "(short fRefNum, long offset, long maxSize) -> None"},
+ {"PutMovieIntoDataFork64", (PyCFunction)MovieObj_PutMovieIntoDataFork64, 1,
+ "(long fRefNum, wide offset, unsigned long maxSize) -> None"},
+ {"GetMovieCreationTime", (PyCFunction)MovieObj_GetMovieCreationTime, 1,
+ "() -> (unsigned long _rv)"},
+ {"GetMovieModificationTime", (PyCFunction)MovieObj_GetMovieModificationTime, 1,
+ "() -> (unsigned long _rv)"},
+ {"GetMovieTimeScale", (PyCFunction)MovieObj_GetMovieTimeScale, 1,
+ "() -> (TimeScale _rv)"},
+ {"SetMovieTimeScale", (PyCFunction)MovieObj_SetMovieTimeScale, 1,
+ "(TimeScale timeScale) -> None"},
+ {"GetMovieDuration", (PyCFunction)MovieObj_GetMovieDuration, 1,
+ "() -> (TimeValue _rv)"},
+ {"GetMovieRate", (PyCFunction)MovieObj_GetMovieRate, 1,
+ "() -> (Fixed _rv)"},
+ {"SetMovieRate", (PyCFunction)MovieObj_SetMovieRate, 1,
+ "(Fixed rate) -> None"},
+ {"GetMoviePreferredRate", (PyCFunction)MovieObj_GetMoviePreferredRate, 1,
+ "() -> (Fixed _rv)"},
+ {"SetMoviePreferredRate", (PyCFunction)MovieObj_SetMoviePreferredRate, 1,
+ "(Fixed rate) -> None"},
+ {"GetMoviePreferredVolume", (PyCFunction)MovieObj_GetMoviePreferredVolume, 1,
+ "() -> (short _rv)"},
+ {"SetMoviePreferredVolume", (PyCFunction)MovieObj_SetMoviePreferredVolume, 1,
+ "(short volume) -> None"},
+ {"GetMovieVolume", (PyCFunction)MovieObj_GetMovieVolume, 1,
+ "() -> (short _rv)"},
+ {"SetMovieVolume", (PyCFunction)MovieObj_SetMovieVolume, 1,
+ "(short volume) -> None"},
+ {"GetMoviePreviewTime", (PyCFunction)MovieObj_GetMoviePreviewTime, 1,
+ "() -> (TimeValue previewTime, TimeValue previewDuration)"},
+ {"SetMoviePreviewTime", (PyCFunction)MovieObj_SetMoviePreviewTime, 1,
+ "(TimeValue previewTime, TimeValue previewDuration) -> None"},
+ {"GetMoviePosterTime", (PyCFunction)MovieObj_GetMoviePosterTime, 1,
+ "() -> (TimeValue _rv)"},
+ {"SetMoviePosterTime", (PyCFunction)MovieObj_SetMoviePosterTime, 1,
+ "(TimeValue posterTime) -> None"},
+ {"GetMovieSelection", (PyCFunction)MovieObj_GetMovieSelection, 1,
+ "() -> (TimeValue selectionTime, TimeValue selectionDuration)"},
+ {"SetMovieSelection", (PyCFunction)MovieObj_SetMovieSelection, 1,
+ "(TimeValue selectionTime, TimeValue selectionDuration) -> None"},
+ {"SetMovieActiveSegment", (PyCFunction)MovieObj_SetMovieActiveSegment, 1,
+ "(TimeValue startTime, TimeValue duration) -> None"},
+ {"GetMovieActiveSegment", (PyCFunction)MovieObj_GetMovieActiveSegment, 1,
+ "() -> (TimeValue startTime, TimeValue duration)"},
+ {"GetMovieTime", (PyCFunction)MovieObj_GetMovieTime, 1,
+ "() -> (TimeValue _rv, TimeRecord currentTime)"},
+ {"SetMovieTime", (PyCFunction)MovieObj_SetMovieTime, 1,
+ "(TimeRecord newtime) -> None"},
+ {"SetMovieTimeValue", (PyCFunction)MovieObj_SetMovieTimeValue, 1,
+ "(TimeValue newtime) -> None"},
+ {"GetMovieUserData", (PyCFunction)MovieObj_GetMovieUserData, 1,
+ "() -> (UserData _rv)"},
+ {"GetMovieTrackCount", (PyCFunction)MovieObj_GetMovieTrackCount, 1,
+ "() -> (long _rv)"},
+ {"GetMovieTrack", (PyCFunction)MovieObj_GetMovieTrack, 1,
+ "(long trackID) -> (Track _rv)"},
+ {"GetMovieIndTrack", (PyCFunction)MovieObj_GetMovieIndTrack, 1,
+ "(long index) -> (Track _rv)"},
+ {"GetMovieIndTrackType", (PyCFunction)MovieObj_GetMovieIndTrackType, 1,
+ "(long index, OSType trackType, long flags) -> (Track _rv)"},
+ {"NewMovieTrack", (PyCFunction)MovieObj_NewMovieTrack, 1,
+ "(Fixed width, Fixed height, short trackVolume) -> (Track _rv)"},
+ {"SetAutoTrackAlternatesEnabled", (PyCFunction)MovieObj_SetAutoTrackAlternatesEnabled, 1,
+ "(Boolean enable) -> None"},
+ {"SelectMovieAlternates", (PyCFunction)MovieObj_SelectMovieAlternates, 1,
+ "() -> None"},
+ {"InsertMovieSegment", (PyCFunction)MovieObj_InsertMovieSegment, 1,
+ "(Movie dstMovie, TimeValue srcIn, TimeValue srcDuration, TimeValue dstIn) -> None"},
+ {"InsertEmptyMovieSegment", (PyCFunction)MovieObj_InsertEmptyMovieSegment, 1,
+ "(TimeValue dstIn, TimeValue dstDuration) -> None"},
+ {"DeleteMovieSegment", (PyCFunction)MovieObj_DeleteMovieSegment, 1,
+ "(TimeValue startTime, TimeValue duration) -> None"},
+ {"ScaleMovieSegment", (PyCFunction)MovieObj_ScaleMovieSegment, 1,
+ "(TimeValue startTime, TimeValue oldDuration, TimeValue newDuration) -> None"},
+ {"CutMovieSelection", (PyCFunction)MovieObj_CutMovieSelection, 1,
+ "() -> (Movie _rv)"},
+ {"CopyMovieSelection", (PyCFunction)MovieObj_CopyMovieSelection, 1,
+ "() -> (Movie _rv)"},
+ {"PasteMovieSelection", (PyCFunction)MovieObj_PasteMovieSelection, 1,
+ "(Movie src) -> None"},
+ {"AddMovieSelection", (PyCFunction)MovieObj_AddMovieSelection, 1,
+ "(Movie src) -> None"},
+ {"ClearMovieSelection", (PyCFunction)MovieObj_ClearMovieSelection, 1,
+ "() -> None"},
+ {"PutMovieIntoTypedHandle", (PyCFunction)MovieObj_PutMovieIntoTypedHandle, 1,
+ "(Track targetTrack, OSType handleType, Handle publicMovie, TimeValue start, TimeValue dur, long flags, ComponentInstance userComp) -> None"},
+ {"CopyMovieSettings", (PyCFunction)MovieObj_CopyMovieSettings, 1,
+ "(Movie dstMovie) -> None"},
+ {"ConvertMovieToFile", (PyCFunction)MovieObj_ConvertMovieToFile, 1,
+ "(Track onlyTrack, FSSpec outputFile, OSType fileType, OSType creator, ScriptCode scriptTag, long flags, ComponentInstance userComp) -> (short resID)"},
+ {"GetMovieDataSize", (PyCFunction)MovieObj_GetMovieDataSize, 1,
+ "(TimeValue startTime, TimeValue duration) -> (long _rv)"},
+ {"GetMovieDataSize64", (PyCFunction)MovieObj_GetMovieDataSize64, 1,
+ "(TimeValue startTime, TimeValue duration) -> (wide dataSize)"},
+ {"PtInMovie", (PyCFunction)MovieObj_PtInMovie, 1,
+ "(Point pt) -> (Boolean _rv)"},
+ {"SetMovieLanguage", (PyCFunction)MovieObj_SetMovieLanguage, 1,
+ "(long language) -> None"},
+ {"GetMovieNextInterestingTime", (PyCFunction)MovieObj_GetMovieNextInterestingTime, 1,
+ "(short interestingTimeFlags, short numMediaTypes, OSType whichMediaTypes, TimeValue time, Fixed rate) -> (TimeValue interestingTime, TimeValue interestingDuration)"},
+ {"AddMovieResource", (PyCFunction)MovieObj_AddMovieResource, 1,
+ "(short resRefNum, Str255 resName) -> (short resId)"},
+ {"UpdateMovieResource", (PyCFunction)MovieObj_UpdateMovieResource, 1,
+ "(short resRefNum, short resId, Str255 resName) -> None"},
+ {"HasMovieChanged", (PyCFunction)MovieObj_HasMovieChanged, 1,
+ "() -> (Boolean _rv)"},
+ {"ClearMovieChanged", (PyCFunction)MovieObj_ClearMovieChanged, 1,
+ "() -> None"},
+ {"SetMovieDefaultDataRef", (PyCFunction)MovieObj_SetMovieDefaultDataRef, 1,
+ "(Handle dataRef, OSType dataRefType) -> None"},
+ {"GetMovieDefaultDataRef", (PyCFunction)MovieObj_GetMovieDefaultDataRef, 1,
+ "() -> (Handle dataRef, OSType dataRefType)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SetMovieAnchorDataRef", (PyCFunction)MovieObj_SetMovieAnchorDataRef, 1,
+ "(Handle dataRef, OSType dataRefType) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"GetMovieAnchorDataRef", (PyCFunction)MovieObj_GetMovieAnchorDataRef, 1,
+ "() -> (Handle dataRef, OSType dataRefType, long outFlags)"},
+#endif
+ {"SetMovieColorTable", (PyCFunction)MovieObj_SetMovieColorTable, 1,
+ "(CTabHandle ctab) -> None"},
+ {"GetMovieColorTable", (PyCFunction)MovieObj_GetMovieColorTable, 1,
+ "() -> (CTabHandle ctab)"},
+ {"FlattenMovie", (PyCFunction)MovieObj_FlattenMovie, 1,
+ "(long movieFlattenFlags, FSSpec theFile, OSType creator, ScriptCode scriptTag, long createMovieFileFlags, Str255 resName) -> (short resId)"},
+ {"FlattenMovieData", (PyCFunction)MovieObj_FlattenMovieData, 1,
+ "(long movieFlattenFlags, FSSpec theFile, OSType creator, ScriptCode scriptTag, long createMovieFileFlags) -> (Movie _rv)"},
+ {"MovieSearchText", (PyCFunction)MovieObj_MovieSearchText, 1,
+ "(Ptr text, long size, long searchFlags) -> (Track searchTrack, TimeValue searchTime, long searchOffset)"},
+ {"GetPosterBox", (PyCFunction)MovieObj_GetPosterBox, 1,
+ "() -> (Rect boxRect)"},
+ {"SetPosterBox", (PyCFunction)MovieObj_SetPosterBox, 1,
+ "(Rect boxRect) -> None"},
+ {"GetMovieSegmentDisplayBoundsRgn", (PyCFunction)MovieObj_GetMovieSegmentDisplayBoundsRgn, 1,
+ "(TimeValue time, TimeValue duration) -> (RgnHandle _rv)"},
+ {"GetMovieStatus", (PyCFunction)MovieObj_GetMovieStatus, 1,
+ "() -> (ComponentResult _rv, Track firstProblemTrack)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"GetMovieLoadState", (PyCFunction)MovieObj_GetMovieLoadState, 1,
+ "() -> (long _rv)"},
+#endif
+ {"NewMovieController", (PyCFunction)MovieObj_NewMovieController, 1,
+ "(Rect movieRect, long someFlags) -> (MovieController _rv)"},
+ {"PutMovieOnScrap", (PyCFunction)MovieObj_PutMovieOnScrap, 1,
+ "(long movieScrapFlags) -> None"},
+ {"SetMoviePlayHints", (PyCFunction)MovieObj_SetMoviePlayHints, 1,
+ "(long flags, long flagsMask) -> None"},
+ {"GetMaxLoadedTimeInMovie", (PyCFunction)MovieObj_GetMaxLoadedTimeInMovie, 1,
+ "() -> (TimeValue time)"},
+ {"QTMovieNeedsTimeTable", (PyCFunction)MovieObj_QTMovieNeedsTimeTable, 1,
+ "() -> (Boolean needsTimeTable)"},
+ {"QTGetDataRefMaxFileOffset", (PyCFunction)MovieObj_QTGetDataRefMaxFileOffset, 1,
+ "(OSType dataRefType, Handle dataRef) -> (long offset)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain MovieObj_chain = { MovieObj_methods, NULL };
+
+static PyObject *MovieObj_getattr(MovieObject *self, char *name)
+{
+ return Py_FindMethodInChain(&MovieObj_chain, (PyObject *)self, name);
+}
+
+#define MovieObj_setattr NULL
+
+#define MovieObj_compare NULL
+
+#define MovieObj_repr NULL
+
+#define MovieObj_hash NULL
+
+PyTypeObject Movie_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Movie", /*tp_name*/
+ sizeof(MovieObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) MovieObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) MovieObj_getattr, /*tp_getattr*/
+ (setattrfunc) MovieObj_setattr, /*tp_setattr*/
+ (cmpfunc) MovieObj_compare, /*tp_compare*/
+ (reprfunc) MovieObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) MovieObj_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type Movie ---------------------- */
+
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_CheckQuickTimeRegistration(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ void * registrationKey;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "sl",
+ &registrationKey,
+ &flags))
+ return NULL;
+ CheckQuickTimeRegistration(registrationKey,
+ flags);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Qt_EnterMovies(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EnterMovies();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_ExitMovies(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ExitMovies();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetMoviesError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMoviesError();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_ClearMoviesStickyError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClearMoviesStickyError();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetMoviesStickyError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMoviesStickyError();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_DisposeMatte(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixMapHandle theMatte;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theMatte))
+ return NULL;
+ DisposeMatte(theMatte);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_NewMovie(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "l",
+ &flags))
+ return NULL;
+ _rv = NewMovie(flags);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_GetDataHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Component _rv;
+ Handle dataRef;
+ OSType dataHandlerSubType;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataHandlerSubType,
+ &flags))
+ return NULL;
+ _rv = GetDataHandler(dataRef,
+ dataHandlerSubType,
+ flags);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_OpenADataHandler(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle dataRef;
+ OSType dataHandlerSubType;
+ Handle anchorDataRef;
+ OSType anchorDataRefType;
+ TimeBase tb;
+ long flags;
+ ComponentInstance dh;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&l",
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataHandlerSubType,
+ ResObj_Convert, &anchorDataRef,
+ PyMac_GetOSType, &anchorDataRefType,
+ TimeBaseObj_Convert, &tb,
+ &flags))
+ return NULL;
+ _err = OpenADataHandler(dataRef,
+ dataHandlerSubType,
+ anchorDataRef,
+ anchorDataRefType,
+ tb,
+ flags,
+ &dh);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpInstObj_New, dh);
+ return _res;
+}
+#endif
+
+static PyObject *Qt_PasteHandleIntoMovie(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle h;
+ OSType handleType;
+ Movie theMovie;
+ long flags;
+ ComponentInstance userComp;
+ if (!PyArg_ParseTuple(_args, "O&O&O&lO&",
+ ResObj_Convert, &h,
+ PyMac_GetOSType, &handleType,
+ MovieObj_Convert, &theMovie,
+ &flags,
+ CmpInstObj_Convert, &userComp))
+ return NULL;
+ _err = PasteHandleIntoMovie(h,
+ handleType,
+ theMovie,
+ flags,
+ userComp);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetMovieImporterForDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType dataRefType;
+ Handle dataRef;
+ long flags;
+ Component importer;
+ if (!PyArg_ParseTuple(_args, "O&O&l",
+ PyMac_GetOSType, &dataRefType,
+ ResObj_Convert, &dataRef,
+ &flags))
+ return NULL;
+ _err = GetMovieImporterForDataRef(dataRefType,
+ dataRef,
+ flags,
+ &importer);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CmpObj_New, importer);
+ return _res;
+}
+
+static PyObject *Qt_TrackTimeToMediaTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeValue _rv;
+ TimeValue value;
+ Track theTrack;
+ if (!PyArg_ParseTuple(_args, "lO&",
+ &value,
+ TrackObj_Convert, &theTrack))
+ return NULL;
+ _rv = TrackTimeToMediaTime(value,
+ theTrack);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_NewUserData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UserData theUserData;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = NewUserData(&theUserData);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, theUserData);
+ return _res;
+}
+
+static PyObject *Qt_NewUserDataFromHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle h;
+ UserData theUserData;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _err = NewUserDataFromHandle(h,
+ &theUserData);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ UserDataObj_New, theUserData);
+ return _res;
+}
+
+static PyObject *Qt_CreateMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+ short resRefNum;
+ Movie newmovie;
+ if (!PyArg_ParseTuple(_args, "O&O&hl",
+ PyMac_GetFSSpec, &fileSpec,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags))
+ return NULL;
+ _err = CreateMovieFile(&fileSpec,
+ creator,
+ scriptTag,
+ createMovieFileFlags,
+ &resRefNum,
+ &newmovie);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hO&",
+ resRefNum,
+ MovieObj_New, newmovie);
+ return _res;
+}
+
+static PyObject *Qt_OpenMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+ short resRefNum;
+ SInt8 permission;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSSpec, &fileSpec,
+ &permission))
+ return NULL;
+ _err = OpenMovieFile(&fileSpec,
+ &resRefNum,
+ permission);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("h",
+ resRefNum);
+ return _res;
+}
+
+static PyObject *Qt_CloseMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &resRefNum))
+ return NULL;
+ _err = CloseMovieFile(resRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_DeleteMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &fileSpec))
+ return NULL;
+ _err = DeleteMovieFile(&fileSpec);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ short resRefNum;
+ short resId;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+ if (!PyArg_ParseTuple(_args, "hhh",
+ &resRefNum,
+ &resId,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromFile(&theMovie,
+ resRefNum,
+ &resId,
+ (StringPtr)0,
+ newMovieFlags,
+ &dataRefWasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&hb",
+ MovieObj_New, theMovie,
+ resId,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ Handle h;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &h,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromHandle(&theMovie,
+ h,
+ newMovieFlags,
+ &dataRefWasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ MovieObj_New, theMovie,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromDataFork(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ short fRefNum;
+ long fileOffset;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+ if (!PyArg_ParseTuple(_args, "hlh",
+ &fRefNum,
+ &fileOffset,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromDataFork(&theMovie,
+ fRefNum,
+ fileOffset,
+ newMovieFlags,
+ &dataRefWasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ MovieObj_New, theMovie,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromDataFork64(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie theMovie;
+ long fRefNum;
+ wide fileOffset;
+ short newMovieFlags;
+ Boolean dataRefWasChanged;
+ if (!PyArg_ParseTuple(_args, "lO&h",
+ &fRefNum,
+ PyMac_Getwide, &fileOffset,
+ &newMovieFlags))
+ return NULL;
+ _err = NewMovieFromDataFork64(&theMovie,
+ fRefNum,
+ &fileOffset,
+ newMovieFlags,
+ &dataRefWasChanged);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&b",
+ MovieObj_New, theMovie,
+ dataRefWasChanged);
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromDataRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Movie m;
+ short flags;
+ short id;
+ Handle dataRef;
+ OSType dataRefType;
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &flags,
+ ResObj_Convert, &dataRef,
+ PyMac_GetOSType, &dataRefType))
+ return NULL;
+ _err = NewMovieFromDataRef(&m,
+ flags,
+ &id,
+ dataRef,
+ dataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ MovieObj_New, m,
+ id);
+ return _res;
+}
+
+static PyObject *Qt_RemoveMovieResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short resRefNum;
+ short resId;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &resRefNum,
+ &resId))
+ return NULL;
+ _err = RemoveMovieResource(resRefNum,
+ resId);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_CreateShortcutMovieFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fileSpec;
+ OSType creator;
+ ScriptCode scriptTag;
+ long createMovieFileFlags;
+ Handle targetDataRef;
+ OSType targetDataRefType;
+ if (!PyArg_ParseTuple(_args, "O&O&hlO&O&",
+ PyMac_GetFSSpec, &fileSpec,
+ PyMac_GetOSType, &creator,
+ &scriptTag,
+ &createMovieFileFlags,
+ ResObj_Convert, &targetDataRef,
+ PyMac_GetOSType, &targetDataRefType))
+ return NULL;
+ _err = CreateShortcutMovieFile(&fileSpec,
+ creator,
+ scriptTag,
+ createMovieFileFlags,
+ targetDataRef,
+ targetDataRefType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_NewMovieFromScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Movie _rv;
+ long newMovieFlags;
+ if (!PyArg_ParseTuple(_args, "l",
+ &newMovieFlags))
+ return NULL;
+ _rv = NewMovieFromScrap(newMovieFlags);
+ _res = Py_BuildValue("O&",
+ MovieObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_QTNewAlias(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ FSSpec fss;
+ AliasHandle alias;
+ Boolean minimal;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSSpec, &fss,
+ &minimal))
+ return NULL;
+ _err = QTNewAlias(&fss,
+ &alias,
+ minimal);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, alias);
+ return _res;
+}
+
+static PyObject *Qt_EndFullScreen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Ptr fullState;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "sl",
+ &fullState,
+ &flags))
+ return NULL;
+ _err = EndFullScreen(fullState,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_AddSoundDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SoundDescriptionHandle desc;
+ Handle extension;
+ OSType idType;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &desc,
+ ResObj_Convert, &extension,
+ PyMac_GetOSType, &idType))
+ return NULL;
+ _err = AddSoundDescriptionExtension(desc,
+ extension,
+ idType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_GetSoundDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SoundDescriptionHandle desc;
+ Handle extension;
+ OSType idType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &desc,
+ PyMac_GetOSType, &idType))
+ return NULL;
+ _err = GetSoundDescriptionExtension(desc,
+ &extension,
+ idType);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, extension);
+ return _res;
+}
+
+static PyObject *Qt_RemoveSoundDescriptionExtension(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SoundDescriptionHandle desc;
+ OSType idType;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &desc,
+ PyMac_GetOSType, &idType))
+ return NULL;
+ _err = RemoveSoundDescriptionExtension(desc,
+ idType);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTIsStandardParameterDialogEvent(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ EventRecord pEvent;
+ QTParameterDialog createdDialog;
+ if (!PyArg_ParseTuple(_args, "l",
+ &createdDialog))
+ return NULL;
+ _err = QTIsStandardParameterDialogEvent(&pEvent,
+ createdDialog);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildEventRecord, &pEvent);
+ return _res;
+}
+
+static PyObject *Qt_QTDismissStandardParameterDialog(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ QTParameterDialog createdDialog;
+ if (!PyArg_ParseTuple(_args, "l",
+ &createdDialog))
+ return NULL;
+ _err = QTDismissStandardParameterDialog(createdDialog);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTStandardParameterDialogDoAction(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ QTParameterDialog createdDialog;
+ long action;
+ void * params;
+ if (!PyArg_ParseTuple(_args, "lls",
+ &createdDialog,
+ &action,
+ &params))
+ return NULL;
+ _err = QTStandardParameterDialogDoAction(createdDialog,
+ action,
+ params);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTRegisterAccessKey(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 accessKeyType;
+ long flags;
+ Handle accessKey;
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ PyMac_GetStr255, accessKeyType,
+ &flags,
+ ResObj_Convert, &accessKey))
+ return NULL;
+ _err = QTRegisterAccessKey(accessKeyType,
+ flags,
+ accessKey);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTUnregisterAccessKey(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 accessKeyType;
+ long flags;
+ Handle accessKey;
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ PyMac_GetStr255, accessKeyType,
+ &flags,
+ ResObj_Convert, &accessKey))
+ return NULL;
+ _err = QTUnregisterAccessKey(accessKeyType,
+ flags,
+ accessKey);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_QTTextToNativeText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Handle theText;
+ long encoding;
+ long flags;
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ ResObj_Convert, &theText,
+ &encoding,
+ &flags))
+ return NULL;
+ _err = QTTextToNativeText(theText,
+ encoding,
+ flags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaResetStatistics(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = VideoMediaResetStatistics(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaGetStatistics(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = VideoMediaGetStatistics(mh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaGetStallCount(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ unsigned long stalls;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = VideoMediaGetStallCount(mh,
+ &stalls);
+ _res = Py_BuildValue("ll",
+ _rv,
+ stalls);
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaSetCodecParameter(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ CodecType cType;
+ OSType parameterID;
+ long parameterChangeSeed;
+ void * dataPtr;
+ long dataSize;
+ if (!PyArg_ParseTuple(_args, "O&O&O&lsl",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetOSType, &cType,
+ PyMac_GetOSType, &parameterID,
+ &parameterChangeSeed,
+ &dataPtr,
+ &dataSize))
+ return NULL;
+ _rv = VideoMediaSetCodecParameter(mh,
+ cType,
+ parameterID,
+ parameterChangeSeed,
+ dataPtr,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_VideoMediaGetCodecParameter(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ CodecType cType;
+ OSType parameterID;
+ Handle outParameterData;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetOSType, &cType,
+ PyMac_GetOSType, &parameterID,
+ ResObj_Convert, &outParameterData))
+ return NULL;
+ _rv = VideoMediaGetCodecParameter(mh,
+ cType,
+ parameterID,
+ outParameterData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaAddTextSample(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Ptr text;
+ unsigned long size;
+ short fontNumber;
+ short fontSize;
+ Style textFace;
+ RGBColor textColor;
+ RGBColor backColor;
+ short textJustification;
+ Rect textBox;
+ long displayFlags;
+ TimeValue scrollDelay;
+ short hiliteStart;
+ short hiliteEnd;
+ RGBColor rgbHiliteColor;
+ TimeValue duration;
+ TimeValue sampleTime;
+ if (!PyArg_ParseTuple(_args, "O&slhhbhllhhl",
+ CmpInstObj_Convert, &mh,
+ &text,
+ &size,
+ &fontNumber,
+ &fontSize,
+ &textFace,
+ &textJustification,
+ &displayFlags,
+ &scrollDelay,
+ &hiliteStart,
+ &hiliteEnd,
+ &duration))
+ return NULL;
+ _rv = TextMediaAddTextSample(mh,
+ text,
+ size,
+ fontNumber,
+ fontSize,
+ textFace,
+ &textColor,
+ &backColor,
+ textJustification,
+ &textBox,
+ displayFlags,
+ scrollDelay,
+ hiliteStart,
+ hiliteEnd,
+ &rgbHiliteColor,
+ duration,
+ &sampleTime);
+ _res = Py_BuildValue("lO&O&O&O&l",
+ _rv,
+ QdRGB_New, &textColor,
+ QdRGB_New, &backColor,
+ PyMac_BuildRect, &textBox,
+ QdRGB_New, &rgbHiliteColor,
+ sampleTime);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaAddTESample(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TEHandle hTE;
+ RGBColor backColor;
+ short textJustification;
+ Rect textBox;
+ long displayFlags;
+ TimeValue scrollDelay;
+ short hiliteStart;
+ short hiliteEnd;
+ RGBColor rgbHiliteColor;
+ TimeValue duration;
+ TimeValue sampleTime;
+ if (!PyArg_ParseTuple(_args, "O&O&hllhhl",
+ CmpInstObj_Convert, &mh,
+ ResObj_Convert, &hTE,
+ &textJustification,
+ &displayFlags,
+ &scrollDelay,
+ &hiliteStart,
+ &hiliteEnd,
+ &duration))
+ return NULL;
+ _rv = TextMediaAddTESample(mh,
+ hTE,
+ &backColor,
+ textJustification,
+ &textBox,
+ displayFlags,
+ scrollDelay,
+ hiliteStart,
+ hiliteEnd,
+ &rgbHiliteColor,
+ duration,
+ &sampleTime);
+ _res = Py_BuildValue("lO&O&O&l",
+ _rv,
+ QdRGB_New, &backColor,
+ PyMac_BuildRect, &textBox,
+ QdRGB_New, &rgbHiliteColor,
+ sampleTime);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaAddHiliteSample(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short hiliteStart;
+ short hiliteEnd;
+ RGBColor rgbHiliteColor;
+ TimeValue duration;
+ TimeValue sampleTime;
+ if (!PyArg_ParseTuple(_args, "O&hhl",
+ CmpInstObj_Convert, &mh,
+ &hiliteStart,
+ &hiliteEnd,
+ &duration))
+ return NULL;
+ _rv = TextMediaAddHiliteSample(mh,
+ hiliteStart,
+ hiliteEnd,
+ &rgbHiliteColor,
+ duration,
+ &sampleTime);
+ _res = Py_BuildValue("lO&l",
+ _rv,
+ QdRGB_New, &rgbHiliteColor,
+ sampleTime);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaDrawRaw(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ GWorldPtr gw;
+ GDHandle gd;
+ void * data;
+ long dataSize;
+ TextDescriptionHandle tdh;
+ if (!PyArg_ParseTuple(_args, "O&O&O&slO&",
+ CmpInstObj_Convert, &mh,
+ GWorldObj_Convert, &gw,
+ OptResObj_Convert, &gd,
+ &data,
+ &dataSize,
+ ResObj_Convert, &tdh))
+ return NULL;
+ _rv = TextMediaDrawRaw(mh,
+ gw,
+ gd,
+ data,
+ dataSize,
+ tdh);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaSetTextProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue atMediaTime;
+ long propertyType;
+ void * data;
+ long dataSize;
+ if (!PyArg_ParseTuple(_args, "O&llsl",
+ CmpInstObj_Convert, &mh,
+ &atMediaTime,
+ &propertyType,
+ &data,
+ &dataSize))
+ return NULL;
+ _rv = TextMediaSetTextProperty(mh,
+ atMediaTime,
+ propertyType,
+ data,
+ dataSize);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaRawSetup(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ GWorldPtr gw;
+ GDHandle gd;
+ void * data;
+ long dataSize;
+ TextDescriptionHandle tdh;
+ TimeValue sampleDuration;
+ if (!PyArg_ParseTuple(_args, "O&O&O&slO&l",
+ CmpInstObj_Convert, &mh,
+ GWorldObj_Convert, &gw,
+ OptResObj_Convert, &gd,
+ &data,
+ &dataSize,
+ ResObj_Convert, &tdh,
+ &sampleDuration))
+ return NULL;
+ _rv = TextMediaRawSetup(mh,
+ gw,
+ gd,
+ data,
+ dataSize,
+ tdh,
+ sampleDuration);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaRawIdle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ GWorldPtr gw;
+ GDHandle gd;
+ TimeValue sampleTime;
+ long flagsIn;
+ long flagsOut;
+ if (!PyArg_ParseTuple(_args, "O&O&O&ll",
+ CmpInstObj_Convert, &mh,
+ GWorldObj_Convert, &gw,
+ OptResObj_Convert, &gd,
+ &sampleTime,
+ &flagsIn))
+ return NULL;
+ _rv = TextMediaRawIdle(mh,
+ gw,
+ gd,
+ sampleTime,
+ flagsIn,
+ &flagsOut);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flagsOut);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaFindNextText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Ptr text;
+ long size;
+ short findFlags;
+ TimeValue startTime;
+ TimeValue foundTime;
+ TimeValue foundDuration;
+ long offset;
+ if (!PyArg_ParseTuple(_args, "O&slhl",
+ CmpInstObj_Convert, &mh,
+ &text,
+ &size,
+ &findFlags,
+ &startTime))
+ return NULL;
+ _rv = TextMediaFindNextText(mh,
+ text,
+ size,
+ findFlags,
+ startTime,
+ &foundTime,
+ &foundDuration,
+ &offset);
+ _res = Py_BuildValue("llll",
+ _rv,
+ foundTime,
+ foundDuration,
+ offset);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaHiliteTextSample(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ TimeValue sampleTime;
+ short hiliteStart;
+ short hiliteEnd;
+ RGBColor rgbHiliteColor;
+ if (!PyArg_ParseTuple(_args, "O&lhh",
+ CmpInstObj_Convert, &mh,
+ &sampleTime,
+ &hiliteStart,
+ &hiliteEnd))
+ return NULL;
+ _rv = TextMediaHiliteTextSample(mh,
+ sampleTime,
+ hiliteStart,
+ hiliteEnd,
+ &rgbHiliteColor);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ QdRGB_New, &rgbHiliteColor);
+ return _res;
+}
+
+static PyObject *Qt_TextMediaSetTextSampleData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * data;
+ OSType dataType;
+ if (!PyArg_ParseTuple(_args, "O&sO&",
+ CmpInstObj_Convert, &mh,
+ &data,
+ PyMac_GetOSType, &dataType))
+ return NULL;
+ _rv = TextMediaSetTextSampleData(mh,
+ data,
+ dataType);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSetProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short spriteIndex;
+ long propertyType;
+ void * propertyValue;
+ if (!PyArg_ParseTuple(_args, "O&hls",
+ CmpInstObj_Convert, &mh,
+ &spriteIndex,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = SpriteMediaSetProperty(mh,
+ spriteIndex,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short spriteIndex;
+ long propertyType;
+ void * propertyValue;
+ if (!PyArg_ParseTuple(_args, "O&hls",
+ CmpInstObj_Convert, &mh,
+ &spriteIndex,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = SpriteMediaGetProperty(mh,
+ spriteIndex,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaHitTestSprites(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flags;
+ Point loc;
+ short spriteHitIndex;
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ PyMac_GetPoint, &loc))
+ return NULL;
+ _rv = SpriteMediaHitTestSprites(mh,
+ flags,
+ loc,
+ &spriteHitIndex);
+ _res = Py_BuildValue("lh",
+ _rv,
+ spriteHitIndex);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaCountSprites(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short numSprites;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = SpriteMediaCountSprites(mh,
+ &numSprites);
+ _res = Py_BuildValue("lh",
+ _rv,
+ numSprites);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaCountImages(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short numImages;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = SpriteMediaCountImages(mh,
+ &numImages);
+ _res = Py_BuildValue("lh",
+ _rv,
+ numImages);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetIndImageDescription(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short imageIndex;
+ ImageDescriptionHandle imageDescription;
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ CmpInstObj_Convert, &mh,
+ &imageIndex,
+ ResObj_Convert, &imageDescription))
+ return NULL;
+ _rv = SpriteMediaGetIndImageDescription(mh,
+ imageIndex,
+ imageDescription);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetDisplayedSampleNumber(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long sampleNum;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = SpriteMediaGetDisplayedSampleNumber(mh,
+ &sampleNum);
+ _res = Py_BuildValue("ll",
+ _rv,
+ sampleNum);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetSpriteName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ Str255 spriteName;
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &spriteID,
+ PyMac_GetStr255, spriteName))
+ return NULL;
+ _rv = SpriteMediaGetSpriteName(mh,
+ spriteID,
+ spriteName);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetImageName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short imageIndex;
+ Str255 imageName;
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ CmpInstObj_Convert, &mh,
+ &imageIndex,
+ PyMac_GetStr255, imageName))
+ return NULL;
+ _rv = SpriteMediaGetImageName(mh,
+ imageIndex,
+ imageName);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSetSpriteProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ long propertyType;
+ void * propertyValue;
+ if (!PyArg_ParseTuple(_args, "O&lls",
+ CmpInstObj_Convert, &mh,
+ &spriteID,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = SpriteMediaSetSpriteProperty(mh,
+ spriteID,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetSpriteProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ long propertyType;
+ void * propertyValue;
+ if (!PyArg_ParseTuple(_args, "O&lls",
+ CmpInstObj_Convert, &mh,
+ &spriteID,
+ &propertyType,
+ &propertyValue))
+ return NULL;
+ _rv = SpriteMediaGetSpriteProperty(mh,
+ spriteID,
+ propertyType,
+ propertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaHitTestAllSprites(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flags;
+ Point loc;
+ QTAtomID spriteHitID;
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ CmpInstObj_Convert, &mh,
+ &flags,
+ PyMac_GetPoint, &loc))
+ return NULL;
+ _rv = SpriteMediaHitTestAllSprites(mh,
+ flags,
+ loc,
+ &spriteHitID);
+ _res = Py_BuildValue("ll",
+ _rv,
+ spriteHitID);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaHitTestOneSprite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ long flags;
+ Point loc;
+ Boolean wasHit;
+ if (!PyArg_ParseTuple(_args, "O&llO&",
+ CmpInstObj_Convert, &mh,
+ &spriteID,
+ &flags,
+ PyMac_GetPoint, &loc))
+ return NULL;
+ _rv = SpriteMediaHitTestOneSprite(mh,
+ spriteID,
+ flags,
+ loc,
+ &wasHit);
+ _res = Py_BuildValue("lb",
+ _rv,
+ wasHit);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSpriteIndexToID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short spriteIndex;
+ QTAtomID spriteID;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mh,
+ &spriteIndex))
+ return NULL;
+ _rv = SpriteMediaSpriteIndexToID(mh,
+ spriteIndex,
+ &spriteID);
+ _res = Py_BuildValue("ll",
+ _rv,
+ spriteID);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSpriteIDToIndex(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ short spriteIndex;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &spriteID))
+ return NULL;
+ _rv = SpriteMediaSpriteIDToIndex(mh,
+ spriteID,
+ &spriteIndex);
+ _res = Py_BuildValue("lh",
+ _rv,
+ spriteIndex);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSetActionVariable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID variableID;
+ float value;
+ if (!PyArg_ParseTuple(_args, "O&lf",
+ CmpInstObj_Convert, &mh,
+ &variableID,
+ &value))
+ return NULL;
+ _rv = SpriteMediaSetActionVariable(mh,
+ variableID,
+ &value);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetActionVariable(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID variableID;
+ float value;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &variableID))
+ return NULL;
+ _rv = SpriteMediaGetActionVariable(mh,
+ variableID,
+ &value);
+ _res = Py_BuildValue("lf",
+ _rv,
+ value);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_SpriteMediaGetIndImageProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short imageIndex;
+ long imagePropertyType;
+ void * imagePropertyValue;
+ if (!PyArg_ParseTuple(_args, "O&hls",
+ CmpInstObj_Convert, &mh,
+ &imageIndex,
+ &imagePropertyType,
+ &imagePropertyValue))
+ return NULL;
+ _rv = SpriteMediaGetIndImageProperty(mh,
+ imageIndex,
+ imagePropertyType,
+ imagePropertyValue);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *Qt_SpriteMediaDisposeSprite(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID spriteID;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &spriteID))
+ return NULL;
+ _rv = SpriteMediaDisposeSprite(mh,
+ spriteID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaSetActionVariableToString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID variableID;
+ Ptr theCString;
+ if (!PyArg_ParseTuple(_args, "O&ls",
+ CmpInstObj_Convert, &mh,
+ &variableID,
+ &theCString))
+ return NULL;
+ _rv = SpriteMediaSetActionVariableToString(mh,
+ variableID,
+ theCString);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_SpriteMediaGetActionVariableAsString(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID variableID;
+ Handle theCString;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &variableID))
+ return NULL;
+ _rv = SpriteMediaGetActionVariableAsString(mh,
+ variableID,
+ &theCString);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ ResObj_New, theCString);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaSetPan(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short xPercent;
+ short yPercent;
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ CmpInstObj_Convert, &mh,
+ &xPercent,
+ &yPercent))
+ return NULL;
+ _rv = FlashMediaSetPan(mh,
+ xPercent,
+ yPercent);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaSetZoom(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ short factor;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ CmpInstObj_Convert, &mh,
+ &factor))
+ return NULL;
+ _rv = FlashMediaSetZoom(mh,
+ factor);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaSetZoomRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long left;
+ long top;
+ long right;
+ long bottom;
+ if (!PyArg_ParseTuple(_args, "O&llll",
+ CmpInstObj_Convert, &mh,
+ &left,
+ &top,
+ &right,
+ &bottom))
+ return NULL;
+ _rv = FlashMediaSetZoomRect(mh,
+ left,
+ top,
+ right,
+ bottom);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaGetRefConBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long refCon;
+ long left;
+ long top;
+ long right;
+ long bottom;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &refCon))
+ return NULL;
+ _rv = FlashMediaGetRefConBounds(mh,
+ refCon,
+ &left,
+ &top,
+ &right,
+ &bottom);
+ _res = Py_BuildValue("lllll",
+ _rv,
+ left,
+ top,
+ right,
+ bottom);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaGetRefConID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long refCon;
+ long refConID;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &refCon))
+ return NULL;
+ _rv = FlashMediaGetRefConID(mh,
+ refCon,
+ &refConID);
+ _res = Py_BuildValue("ll",
+ _rv,
+ refConID);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaIDToRefCon(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long refConID;
+ long refCon;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &refConID))
+ return NULL;
+ _rv = FlashMediaIDToRefCon(mh,
+ refConID,
+ &refCon);
+ _res = Py_BuildValue("ll",
+ _rv,
+ refCon);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaGetDisplayedFrameNumber(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flashFrameNumber;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = FlashMediaGetDisplayedFrameNumber(mh,
+ &flashFrameNumber);
+ _res = Py_BuildValue("ll",
+ _rv,
+ flashFrameNumber);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaFrameNumberToMovieTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long flashFrameNumber;
+ TimeValue movieTime;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &flashFrameNumber))
+ return NULL;
+ _rv = FlashMediaFrameNumberToMovieTime(mh,
+ flashFrameNumber,
+ &movieTime);
+ _res = Py_BuildValue("ll",
+ _rv,
+ movieTime);
+ return _res;
+}
+
+static PyObject *Qt_FlashMediaFrameLabelToMovieTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ Ptr theLabel;
+ TimeValue movieTime;
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &theLabel))
+ return NULL;
+ _rv = FlashMediaFrameLabelToMovieTime(mh,
+ theLabel,
+ &movieTime);
+ _res = Py_BuildValue("ll",
+ _rv,
+ movieTime);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_MovieMediaGetCurrentMovieProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ OSType whichProperty;
+ void * value;
+ if (!PyArg_ParseTuple(_args, "O&O&s",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetOSType, &whichProperty,
+ &value))
+ return NULL;
+ _rv = MovieMediaGetCurrentMovieProperty(mh,
+ whichProperty,
+ value);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_MovieMediaGetCurrentTrackProperty(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ long trackID;
+ OSType whichProperty;
+ void * value;
+ if (!PyArg_ParseTuple(_args, "O&lO&s",
+ CmpInstObj_Convert, &mh,
+ &trackID,
+ PyMac_GetOSType, &whichProperty,
+ &value))
+ return NULL;
+ _rv = MovieMediaGetCurrentTrackProperty(mh,
+ trackID,
+ whichProperty,
+ value);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_MovieMediaGetChildMovieDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID dataRefID;
+ short dataRefIndex;
+ OSType dataRefType;
+ Handle dataRef;
+ QTAtomID dataRefIDOut;
+ short dataRefIndexOut;
+ if (!PyArg_ParseTuple(_args, "O&lh",
+ CmpInstObj_Convert, &mh,
+ &dataRefID,
+ &dataRefIndex))
+ return NULL;
+ _rv = MovieMediaGetChildMovieDataReference(mh,
+ dataRefID,
+ dataRefIndex,
+ &dataRefType,
+ &dataRef,
+ &dataRefIDOut,
+ &dataRefIndexOut);
+ _res = Py_BuildValue("lO&O&lh",
+ _rv,
+ PyMac_BuildOSType, dataRefType,
+ ResObj_New, dataRef,
+ dataRefIDOut,
+ dataRefIndexOut);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_MovieMediaSetChildMovieDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID dataRefID;
+ OSType dataRefType;
+ Handle dataRef;
+ if (!PyArg_ParseTuple(_args, "O&lO&O&",
+ CmpInstObj_Convert, &mh,
+ &dataRefID,
+ PyMac_GetOSType, &dataRefType,
+ ResObj_Convert, &dataRef))
+ return NULL;
+ _rv = MovieMediaSetChildMovieDataReference(mh,
+ dataRefID,
+ dataRefType,
+ dataRef);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_MovieMediaLoadChildMovieFromDataReference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTAtomID dataRefID;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &mh,
+ &dataRefID))
+ return NULL;
+ _rv = MovieMediaLoadChildMovieFromDataReference(mh,
+ dataRefID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *Qt_Media3DGetCurrentGroup(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * group;
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &group))
+ return NULL;
+ _rv = Media3DGetCurrentGroup(mh,
+ group);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DTranslateNamedObjectTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char objectName;
+ Fixed x;
+ Fixed y;
+ Fixed z;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetFixed, &x,
+ PyMac_GetFixed, &y,
+ PyMac_GetFixed, &z))
+ return NULL;
+ _rv = Media3DTranslateNamedObjectTo(mh,
+ &objectName,
+ x,
+ y,
+ z);
+ _res = Py_BuildValue("lc",
+ _rv,
+ objectName);
+ return _res;
+}
+
+static PyObject *Qt_Media3DScaleNamedObjectTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char objectName;
+ Fixed xScale;
+ Fixed yScale;
+ Fixed zScale;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetFixed, &xScale,
+ PyMac_GetFixed, &yScale,
+ PyMac_GetFixed, &zScale))
+ return NULL;
+ _rv = Media3DScaleNamedObjectTo(mh,
+ &objectName,
+ xScale,
+ yScale,
+ zScale);
+ _res = Py_BuildValue("lc",
+ _rv,
+ objectName);
+ return _res;
+}
+
+static PyObject *Qt_Media3DRotateNamedObjectTo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ char objectName;
+ Fixed xDegrees;
+ Fixed yDegrees;
+ Fixed zDegrees;
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&",
+ CmpInstObj_Convert, &mh,
+ PyMac_GetFixed, &xDegrees,
+ PyMac_GetFixed, &yDegrees,
+ PyMac_GetFixed, &zDegrees))
+ return NULL;
+ _rv = Media3DRotateNamedObjectTo(mh,
+ &objectName,
+ xDegrees,
+ yDegrees,
+ zDegrees);
+ _res = Py_BuildValue("lc",
+ _rv,
+ objectName);
+ return _res;
+}
+
+static PyObject *Qt_Media3DSetCameraData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * cameraData;
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &cameraData))
+ return NULL;
+ _rv = Media3DSetCameraData(mh,
+ cameraData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DGetCameraData(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * cameraData;
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &cameraData))
+ return NULL;
+ _rv = Media3DGetCameraData(mh,
+ cameraData);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DSetCameraAngleAspect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTFloatSingle fov;
+ QTFloatSingle aspectRatioXToY;
+ if (!PyArg_ParseTuple(_args, "O&ff",
+ CmpInstObj_Convert, &mh,
+ &fov,
+ &aspectRatioXToY))
+ return NULL;
+ _rv = Media3DSetCameraAngleAspect(mh,
+ fov,
+ aspectRatioXToY);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DGetCameraAngleAspect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ QTFloatSingle fov;
+ QTFloatSingle aspectRatioXToY;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CmpInstObj_Convert, &mh))
+ return NULL;
+ _rv = Media3DGetCameraAngleAspect(mh,
+ &fov,
+ &aspectRatioXToY);
+ _res = Py_BuildValue("lff",
+ _rv,
+ fov,
+ aspectRatioXToY);
+ return _res;
+}
+
+static PyObject *Qt_Media3DSetCameraRange(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * tQ3CameraRange;
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &tQ3CameraRange))
+ return NULL;
+ _rv = Media3DSetCameraRange(mh,
+ tQ3CameraRange);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Qt_Media3DGetCameraRange(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * tQ3CameraRange;
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &tQ3CameraRange))
+ return NULL;
+ _rv = Media3DGetCameraRange(mh,
+ tQ3CameraRange);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Qt_Media3DGetViewObject(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ MediaHandler mh;
+ void * tq3viewObject;
+ if (!PyArg_ParseTuple(_args, "O&s",
+ CmpInstObj_Convert, &mh,
+ &tq3viewObject))
+ return NULL;
+ _rv = Media3DGetViewObject(mh,
+ tq3viewObject);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *Qt_NewTimeBase(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeBase _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = NewTimeBase();
+ _res = Py_BuildValue("O&",
+ TimeBaseObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Qt_ConvertTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord inout;
+ TimeBase newBase;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ QtTimeRecord_Convert, &inout,
+ TimeBaseObj_Convert, &newBase))
+ return NULL;
+ ConvertTime(&inout,
+ newBase);
+ _res = Py_BuildValue("O&",
+ QtTimeRecord_New, &inout);
+ return _res;
+}
+
+static PyObject *Qt_ConvertTimeScale(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord inout;
+ TimeScale newScale;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ QtTimeRecord_Convert, &inout,
+ &newScale))
+ return NULL;
+ ConvertTimeScale(&inout,
+ newScale);
+ _res = Py_BuildValue("O&",
+ QtTimeRecord_New, &inout);
+ return _res;
+}
+
+static PyObject *Qt_AddTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord dst;
+ TimeRecord src;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ QtTimeRecord_Convert, &dst,
+ QtTimeRecord_Convert, &src))
+ return NULL;
+ AddTime(&dst,
+ &src);
+ _res = Py_BuildValue("O&",
+ QtTimeRecord_New, &dst);
+ return _res;
+}
+
+static PyObject *Qt_SubtractTime(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TimeRecord dst;
+ TimeRecord src;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ QtTimeRecord_Convert, &dst,
+ QtTimeRecord_Convert, &src))
+ return NULL;
+ SubtractTime(&dst,
+ &src);
+ _res = Py_BuildValue("O&",
+ QtTimeRecord_New, &dst);
+ return _res;
+}
+
+static PyObject *Qt_MusicMediaGetIndexedTunePlayer(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ComponentResult _rv;
+ ComponentInstance ti;
+ long sampleDescIndex;
+ ComponentInstance tp;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ CmpInstObj_Convert, &ti,
+ &sampleDescIndex))
+ return NULL;
+ _rv = MusicMediaGetIndexedTunePlayer(ti,
+ sampleDescIndex,
+ &tp);
+ _res = Py_BuildValue("lO&",
+ _rv,
+ CmpInstObj_New, tp);
+ return _res;
+}
+
+static PyObject *Qt_AlignWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr wp;
+ Boolean front;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ WinObj_Convert, &wp,
+ &front))
+ return NULL;
+ AlignWindow(wp,
+ front,
+ (Rect *)0,
+ (ICMAlignmentProcRecordPtr)0);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_DragAlignedWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr wp;
+ Point startPt;
+ Rect boundsRect;
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ WinObj_Convert, &wp,
+ PyMac_GetPoint, &startPt,
+ PyMac_GetRect, &boundsRect))
+ return NULL;
+ DragAlignedWindow(wp,
+ startPt,
+ &boundsRect,
+ (Rect *)0,
+ (ICMAlignmentProcRecordPtr)0);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qt_MoviesTask(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long maxMilliSecToUse;
+ if (!PyArg_ParseTuple(_args, "l",
+ &maxMilliSecToUse))
+ return NULL;
+ MoviesTask((Movie)0,
+ maxMilliSecToUse);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef Qt_methods[] = {
+
+#if !TARGET_API_MAC_CARBON
+ {"CheckQuickTimeRegistration", (PyCFunction)Qt_CheckQuickTimeRegistration, 1,
+ "(void * registrationKey, long flags) -> None"},
+#endif
+ {"EnterMovies", (PyCFunction)Qt_EnterMovies, 1,
+ "() -> None"},
+ {"ExitMovies", (PyCFunction)Qt_ExitMovies, 1,
+ "() -> None"},
+ {"GetMoviesError", (PyCFunction)Qt_GetMoviesError, 1,
+ "() -> None"},
+ {"ClearMoviesStickyError", (PyCFunction)Qt_ClearMoviesStickyError, 1,
+ "() -> None"},
+ {"GetMoviesStickyError", (PyCFunction)Qt_GetMoviesStickyError, 1,
+ "() -> None"},
+ {"DisposeMatte", (PyCFunction)Qt_DisposeMatte, 1,
+ "(PixMapHandle theMatte) -> None"},
+ {"NewMovie", (PyCFunction)Qt_NewMovie, 1,
+ "(long flags) -> (Movie _rv)"},
+ {"GetDataHandler", (PyCFunction)Qt_GetDataHandler, 1,
+ "(Handle dataRef, OSType dataHandlerSubType, long flags) -> (Component _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"OpenADataHandler", (PyCFunction)Qt_OpenADataHandler, 1,
+ "(Handle dataRef, OSType dataHandlerSubType, Handle anchorDataRef, OSType anchorDataRefType, TimeBase tb, long flags) -> (ComponentInstance dh)"},
+#endif
+ {"PasteHandleIntoMovie", (PyCFunction)Qt_PasteHandleIntoMovie, 1,
+ "(Handle h, OSType handleType, Movie theMovie, long flags, ComponentInstance userComp) -> None"},
+ {"GetMovieImporterForDataRef", (PyCFunction)Qt_GetMovieImporterForDataRef, 1,
+ "(OSType dataRefType, Handle dataRef, long flags) -> (Component importer)"},
+ {"TrackTimeToMediaTime", (PyCFunction)Qt_TrackTimeToMediaTime, 1,
+ "(TimeValue value, Track theTrack) -> (TimeValue _rv)"},
+ {"NewUserData", (PyCFunction)Qt_NewUserData, 1,
+ "() -> (UserData theUserData)"},
+ {"NewUserDataFromHandle", (PyCFunction)Qt_NewUserDataFromHandle, 1,
+ "(Handle h) -> (UserData theUserData)"},
+ {"CreateMovieFile", (PyCFunction)Qt_CreateMovieFile, 1,
+ "(FSSpec fileSpec, OSType creator, ScriptCode scriptTag, long createMovieFileFlags) -> (short resRefNum, Movie newmovie)"},
+ {"OpenMovieFile", (PyCFunction)Qt_OpenMovieFile, 1,
+ "(FSSpec fileSpec, SInt8 permission) -> (short resRefNum)"},
+ {"CloseMovieFile", (PyCFunction)Qt_CloseMovieFile, 1,
+ "(short resRefNum) -> None"},
+ {"DeleteMovieFile", (PyCFunction)Qt_DeleteMovieFile, 1,
+ "(FSSpec fileSpec) -> None"},
+ {"NewMovieFromFile", (PyCFunction)Qt_NewMovieFromFile, 1,
+ "(short resRefNum, short resId, short newMovieFlags) -> (Movie theMovie, short resId, Boolean dataRefWasChanged)"},
+ {"NewMovieFromHandle", (PyCFunction)Qt_NewMovieFromHandle, 1,
+ "(Handle h, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)"},
+ {"NewMovieFromDataFork", (PyCFunction)Qt_NewMovieFromDataFork, 1,
+ "(short fRefNum, long fileOffset, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)"},
+ {"NewMovieFromDataFork64", (PyCFunction)Qt_NewMovieFromDataFork64, 1,
+ "(long fRefNum, wide fileOffset, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)"},
+ {"NewMovieFromDataRef", (PyCFunction)Qt_NewMovieFromDataRef, 1,
+ "(short flags, Handle dataRef, OSType dataRefType) -> (Movie m, short id)"},
+ {"RemoveMovieResource", (PyCFunction)Qt_RemoveMovieResource, 1,
+ "(short resRefNum, short resId) -> None"},
+ {"CreateShortcutMovieFile", (PyCFunction)Qt_CreateShortcutMovieFile, 1,
+ "(FSSpec fileSpec, OSType creator, ScriptCode scriptTag, long createMovieFileFlags, Handle targetDataRef, OSType targetDataRefType) -> None"},
+ {"NewMovieFromScrap", (PyCFunction)Qt_NewMovieFromScrap, 1,
+ "(long newMovieFlags) -> (Movie _rv)"},
+ {"QTNewAlias", (PyCFunction)Qt_QTNewAlias, 1,
+ "(FSSpec fss, Boolean minimal) -> (AliasHandle alias)"},
+ {"EndFullScreen", (PyCFunction)Qt_EndFullScreen, 1,
+ "(Ptr fullState, long flags) -> None"},
+ {"AddSoundDescriptionExtension", (PyCFunction)Qt_AddSoundDescriptionExtension, 1,
+ "(SoundDescriptionHandle desc, Handle extension, OSType idType) -> None"},
+ {"GetSoundDescriptionExtension", (PyCFunction)Qt_GetSoundDescriptionExtension, 1,
+ "(SoundDescriptionHandle desc, OSType idType) -> (Handle extension)"},
+ {"RemoveSoundDescriptionExtension", (PyCFunction)Qt_RemoveSoundDescriptionExtension, 1,
+ "(SoundDescriptionHandle desc, OSType idType) -> None"},
+ {"QTIsStandardParameterDialogEvent", (PyCFunction)Qt_QTIsStandardParameterDialogEvent, 1,
+ "(QTParameterDialog createdDialog) -> (EventRecord pEvent)"},
+ {"QTDismissStandardParameterDialog", (PyCFunction)Qt_QTDismissStandardParameterDialog, 1,
+ "(QTParameterDialog createdDialog) -> None"},
+ {"QTStandardParameterDialogDoAction", (PyCFunction)Qt_QTStandardParameterDialogDoAction, 1,
+ "(QTParameterDialog createdDialog, long action, void * params) -> None"},
+ {"QTRegisterAccessKey", (PyCFunction)Qt_QTRegisterAccessKey, 1,
+ "(Str255 accessKeyType, long flags, Handle accessKey) -> None"},
+ {"QTUnregisterAccessKey", (PyCFunction)Qt_QTUnregisterAccessKey, 1,
+ "(Str255 accessKeyType, long flags, Handle accessKey) -> None"},
+ {"QTTextToNativeText", (PyCFunction)Qt_QTTextToNativeText, 1,
+ "(Handle theText, long encoding, long flags) -> None"},
+ {"VideoMediaResetStatistics", (PyCFunction)Qt_VideoMediaResetStatistics, 1,
+ "(MediaHandler mh) -> (ComponentResult _rv)"},
+ {"VideoMediaGetStatistics", (PyCFunction)Qt_VideoMediaGetStatistics, 1,
+ "(MediaHandler mh) -> (ComponentResult _rv)"},
+ {"VideoMediaGetStallCount", (PyCFunction)Qt_VideoMediaGetStallCount, 1,
+ "(MediaHandler mh) -> (ComponentResult _rv, unsigned long stalls)"},
+ {"VideoMediaSetCodecParameter", (PyCFunction)Qt_VideoMediaSetCodecParameter, 1,
+ "(MediaHandler mh, CodecType cType, OSType parameterID, long parameterChangeSeed, void * dataPtr, long dataSize) -> (ComponentResult _rv)"},
+ {"VideoMediaGetCodecParameter", (PyCFunction)Qt_VideoMediaGetCodecParameter, 1,
+ "(MediaHandler mh, CodecType cType, OSType parameterID, Handle outParameterData) -> (ComponentResult _rv)"},
+ {"TextMediaAddTextSample", (PyCFunction)Qt_TextMediaAddTextSample, 1,
+ "(MediaHandler mh, Ptr text, unsigned long size, short fontNumber, short fontSize, Style textFace, short textJustification, long displayFlags, TimeValue scrollDelay, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor textColor, RGBColor backColor, Rect textBox, RGBColor rgbHiliteColor, TimeValue sampleTime)"},
+ {"TextMediaAddTESample", (PyCFunction)Qt_TextMediaAddTESample, 1,
+ "(MediaHandler mh, TEHandle hTE, short textJustification, long displayFlags, TimeValue scrollDelay, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor backColor, Rect textBox, RGBColor rgbHiliteColor, TimeValue sampleTime)"},
+ {"TextMediaAddHiliteSample", (PyCFunction)Qt_TextMediaAddHiliteSample, 1,
+ "(MediaHandler mh, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor rgbHiliteColor, TimeValue sampleTime)"},
+ {"TextMediaDrawRaw", (PyCFunction)Qt_TextMediaDrawRaw, 1,
+ "(MediaHandler mh, GWorldPtr gw, GDHandle gd, void * data, long dataSize, TextDescriptionHandle tdh) -> (ComponentResult _rv)"},
+ {"TextMediaSetTextProperty", (PyCFunction)Qt_TextMediaSetTextProperty, 1,
+ "(MediaHandler mh, TimeValue atMediaTime, long propertyType, void * data, long dataSize) -> (ComponentResult _rv)"},
+ {"TextMediaRawSetup", (PyCFunction)Qt_TextMediaRawSetup, 1,
+ "(MediaHandler mh, GWorldPtr gw, GDHandle gd, void * data, long dataSize, TextDescriptionHandle tdh, TimeValue sampleDuration) -> (ComponentResult _rv)"},
+ {"TextMediaRawIdle", (PyCFunction)Qt_TextMediaRawIdle, 1,
+ "(MediaHandler mh, GWorldPtr gw, GDHandle gd, TimeValue sampleTime, long flagsIn) -> (ComponentResult _rv, long flagsOut)"},
+ {"TextMediaFindNextText", (PyCFunction)Qt_TextMediaFindNextText, 1,
+ "(MediaHandler mh, Ptr text, long size, short findFlags, TimeValue startTime) -> (ComponentResult _rv, TimeValue foundTime, TimeValue foundDuration, long offset)"},
+ {"TextMediaHiliteTextSample", (PyCFunction)Qt_TextMediaHiliteTextSample, 1,
+ "(MediaHandler mh, TimeValue sampleTime, short hiliteStart, short hiliteEnd) -> (ComponentResult _rv, RGBColor rgbHiliteColor)"},
+ {"TextMediaSetTextSampleData", (PyCFunction)Qt_TextMediaSetTextSampleData, 1,
+ "(MediaHandler mh, void * data, OSType dataType) -> (ComponentResult _rv)"},
+ {"SpriteMediaSetProperty", (PyCFunction)Qt_SpriteMediaSetProperty, 1,
+ "(MediaHandler mh, short spriteIndex, long propertyType, void * propertyValue) -> (ComponentResult _rv)"},
+ {"SpriteMediaGetProperty", (PyCFunction)Qt_SpriteMediaGetProperty, 1,
+ "(MediaHandler mh, short spriteIndex, long propertyType, void * propertyValue) -> (ComponentResult _rv)"},
+ {"SpriteMediaHitTestSprites", (PyCFunction)Qt_SpriteMediaHitTestSprites, 1,
+ "(MediaHandler mh, long flags, Point loc) -> (ComponentResult _rv, short spriteHitIndex)"},
+ {"SpriteMediaCountSprites", (PyCFunction)Qt_SpriteMediaCountSprites, 1,
+ "(MediaHandler mh) -> (ComponentResult _rv, short numSprites)"},
+ {"SpriteMediaCountImages", (PyCFunction)Qt_SpriteMediaCountImages, 1,
+ "(MediaHandler mh) -> (ComponentResult _rv, short numImages)"},
+ {"SpriteMediaGetIndImageDescription", (PyCFunction)Qt_SpriteMediaGetIndImageDescription, 1,
+ "(MediaHandler mh, short imageIndex, ImageDescriptionHandle imageDescription) -> (ComponentResult _rv)"},
+ {"SpriteMediaGetDisplayedSampleNumber", (PyCFunction)Qt_SpriteMediaGetDisplayedSampleNumber, 1,
+ "(MediaHandler mh) -> (ComponentResult _rv, long sampleNum)"},
+ {"SpriteMediaGetSpriteName", (PyCFunction)Qt_SpriteMediaGetSpriteName, 1,
+ "(MediaHandler mh, QTAtomID spriteID, Str255 spriteName) -> (ComponentResult _rv)"},
+ {"SpriteMediaGetImageName", (PyCFunction)Qt_SpriteMediaGetImageName, 1,
+ "(MediaHandler mh, short imageIndex, Str255 imageName) -> (ComponentResult _rv)"},
+ {"SpriteMediaSetSpriteProperty", (PyCFunction)Qt_SpriteMediaSetSpriteProperty, 1,
+ "(MediaHandler mh, QTAtomID spriteID, long propertyType, void * propertyValue) -> (ComponentResult _rv)"},
+ {"SpriteMediaGetSpriteProperty", (PyCFunction)Qt_SpriteMediaGetSpriteProperty, 1,
+ "(MediaHandler mh, QTAtomID spriteID, long propertyType, void * propertyValue) -> (ComponentResult _rv)"},
+ {"SpriteMediaHitTestAllSprites", (PyCFunction)Qt_SpriteMediaHitTestAllSprites, 1,
+ "(MediaHandler mh, long flags, Point loc) -> (ComponentResult _rv, QTAtomID spriteHitID)"},
+ {"SpriteMediaHitTestOneSprite", (PyCFunction)Qt_SpriteMediaHitTestOneSprite, 1,
+ "(MediaHandler mh, QTAtomID spriteID, long flags, Point loc) -> (ComponentResult _rv, Boolean wasHit)"},
+ {"SpriteMediaSpriteIndexToID", (PyCFunction)Qt_SpriteMediaSpriteIndexToID, 1,
+ "(MediaHandler mh, short spriteIndex) -> (ComponentResult _rv, QTAtomID spriteID)"},
+ {"SpriteMediaSpriteIDToIndex", (PyCFunction)Qt_SpriteMediaSpriteIDToIndex, 1,
+ "(MediaHandler mh, QTAtomID spriteID) -> (ComponentResult _rv, short spriteIndex)"},
+ {"SpriteMediaSetActionVariable", (PyCFunction)Qt_SpriteMediaSetActionVariable, 1,
+ "(MediaHandler mh, QTAtomID variableID, float value) -> (ComponentResult _rv)"},
+ {"SpriteMediaGetActionVariable", (PyCFunction)Qt_SpriteMediaGetActionVariable, 1,
+ "(MediaHandler mh, QTAtomID variableID) -> (ComponentResult _rv, float value)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SpriteMediaGetIndImageProperty", (PyCFunction)Qt_SpriteMediaGetIndImageProperty, 1,
+ "(MediaHandler mh, short imageIndex, long imagePropertyType, void * imagePropertyValue) -> (ComponentResult _rv)"},
+#endif
+ {"SpriteMediaDisposeSprite", (PyCFunction)Qt_SpriteMediaDisposeSprite, 1,
+ "(MediaHandler mh, QTAtomID spriteID) -> (ComponentResult _rv)"},
+ {"SpriteMediaSetActionVariableToString", (PyCFunction)Qt_SpriteMediaSetActionVariableToString, 1,
+ "(MediaHandler mh, QTAtomID variableID, Ptr theCString) -> (ComponentResult _rv)"},
+ {"SpriteMediaGetActionVariableAsString", (PyCFunction)Qt_SpriteMediaGetActionVariableAsString, 1,
+ "(MediaHandler mh, QTAtomID variableID) -> (ComponentResult _rv, Handle theCString)"},
+ {"FlashMediaSetPan", (PyCFunction)Qt_FlashMediaSetPan, 1,
+ "(MediaHandler mh, short xPercent, short yPercent) -> (ComponentResult _rv)"},
+ {"FlashMediaSetZoom", (PyCFunction)Qt_FlashMediaSetZoom, 1,
+ "(MediaHandler mh, short factor) -> (ComponentResult _rv)"},
+ {"FlashMediaSetZoomRect", (PyCFunction)Qt_FlashMediaSetZoomRect, 1,
+ "(MediaHandler mh, long left, long top, long right, long bottom) -> (ComponentResult _rv)"},
+ {"FlashMediaGetRefConBounds", (PyCFunction)Qt_FlashMediaGetRefConBounds, 1,
+ "(MediaHandler mh, long refCon) -> (ComponentResult _rv, long left, long top, long right, long bottom)"},
+ {"FlashMediaGetRefConID", (PyCFunction)Qt_FlashMediaGetRefConID, 1,
+ "(MediaHandler mh, long refCon) -> (ComponentResult _rv, long refConID)"},
+ {"FlashMediaIDToRefCon", (PyCFunction)Qt_FlashMediaIDToRefCon, 1,
+ "(MediaHandler mh, long refConID) -> (ComponentResult _rv, long refCon)"},
+ {"FlashMediaGetDisplayedFrameNumber", (PyCFunction)Qt_FlashMediaGetDisplayedFrameNumber, 1,
+ "(MediaHandler mh) -> (ComponentResult _rv, long flashFrameNumber)"},
+ {"FlashMediaFrameNumberToMovieTime", (PyCFunction)Qt_FlashMediaFrameNumberToMovieTime, 1,
+ "(MediaHandler mh, long flashFrameNumber) -> (ComponentResult _rv, TimeValue movieTime)"},
+ {"FlashMediaFrameLabelToMovieTime", (PyCFunction)Qt_FlashMediaFrameLabelToMovieTime, 1,
+ "(MediaHandler mh, Ptr theLabel) -> (ComponentResult _rv, TimeValue movieTime)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"MovieMediaGetCurrentMovieProperty", (PyCFunction)Qt_MovieMediaGetCurrentMovieProperty, 1,
+ "(MediaHandler mh, OSType whichProperty, void * value) -> (ComponentResult _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"MovieMediaGetCurrentTrackProperty", (PyCFunction)Qt_MovieMediaGetCurrentTrackProperty, 1,
+ "(MediaHandler mh, long trackID, OSType whichProperty, void * value) -> (ComponentResult _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"MovieMediaGetChildMovieDataReference", (PyCFunction)Qt_MovieMediaGetChildMovieDataReference, 1,
+ "(MediaHandler mh, QTAtomID dataRefID, short dataRefIndex) -> (ComponentResult _rv, OSType dataRefType, Handle dataRef, QTAtomID dataRefIDOut, short dataRefIndexOut)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"MovieMediaSetChildMovieDataReference", (PyCFunction)Qt_MovieMediaSetChildMovieDataReference, 1,
+ "(MediaHandler mh, QTAtomID dataRefID, OSType dataRefType, Handle dataRef) -> (ComponentResult _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"MovieMediaLoadChildMovieFromDataReference", (PyCFunction)Qt_MovieMediaLoadChildMovieFromDataReference, 1,
+ "(MediaHandler mh, QTAtomID dataRefID) -> (ComponentResult _rv)"},
+#endif
+ {"Media3DGetCurrentGroup", (PyCFunction)Qt_Media3DGetCurrentGroup, 1,
+ "(MediaHandler mh, void * group) -> (ComponentResult _rv)"},
+ {"Media3DTranslateNamedObjectTo", (PyCFunction)Qt_Media3DTranslateNamedObjectTo, 1,
+ "(MediaHandler mh, Fixed x, Fixed y, Fixed z) -> (ComponentResult _rv, char objectName)"},
+ {"Media3DScaleNamedObjectTo", (PyCFunction)Qt_Media3DScaleNamedObjectTo, 1,
+ "(MediaHandler mh, Fixed xScale, Fixed yScale, Fixed zScale) -> (ComponentResult _rv, char objectName)"},
+ {"Media3DRotateNamedObjectTo", (PyCFunction)Qt_Media3DRotateNamedObjectTo, 1,
+ "(MediaHandler mh, Fixed xDegrees, Fixed yDegrees, Fixed zDegrees) -> (ComponentResult _rv, char objectName)"},
+ {"Media3DSetCameraData", (PyCFunction)Qt_Media3DSetCameraData, 1,
+ "(MediaHandler mh, void * cameraData) -> (ComponentResult _rv)"},
+ {"Media3DGetCameraData", (PyCFunction)Qt_Media3DGetCameraData, 1,
+ "(MediaHandler mh, void * cameraData) -> (ComponentResult _rv)"},
+ {"Media3DSetCameraAngleAspect", (PyCFunction)Qt_Media3DSetCameraAngleAspect, 1,
+ "(MediaHandler mh, QTFloatSingle fov, QTFloatSingle aspectRatioXToY) -> (ComponentResult _rv)"},
+ {"Media3DGetCameraAngleAspect", (PyCFunction)Qt_Media3DGetCameraAngleAspect, 1,
+ "(MediaHandler mh) -> (ComponentResult _rv, QTFloatSingle fov, QTFloatSingle aspectRatioXToY)"},
+ {"Media3DSetCameraRange", (PyCFunction)Qt_Media3DSetCameraRange, 1,
+ "(MediaHandler mh, void * tQ3CameraRange) -> (ComponentResult _rv)"},
+ {"Media3DGetCameraRange", (PyCFunction)Qt_Media3DGetCameraRange, 1,
+ "(MediaHandler mh, void * tQ3CameraRange) -> (ComponentResult _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"Media3DGetViewObject", (PyCFunction)Qt_Media3DGetViewObject, 1,
+ "(MediaHandler mh, void * tq3viewObject) -> (ComponentResult _rv)"},
+#endif
+ {"NewTimeBase", (PyCFunction)Qt_NewTimeBase, 1,
+ "() -> (TimeBase _rv)"},
+ {"ConvertTime", (PyCFunction)Qt_ConvertTime, 1,
+ "(TimeRecord inout, TimeBase newBase) -> (TimeRecord inout)"},
+ {"ConvertTimeScale", (PyCFunction)Qt_ConvertTimeScale, 1,
+ "(TimeRecord inout, TimeScale newScale) -> (TimeRecord inout)"},
+ {"AddTime", (PyCFunction)Qt_AddTime, 1,
+ "(TimeRecord dst, TimeRecord src) -> (TimeRecord dst)"},
+ {"SubtractTime", (PyCFunction)Qt_SubtractTime, 1,
+ "(TimeRecord dst, TimeRecord src) -> (TimeRecord dst)"},
+ {"MusicMediaGetIndexedTunePlayer", (PyCFunction)Qt_MusicMediaGetIndexedTunePlayer, 1,
+ "(ComponentInstance ti, long sampleDescIndex) -> (ComponentResult _rv, ComponentInstance tp)"},
+ {"AlignWindow", (PyCFunction)Qt_AlignWindow, 1,
+ "(WindowPtr wp, Boolean front) -> None"},
+ {"DragAlignedWindow", (PyCFunction)Qt_DragAlignedWindow, 1,
+ "(WindowPtr wp, Point startPt, Rect boundsRect) -> None"},
+ {"MoviesTask", (PyCFunction)Qt_MoviesTask, 1,
+ "(long maxMilliSecToUse) -> None"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Qt(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Movie, MovieObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Movie, MovieObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieController, MovieCtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieController, MovieCtlObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBase, TimeBaseObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBase, TimeBaseObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(UserData, UserDataObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert);
+
+
+ m = Py_InitModule("_Qt", Qt_methods);
+ d = PyModule_GetDict(m);
+ Qt_Error = PyMac_GetOSErrException();
+ if (Qt_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Qt_Error) != 0)
+ return;
+ MovieController_Type.ob_type = &PyType_Type;
+ Py_INCREF(&MovieController_Type);
+ if (PyDict_SetItemString(d, "MovieControllerType", (PyObject *)&MovieController_Type) != 0)
+ Py_FatalError("can't initialize MovieControllerType");
+ TimeBase_Type.ob_type = &PyType_Type;
+ Py_INCREF(&TimeBase_Type);
+ if (PyDict_SetItemString(d, "TimeBaseType", (PyObject *)&TimeBase_Type) != 0)
+ Py_FatalError("can't initialize TimeBaseType");
+ UserData_Type.ob_type = &PyType_Type;
+ Py_INCREF(&UserData_Type);
+ if (PyDict_SetItemString(d, "UserDataType", (PyObject *)&UserData_Type) != 0)
+ Py_FatalError("can't initialize UserDataType");
+ Media_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Media_Type);
+ if (PyDict_SetItemString(d, "MediaType", (PyObject *)&Media_Type) != 0)
+ Py_FatalError("can't initialize MediaType");
+ Track_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Track_Type);
+ if (PyDict_SetItemString(d, "TrackType", (PyObject *)&Track_Type) != 0)
+ Py_FatalError("can't initialize TrackType");
+ Movie_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Movie_Type);
+ if (PyDict_SetItemString(d, "MovieType", (PyObject *)&Movie_Type) != 0)
+ Py_FatalError("can't initialize MovieType");
+}
+
+/* ========================= End module _Qt ========================= */
+
diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c
new file mode 100644
index 0000000..46b379c
--- /dev/null
+++ b/Mac/Modules/res/_Resmodule.c
@@ -0,0 +1,1587 @@
+
+/* ========================== Module _Res =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Resources.h>
+#include <string.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ResObj_New(Handle);
+extern int _ResObj_Convert(PyObject *, Handle *);
+extern PyObject *_OptResObj_New(Handle);
+extern int _OptResObj_Convert(PyObject *, Handle *);
+#define ResObj_New _ResObj_New
+#define ResObj_Convert _ResObj_Convert
+#define OptResObj_New _OptResObj_New
+#define OptResObj_Convert _OptResObj_Convert
+#endif
+
+/* Function to dispose a resource, with a "normal" calling sequence */
+static void
+PyMac_AutoDisposeHandle(Handle h)
+{
+ DisposeHandle(h);
+}
+
+static PyObject *Res_Error;
+
+/* ---------------------- Object type Resource ---------------------- */
+
+PyTypeObject Resource_Type;
+
+#define ResObj_Check(x) ((x)->ob_type == &Resource_Type)
+
+typedef struct ResourceObject {
+ PyObject_HEAD
+ Handle ob_itself;
+ void (*ob_freeit)(Handle ptr);
+} ResourceObject;
+
+PyObject *ResObj_New(Handle itself)
+{
+ ResourceObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(ResourceObject, &Resource_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_freeit = NULL;
+ return (PyObject *)it;
+}
+ResObj_Convert(PyObject *v, Handle *p_itself)
+{
+ if (!ResObj_Check(v))
+ {
+ PyObject *tmp;
+ if ( (tmp=PyObject_CallMethod(v, "as_Resource", "")) )
+ {
+ *p_itself = ((ResourceObject *)tmp)->ob_itself;
+ Py_DECREF(tmp);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+ if (!ResObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "Resource required");
+ return 0;
+ }
+ *p_itself = ((ResourceObject *)v)->ob_itself;
+ return 1;
+}
+
+static void ResObj_dealloc(ResourceObject *self)
+{
+ if (self->ob_freeit && self->ob_itself)
+ {
+ self->ob_freeit(self->ob_itself);
+ }
+ self->ob_itself = NULL;
+ PyMem_DEL(self);
+}
+
+static PyObject *ResObj_HomeResFile(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = HomeResFile(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *ResObj_MacLoadResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacLoadResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_ReleaseResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ReleaseResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_DetachResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DetachResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_GetResAttrs(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetResAttrs(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *ResObj_GetResInfo(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short theID;
+ ResType theType;
+ Str255 name;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetResInfo(_self->ob_itself,
+ &theID,
+ &theType,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("hO&O&",
+ theID,
+ PyMac_BuildOSType, theType,
+ PyMac_BuildStr255, name);
+ return _res;
+}
+
+static PyObject *ResObj_SetResInfo(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short theID;
+ Str255 name;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &theID,
+ PyMac_GetStr255, name))
+ return NULL;
+ SetResInfo(_self->ob_itself,
+ theID,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_AddResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short theID;
+ Str255 name;
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ PyMac_GetOSType, &theType,
+ &theID,
+ PyMac_GetStr255, name))
+ return NULL;
+ AddResource(_self->ob_itself,
+ theType,
+ theID,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_GetResourceSizeOnDisk(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetResourceSizeOnDisk(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *ResObj_GetMaxResourceSize(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMaxResourceSize(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_OS8
+
+static PyObject *ResObj_RsrcMapEntry(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = RsrcMapEntry(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *ResObj_SetResAttrs(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short attrs;
+ if (!PyArg_ParseTuple(_args, "h",
+ &attrs))
+ return NULL;
+ SetResAttrs(_self->ob_itself,
+ attrs);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_ChangedResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ChangedResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_RemoveResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ RemoveResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_WriteResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ WriteResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_SetResourceSize(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long newSize;
+ if (!PyArg_ParseTuple(_args, "l",
+ &newSize))
+ return NULL;
+ SetResourceSize(_self->ob_itself,
+ newSize);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_GetNextFOND(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetNextFOND(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ return CtlObj_New((ControlHandle)_self->ob_itself);
+
+}
+
+static PyObject *ResObj_as_Menu(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ return MenuObj_New((MenuHandle)_self->ob_itself);
+
+}
+
+static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ LoadResource(_self->ob_itself);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *ResObj_AutoDispose(ResourceObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int onoff, old = 0;
+ if (!PyArg_ParseTuple(_args, "i", &onoff))
+ return NULL;
+ if ( _self->ob_freeit )
+ old = 1;
+ if ( onoff )
+ _self->ob_freeit = PyMac_AutoDisposeHandle;
+ else
+ _self->ob_freeit = NULL;
+ return Py_BuildValue("i", old);
+
+}
+
+static PyMethodDef ResObj_methods[] = {
+ {"HomeResFile", (PyCFunction)ResObj_HomeResFile, 1,
+ "() -> (short _rv)"},
+ {"MacLoadResource", (PyCFunction)ResObj_MacLoadResource, 1,
+ "() -> None"},
+ {"ReleaseResource", (PyCFunction)ResObj_ReleaseResource, 1,
+ "() -> None"},
+ {"DetachResource", (PyCFunction)ResObj_DetachResource, 1,
+ "() -> None"},
+ {"GetResAttrs", (PyCFunction)ResObj_GetResAttrs, 1,
+ "() -> (short _rv)"},
+ {"GetResInfo", (PyCFunction)ResObj_GetResInfo, 1,
+ "() -> (short theID, ResType theType, Str255 name)"},
+ {"SetResInfo", (PyCFunction)ResObj_SetResInfo, 1,
+ "(short theID, Str255 name) -> None"},
+ {"AddResource", (PyCFunction)ResObj_AddResource, 1,
+ "(ResType theType, short theID, Str255 name) -> None"},
+ {"GetResourceSizeOnDisk", (PyCFunction)ResObj_GetResourceSizeOnDisk, 1,
+ "() -> (long _rv)"},
+ {"GetMaxResourceSize", (PyCFunction)ResObj_GetMaxResourceSize, 1,
+ "() -> (long _rv)"},
+
+#if TARGET_API_MAC_OS8
+ {"RsrcMapEntry", (PyCFunction)ResObj_RsrcMapEntry, 1,
+ "() -> (long _rv)"},
+#endif
+ {"SetResAttrs", (PyCFunction)ResObj_SetResAttrs, 1,
+ "(short attrs) -> None"},
+ {"ChangedResource", (PyCFunction)ResObj_ChangedResource, 1,
+ "() -> None"},
+ {"RemoveResource", (PyCFunction)ResObj_RemoveResource, 1,
+ "() -> None"},
+ {"WriteResource", (PyCFunction)ResObj_WriteResource, 1,
+ "() -> None"},
+ {"SetResourceSize", (PyCFunction)ResObj_SetResourceSize, 1,
+ "(long newSize) -> None"},
+ {"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1,
+ "() -> (Handle _rv)"},
+ {"as_Control", (PyCFunction)ResObj_as_Control, 1,
+ "Return this resource/handle as a Control"},
+ {"as_Menu", (PyCFunction)ResObj_as_Menu, 1,
+ "Return this resource/handle as a Menu"},
+ {"LoadResource", (PyCFunction)ResObj_LoadResource, 1,
+ "() -> None"},
+ {"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1,
+ "(int)->int. Automatically DisposeHandle the object on Python object cleanup"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain ResObj_chain = { ResObj_methods, NULL };
+
+static PyObject *ResObj_getattr(ResourceObject *self, char *name)
+{
+
+ if (strcmp(name, "size") == 0)
+ return PyInt_FromLong(GetHandleSize(self->ob_itself));
+ if (strcmp(name, "data") == 0) {
+ PyObject *res;
+ char state;
+ state = HGetState(self->ob_itself);
+ HLock(self->ob_itself);
+ res = PyString_FromStringAndSize(
+ *self->ob_itself,
+ GetHandleSize(self->ob_itself));
+ HUnlock(self->ob_itself);
+ HSetState(self->ob_itself, state);
+ return res;
+ }
+ if (strcmp(name, "__members__") == 0)
+ return Py_BuildValue("[ss]", "data", "size");
+
+ return Py_FindMethodInChain(&ResObj_chain, (PyObject *)self, name);
+}
+
+static int
+ResObj_setattr(ResourceObject *self, char *name, PyObject *value)
+{
+ char *data;
+ long size;
+
+ if (strcmp(name, "data") != 0 || value == NULL )
+ return -1;
+ if ( !PyString_Check(value) )
+ return -1;
+ size = PyString_Size(value);
+ data = PyString_AsString(value);
+ /* XXXX Do I need the GetState/SetState calls? */
+ SetHandleSize(self->ob_itself, size);
+ if ( MemError())
+ return -1;
+ HLock(self->ob_itself);
+ memcpy((char *)*self->ob_itself, data, size);
+ HUnlock(self->ob_itself);
+ /* XXXX Should I do the Changed call immedeately? */
+ return 0;
+}
+
+
+#define ResObj_compare NULL
+
+#define ResObj_repr NULL
+
+#define ResObj_hash NULL
+
+PyTypeObject Resource_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Resource", /*tp_name*/
+ sizeof(ResourceObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) ResObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) ResObj_getattr, /*tp_getattr*/
+ (setattrfunc) ResObj_setattr, /*tp_setattr*/
+ (cmpfunc) ResObj_compare, /*tp_compare*/
+ (reprfunc) ResObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) ResObj_hash, /*tp_hash*/
+};
+
+/* -------------------- End object type Resource -------------------- */
+
+
+#if TARGET_API_MAC_OS8
+
+static PyObject *Res_InitResources(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = InitResources();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_OS8
+
+static PyObject *Res_RsrcZoneInit(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ RsrcZoneInit();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Res_CloseResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ CloseResFile(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_ResError(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = ResError();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_CurResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CurResFile();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_OS8
+
+static PyObject *Res_CreateResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Str255 fileName;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, fileName))
+ return NULL;
+ CreateResFile(fileName);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_OS8
+
+static PyObject *Res_OpenResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Str255 fileName;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetStr255, fileName))
+ return NULL;
+ _rv = OpenResFile(fileName);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *Res_UseResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ UseResFile(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_CountTypes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountTypes();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_Count1Types(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = Count1Types();
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_GetIndType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short index;
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ GetIndType(&theType,
+ index);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, theType);
+ return _res;
+}
+
+static PyObject *Res_Get1IndType(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ ResType theType;
+ short index;
+ if (!PyArg_ParseTuple(_args, "h",
+ &index))
+ return NULL;
+ Get1IndType(&theType,
+ index);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ PyMac_BuildOSType, theType);
+ return _res;
+}
+
+static PyObject *Res_SetResLoad(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean load;
+ if (!PyArg_ParseTuple(_args, "b",
+ &load))
+ return NULL;
+ SetResLoad(load);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_CountResources(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ ResType theType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _rv = CountResources(theType);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_Count1Resources(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ ResType theType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _rv = Count1Resources(theType);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_GetIndResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short index;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &index))
+ return NULL;
+ _rv = GetIndResource(theType,
+ index);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_Get1IndResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short index;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &index))
+ return NULL;
+ _rv = Get1IndResource(theType,
+ index);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_GetResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short theID;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &theID))
+ return NULL;
+ _rv = GetResource(theType,
+ theID);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_Get1Resource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short theID;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &theID))
+ return NULL;
+ _rv = Get1Resource(theType,
+ theID);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_GetNamedResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ Str255 name;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theType,
+ PyMac_GetStr255, name))
+ return NULL;
+ _rv = GetNamedResource(theType,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_Get1NamedResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ Str255 name;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theType,
+ PyMac_GetStr255, name))
+ return NULL;
+ _rv = Get1NamedResource(theType,
+ name);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Res_UniqueID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ ResType theType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _rv = UniqueID(theType);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_Unique1ID(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ ResType theType;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &theType))
+ return NULL;
+ _rv = Unique1ID(theType);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_UpdateResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ UpdateResFile(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_SetResPurge(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean install;
+ if (!PyArg_ParseTuple(_args, "b",
+ &install))
+ return NULL;
+ SetResPurge(install);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_GetResFileAttrs(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short refNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _rv = GetResFileAttrs(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_SetResFileAttrs(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short refNum;
+ short attrs;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &refNum,
+ &attrs))
+ return NULL;
+ SetResFileAttrs(refNum,
+ attrs);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Str255 fileName;
+ short vRefNum;
+ SignedByte permission;
+ if (!PyArg_ParseTuple(_args, "O&hb",
+ PyMac_GetStr255, fileName,
+ &vRefNum,
+ &permission))
+ return NULL;
+ _rv = OpenRFPerm(fileName,
+ vRefNum,
+ permission);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_OS8
+
+static PyObject *Res_RGetResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ ResType theType;
+ short theID;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetOSType, &theType,
+ &theID))
+ return NULL;
+ _rv = RGetResource(theType,
+ theID);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+#endif
+
+static PyObject *Res_HOpenResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ SignedByte permission;
+ if (!PyArg_ParseTuple(_args, "hlO&b",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName,
+ &permission))
+ return NULL;
+ _rv = HOpenResFile(vRefNum,
+ dirID,
+ fileName,
+ permission);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_HCreateResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short vRefNum;
+ long dirID;
+ Str255 fileName;
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &vRefNum,
+ &dirID,
+ PyMac_GetStr255, fileName))
+ return NULL;
+ HCreateResFile(vRefNum,
+ dirID,
+ fileName);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Res_FSpOpenResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ FSSpec spec;
+ SignedByte permission;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSSpec, &spec,
+ &permission))
+ return NULL;
+ _rv = FSpOpenResFile(&spec,
+ permission);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_FSpCreateResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ FSSpec spec;
+ OSType creator;
+ OSType fileType;
+ ScriptCode scriptTag;
+ if (!PyArg_ParseTuple(_args, "O&O&O&h",
+ PyMac_GetFSSpec, &spec,
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &fileType,
+ &scriptTag))
+ return NULL;
+ FSpCreateResFile(&spec,
+ creator,
+ fileType,
+ scriptTag);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _rv;
+ SInt16 refNum;
+ RsrcChainLocation where;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &refNum,
+ &where))
+ return NULL;
+ _rv = InsertResourceFile(refNum,
+ where);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Res_DetachResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _rv;
+ SInt16 refNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &refNum))
+ return NULL;
+ _rv = DetachResourceFile(refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ FSSpec resourceFile;
+ Boolean inChain;
+ SInt16 refNum;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSSpec, &resourceFile))
+ return NULL;
+ _rv = FSpResourceFileAlreadyOpen(&resourceFile,
+ &inChain,
+ &refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("bbh",
+ _rv,
+ inChain,
+ refNum);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Res_FSpOpenOrphanResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _rv;
+ FSSpec spec;
+ SignedByte permission;
+ SInt16 refNum;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSSpec, &spec,
+ &permission))
+ return NULL;
+ _rv = FSpOpenOrphanResFile(&spec,
+ permission,
+ &refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("hh",
+ _rv,
+ refNum);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Res_GetTopResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _rv;
+ SInt16 refNum;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetTopResourceFile(&refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("hh",
+ _rv,
+ refNum);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _rv;
+ SInt16 curRefNum;
+ SInt16 nextRefNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &curRefNum))
+ return NULL;
+ _rv = GetNextResourceFile(curRefNum,
+ &nextRefNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("hh",
+ _rv,
+ nextRefNum);
+ return _res;
+}
+#endif
+
+static PyObject *Res_Resource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ char *buf;
+ int len;
+ Handle h;
+
+ if (!PyArg_ParseTuple(_args, "s#", &buf, &len))
+ return NULL;
+ h = NewHandle(len);
+ if ( h == NULL ) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+ HLock(h);
+ memcpy(*h, buf, len);
+ HUnlock(h);
+ return ResObj_New(h);
+
+}
+
+static PyObject *Res_Handle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ char *buf;
+ int len;
+ Handle h;
+ ResourceObject *rv;
+
+ if (!PyArg_ParseTuple(_args, "s#", &buf, &len))
+ return NULL;
+ h = NewHandle(len);
+ if ( h == NULL ) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+ HLock(h);
+ memcpy(*h, buf, len);
+ HUnlock(h);
+ rv = (ResourceObject *)ResObj_New(h);
+ rv->ob_freeit = PyMac_AutoDisposeHandle;
+ return (PyObject *)rv;
+
+}
+
+static PyMethodDef Res_methods[] = {
+
+#if TARGET_API_MAC_OS8
+ {"InitResources", (PyCFunction)Res_InitResources, 1,
+ "() -> (short _rv)"},
+#endif
+
+#if TARGET_API_MAC_OS8
+ {"RsrcZoneInit", (PyCFunction)Res_RsrcZoneInit, 1,
+ "() -> None"},
+#endif
+ {"CloseResFile", (PyCFunction)Res_CloseResFile, 1,
+ "(short refNum) -> None"},
+ {"ResError", (PyCFunction)Res_ResError, 1,
+ "() -> (OSErr _rv)"},
+ {"CurResFile", (PyCFunction)Res_CurResFile, 1,
+ "() -> (short _rv)"},
+
+#if TARGET_API_MAC_OS8
+ {"CreateResFile", (PyCFunction)Res_CreateResFile, 1,
+ "(Str255 fileName) -> None"},
+#endif
+
+#if TARGET_API_MAC_OS8
+ {"OpenResFile", (PyCFunction)Res_OpenResFile, 1,
+ "(Str255 fileName) -> (short _rv)"},
+#endif
+ {"UseResFile", (PyCFunction)Res_UseResFile, 1,
+ "(short refNum) -> None"},
+ {"CountTypes", (PyCFunction)Res_CountTypes, 1,
+ "() -> (short _rv)"},
+ {"Count1Types", (PyCFunction)Res_Count1Types, 1,
+ "() -> (short _rv)"},
+ {"GetIndType", (PyCFunction)Res_GetIndType, 1,
+ "(short index) -> (ResType theType)"},
+ {"Get1IndType", (PyCFunction)Res_Get1IndType, 1,
+ "(short index) -> (ResType theType)"},
+ {"SetResLoad", (PyCFunction)Res_SetResLoad, 1,
+ "(Boolean load) -> None"},
+ {"CountResources", (PyCFunction)Res_CountResources, 1,
+ "(ResType theType) -> (short _rv)"},
+ {"Count1Resources", (PyCFunction)Res_Count1Resources, 1,
+ "(ResType theType) -> (short _rv)"},
+ {"GetIndResource", (PyCFunction)Res_GetIndResource, 1,
+ "(ResType theType, short index) -> (Handle _rv)"},
+ {"Get1IndResource", (PyCFunction)Res_Get1IndResource, 1,
+ "(ResType theType, short index) -> (Handle _rv)"},
+ {"GetResource", (PyCFunction)Res_GetResource, 1,
+ "(ResType theType, short theID) -> (Handle _rv)"},
+ {"Get1Resource", (PyCFunction)Res_Get1Resource, 1,
+ "(ResType theType, short theID) -> (Handle _rv)"},
+ {"GetNamedResource", (PyCFunction)Res_GetNamedResource, 1,
+ "(ResType theType, Str255 name) -> (Handle _rv)"},
+ {"Get1NamedResource", (PyCFunction)Res_Get1NamedResource, 1,
+ "(ResType theType, Str255 name) -> (Handle _rv)"},
+ {"UniqueID", (PyCFunction)Res_UniqueID, 1,
+ "(ResType theType) -> (short _rv)"},
+ {"Unique1ID", (PyCFunction)Res_Unique1ID, 1,
+ "(ResType theType) -> (short _rv)"},
+ {"UpdateResFile", (PyCFunction)Res_UpdateResFile, 1,
+ "(short refNum) -> None"},
+ {"SetResPurge", (PyCFunction)Res_SetResPurge, 1,
+ "(Boolean install) -> None"},
+ {"GetResFileAttrs", (PyCFunction)Res_GetResFileAttrs, 1,
+ "(short refNum) -> (short _rv)"},
+ {"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
+ "(short refNum, short attrs) -> None"},
+ {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
+ "(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)"},
+
+#if TARGET_API_MAC_OS8
+ {"RGetResource", (PyCFunction)Res_RGetResource, 1,
+ "(ResType theType, short theID) -> (Handle _rv)"},
+#endif
+ {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
+ "(short vRefNum, long dirID, Str255 fileName, SignedByte permission) -> (short _rv)"},
+ {"HCreateResFile", (PyCFunction)Res_HCreateResFile, 1,
+ "(short vRefNum, long dirID, Str255 fileName) -> None"},
+ {"FSpOpenResFile", (PyCFunction)Res_FSpOpenResFile, 1,
+ "(FSSpec spec, SignedByte permission) -> (short _rv)"},
+ {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
+ "(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
+ "(SInt16 refNum, RsrcChainLocation where) -> (OSErr _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
+ "(SInt16 refNum) -> (OSErr _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
+ "(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
+ "(FSSpec spec, SignedByte permission) -> (OSErr _rv, SInt16 refNum)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetTopResourceFile", (PyCFunction)Res_GetTopResourceFile, 1,
+ "() -> (OSErr _rv, SInt16 refNum)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
+ "(SInt16 curRefNum) -> (OSErr _rv, SInt16 nextRefNum)"},
+#endif
+ {"Resource", (PyCFunction)Res_Resource, 1,
+ "Convert a string to a resource object.\n\nThe created resource object is actually just a handle,\napply AddResource() to write it to a resource file.\nSee also the Handle() docstring.\n"},
+ {"Handle", (PyCFunction)Res_Handle, 1,
+ "Convert a string to a Handle object.\n\nResource() and Handle() are very similar, but objects created with Handle() are\nby default automatically DisposeHandle()d upon object cleanup. Use AutoDispose()\nto change this.\n"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+/* Alternative version of ResObj_New, which returns None for null argument */
+PyObject *OptResObj_New(Handle itself)
+{
+ if (itself == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return ResObj_New(itself);
+}
+
+OptResObj_Convert(PyObject *v, Handle *p_itself)
+{
+ PyObject *tmp;
+
+ if ( v == Py_None ) {
+ *p_itself = NULL;
+ return 1;
+ }
+ if (ResObj_Check(v))
+ {
+ *p_itself = ((ResourceObject *)v)->ob_itself;
+ return 1;
+ }
+ /* If it isn't a resource yet see whether it is convertible */
+ if ( (tmp=PyObject_CallMethod(v, "as_Resource", "")) ) {
+ *p_itself = ((ResourceObject *)tmp)->ob_itself;
+ Py_DECREF(tmp);
+ return 1;
+ }
+ PyErr_Clear();
+ PyErr_SetString(PyExc_TypeError, "Resource required");
+ return 0;
+}
+
+
+void init_Res(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, ResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, ResObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, OptResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, OptResObj_Convert);
+
+
+ m = Py_InitModule("_Res", Res_methods);
+ d = PyModule_GetDict(m);
+ Res_Error = PyMac_GetOSErrException();
+ if (Res_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Res_Error) != 0)
+ return;
+ Resource_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Resource_Type);
+ if (PyDict_SetItemString(d, "ResourceType", (PyObject *)&Resource_Type) != 0)
+ Py_FatalError("can't initialize ResourceType");
+}
+
+/* ======================== End module _Res ========================= */
+
diff --git a/Mac/Modules/scrap/_Scrapmodule.c b/Mac/Modules/scrap/_Scrapmodule.c
new file mode 100644
index 0000000..3acfb81
--- /dev/null
+++ b/Mac/Modules/scrap/_Scrapmodule.c
@@ -0,0 +1,260 @@
+
+/* ========================== Module Scrap ========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#include "pymactoolbox.h"
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Scrap.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+/*
+** Generate ScrapInfo records
+*/
+static PyObject *
+SCRRec_New(itself)
+ ScrapStuff *itself;
+{
+
+ return Py_BuildValue("lO&hhO&", itself->scrapSize,
+ ResObj_New, itself->scrapHandle, itself->scrapCount, itself->scrapState,
+ PyMac_BuildStr255, itself->scrapName);
+}
+#endif
+
+static PyObject *Scrap_Error;
+
+static PyObject *Scrap_LoadScrap(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = LoadScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Scrap_UnloadScrap(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UnloadScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Scrap_InfoScrap(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ ScrapStuffPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = InfoScrap();
+ _res = Py_BuildValue("O&",
+ SCRRec_New, _rv);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Scrap_GetScrap(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ long _rv;
+ Handle destination;
+ ScrapFlavorType flavorType;
+ SInt32 offset;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &destination,
+ PyMac_GetOSType, &flavorType))
+ return NULL;
+ _rv = GetScrap(destination,
+ flavorType,
+ &offset);
+ _res = Py_BuildValue("ll",
+ _rv,
+ offset);
+ return _res;
+}
+#endif
+
+
+static PyObject *Scrap_ZeroScrap(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+#if TARGET_API_MAC_CARBON
+ {
+ ScrapRef scrap;
+
+ _err = ClearCurrentScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ _err = GetCurrentScrap(&scrap);
+ }
+#else
+ _err = ZeroScrap();
+#endif
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Scrap_PutScrap(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt32 sourceBufferByteCount;
+ ScrapFlavorType flavorType;
+ char *sourceBuffer__in__;
+ int sourceBuffer__len__;
+ int sourceBuffer__in_len__;
+#if TARGET_API_MAC_CARBON
+ ScrapRef scrap;
+#endif
+
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetOSType, &flavorType,
+ &sourceBuffer__in__, &sourceBuffer__in_len__))
+ return NULL;
+ sourceBufferByteCount = sourceBuffer__in_len__;
+ sourceBuffer__len__ = sourceBuffer__in_len__;
+#if TARGET_API_MAC_CARBON
+ _err = GetCurrentScrap(&scrap);
+ if (_err != noErr) return PyMac_Error(_err);
+ _err = PutScrapFlavor(scrap, flavorType, 0, sourceBufferByteCount, sourceBuffer__in__);
+#else
+ _err = PutScrap(sourceBufferByteCount,
+ flavorType,
+ sourceBuffer__in__);
+#endif
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ sourceBuffer__error__: ;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Scrap_ClearCurrentScrap(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ClearCurrentScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Scrap_CallInScrapPromises(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CallInScrapPromises();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyMethodDef Scrap_methods[] = {
+ {"LoadScrap", (PyCFunction)Scrap_LoadScrap, 1,
+ "() -> None"},
+ {"UnloadScrap", (PyCFunction)Scrap_UnloadScrap, 1,
+ "() -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"InfoScrap", (PyCFunction)Scrap_InfoScrap, 1,
+ "() -> (ScrapStuffPtr _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"GetScrap", (PyCFunction)Scrap_GetScrap, 1,
+ "(Handle destination, ScrapFlavorType flavorType) -> (long _rv, SInt32 offset)"},
+#endif
+
+ {"ZeroScrap", (PyCFunction)Scrap_ZeroScrap, 1,
+ "() -> None"},
+
+ {"PutScrap", (PyCFunction)Scrap_PutScrap, 1,
+ "(ScrapFlavorType flavorType, Buffer sourceBuffer) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"ClearCurrentScrap", (PyCFunction)Scrap_ClearCurrentScrap, 1,
+ "() -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"CallInScrapPromises", (PyCFunction)Scrap_CallInScrapPromises, 1,
+ "() -> None"},
+#endif
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_Scrap()
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+ m = Py_InitModule("_Scrap", Scrap_methods);
+ d = PyModule_GetDict(m);
+ Scrap_Error = PyMac_GetOSErrException();
+ if (Scrap_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Scrap_Error) != 0)
+ return;
+}
+
+/* ======================== End module Scrap ======================== */
+
diff --git a/Mac/Modules/snd/_Sndihooks.c b/Mac/Modules/snd/_Sndihooks.c
new file mode 100644
index 0000000..cf0d8e9
--- /dev/null
+++ b/Mac/Modules/snd/_Sndihooks.c
@@ -0,0 +1,513 @@
+/***********************************************************
+Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
+The Netherlands.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Stichting Mathematisch
+Centrum or CWI or Corporation for National Research Initiatives or
+CNRI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+While CWI is the initial source for this software, a modified version
+is made available by the Corporation for National Research Initiatives
+(CNRI) at the Internet address ftp://ftp.python.org.
+
+STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
+CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+******************************************************************/
+
+#include "Python.h"
+#include "macglue.h"
+#include "pymactoolbox.h"
+#include <Sound.h>
+
+#pragma options align=mac68k
+struct SampleRateAvailable_arg {
+ short numrates;
+ Handle rates;
+};
+
+struct SampleSizeAvailable_arg {
+ short numsizes;
+ Handle sizes;
+};
+
+#pragma options align=reset
+
+static PyObject *ErrorObject;
+
+
+/* Convert Python object to unsigned Fixed */
+static int
+PyMac_GetUFixed(PyObject *v, Fixed *f)
+{
+ double d;
+ unsigned long uns;
+
+ if( !PyArg_Parse(v, "d", &d))
+ return 0;
+ uns = (unsigned long)(d * 0x10000);
+ *f = (Fixed)uns;
+ return 1;
+}
+
+/* Convert a Point to a Python object */
+static PyObject *
+PyMac_BuildUFixed(Fixed f)
+{
+ double d;
+ unsigned long funs;
+
+ funs = (unsigned long)f;
+
+ d = funs;
+ d = d / 0x10000;
+ return Py_BuildValue("d", d);
+}
+
+
+/* ----------------------------------------------------- */
+
+static char sndih_getChannelAvailable__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getChannelAvailable(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short nchannel;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siChannelAvailable, (Ptr)&nchannel)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", nchannel);
+}
+
+static char sndih_getNumberChannels__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getNumberChannels(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short nchannel;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siNumberChannels, (Ptr)&nchannel)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", nchannel);
+}
+
+static char sndih_setNumberChannels__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setNumberChannels(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short nchannel;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &nchannel))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siNumberChannels, (Ptr)&nchannel)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getContinuous__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getContinuous(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short onoff;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siContinuous, (Ptr)&onoff)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", onoff);
+}
+
+static char sndih_setContinuous__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setContinuous(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short onoff;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &onoff))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siContinuous, (Ptr)&onoff)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getInputSourceNames__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getInputSourceNames(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ Handle names;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siInputSourceNames, (Ptr)&names)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("O&", ResObj_New, names);
+}
+
+static char sndih_getInputSource__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getInputSource(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short source;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siInputSource, (Ptr)&source)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", source);
+}
+
+static char sndih_setInputSource__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setInputSource(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short source;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &source))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siInputSource, (Ptr)&source)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getPlayThruOnOff__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getPlayThruOnOff(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short onoff;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siPlayThruOnOff, (Ptr)&onoff)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", onoff);
+}
+
+static char sndih_setPlayThruOnOff__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setPlayThruOnOff(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short onoff;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &onoff))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siPlayThruOnOff, (Ptr)&onoff)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getSampleRate__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getSampleRate(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ Fixed sample_rate;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siSampleRate, (Ptr)&sample_rate)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("O&", PyMac_BuildUFixed, sample_rate);
+}
+
+static char sndih_setSampleRate__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setSampleRate(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ Fixed sample_rate;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lO&", &inRefNum, PyMac_GetUFixed, &sample_rate))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siSampleRate, (Ptr)&sample_rate)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getSampleSize__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getSampleSize(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short bits;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siSampleSize, (Ptr)&bits)) != noErr )
+ return PyMac_Error(err);
+ return Py_BuildValue("h", bits);
+}
+
+static char sndih_setSampleSize__doc__[] =
+""
+;
+
+static PyObject *
+sndih_setSampleSize(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ short size;
+ OSErr err;
+
+ if (!PyArg_ParseTuple(args, "lh", &inRefNum, &size))
+ return NULL;
+
+ if( (err=SPBSetDeviceInfo(inRefNum, siSampleSize, (Ptr)&size)) != noErr )
+ return PyMac_Error(err);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static char sndih_getSampleSizeAvailable__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getSampleSizeAvailable(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ struct SampleSizeAvailable_arg arg;
+ OSErr err;
+ PyObject *rsizes;
+ short *fsizes;
+ int i;
+
+ arg.sizes = NULL;
+ rsizes = NULL;
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siSampleSizeAvailable, (Ptr)&arg)) != noErr ) {
+ return PyMac_Error(err);
+ }
+ fsizes = (short *)*(arg.sizes);
+ /* Handle contains a list of rates */
+ if( (rsizes = PyTuple_New(arg.numsizes)) == NULL)
+ return NULL;
+ for( i=0; i<arg.numsizes; i++ )
+ PyTuple_SetItem(rsizes, i, PyInt_FromLong((long)fsizes[i]));
+ return rsizes;
+}
+
+static char sndih_getSampleRateAvailable__doc__[] =
+""
+;
+
+static PyObject *
+sndih_getSampleRateAvailable(self, args)
+ PyObject *self; /* Not used */
+ PyObject *args;
+{
+ long inRefNum;
+ struct SampleRateAvailable_arg arg;
+ OSErr err;
+ PyObject *rrates, *obj;
+ Fixed *frates;
+ int i;
+
+ arg.rates = NULL;
+ rrates = NULL;
+ if (!PyArg_ParseTuple(args, "l", &inRefNum))
+ return NULL;
+
+ if( (err=SPBGetDeviceInfo(inRefNum, siSampleRateAvailable, (Ptr)&arg)) != noErr ) {
+ return PyMac_Error(err);
+ }
+ frates = (Fixed *)*(arg.rates);
+ if( arg.numrates == 0 ) {
+ /* The handle contains upper and lowerbound */
+ rrates = Py_BuildValue("O&O&", frates[0], frates[1]);
+ if (rrates == NULL) return NULL;
+ } else {
+ /* Handle contains a list of rates */
+ if( (rrates = PyTuple_New(arg.numrates)) == NULL)
+ return NULL;
+ for( i=0; i<arg.numrates; i++ ) {
+ if( (obj = Py_BuildValue("O&", PyMac_BuildUFixed, frates[i]))==NULL)
+ goto out;
+ PyTuple_SetItem(rrates, i, obj);
+ }
+ }
+ return Py_BuildValue("hO", arg.numrates, rrates);
+out:
+ Py_XDECREF(rrates);
+ return NULL;
+}
+
+/* List of methods defined in the module */
+
+static struct PyMethodDef sndih_methods[] = {
+ {"getChannelAvailable", (PyCFunction)sndih_getChannelAvailable, METH_VARARGS, sndih_getChannelAvailable__doc__},
+ {"getNumberChannels", (PyCFunction)sndih_getNumberChannels, METH_VARARGS, sndih_getNumberChannels__doc__},
+ {"setNumberChannels", (PyCFunction)sndih_setNumberChannels, METH_VARARGS, sndih_setNumberChannels__doc__},
+ {"getContinuous", (PyCFunction)sndih_getContinuous, METH_VARARGS, sndih_getContinuous__doc__},
+ {"setContinuous", (PyCFunction)sndih_setContinuous, METH_VARARGS, sndih_setContinuous__doc__},
+ {"getInputSourceNames", (PyCFunction)sndih_getInputSourceNames, METH_VARARGS, sndih_getInputSourceNames__doc__},
+ {"getInputSource", (PyCFunction)sndih_getInputSource, METH_VARARGS, sndih_getInputSource__doc__},
+ {"setInputSource", (PyCFunction)sndih_setInputSource, METH_VARARGS, sndih_setInputSource__doc__},
+ {"getPlayThruOnOff", (PyCFunction)sndih_getPlayThruOnOff, METH_VARARGS, sndih_getPlayThruOnOff__doc__},
+ {"setPlayThruOnOff", (PyCFunction)sndih_setPlayThruOnOff, METH_VARARGS, sndih_setPlayThruOnOff__doc__},
+ {"getSampleRate", (PyCFunction)sndih_getSampleRate, METH_VARARGS, sndih_getSampleRate__doc__},
+ {"setSampleRate", (PyCFunction)sndih_setSampleRate, METH_VARARGS, sndih_setSampleRate__doc__},
+ {"getSampleSize", (PyCFunction)sndih_getSampleSize, METH_VARARGS, sndih_getSampleSize__doc__},
+ {"setSampleSize", (PyCFunction)sndih_setSampleSize, METH_VARARGS, sndih_setSampleSize__doc__},
+ {"getSampleSizeAvailable", (PyCFunction)sndih_getSampleSizeAvailable, METH_VARARGS, sndih_getSampleSizeAvailable__doc__},
+ {"getSampleRateAvailable", (PyCFunction)sndih_getSampleRateAvailable, METH_VARARGS, sndih_getSampleRateAvailable__doc__},
+
+ {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
+};
+
+
+/* Initialization function for the module (*must* be called initSndihooks) */
+
+static char Sndihooks_module_documentation[] =
+""
+;
+
+void
+init_Sndihooks()
+{
+ PyObject *m, *d;
+
+ /* Create the module and add the functions */
+ m = Py_InitModule4("_Sndihooks", sndih_methods,
+ Sndihooks_module_documentation,
+ (PyObject*)NULL,PYTHON_API_VERSION);
+
+ /* Add some symbolic constants to the module */
+ d = PyModule_GetDict(m);
+ ErrorObject = PyString_FromString("Sndihooks.error");
+ PyDict_SetItemString(d, "error", ErrorObject);
+
+ /* XXXX Add constants here */
+
+ /* Check for errors */
+ if (PyErr_Occurred())
+ Py_FatalError("can't initialize module Sndihooks");
+}
+
diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c
new file mode 100644
index 0000000..23989cd
--- /dev/null
+++ b/Mac/Modules/snd/_Sndmodule.c
@@ -0,0 +1,1462 @@
+
+/* ========================== Module _Snd =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Sound.h>
+#include <OSUtils.h> /* for Set(Current)A5 */
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+
+/* Create a SndCommand object (an (int, int, int) tuple) */
+static PyObject *
+SndCmd_New(SndCommand *pc)
+{
+ return Py_BuildValue("hhl", pc->cmd, pc->param1, pc->param2);
+}
+
+/* Convert a SndCommand argument */
+static int
+SndCmd_Convert(PyObject *v, SndCommand *pc)
+{
+ int len;
+ pc->param1 = 0;
+ pc->param2 = 0;
+ if (PyTuple_Check(v)) {
+ if (PyArg_ParseTuple(v, "h|hl", &pc->cmd, &pc->param1, &pc->param2))
+ return 1;
+ PyErr_Clear();
+ return PyArg_ParseTuple(v, "Hhs#", &pc->cmd, &pc->param1, &pc->param2, &len);
+ }
+ return PyArg_Parse(v, "H", &pc->cmd);
+}
+
+static pascal void SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd); /* Forward */
+static pascal void SPB_completion(SPBPtr my_spb); /* Forward */
+#if !TARGET_API_MAC_CARBON
+static pascal void SPB_interrupt(SPBPtr my_spb); /* Forward */
+#endif
+
+static PyObject *Snd_Error;
+
+/* --------------------- Object type SndChannel --------------------- */
+
+staticforward PyTypeObject SndChannel_Type;
+
+#define SndCh_Check(x) ((x)->ob_type == &SndChannel_Type)
+
+typedef struct SndChannelObject {
+ PyObject_HEAD
+ SndChannelPtr ob_itself;
+ /* Members used to implement callbacks: */
+ PyObject *ob_callback;
+ long ob_A5;
+ SndCommand ob_cmd;
+} SndChannelObject;
+
+static PyObject *SndCh_New(SndChannelPtr itself)
+{
+ SndChannelObject *it;
+ it = PyObject_NEW(SndChannelObject, &SndChannel_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->ob_callback = NULL;
+ it->ob_A5 = SetCurrentA5();
+ return (PyObject *)it;
+}
+static SndCh_Convert(PyObject *v, SndChannelPtr *p_itself)
+{
+ if (!SndCh_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "SndChannel required");
+ return 0;
+ }
+ *p_itself = ((SndChannelObject *)v)->ob_itself;
+ return 1;
+}
+
+static void SndCh_dealloc(SndChannelObject *self)
+{
+ SndDisposeChannel(self->ob_itself, 1);
+ Py_XDECREF(self->ob_callback);
+ PyMem_DEL(self);
+}
+
+static PyObject *SndCh_SndDoCommand(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndCommand cmd;
+ Boolean noWait;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ SndCmd_Convert, &cmd,
+ &noWait))
+ return NULL;
+ _err = SndDoCommand(_self->ob_itself,
+ &cmd,
+ noWait);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *SndCh_SndDoImmediate(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndCommand cmd;
+ if (!PyArg_ParseTuple(_args, "O&",
+ SndCmd_Convert, &cmd))
+ return NULL;
+ _err = SndDoImmediate(_self->ob_itself,
+ &cmd);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *SndCh_SndPlay(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndListHandle sndHandle;
+ Boolean async;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ ResObj_Convert, &sndHandle,
+ &async))
+ return NULL;
+ _err = SndPlay(_self->ob_itself,
+ sndHandle,
+ async);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *SndCh_SndStartFilePlay(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short fRefNum;
+ short resNum;
+ long bufferSize;
+ Boolean async;
+ if (!PyArg_ParseTuple(_args, "hhlb",
+ &fRefNum,
+ &resNum,
+ &bufferSize,
+ &async))
+ return NULL;
+ _err = SndStartFilePlay(_self->ob_itself,
+ fRefNum,
+ resNum,
+ bufferSize,
+ 0,
+ 0,
+ 0,
+ async);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *SndCh_SndPauseFilePlay(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = SndPauseFilePlay(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *SndCh_SndStopFilePlay(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Boolean quietNow;
+ if (!PyArg_ParseTuple(_args, "b",
+ &quietNow))
+ return NULL;
+ _err = SndStopFilePlay(_self->ob_itself,
+ quietNow);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *SndCh_SndChannelStatus(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short theLength;
+ SCStatus theStatus__out__;
+ if (!PyArg_ParseTuple(_args, "h",
+ &theLength))
+ return NULL;
+ _err = SndChannelStatus(_self->ob_itself,
+ theLength,
+ &theStatus__out__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s#",
+ (char *)&theStatus__out__, (int)sizeof(SCStatus));
+ theStatus__error__: ;
+ return _res;
+}
+
+static PyObject *SndCh_SndGetInfo(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType selector;
+ void * infoPtr;
+ if (!PyArg_ParseTuple(_args, "O&w",
+ PyMac_GetOSType, &selector,
+ &infoPtr))
+ return NULL;
+ _err = SndGetInfo(_self->ob_itself,
+ selector,
+ infoPtr);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *SndCh_SndSetInfo(SndChannelObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType selector;
+ void * infoPtr;
+ if (!PyArg_ParseTuple(_args, "O&w",
+ PyMac_GetOSType, &selector,
+ &infoPtr))
+ return NULL;
+ _err = SndSetInfo(_self->ob_itself,
+ selector,
+ infoPtr);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef SndCh_methods[] = {
+ {"SndDoCommand", (PyCFunction)SndCh_SndDoCommand, 1,
+ "(SndCommand cmd, Boolean noWait) -> None"},
+ {"SndDoImmediate", (PyCFunction)SndCh_SndDoImmediate, 1,
+ "(SndCommand cmd) -> None"},
+ {"SndPlay", (PyCFunction)SndCh_SndPlay, 1,
+ "(SndListHandle sndHandle, Boolean async) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SndStartFilePlay", (PyCFunction)SndCh_SndStartFilePlay, 1,
+ "(short fRefNum, short resNum, long bufferSize, Boolean async) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1,
+ "() -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SndStopFilePlay", (PyCFunction)SndCh_SndStopFilePlay, 1,
+ "(Boolean quietNow) -> None"},
+#endif
+ {"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1,
+ "(short theLength) -> (SCStatus theStatus)"},
+ {"SndGetInfo", (PyCFunction)SndCh_SndGetInfo, 1,
+ "(OSType selector, void * infoPtr) -> None"},
+ {"SndSetInfo", (PyCFunction)SndCh_SndSetInfo, 1,
+ "(OSType selector, void * infoPtr) -> None"},
+ {NULL, NULL, 0}
+};
+
+static PyMethodChain SndCh_chain = { SndCh_methods, NULL };
+
+static PyObject *SndCh_getattr(SndChannelObject *self, char *name)
+{
+ return Py_FindMethodInChain(&SndCh_chain, (PyObject *)self, name);
+}
+
+#define SndCh_setattr NULL
+
+#define SndCh_compare NULL
+
+#define SndCh_repr NULL
+
+#define SndCh_hash NULL
+
+staticforward PyTypeObject SndChannel_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "SndChannel", /*tp_name*/
+ sizeof(SndChannelObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) SndCh_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) SndCh_getattr, /*tp_getattr*/
+ (setattrfunc) SndCh_setattr, /*tp_setattr*/
+ (cmpfunc) SndCh_compare, /*tp_compare*/
+ (reprfunc) SndCh_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) SndCh_hash, /*tp_hash*/
+};
+
+/* ------------------- End object type SndChannel ------------------- */
+
+
+/* ------------------------ Object type SPB ------------------------- */
+
+staticforward PyTypeObject SPB_Type;
+
+#define SPBObj_Check(x) ((x)->ob_type == &SPB_Type)
+
+typedef struct SPBObject {
+ PyObject_HEAD
+ /* Members used to implement callbacks: */
+ PyObject *ob_completion;
+ PyObject *ob_interrupt;
+ PyObject *ob_thiscallback;
+ long ob_A5;
+ SPB ob_spb;
+} SPBObject;
+
+static PyObject *SPBObj_New(void)
+{
+ SPBObject *it;
+ it = PyObject_NEW(SPBObject, &SPB_Type);
+ if (it == NULL) return NULL;
+ it->ob_completion = NULL;
+ it->ob_interrupt = NULL;
+ it->ob_thiscallback = NULL;
+ it->ob_A5 = SetCurrentA5();
+ memset((char *)&it->ob_spb, 0, sizeof(it->ob_spb));
+ it->ob_spb.userLong = (long)it;
+ return (PyObject *)it;
+}
+static SPBObj_Convert(PyObject *v, SPBPtr *p_itself)
+{
+ if (!SPBObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "SPB required");
+ return 0;
+ }
+ *p_itself = &((SPBObject *)v)->ob_spb;
+ return 1;
+}
+
+static void SPBObj_dealloc(SPBObject *self)
+{
+ /* Cleanup of self->ob_itself goes here */
+ self->ob_spb.userLong = 0;
+ self->ob_thiscallback = 0;
+ Py_XDECREF(self->ob_completion);
+ Py_XDECREF(self->ob_interrupt);
+ PyMem_DEL(self);
+}
+
+static PyMethodDef SPBObj_methods[] = {
+ {NULL, NULL, 0}
+};
+
+static PyMethodChain SPBObj_chain = { SPBObj_methods, NULL };
+
+static PyObject *SPBObj_getattr(SPBObject *self, char *name)
+{
+
+ if (strcmp(name, "inRefNum") == 0)
+ return Py_BuildValue("l", self->ob_spb.inRefNum);
+ else if (strcmp(name, "count") == 0)
+ return Py_BuildValue("l", self->ob_spb.count);
+ else if (strcmp(name, "milliseconds") == 0)
+ return Py_BuildValue("l", self->ob_spb.milliseconds);
+ else if (strcmp(name, "error") == 0)
+ return Py_BuildValue("h", self->ob_spb.error);
+ return Py_FindMethodInChain(&SPBObj_chain, (PyObject *)self, name);
+}
+
+static int SPBObj_setattr(SPBObject *self, char *name, PyObject *value)
+{
+
+ int rv = 0;
+
+ if (strcmp(name, "inRefNum") == 0)
+ rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
+ else if (strcmp(name, "count") == 0)
+ rv = PyArg_Parse(value, "l", &self->ob_spb.count);
+ else if (strcmp(name, "milliseconds") == 0)
+ rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
+ else if (strcmp(name, "buffer") == 0)
+ rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
+ else if (strcmp(name, "completionRoutine") == 0) {
+ self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion);
+ self->ob_completion = value;
+ Py_INCREF(value);
+ rv = 1;
+#if !TARGET_API_MAC_CARBON
+ } else if (strcmp(name, "interruptRoutine") == 0) {
+ self->ob_spb.completionRoutine = NewSIInterruptUPP(SPB_interrupt);
+ self->ob_interrupt = value;
+ Py_INCREF(value);
+ rv = 1;
+#endif
+ }
+ if ( rv ) return 0;
+ else return -1;
+}
+
+#define SPBObj_compare NULL
+
+#define SPBObj_repr NULL
+
+#define SPBObj_hash NULL
+
+staticforward PyTypeObject SPB_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "SPB", /*tp_name*/
+ sizeof(SPBObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) SPBObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) SPBObj_getattr, /*tp_getattr*/
+ (setattrfunc) SPBObj_setattr, /*tp_setattr*/
+ (cmpfunc) SPBObj_compare, /*tp_compare*/
+ (reprfunc) SPBObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) SPBObj_hash, /*tp_hash*/
+};
+
+/* ---------------------- End object type SPB ----------------------- */
+
+
+static PyObject *Snd_SPB(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ return SPBObj_New();
+}
+
+static PyObject *Snd_SysBeep(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short duration;
+ if (!PyArg_ParseTuple(_args, "h",
+ &duration))
+ return NULL;
+ SysBeep(duration);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SndNewChannel(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndChannelPtr chan = 0;
+ short synth;
+ long init;
+ PyObject* userRoutine;
+ if (!PyArg_ParseTuple(_args, "hlO",
+ &synth,
+ &init,
+ &userRoutine))
+ return NULL;
+ if (userRoutine != Py_None && !PyCallable_Check(userRoutine))
+ {
+ PyErr_SetString(PyExc_TypeError, "callback must be callable");
+ goto userRoutine__error__;
+ }
+ _err = SndNewChannel(&chan,
+ synth,
+ init,
+ NewSndCallBackUPP(SndCh_UserRoutine));
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ SndCh_New, chan);
+ if (_res != NULL && userRoutine != Py_None)
+ {
+ SndChannelObject *p = (SndChannelObject *)_res;
+ p->ob_itself->userInfo = (long)p;
+ Py_INCREF(userRoutine);
+ p->ob_callback = userRoutine;
+ }
+ userRoutine__error__: ;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Snd_SndControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short id;
+ SndCommand cmd;
+ if (!PyArg_ParseTuple(_args, "h",
+ &id))
+ return NULL;
+ _err = SndControl(id,
+ &cmd);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ SndCmd_New, &cmd);
+ return _res;
+}
+#endif
+
+static PyObject *Snd_SndSoundManagerVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ NumVersion _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = SndSoundManagerVersion();
+ _res = Py_BuildValue("O&",
+ PyMac_BuildNumVersion, _rv);
+ return _res;
+}
+
+static PyObject *Snd_SndManagerStatus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short theLength;
+ SMStatus theStatus__out__;
+ if (!PyArg_ParseTuple(_args, "h",
+ &theLength))
+ return NULL;
+ _err = SndManagerStatus(theLength,
+ &theStatus__out__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s#",
+ (char *)&theStatus__out__, (int)sizeof(SMStatus));
+ theStatus__error__: ;
+ return _res;
+}
+
+static PyObject *Snd_SndGetSysBeepState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short sysBeepState;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SndGetSysBeepState(&sysBeepState);
+ _res = Py_BuildValue("h",
+ sysBeepState);
+ return _res;
+}
+
+static PyObject *Snd_SndSetSysBeepState(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short sysBeepState;
+ if (!PyArg_ParseTuple(_args, "h",
+ &sysBeepState))
+ return NULL;
+ _err = SndSetSysBeepState(sysBeepState);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Snd_MACEVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ NumVersion _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MACEVersion();
+ _res = Py_BuildValue("O&",
+ PyMac_BuildNumVersion, _rv);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Snd_Comp3to1(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *buffer__in__;
+ char *buffer__out__;
+ long buffer__len__;
+ int buffer__in_len__;
+ StateBlock *state__in__;
+ StateBlock state__out__;
+ int state__in_len__;
+ unsigned long numChannels;
+ unsigned long whichChannel;
+ if (!PyArg_ParseTuple(_args, "s#s#ll",
+ &buffer__in__, &buffer__in_len__,
+ (char **)&state__in__, &state__in_len__,
+ &numChannels,
+ &whichChannel))
+ return NULL;
+ if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto buffer__error__;
+ }
+ buffer__len__ = buffer__in_len__;
+ if (state__in_len__ != sizeof(StateBlock))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)");
+ goto state__error__;
+ }
+ Comp3to1(buffer__in__, buffer__out__, (long)buffer__len__,
+ state__in__, &state__out__,
+ numChannels,
+ whichChannel);
+ _res = Py_BuildValue("s#s#",
+ buffer__out__, (int)buffer__len__,
+ (char *)&state__out__, (int)sizeof(StateBlock));
+ state__error__: ;
+ free(buffer__out__);
+ buffer__error__: ;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Snd_Exp1to3(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *buffer__in__;
+ char *buffer__out__;
+ long buffer__len__;
+ int buffer__in_len__;
+ StateBlock *state__in__;
+ StateBlock state__out__;
+ int state__in_len__;
+ unsigned long numChannels;
+ unsigned long whichChannel;
+ if (!PyArg_ParseTuple(_args, "s#s#ll",
+ &buffer__in__, &buffer__in_len__,
+ (char **)&state__in__, &state__in_len__,
+ &numChannels,
+ &whichChannel))
+ return NULL;
+ if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto buffer__error__;
+ }
+ buffer__len__ = buffer__in_len__;
+ if (state__in_len__ != sizeof(StateBlock))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)");
+ goto state__error__;
+ }
+ Exp1to3(buffer__in__, buffer__out__, (long)buffer__len__,
+ state__in__, &state__out__,
+ numChannels,
+ whichChannel);
+ _res = Py_BuildValue("s#s#",
+ buffer__out__, (int)buffer__len__,
+ (char *)&state__out__, (int)sizeof(StateBlock));
+ state__error__: ;
+ free(buffer__out__);
+ buffer__error__: ;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Snd_Comp6to1(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *buffer__in__;
+ char *buffer__out__;
+ long buffer__len__;
+ int buffer__in_len__;
+ StateBlock *state__in__;
+ StateBlock state__out__;
+ int state__in_len__;
+ unsigned long numChannels;
+ unsigned long whichChannel;
+ if (!PyArg_ParseTuple(_args, "s#s#ll",
+ &buffer__in__, &buffer__in_len__,
+ (char **)&state__in__, &state__in_len__,
+ &numChannels,
+ &whichChannel))
+ return NULL;
+ if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto buffer__error__;
+ }
+ buffer__len__ = buffer__in_len__;
+ if (state__in_len__ != sizeof(StateBlock))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)");
+ goto state__error__;
+ }
+ Comp6to1(buffer__in__, buffer__out__, (long)buffer__len__,
+ state__in__, &state__out__,
+ numChannels,
+ whichChannel);
+ _res = Py_BuildValue("s#s#",
+ buffer__out__, (int)buffer__len__,
+ (char *)&state__out__, (int)sizeof(StateBlock));
+ state__error__: ;
+ free(buffer__out__);
+ buffer__error__: ;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Snd_Exp1to6(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *buffer__in__;
+ char *buffer__out__;
+ long buffer__len__;
+ int buffer__in_len__;
+ StateBlock *state__in__;
+ StateBlock state__out__;
+ int state__in_len__;
+ unsigned long numChannels;
+ unsigned long whichChannel;
+ if (!PyArg_ParseTuple(_args, "s#s#ll",
+ &buffer__in__, &buffer__in_len__,
+ (char **)&state__in__, &state__in_len__,
+ &numChannels,
+ &whichChannel))
+ return NULL;
+ if ((buffer__out__ = malloc(buffer__in_len__)) == NULL)
+ {
+ PyErr_NoMemory();
+ goto buffer__error__;
+ }
+ buffer__len__ = buffer__in_len__;
+ if (state__in_len__ != sizeof(StateBlock))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(StateBlock)");
+ goto state__error__;
+ }
+ Exp1to6(buffer__in__, buffer__out__, (long)buffer__len__,
+ state__in__, &state__out__,
+ numChannels,
+ whichChannel);
+ _res = Py_BuildValue("s#s#",
+ buffer__out__, (int)buffer__len__,
+ (char *)&state__out__, (int)sizeof(StateBlock));
+ state__error__: ;
+ free(buffer__out__);
+ buffer__error__: ;
+ return _res;
+}
+#endif
+
+static PyObject *Snd_GetSysBeepVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long level;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetSysBeepVolume(&level);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ level);
+ return _res;
+}
+
+static PyObject *Snd_SetSysBeepVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long level;
+ if (!PyArg_ParseTuple(_args, "l",
+ &level))
+ return NULL;
+ _err = SetSysBeepVolume(level);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_GetDefaultOutputVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long level;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetDefaultOutputVolume(&level);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ level);
+ return _res;
+}
+
+static PyObject *Snd_SetDefaultOutputVolume(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long level;
+ if (!PyArg_ParseTuple(_args, "l",
+ &level))
+ return NULL;
+ _err = SetDefaultOutputVolume(level);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_GetSoundHeaderOffset(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SndListHandle sndHandle;
+ long offset;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &sndHandle))
+ return NULL;
+ _err = GetSoundHeaderOffset(sndHandle,
+ &offset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ offset);
+ return _res;
+}
+
+static PyObject *Snd_GetCompressionInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short compressionID;
+ OSType format;
+ short numChannels;
+ short sampleSize;
+ CompressionInfo cp__out__;
+ if (!PyArg_ParseTuple(_args, "hO&hh",
+ &compressionID,
+ PyMac_GetOSType, &format,
+ &numChannels,
+ &sampleSize))
+ return NULL;
+ _err = GetCompressionInfo(compressionID,
+ format,
+ numChannels,
+ sampleSize,
+ &cp__out__);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("s#",
+ (char *)&cp__out__, (int)sizeof(CompressionInfo));
+ cp__error__: ;
+ return _res;
+}
+
+static PyObject *Snd_SetSoundPreference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType theType;
+ Str255 name;
+ Handle settings;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theType,
+ ResObj_Convert, &settings))
+ return NULL;
+ _err = SetSoundPreference(theType,
+ name,
+ settings);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, name);
+ return _res;
+}
+
+static PyObject *Snd_GetSoundPreference(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType theType;
+ Str255 name;
+ Handle settings;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &theType,
+ ResObj_Convert, &settings))
+ return NULL;
+ _err = GetSoundPreference(theType,
+ name,
+ settings);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, name);
+ return _res;
+}
+
+static PyObject *Snd_GetCompressionName(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ OSType compressionType;
+ Str255 compressionName;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetOSType, &compressionType))
+ return NULL;
+ _err = GetCompressionName(compressionType,
+ compressionName);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, compressionName);
+ return _res;
+}
+
+static PyObject *Snd_SPBVersion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ NumVersion _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = SPBVersion();
+ _res = Py_BuildValue("O&",
+ PyMac_BuildNumVersion, _rv);
+ return _res;
+}
+
+static PyObject *Snd_SPBSignInDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short deviceRefNum;
+ Str255 deviceName;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &deviceRefNum,
+ PyMac_GetStr255, deviceName))
+ return NULL;
+ _err = SPBSignInDevice(deviceRefNum,
+ deviceName);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBSignOutDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short deviceRefNum;
+ if (!PyArg_ParseTuple(_args, "h",
+ &deviceRefNum))
+ return NULL;
+ _err = SPBSignOutDevice(deviceRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBGetIndexedDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short count;
+ Str255 deviceName;
+ Handle deviceIconHandle;
+ if (!PyArg_ParseTuple(_args, "h",
+ &count))
+ return NULL;
+ _err = SPBGetIndexedDevice(count,
+ deviceName,
+ &deviceIconHandle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildStr255, deviceName,
+ ResObj_New, deviceIconHandle);
+ return _res;
+}
+
+static PyObject *Snd_SPBOpenDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Str255 deviceName;
+ short permission;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetStr255, deviceName,
+ &permission))
+ return NULL;
+ _err = SPBOpenDevice(deviceName,
+ permission,
+ &inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ inRefNum);
+ return _res;
+}
+
+static PyObject *Snd_SPBCloseDevice(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBCloseDevice(inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBRecord(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ SPBPtr inParamPtr;
+ Boolean asynchFlag;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ SPBObj_Convert, &inParamPtr,
+ &asynchFlag))
+ return NULL;
+ _err = SPBRecord(inParamPtr,
+ asynchFlag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Snd_SPBRecordToFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short fRefNum;
+ SPBPtr inParamPtr;
+ Boolean asynchFlag;
+ if (!PyArg_ParseTuple(_args, "hO&b",
+ &fRefNum,
+ SPBObj_Convert, &inParamPtr,
+ &asynchFlag))
+ return NULL;
+ _err = SPBRecordToFile(fRefNum,
+ inParamPtr,
+ asynchFlag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Snd_SPBPauseRecording(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBPauseRecording(inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBResumeRecording(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBResumeRecording(inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBStopRecording(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBStopRecording(inRefNum);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBGetRecordingStatus(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ short recordingStatus;
+ short meterLevel;
+ unsigned long totalSamplesToRecord;
+ unsigned long numberOfSamplesRecorded;
+ unsigned long totalMsecsToRecord;
+ unsigned long numberOfMsecsRecorded;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBGetRecordingStatus(inRefNum,
+ &recordingStatus,
+ &meterLevel,
+ &totalSamplesToRecord,
+ &numberOfSamplesRecorded,
+ &totalMsecsToRecord,
+ &numberOfMsecsRecorded);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hhllll",
+ recordingStatus,
+ meterLevel,
+ totalSamplesToRecord,
+ numberOfSamplesRecorded,
+ totalMsecsToRecord,
+ numberOfMsecsRecorded);
+ return _res;
+}
+
+static PyObject *Snd_SPBGetDeviceInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ OSType infoType;
+ void * infoData;
+ if (!PyArg_ParseTuple(_args, "lO&w",
+ &inRefNum,
+ PyMac_GetOSType, &infoType,
+ &infoData))
+ return NULL;
+ _err = SPBGetDeviceInfo(inRefNum,
+ infoType,
+ infoData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBSetDeviceInfo(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ OSType infoType;
+ void * infoData;
+ if (!PyArg_ParseTuple(_args, "lO&w",
+ &inRefNum,
+ PyMac_GetOSType, &infoType,
+ &infoData))
+ return NULL;
+ _err = SPBSetDeviceInfo(inRefNum,
+ infoType,
+ infoData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Snd_SPBMillisecondsToBytes(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ long milliseconds;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBMillisecondsToBytes(inRefNum,
+ &milliseconds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ milliseconds);
+ return _res;
+}
+
+static PyObject *Snd_SPBBytesToMilliseconds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ long inRefNum;
+ long byteCount;
+ if (!PyArg_ParseTuple(_args, "l",
+ &inRefNum))
+ return NULL;
+ _err = SPBBytesToMilliseconds(inRefNum,
+ &byteCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ byteCount);
+ return _res;
+}
+
+static PyMethodDef Snd_methods[] = {
+ {"SPB", (PyCFunction)Snd_SPB, 1,
+ NULL},
+ {"SysBeep", (PyCFunction)Snd_SysBeep, 1,
+ "(short duration) -> None"},
+ {"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1,
+ "(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SndControl", (PyCFunction)Snd_SndControl, 1,
+ "(short id) -> (SndCommand cmd)"},
+#endif
+ {"SndSoundManagerVersion", (PyCFunction)Snd_SndSoundManagerVersion, 1,
+ "() -> (NumVersion _rv)"},
+ {"SndManagerStatus", (PyCFunction)Snd_SndManagerStatus, 1,
+ "(short theLength) -> (SMStatus theStatus)"},
+ {"SndGetSysBeepState", (PyCFunction)Snd_SndGetSysBeepState, 1,
+ "() -> (short sysBeepState)"},
+ {"SndSetSysBeepState", (PyCFunction)Snd_SndSetSysBeepState, 1,
+ "(short sysBeepState) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"MACEVersion", (PyCFunction)Snd_MACEVersion, 1,
+ "() -> (NumVersion _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"Comp3to1", (PyCFunction)Snd_Comp3to1, 1,
+ "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"Exp1to3", (PyCFunction)Snd_Exp1to3, 1,
+ "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"Comp6to1", (PyCFunction)Snd_Comp6to1, 1,
+ "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"Exp1to6", (PyCFunction)Snd_Exp1to6, 1,
+ "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"},
+#endif
+ {"GetSysBeepVolume", (PyCFunction)Snd_GetSysBeepVolume, 1,
+ "() -> (long level)"},
+ {"SetSysBeepVolume", (PyCFunction)Snd_SetSysBeepVolume, 1,
+ "(long level) -> None"},
+ {"GetDefaultOutputVolume", (PyCFunction)Snd_GetDefaultOutputVolume, 1,
+ "() -> (long level)"},
+ {"SetDefaultOutputVolume", (PyCFunction)Snd_SetDefaultOutputVolume, 1,
+ "(long level) -> None"},
+ {"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1,
+ "(SndListHandle sndHandle) -> (long offset)"},
+ {"GetCompressionInfo", (PyCFunction)Snd_GetCompressionInfo, 1,
+ "(short compressionID, OSType format, short numChannels, short sampleSize) -> (CompressionInfo cp)"},
+ {"SetSoundPreference", (PyCFunction)Snd_SetSoundPreference, 1,
+ "(OSType theType, Handle settings) -> (Str255 name)"},
+ {"GetSoundPreference", (PyCFunction)Snd_GetSoundPreference, 1,
+ "(OSType theType, Handle settings) -> (Str255 name)"},
+ {"GetCompressionName", (PyCFunction)Snd_GetCompressionName, 1,
+ "(OSType compressionType) -> (Str255 compressionName)"},
+ {"SPBVersion", (PyCFunction)Snd_SPBVersion, 1,
+ "() -> (NumVersion _rv)"},
+ {"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1,
+ "(short deviceRefNum, Str255 deviceName) -> None"},
+ {"SPBSignOutDevice", (PyCFunction)Snd_SPBSignOutDevice, 1,
+ "(short deviceRefNum) -> None"},
+ {"SPBGetIndexedDevice", (PyCFunction)Snd_SPBGetIndexedDevice, 1,
+ "(short count) -> (Str255 deviceName, Handle deviceIconHandle)"},
+ {"SPBOpenDevice", (PyCFunction)Snd_SPBOpenDevice, 1,
+ "(Str255 deviceName, short permission) -> (long inRefNum)"},
+ {"SPBCloseDevice", (PyCFunction)Snd_SPBCloseDevice, 1,
+ "(long inRefNum) -> None"},
+ {"SPBRecord", (PyCFunction)Snd_SPBRecord, 1,
+ "(SPBPtr inParamPtr, Boolean asynchFlag) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SPBRecordToFile", (PyCFunction)Snd_SPBRecordToFile, 1,
+ "(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag) -> None"},
+#endif
+ {"SPBPauseRecording", (PyCFunction)Snd_SPBPauseRecording, 1,
+ "(long inRefNum) -> None"},
+ {"SPBResumeRecording", (PyCFunction)Snd_SPBResumeRecording, 1,
+ "(long inRefNum) -> None"},
+ {"SPBStopRecording", (PyCFunction)Snd_SPBStopRecording, 1,
+ "(long inRefNum) -> None"},
+ {"SPBGetRecordingStatus", (PyCFunction)Snd_SPBGetRecordingStatus, 1,
+ "(long inRefNum) -> (short recordingStatus, short meterLevel, unsigned long totalSamplesToRecord, unsigned long numberOfSamplesRecorded, unsigned long totalMsecsToRecord, unsigned long numberOfMsecsRecorded)"},
+ {"SPBGetDeviceInfo", (PyCFunction)Snd_SPBGetDeviceInfo, 1,
+ "(long inRefNum, OSType infoType, void * infoData) -> None"},
+ {"SPBSetDeviceInfo", (PyCFunction)Snd_SPBSetDeviceInfo, 1,
+ "(long inRefNum, OSType infoType, void * infoData) -> None"},
+ {"SPBMillisecondsToBytes", (PyCFunction)Snd_SPBMillisecondsToBytes, 1,
+ "(long inRefNum) -> (long milliseconds)"},
+ {"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1,
+ "(long inRefNum) -> (long byteCount)"},
+ {NULL, NULL, 0}
+};
+
+
+
+/* Routine passed to Py_AddPendingCall -- call the Python callback */
+static int
+SndCh_CallCallBack(void *arg)
+{
+ SndChannelObject *p = (SndChannelObject *)arg;
+ PyObject *args;
+ PyObject *res;
+ args = Py_BuildValue("(O(hhl))",
+ p, p->ob_cmd.cmd, p->ob_cmd.param1, p->ob_cmd.param2);
+ res = PyEval_CallObject(p->ob_callback, args);
+ Py_DECREF(args);
+ if (res == NULL)
+ return -1;
+ Py_DECREF(res);
+ return 0;
+}
+
+/* Routine passed to NewSndChannel -- schedule a call to SndCh_CallCallBack */
+static pascal void
+SndCh_UserRoutine(SndChannelPtr chan, SndCommand *cmd)
+{
+ SndChannelObject *p = (SndChannelObject *)(chan->userInfo);
+ if (p->ob_callback != NULL) {
+ long A5 = SetA5(p->ob_A5);
+ p->ob_cmd = *cmd;
+ Py_AddPendingCall(SndCh_CallCallBack, (void *)p);
+ SetA5(A5);
+ }
+}
+
+/* SPB callbacks - Schedule callbacks to Python */
+static int
+SPB_CallCallBack(void *arg)
+{
+ SPBObject *p = (SPBObject *)arg;
+ PyObject *args;
+ PyObject *res;
+
+ if ( p->ob_thiscallback == 0 ) return 0;
+ args = Py_BuildValue("(O)", p);
+ res = PyEval_CallObject(p->ob_thiscallback, args);
+ p->ob_thiscallback = 0;
+ Py_DECREF(args);
+ if (res == NULL)
+ return -1;
+ Py_DECREF(res);
+ return 0;
+}
+
+static pascal void
+SPB_completion(SPBPtr my_spb)
+{
+ SPBObject *p = (SPBObject *)(my_spb->userLong);
+
+ if (p && p->ob_completion) {
+ long A5 = SetA5(p->ob_A5);
+ p->ob_thiscallback = p->ob_completion; /* Hope we cannot get two at the same time */
+ Py_AddPendingCall(SPB_CallCallBack, (void *)p);
+ SetA5(A5);
+ }
+}
+
+#if !TARGET_API_MAC_CARBON
+static pascal void
+SPB_interrupt(SPBPtr my_spb)
+{
+ SPBObject *p = (SPBObject *)(my_spb->userLong);
+
+ if (p && p->ob_interrupt) {
+ long A5 = SetA5(p->ob_A5);
+ p->ob_thiscallback = p->ob_interrupt; /* Hope we cannot get two at the same time */
+ Py_AddPendingCall(SPB_CallCallBack, (void *)p);
+ SetA5(A5);
+ }
+}
+#endif
+
+
+void init_Snd(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+
+
+ m = Py_InitModule("_Snd", Snd_methods);
+ d = PyModule_GetDict(m);
+ Snd_Error = PyMac_GetOSErrException();
+ if (Snd_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Snd_Error) != 0)
+ return;
+ SndChannel_Type.ob_type = &PyType_Type;
+ Py_INCREF(&SndChannel_Type);
+ if (PyDict_SetItemString(d, "SndChannelType", (PyObject *)&SndChannel_Type) != 0)
+ Py_FatalError("can't initialize SndChannelType");
+ SPB_Type.ob_type = &PyType_Type;
+ Py_INCREF(&SPB_Type);
+ if (PyDict_SetItemString(d, "SPBType", (PyObject *)&SPB_Type) != 0)
+ Py_FatalError("can't initialize SPBType");
+}
+
+/* ======================== End module _Snd ========================= */
+
diff --git a/Mac/Modules/te/_TEmodule.c b/Mac/Modules/te/_TEmodule.c
new file mode 100644
index 0000000..ee383f9
--- /dev/null
+++ b/Mac/Modules/te/_TEmodule.c
@@ -0,0 +1,1040 @@
+
+/* =========================== Module _TE =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <TextEdit.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TEObj_New(TEHandle);
+extern int _TEObj_Convert(PyObject *, TEHandle *);
+
+#define TEObj_New _TEObj_New
+#define TEObj_Convert _TEObj_Convert
+#endif
+
+#define as_TE(h) ((TEHandle)h)
+#define as_Resource(teh) ((Handle)teh)
+
+/*
+** Parse/generate TextStyle records
+*/
+static PyObject *
+TextStyle_New(TextStylePtr itself)
+{
+
+ return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
+ &itself->tsColor);
+}
+
+static int
+TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
+{
+ long font, face, size;
+
+ if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
+ return 0;
+ p_itself->tsFont = (short)font;
+ p_itself->tsFace = (Style)face;
+ p_itself->tsSize = (short)size;
+ return 1;
+}
+
+static PyObject *TE_Error;
+
+/* ------------------------- Object type TE ------------------------- */
+
+PyTypeObject TE_Type;
+
+#define TEObj_Check(x) ((x)->ob_type == &TE_Type)
+
+typedef struct TEObject {
+ PyObject_HEAD
+ TEHandle ob_itself;
+} TEObject;
+
+PyObject *TEObj_New(TEHandle itself)
+{
+ TEObject *it;
+ if (itself == NULL) {
+ PyErr_SetString(TE_Error,"Cannot create null TE");
+ return NULL;
+ }
+ it = PyObject_NEW(TEObject, &TE_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ return (PyObject *)it;
+}
+TEObj_Convert(PyObject *v, TEHandle *p_itself)
+{
+ if (!TEObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "TE required");
+ return 0;
+ }
+ *p_itself = ((TEObject *)v)->ob_itself;
+ return 1;
+}
+
+static void TEObj_dealloc(TEObject *self)
+{
+ TEDispose(self->ob_itself);
+ PyMem_DEL(self);
+}
+
+static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *text__in__;
+ long text__len__;
+ int text__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ &text__in__, &text__in_len__))
+ return NULL;
+ text__len__ = text__in_len__;
+ TESetText(text__in__, text__len__,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ text__error__: ;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetText(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CharsHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetText(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEIdle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEIdle(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESetSelect(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long selStart;
+ long selEnd;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &selStart,
+ &selEnd))
+ return NULL;
+ TESetSelect(selStart,
+ selEnd,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEActivate(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEActivate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEDeactivate(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEDeactivate(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEKey(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CharParameter key;
+ if (!PyArg_ParseTuple(_args, "h",
+ &key))
+ return NULL;
+ TEKey(key,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TECut(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TECut(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TECopy(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TECopy(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEPaste(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEPaste(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEDelete(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEDelete(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEInsert(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *text__in__;
+ long text__len__;
+ int text__in_len__;
+ if (!PyArg_ParseTuple(_args, "s#",
+ &text__in__, &text__in_len__))
+ return NULL;
+ text__len__ = text__in_len__;
+ TEInsert(text__in__, text__len__,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ text__error__: ;
+ return _res;
+}
+
+static PyObject *TEObj_TESetAlignment(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short just;
+ if (!PyArg_ParseTuple(_args, "h",
+ &just))
+ return NULL;
+ TESetAlignment(just,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEUpdate(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rUpdate;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rUpdate))
+ return NULL;
+ TEUpdate(&rUpdate,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEScroll(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
+ return NULL;
+ TEScroll(dh,
+ dv,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESelView(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TESelView(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEPinScroll(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short dh;
+ short dv;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
+ return NULL;
+ TEPinScroll(dh,
+ dv,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEAutoView(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean fAuto;
+ if (!PyArg_ParseTuple(_args, "b",
+ &fAuto))
+ return NULL;
+ TEAutoView(fAuto,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TECalText(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TECalText(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetOffset(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Point pt;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
+ return NULL;
+ _rv = TEGetOffset(pt,
+ _self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEGetPoint(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point _rv;
+ short offset;
+ if (!PyArg_ParseTuple(_args, "h",
+ &offset))
+ return NULL;
+ _rv = TEGetPoint(offset,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEClick(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Point pt;
+ Boolean fExtend;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetPoint, &pt,
+ &fExtend))
+ return NULL;
+ TEClick(pt,
+ fExtend,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESetStyleHandle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEStyleHandle theHandle;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &theHandle))
+ return NULL;
+ TESetStyleHandle(theHandle,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetStyleHandle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEStyleHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetStyleHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEGetStyle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short offset;
+ TextStyle theStyle;
+ short lineHeight;
+ short fontAscent;
+ if (!PyArg_ParseTuple(_args, "h",
+ &offset))
+ return NULL;
+ TEGetStyle(offset,
+ &theStyle,
+ &lineHeight,
+ &fontAscent,
+ _self->ob_itself);
+ _res = Py_BuildValue("O&hh",
+ TextStyle_New, &theStyle,
+ lineHeight,
+ fontAscent);
+ return _res;
+}
+
+static PyObject *TEObj_TEStylePaste(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ TEStylePaste(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TESetStyle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+ TextStyle newStyle;
+ Boolean fRedraw;
+ if (!PyArg_ParseTuple(_args, "hO&b",
+ &mode,
+ TextStyle_Convert, &newStyle,
+ &fRedraw))
+ return NULL;
+ TESetStyle(mode,
+ &newStyle,
+ fRedraw,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEReplaceStyle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short mode;
+ TextStyle oldStyle;
+ TextStyle newStyle;
+ Boolean fRedraw;
+ if (!PyArg_ParseTuple(_args, "hO&O&b",
+ &mode,
+ TextStyle_Convert, &oldStyle,
+ TextStyle_Convert, &newStyle,
+ &fRedraw))
+ return NULL;
+ TEReplaceStyle(mode,
+ &oldStyle,
+ &newStyle,
+ fRedraw,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetStyleScrapHandle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ StScrpHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetStyleScrapHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEStyleInsert(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *text__in__;
+ long text__len__;
+ int text__in_len__;
+ StScrpHandle hST;
+ if (!PyArg_ParseTuple(_args, "s#O&",
+ &text__in__, &text__in_len__,
+ ResObj_Convert, &hST))
+ return NULL;
+ text__len__ = text__in_len__;
+ TEStyleInsert(text__in__, text__len__,
+ hST,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ text__error__: ;
+ return _res;
+}
+
+static PyObject *TEObj_TEGetHeight(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ long endLine;
+ long startLine;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &endLine,
+ &startLine))
+ return NULL;
+ _rv = TEGetHeight(endLine,
+ startLine,
+ _self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEContinuousStyle(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short mode;
+ TextStyle aStyle;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &mode,
+ TextStyle_Convert, &aStyle))
+ return NULL;
+ _rv = TEContinuousStyle(&mode,
+ &aStyle,
+ _self->ob_itself);
+ _res = Py_BuildValue("bhO&",
+ _rv,
+ mode,
+ TextStyle_New, &aStyle);
+ return _res;
+}
+
+static PyObject *TEObj_TEUseStyleScrap(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long rangeStart;
+ long rangeEnd;
+ StScrpHandle newStyles;
+ Boolean fRedraw;
+ if (!PyArg_ParseTuple(_args, "llO&b",
+ &rangeStart,
+ &rangeEnd,
+ ResObj_Convert, &newStyles,
+ &fRedraw))
+ return NULL;
+ TEUseStyleScrap(rangeStart,
+ rangeEnd,
+ newStyles,
+ fRedraw,
+ _self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_TENumStyles(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ long rangeStart;
+ long rangeEnd;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &rangeStart,
+ &rangeEnd))
+ return NULL;
+ _rv = TENumStyles(rangeStart,
+ rangeEnd,
+ _self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEFeatureFlag(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ short feature;
+ short action;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &feature,
+ &action))
+ return NULL;
+ _rv = TEFeatureFlag(feature,
+ action,
+ _self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *TEObj_TEGetHiliteRgn(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ RgnHandle region;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ return NULL;
+ _err = TEGetHiliteRgn(region,
+ _self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TEObj_as_Resource(TEObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef TEObj_methods[] = {
+ {"TESetText", (PyCFunction)TEObj_TESetText, 1,
+ "(Buffer text) -> None"},
+ {"TEGetText", (PyCFunction)TEObj_TEGetText, 1,
+ "() -> (CharsHandle _rv)"},
+ {"TEIdle", (PyCFunction)TEObj_TEIdle, 1,
+ "() -> None"},
+ {"TESetSelect", (PyCFunction)TEObj_TESetSelect, 1,
+ "(long selStart, long selEnd) -> None"},
+ {"TEActivate", (PyCFunction)TEObj_TEActivate, 1,
+ "() -> None"},
+ {"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1,
+ "() -> None"},
+ {"TEKey", (PyCFunction)TEObj_TEKey, 1,
+ "(CharParameter key) -> None"},
+ {"TECut", (PyCFunction)TEObj_TECut, 1,
+ "() -> None"},
+ {"TECopy", (PyCFunction)TEObj_TECopy, 1,
+ "() -> None"},
+ {"TEPaste", (PyCFunction)TEObj_TEPaste, 1,
+ "() -> None"},
+ {"TEDelete", (PyCFunction)TEObj_TEDelete, 1,
+ "() -> None"},
+ {"TEInsert", (PyCFunction)TEObj_TEInsert, 1,
+ "(Buffer text) -> None"},
+ {"TESetAlignment", (PyCFunction)TEObj_TESetAlignment, 1,
+ "(short just) -> None"},
+ {"TEUpdate", (PyCFunction)TEObj_TEUpdate, 1,
+ "(Rect rUpdate) -> None"},
+ {"TEScroll", (PyCFunction)TEObj_TEScroll, 1,
+ "(short dh, short dv) -> None"},
+ {"TESelView", (PyCFunction)TEObj_TESelView, 1,
+ "() -> None"},
+ {"TEPinScroll", (PyCFunction)TEObj_TEPinScroll, 1,
+ "(short dh, short dv) -> None"},
+ {"TEAutoView", (PyCFunction)TEObj_TEAutoView, 1,
+ "(Boolean fAuto) -> None"},
+ {"TECalText", (PyCFunction)TEObj_TECalText, 1,
+ "() -> None"},
+ {"TEGetOffset", (PyCFunction)TEObj_TEGetOffset, 1,
+ "(Point pt) -> (short _rv)"},
+ {"TEGetPoint", (PyCFunction)TEObj_TEGetPoint, 1,
+ "(short offset) -> (Point _rv)"},
+ {"TEClick", (PyCFunction)TEObj_TEClick, 1,
+ "(Point pt, Boolean fExtend) -> None"},
+ {"TESetStyleHandle", (PyCFunction)TEObj_TESetStyleHandle, 1,
+ "(TEStyleHandle theHandle) -> None"},
+ {"TEGetStyleHandle", (PyCFunction)TEObj_TEGetStyleHandle, 1,
+ "() -> (TEStyleHandle _rv)"},
+ {"TEGetStyle", (PyCFunction)TEObj_TEGetStyle, 1,
+ "(short offset) -> (TextStyle theStyle, short lineHeight, short fontAscent)"},
+ {"TEStylePaste", (PyCFunction)TEObj_TEStylePaste, 1,
+ "() -> None"},
+ {"TESetStyle", (PyCFunction)TEObj_TESetStyle, 1,
+ "(short mode, TextStyle newStyle, Boolean fRedraw) -> None"},
+ {"TEReplaceStyle", (PyCFunction)TEObj_TEReplaceStyle, 1,
+ "(short mode, TextStyle oldStyle, TextStyle newStyle, Boolean fRedraw) -> None"},
+ {"TEGetStyleScrapHandle", (PyCFunction)TEObj_TEGetStyleScrapHandle, 1,
+ "() -> (StScrpHandle _rv)"},
+ {"TEStyleInsert", (PyCFunction)TEObj_TEStyleInsert, 1,
+ "(Buffer text, StScrpHandle hST) -> None"},
+ {"TEGetHeight", (PyCFunction)TEObj_TEGetHeight, 1,
+ "(long endLine, long startLine) -> (long _rv)"},
+ {"TEContinuousStyle", (PyCFunction)TEObj_TEContinuousStyle, 1,
+ "(short mode, TextStyle aStyle) -> (Boolean _rv, short mode, TextStyle aStyle)"},
+ {"TEUseStyleScrap", (PyCFunction)TEObj_TEUseStyleScrap, 1,
+ "(long rangeStart, long rangeEnd, StScrpHandle newStyles, Boolean fRedraw) -> None"},
+ {"TENumStyles", (PyCFunction)TEObj_TENumStyles, 1,
+ "(long rangeStart, long rangeEnd) -> (long _rv)"},
+ {"TEFeatureFlag", (PyCFunction)TEObj_TEFeatureFlag, 1,
+ "(short feature, short action) -> (short _rv)"},
+ {"TEGetHiliteRgn", (PyCFunction)TEObj_TEGetHiliteRgn, 1,
+ "(RgnHandle region) -> None"},
+ {"as_Resource", (PyCFunction)TEObj_as_Resource, 1,
+ "() -> (Handle _rv)"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain TEObj_chain = { TEObj_methods, NULL };
+
+static PyObject *TEObj_getattr(TEObject *self, char *name)
+{
+
+ if( strcmp(name, "destRect") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildRect,
+ &(*self->ob_itself)->destRect);
+ if( strcmp(name, "viewRect") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildRect,
+ &(*self->ob_itself)->viewRect);
+ if( strcmp(name, "selRect") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildRect,
+ &(*self->ob_itself)->selRect);
+ if( strcmp(name, "lineHeight") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->lineHeight);
+ if( strcmp(name, "fontAscent") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->fontAscent);
+ if( strcmp(name, "selPoint") == 0 )
+ return Py_BuildValue("O&", PyMac_BuildPoint,
+ (*self->ob_itself)->selPoint);
+ if( strcmp(name, "selStart") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->selStart);
+ if( strcmp(name, "selEnd") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->selEnd);
+ if( strcmp(name, "active") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->active);
+ if( strcmp(name, "just") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->just);
+ if( strcmp(name, "teLength") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->teLength);
+ if( strcmp(name, "txFont") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->txFont);
+ if( strcmp(name, "txFace") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->txFace);
+ if( strcmp(name, "txMode") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->txMode);
+ if( strcmp(name, "txSize") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->txSize);
+ if( strcmp(name, "nLines") == 0 )
+ return Py_BuildValue("h", (*self->ob_itself)->nLines);
+
+ return Py_FindMethodInChain(&TEObj_chain, (PyObject *)self, name);
+}
+
+#define TEObj_setattr NULL
+
+#define TEObj_compare NULL
+
+#define TEObj_repr NULL
+
+#define TEObj_hash NULL
+
+PyTypeObject TE_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "TE", /*tp_name*/
+ sizeof(TEObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) TEObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) TEObj_getattr, /*tp_getattr*/
+ (setattrfunc) TEObj_setattr, /*tp_setattr*/
+ (cmpfunc) TEObj_compare, /*tp_compare*/
+ (reprfunc) TEObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) TEObj_hash, /*tp_hash*/
+};
+
+/* ----------------------- End object type TE ----------------------- */
+
+
+static PyObject *TE_TEScrapHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEScrapHandle();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TE_TEGetScrapLength(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetScrapLength();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *TE_TENew(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEHandle _rv;
+ Rect destRect;
+ Rect viewRect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &destRect,
+ PyMac_GetRect, &viewRect))
+ return NULL;
+ _rv = TENew(&destRect,
+ &viewRect);
+ _res = Py_BuildValue("O&",
+ TEObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TE_TETextBox(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ char *text__in__;
+ long text__len__;
+ int text__in_len__;
+ Rect box;
+ short just;
+ if (!PyArg_ParseTuple(_args, "s#O&h",
+ &text__in__, &text__in_len__,
+ PyMac_GetRect, &box,
+ &just))
+ return NULL;
+ text__len__ = text__in_len__;
+ TETextBox(text__in__, text__len__,
+ &box,
+ just);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ text__error__: ;
+ return _res;
+}
+
+static PyObject *TE_TEStyleNew(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEHandle _rv;
+ Rect destRect;
+ Rect viewRect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &destRect,
+ PyMac_GetRect, &viewRect))
+ return NULL;
+ _rv = TEStyleNew(&destRect,
+ &viewRect);
+ _res = Py_BuildValue("O&",
+ TEObj_New, _rv);
+ return _res;
+}
+
+static PyObject *TE_TESetScrapLength(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long length;
+ if (!PyArg_ParseTuple(_args, "l",
+ &length))
+ return NULL;
+ TESetScrapLength(length);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TE_TEFromScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TEFromScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *TE_TEToScrap(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = TEToScrap();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *TE_TEGetScrapHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TEGetScrapHandle();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *TE_TESetScrapHandle(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Handle value;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &value))
+ return NULL;
+ TESetScrapHandle(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *TE_as_TE(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ TEHandle _rv;
+ Handle h;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &h))
+ return NULL;
+ _rv = as_TE(h);
+ _res = Py_BuildValue("O&",
+ TEObj_New, _rv);
+ return _res;
+}
+
+static PyMethodDef TE_methods[] = {
+ {"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1,
+ "() -> (Handle _rv)"},
+ {"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1,
+ "() -> (long _rv)"},
+ {"TENew", (PyCFunction)TE_TENew, 1,
+ "(Rect destRect, Rect viewRect) -> (TEHandle _rv)"},
+ {"TETextBox", (PyCFunction)TE_TETextBox, 1,
+ "(Buffer text, Rect box, short just) -> None"},
+ {"TEStyleNew", (PyCFunction)TE_TEStyleNew, 1,
+ "(Rect destRect, Rect viewRect) -> (TEHandle _rv)"},
+ {"TESetScrapLength", (PyCFunction)TE_TESetScrapLength, 1,
+ "(long length) -> None"},
+ {"TEFromScrap", (PyCFunction)TE_TEFromScrap, 1,
+ "() -> None"},
+ {"TEToScrap", (PyCFunction)TE_TEToScrap, 1,
+ "() -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"TEGetScrapHandle", (PyCFunction)TE_TEGetScrapHandle, 1,
+ "() -> (Handle _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"TESetScrapHandle", (PyCFunction)TE_TESetScrapHandle, 1,
+ "(Handle value) -> None"},
+#endif
+ {"as_TE", (PyCFunction)TE_as_TE, 1,
+ "(Handle h) -> (TEHandle _rv)"},
+ {NULL, NULL, 0}
+};
+
+
+
+
+void init_TE(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert);
+
+
+ m = Py_InitModule("_TE", TE_methods);
+ d = PyModule_GetDict(m);
+ TE_Error = PyMac_GetOSErrException();
+ if (TE_Error == NULL ||
+ PyDict_SetItemString(d, "Error", TE_Error) != 0)
+ return;
+ TE_Type.ob_type = &PyType_Type;
+ Py_INCREF(&TE_Type);
+ if (PyDict_SetItemString(d, "TEType", (PyObject *)&TE_Type) != 0)
+ Py_FatalError("can't initialize TEType");
+}
+
+/* ========================= End module _TE ========================= */
+
diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c
new file mode 100644
index 0000000..8eecd1a
--- /dev/null
+++ b/Mac/Modules/win/_Winmodule.c
@@ -0,0 +1,2814 @@
+
+/* ========================== Module _Win =========================== */
+
+#include "Python.h"
+
+
+
+#include "macglue.h"
+#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)
+
+
+#ifdef WITHOUT_FRAMEWORKS
+#include <Windows.h>
+#else
+#include <Carbon/Carbon.h>
+#endif
+
+#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
+
+#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+/* Carbon calls that we emulate in classic mode */
+#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
+#define GetWindowFromPort(port) ((WindowRef)(port))
+#define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect)
+#define IsPointerValid(p) (((long)p&3) == 0)
+#endif
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+/* 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))
+#endif
+
+/* 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)
+
+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);
+ 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;
+}
+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;
+ PyMem_DEL(self);
+}
+
+static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ UInt32 outCount;
+ 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;
+ 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;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_ReshapeCustomWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ 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;
+}
+#endif
+
+static PyObject *WinObj_GetWindowClass(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowClass outClass;
+ 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;
+ 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;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_ChangeWindowAttributes(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowAttributes setTheseAttributes;
+ WindowAttributes clearTheseAttributes;
+ 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;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_SetWinColor(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WCTabHandle newColorTable;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &newColorTable))
+ return NULL;
+ SetWinColor(_self->ob_itself,
+ newColorTable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_SetWindowContentColor(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RGBColor color;
+ 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;
+ 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;
+ 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;
+ 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;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_ScrollWindowRect(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inScrollRect;
+ SInt16 inHPixels;
+ SInt16 inVPixels;
+ ScrollWindowOptions inOptions;
+ RgnHandle outExposedRgn;
+ 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;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_ScrollWindowRegion(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle inScrollRgn;
+ SInt16 inHPixels;
+ SInt16 inVPixels;
+ ScrollWindowOptions inOptions;
+ RgnHandle outExposedRgn;
+ 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;
+}
+#endif
+
+static PyObject *WinObj_ClipAbove(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ClipAbove(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_SaveOld(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SaveOld(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_DrawNew(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean update;
+ if (!PyArg_ParseTuple(_args, "b",
+ &update))
+ return NULL;
+ DrawNew(_self->ob_itself,
+ update);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_PaintOne(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle clobberedRgn;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SelectWindow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_GetNextWindowOfClass(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ WindowClass inWindowClass;
+ Boolean mustBeVisible;
+ 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;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_IsValidWindowPtr(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsValidWindowPtr(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_HiliteWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean fHilite;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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_BeginUpdate(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ 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;
+ 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;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ 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;
+ 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;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &region))
+ 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;
+ 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;
+ 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;
+ 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;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWTitle(_self->ob_itself,
+ title);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildStr255, title);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSSpec inFile;
+ 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;
+ 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 alias;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &alias))
+ return NULL;
+ _err = SetWindowProxyAlias(_self->ob_itself,
+ alias);
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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 effect;
+ WindowTransitionAction action;
+ Rect rect;
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &effect,
+ &action,
+ PyMac_GetRect, &rect))
+ return NULL;
+ _err = TransitionWindow(_self->ob_itself,
+ effect,
+ action,
+ &rect);
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ if (!PyArg_ParseTuple(_args, "H",
+ &regionCode))
+ 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 startPoint;
+ Rect sizeConstraints;
+ Rect newContentRect;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &startPoint,
+ PyMac_GetRect, &sizeConstraints))
+ return NULL;
+ _rv = ResizeWindow(_self->ob_itself,
+ startPoint,
+ &sizeConstraints,
+ &newContentRect);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildRect, &newContentRect);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowBounds(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowRegionCode regionCode;
+ Rect globalBounds;
+ if (!PyArg_ParseTuple(_args, "HO&",
+ &regionCode,
+ 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;
+ 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;
+ 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 idealSize;
+ Rect idealStandardState;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowInStandardState(_self->ob_itself,
+ &idealSize,
+ &idealStandardState);
+ _res = Py_BuildValue("bO&O&",
+ _rv,
+ PyMac_BuildPoint, idealSize,
+ PyMac_BuildRect, &idealStandardState);
+ return _res;
+}
+
+static PyObject *WinObj_ZoomWindowIdeal(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPartCode partCode;
+ Point ioIdealSize;
+ if (!PyArg_ParseTuple(_args, "h",
+ &partCode))
+ return NULL;
+ _err = ZoomWindowIdeal(_self->ob_itself,
+ partCode,
+ &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 userState;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetWindowIdealUserState(_self->ob_itself,
+ &userState);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &userState);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowIdealUserState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect userState;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = SetWindowIdealUserState(_self->ob_itself,
+ &userState);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &userState);
+ return _res;
+}
+
+static PyObject *WinObj_HideWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ 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;
+ 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;
+ if (!PyArg_ParseTuple(_args, "b",
+ &showFlag))
+ return NULL;
+ ShowHide(_self->ob_itself,
+ showFlag);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_GetWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributes;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetWindowPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ &attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ attributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_ChangeWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributesToSet;
+ UInt32 attributesToClear;
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag,
+ &attributesToSet,
+ &attributesToClear))
+ return NULL;
+ _err = ChangeWindowPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ attributesToSet,
+ attributesToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_TrackBox(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point thePt;
+ WindowPartCode partCode;
+ if (!PyArg_ParseTuple(_args, "O&h",
+ PyMac_GetPoint, &thePt,
+ &partCode))
+ return NULL;
+ _rv = TrackBox(_self->ob_itself,
+ thePt,
+ partCode);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_TrackGoAway(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Point thePt;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePt))
+ return NULL;
+ _rv = TrackGoAway(_self->ob_itself,
+ thePt);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_GetAuxWin(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ AuxWinHandle awHndl;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetAuxWin(_self->ob_itself,
+ &awHndl);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ ResObj_New, awHndl);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_GetWindowGoAwayFlag(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowGoAwayFlag(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_GetWindowSpareFlag(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowSpareFlag(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_GetWindowPort(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowKind(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowKind(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_MacIsWindowVisible(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MacIsWindowVisible(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowHilited(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowHilited(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_IsWindowUpdatePending(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowUpdatePending(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_MacGetNextWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MacGetNextWindow(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowStandardState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWindowStandardState(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowUserState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWindowUserState(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowKind(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short kind;
+ if (!PyArg_ParseTuple(_args, "h",
+ &kind))
+ return NULL;
+ SetWindowKind(_self->ob_itself,
+ kind);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowStandardState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rect))
+ return NULL;
+ SetWindowStandardState(_self->ob_itself,
+ &rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowUserState(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect rect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rect))
+ return NULL;
+ SetWindowUserState(_self->ob_itself,
+ &rect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetPortWindowPort(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SetPortWindowPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowPortBounds(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWindowPortBounds(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowVisible(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowVisible(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_GetWindowZoomFlag(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowZoomFlag(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_GetWindowStructureRgn(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowStructureRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowContentRgn(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowContentRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowUpdateRgn(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowUpdateRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_GetWindowTitleWidth(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowTitleWidth(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_GetNextWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetNextWindow(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *WinObj_CloseWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ CloseWindow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *WinObj_MoveWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short hGlobal;
+ short vGlobal;
+ Boolean front;
+ if (!PyArg_ParseTuple(_args, "hhb",
+ &hGlobal,
+ &vGlobal,
+ &front))
+ return NULL;
+ MoveWindow(_self->ob_itself,
+ hGlobal,
+ vGlobal,
+ front);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_ShowWindow(WindowObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ ShowWindow(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyMethodDef WinObj_methods[] = {
+ {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1,
+ "() -> (UInt32 outCount)"},
+ {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1,
+ "() -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1,
+ "() -> None"},
+#endif
+ {"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1,
+ "() -> (WindowClass outClass)"},
+ {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1,
+ "() -> (WindowAttributes outAttributes)"},
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1,
+ "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1,
+ "(WCTabHandle newColorTable) -> None"},
+#endif
+ {"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1,
+ "(RGBColor color) -> None"},
+ {"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1,
+ "() -> (RGBColor color)"},
+ {"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1,
+ "(PixPatHandle outPixPat) -> None"},
+ {"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1,
+ "(PixPatHandle pixPat) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1,
+ "(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1,
+ "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"},
+#endif
+ {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
+ "() -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SaveOld", (PyCFunction)WinObj_SaveOld, 1,
+ "() -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"DrawNew", (PyCFunction)WinObj_DrawNew, 1,
+ "(Boolean update) -> None"},
+#endif
+ {"PaintOne", (PyCFunction)WinObj_PaintOne, 1,
+ "(RgnHandle clobberedRgn) -> None"},
+ {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1,
+ "(RgnHandle clobberedRgn) -> None"},
+ {"CalcVis", (PyCFunction)WinObj_CalcVis, 1,
+ "() -> None"},
+ {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1,
+ "(RgnHandle clobberedRgn) -> None"},
+ {"BringToFront", (PyCFunction)WinObj_BringToFront, 1,
+ "() -> None"},
+ {"SendBehind", (PyCFunction)WinObj_SendBehind, 1,
+ "(WindowPtr behindWindow) -> None"},
+ {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1,
+ "() -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1,
+ "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"IsValidWindowPtr", (PyCFunction)WinObj_IsValidWindowPtr, 1,
+ "() -> (Boolean _rv)"},
+#endif
+ {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1,
+ "(Boolean fHilite) -> None"},
+ {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1,
+ "(long data) -> None"},
+ {"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1,
+ "() -> (long _rv)"},
+ {"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1,
+ "(PicHandle pic) -> None"},
+ {"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1,
+ "() -> (PicHandle _rv)"},
+ {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1,
+ "() -> (short _rv)"},
+ {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1,
+ "() -> (UInt32 outFeatures)"},
+ {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1,
+ "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"},
+ {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1,
+ "() -> None"},
+ {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1,
+ "() -> None"},
+ {"InvalWindowRgn", (PyCFunction)WinObj_InvalWindowRgn, 1,
+ "(RgnHandle region) -> None"},
+ {"InvalWindowRect", (PyCFunction)WinObj_InvalWindowRect, 1,
+ "(Rect bounds) -> None"},
+ {"ValidWindowRgn", (PyCFunction)WinObj_ValidWindowRgn, 1,
+ "(RgnHandle region) -> None"},
+ {"ValidWindowRect", (PyCFunction)WinObj_ValidWindowRect, 1,
+ "(Rect bounds) -> None"},
+ {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1,
+ "() -> None"},
+ {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1,
+ "(Str255 title) -> None"},
+ {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1,
+ "() -> (Str255 title)"},
+ {"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1,
+ "(FSSpec inFile) -> None"},
+ {"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1,
+ "() -> (FSSpec outFile)"},
+ {"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1,
+ "(AliasHandle alias) -> None"},
+ {"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1,
+ "() -> (AliasHandle alias)"},
+ {"SetWindowProxyCreatorAndType", (PyCFunction)WinObj_SetWindowProxyCreatorAndType, 1,
+ "(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None"},
+ {"GetWindowProxyIcon", (PyCFunction)WinObj_GetWindowProxyIcon, 1,
+ "() -> (IconRef outIcon)"},
+ {"SetWindowProxyIcon", (PyCFunction)WinObj_SetWindowProxyIcon, 1,
+ "(IconRef icon) -> None"},
+ {"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1,
+ "() -> None"},
+ {"BeginWindowProxyDrag", (PyCFunction)WinObj_BeginWindowProxyDrag, 1,
+ "(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)"},
+ {"EndWindowProxyDrag", (PyCFunction)WinObj_EndWindowProxyDrag, 1,
+ "(DragReference theDrag) -> None"},
+ {"TrackWindowProxyFromExistingDrag", (PyCFunction)WinObj_TrackWindowProxyFromExistingDrag, 1,
+ "(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None"},
+ {"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1,
+ "(Point startPt) -> None"},
+ {"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1,
+ "() -> (Boolean _rv)"},
+ {"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1,
+ "(Boolean modified) -> None"},
+ {"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1,
+ "(EventRecord event) -> (Boolean _rv)"},
+ {"WindowPathSelect", (PyCFunction)WinObj_WindowPathSelect, 1,
+ "(MenuHandle menu) -> (SInt32 outMenuResult)"},
+ {"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1,
+ "(Boolean hilited) -> None"},
+ {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1,
+ "(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"},
+ {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1,
+ "(short hGlobal, short vGlobal, Boolean front) -> None"},
+ {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1,
+ "(short w, short h, Boolean fUpdate) -> None"},
+ {"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1,
+ "(Point startPt, Rect bBox) -> (long _rv)"},
+ {"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
+ "(Point startPt, Rect boundsRect) -> None"},
+ {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1,
+ "(WindowPartCode partCode, Boolean front) -> None"},
+ {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1,
+ "() -> (Boolean _rv)"},
+ {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1,
+ "() -> (Boolean _rv)"},
+ {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1,
+ "(Boolean collapse) -> None"},
+ {"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1,
+ "(WindowRegionCode regionCode) -> (Rect globalBounds)"},
+ {"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1,
+ "(Point startPoint, Rect sizeConstraints) -> (Boolean _rv, Rect newContentRect)"},
+ {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1,
+ "(WindowRegionCode regionCode, Rect globalBounds) -> None"},
+ {"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1,
+ "(WindowPtr parentWindow, WindowPositionMethod method) -> None"},
+ {"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1,
+ "(short hGlobal, short vGlobal) -> None"},
+ {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1,
+ "() -> (Boolean _rv, Point idealSize, Rect idealStandardState)"},
+ {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1,
+ "(WindowPartCode partCode) -> (Point ioIdealSize)"},
+ {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1,
+ "() -> (Rect userState)"},
+ {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1,
+ "() -> (Rect userState)"},
+ {"HideWindow", (PyCFunction)WinObj_HideWindow, 1,
+ "() -> None"},
+ {"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1,
+ "() -> None"},
+ {"ShowHide", (PyCFunction)WinObj_ShowHide, 1,
+ "(Boolean showFlag) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1,
+ "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1,
+ "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
+#endif
+ {"TrackBox", (PyCFunction)WinObj_TrackBox, 1,
+ "(Point thePt, WindowPartCode partCode) -> (Boolean _rv)"},
+ {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1,
+ "(Point thePt) -> (Boolean _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1,
+ "() -> (Boolean _rv, AuxWinHandle awHndl)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1,
+ "() -> (Boolean _rv)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"GetWindowSpareFlag", (PyCFunction)WinObj_GetWindowSpareFlag, 1,
+ "() -> (Boolean _rv)"},
+#endif
+ {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1,
+ "() -> (CGrafPtr _rv)"},
+ {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1,
+ "() -> (short _rv)"},
+ {"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1,
+ "() -> (Boolean _rv)"},
+ {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1,
+ "() -> (Boolean _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1,
+ "() -> (Boolean _rv)"},
+#endif
+ {"MacGetNextWindow", (PyCFunction)WinObj_MacGetNextWindow, 1,
+ "() -> (WindowPtr _rv)"},
+ {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1,
+ "() -> (Rect rect)"},
+ {"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1,
+ "() -> (Rect rect)"},
+ {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1,
+ "(short kind) -> None"},
+ {"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1,
+ "(Rect rect) -> None"},
+ {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
+ "(Rect rect) -> None"},
+ {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1,
+ "() -> None"},
+ {"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1,
+ "() -> (Rect bounds)"},
+ {"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1,
+ "() -> (Boolean _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1,
+ "() -> (Boolean _rv)"},
+#endif
+ {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1,
+ "(RgnHandle r) -> None"},
+ {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1,
+ "(RgnHandle r) -> None"},
+ {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1,
+ "(RgnHandle r) -> None"},
+
+#if !TARGET_API_MAC_CARBON
+ {"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1,
+ "() -> (short _rv)"},
+#endif
+ {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
+ "() -> (WindowPtr _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1,
+ "() -> None"},
+#endif
+ {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,
+ "(short hGlobal, short vGlobal, Boolean front) -> None"},
+ {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1,
+ "() -> None"},
+ {NULL, NULL, 0}
+};
+
+PyMethodChain WinObj_chain = { WinObj_methods, NULL };
+
+static PyObject *WinObj_getattr(WindowObject *self, char *name)
+{
+ return Py_FindMethodInChain(&WinObj_chain, (PyObject *)self, name);
+}
+
+#define WinObj_setattr NULL
+
+static int WinObj_compare(WindowObject *self, WindowObject *other)
+{
+ if ( self->ob_itself > other->ob_itself ) return 1;
+ if ( self->ob_itself < other->ob_itself ) return -1;
+ return 0;
+}
+
+static PyObject * WinObj_repr(WindowObject *self)
+{
+ char buf[100];
+ sprintf(buf, "<Window object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself);
+ return PyString_FromString(buf);
+}
+
+static int WinObj_hash(WindowObject *self)
+{
+ return (int)self->ob_itself;
+}
+
+PyTypeObject Window_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "Window", /*tp_name*/
+ sizeof(WindowObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) WinObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) WinObj_getattr, /*tp_getattr*/
+ (setattrfunc) WinObj_setattr, /*tp_setattr*/
+ (cmpfunc) WinObj_compare, /*tp_compare*/
+ (reprfunc) WinObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) WinObj_hash, /*tp_hash*/
+};
+
+/* --------------------- End object type Window --------------------- */
+
+
+static PyObject *Win_GetNewCWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ short windowID;
+ WindowPtr behind;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &windowID,
+ WinObj_Convert, &behind))
+ return NULL;
+ _rv = GetNewCWindow(windowID,
+ (void *)0,
+ behind);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_NewWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ Rect boundsRect;
+ Str255 title;
+ Boolean visible;
+ short theProc;
+ WindowPtr behind;
+ Boolean goAwayFlag;
+ long refCon;
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&bl",
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, title,
+ &visible,
+ &theProc,
+ WinObj_Convert, &behind,
+ &goAwayFlag,
+ &refCon))
+ return NULL;
+ _rv = NewWindow((void *)0,
+ &boundsRect,
+ title,
+ visible,
+ theProc,
+ behind,
+ goAwayFlag,
+ refCon);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_GetNewWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ short windowID;
+ WindowPtr behind;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &windowID,
+ WinObj_Convert, &behind))
+ return NULL;
+ _rv = GetNewWindow(windowID,
+ (void *)0,
+ behind);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_NewCWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ Rect boundsRect;
+ Str255 title;
+ Boolean visible;
+ short procID;
+ WindowPtr behind;
+ Boolean goAwayFlag;
+ long refCon;
+ if (!PyArg_ParseTuple(_args, "O&O&bhO&bl",
+ PyMac_GetRect, &boundsRect,
+ PyMac_GetStr255, title,
+ &visible,
+ &procID,
+ WinObj_Convert, &behind,
+ &goAwayFlag,
+ &refCon))
+ return NULL;
+ _rv = NewCWindow((void *)0,
+ &boundsRect,
+ title,
+ visible,
+ procID,
+ behind,
+ goAwayFlag,
+ refCon);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_CreateNewWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowClass windowClass;
+ WindowAttributes attributes;
+ Rect contentBounds;
+ WindowPtr outWindow;
+ if (!PyArg_ParseTuple(_args, "llO&",
+ &windowClass,
+ &attributes,
+ PyMac_GetRect, &contentBounds))
+ return NULL;
+ _err = CreateNewWindow(windowClass,
+ attributes,
+ &contentBounds,
+ &outWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, outWindow);
+ return _res;
+}
+
+static PyObject *Win_CreateWindowFromResource(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ SInt16 resID;
+ WindowPtr outWindow;
+ if (!PyArg_ParseTuple(_args, "h",
+ &resID))
+ return NULL;
+ _err = CreateWindowFromResource(resID,
+ &outWindow);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, outWindow);
+ return _res;
+}
+
+static PyObject *Win_ShowFloatingWindows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = ShowFloatingWindows();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Win_HideFloatingWindows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = HideFloatingWindows();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Win_AreFloatingWindowsVisible(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = AreFloatingWindowsVisible();
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_SetDeskCPat(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ PixPatHandle deskPixPat;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &deskPixPat))
+ return NULL;
+ SetDeskCPat(deskPixPat);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Win_CheckUpdate(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CheckUpdate(&theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Win_MacFindWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPartCode _rv;
+ Point thePoint;
+ WindowPtr window;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePoint))
+ return NULL;
+ _rv = MacFindWindow(thePoint,
+ &window);
+ _res = Py_BuildValue("hO&",
+ _rv,
+ WinObj_WhichWindow, window);
+ return _res;
+}
+
+static PyObject *Win_FrontWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = FrontWindow();
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, _rv);
+ return _res;
+}
+
+static PyObject *Win_FrontNonFloatingWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = FrontNonFloatingWindow();
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, _rv);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Win_GetFrontWindowOfClass(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ WindowClass inWindowClass;
+ Boolean mustBeVisible;
+ if (!PyArg_ParseTuple(_args, "lb",
+ &inWindowClass,
+ &mustBeVisible))
+ return NULL;
+ _rv = GetFrontWindowOfClass(inWindowClass,
+ mustBeVisible);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Win_FindWindowOfClass(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point where;
+ WindowClass inWindowClass;
+ WindowPtr outWindow;
+ WindowPartCode outWindowPart;
+ if (!PyArg_ParseTuple(_args, "O&l",
+ PyMac_GetPoint, &where,
+ &inWindowClass))
+ return NULL;
+ _err = FindWindowOfClass(&where,
+ inWindowClass,
+ &outWindow,
+ &outWindowPart);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ WinObj_WhichWindow, outWindow,
+ outWindowPart);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_InitWindows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ InitWindows();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_GetWMgrPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ GrafPtr wPort;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWMgrPort(&wPort);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, wPort);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_GetCWMgrPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ CGrafPtr wMgrCPort;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetCWMgrPort(&wMgrCPort);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, wMgrCPort);
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_InitFloatingWindows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = InitFloatingWindows();
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_InvalRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect badRect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &badRect))
+ return NULL;
+ InvalRect(&badRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_InvalRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle badRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &badRgn))
+ return NULL;
+ InvalRgn(badRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_ValidRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect goodRect;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &goodRect))
+ return NULL;
+ ValidRect(&goodRect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if !TARGET_API_MAC_CARBON
+
+static PyObject *Win_ValidRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle goodRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &goodRgn))
+ return NULL;
+ ValidRgn(goodRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *Win_CollapseAllWindows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean collapse;
+ if (!PyArg_ParseTuple(_args, "b",
+ &collapse))
+ return NULL;
+ _err = CollapseAllWindows(collapse);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Win_PinRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ long _rv;
+ Rect theRect;
+ Point thePt;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &theRect,
+ PyMac_GetPoint, &thePt))
+ return NULL;
+ _rv = PinRect(&theRect,
+ thePt);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Win_GetGrayRgn(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGrayRgn();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_GetWindowFromPort(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetWindowFromPort(port);
+ _res = Py_BuildValue("O&",
+ WinObj_New, _rv);
+ return _res;
+}
+
+static PyObject *Win_WhichWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ long ptr;
+
+ if ( !PyArg_ParseTuple(_args, "i", &ptr) )
+ return NULL;
+ return WinObj_WhichWindow((WindowPtr)ptr);
+
+}
+
+static PyObject *Win_FindWindow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ Point thePoint;
+ WindowPtr theWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePoint))
+ return NULL;
+ _rv = FindWindow(thePoint,
+ &theWindow);
+ _res = Py_BuildValue("hO&",
+ _rv,
+ WinObj_WhichWindow, theWindow);
+ return _res;
+}
+
+static PyMethodDef Win_methods[] = {
+ {"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1,
+ "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
+ {"NewWindow", (PyCFunction)Win_NewWindow, 1,
+ "(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
+ {"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1,
+ "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
+ {"NewCWindow", (PyCFunction)Win_NewCWindow, 1,
+ "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
+ {"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1,
+ "(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)"},
+ {"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1,
+ "(SInt16 resID) -> (WindowPtr outWindow)"},
+ {"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1,
+ "() -> None"},
+ {"HideFloatingWindows", (PyCFunction)Win_HideFloatingWindows, 1,
+ "() -> None"},
+ {"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1,
+ "() -> (Boolean _rv)"},
+
+#if !TARGET_API_MAC_CARBON
+ {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1,
+ "(PixPatHandle deskPixPat) -> None"},
+#endif
+ {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1,
+ "() -> (Boolean _rv, EventRecord theEvent)"},
+ {"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1,
+ "(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)"},
+ {"FrontWindow", (PyCFunction)Win_FrontWindow, 1,
+ "() -> (WindowPtr _rv)"},
+ {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1,
+ "() -> (WindowPtr _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1,
+ "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1,
+ "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"InitWindows", (PyCFunction)Win_InitWindows, 1,
+ "() -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1,
+ "() -> (GrafPtr wPort)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1,
+ "() -> (CGrafPtr wMgrCPort)"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1,
+ "() -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"InvalRect", (PyCFunction)Win_InvalRect, 1,
+ "(Rect badRect) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"InvalRgn", (PyCFunction)Win_InvalRgn, 1,
+ "(RgnHandle badRgn) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"ValidRect", (PyCFunction)Win_ValidRect, 1,
+ "(Rect goodRect) -> None"},
+#endif
+
+#if !TARGET_API_MAC_CARBON
+ {"ValidRgn", (PyCFunction)Win_ValidRgn, 1,
+ "(RgnHandle goodRgn) -> None"},
+#endif
+ {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1,
+ "(Boolean collapse) -> None"},
+ {"PinRect", (PyCFunction)Win_PinRect, 1,
+ "(Rect theRect, Point thePt) -> (long _rv)"},
+ {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1,
+ "() -> (RgnHandle _rv)"},
+ {"GetWindowFromPort", (PyCFunction)Win_GetWindowFromPort, 1,
+ "(CGrafPtr port) -> (WindowPtr _rv)"},
+ {"WhichWindow", (PyCFunction)Win_WhichWindow, 1,
+ "Resolve an integer WindowPtr address to a Window object"},
+ {"FindWindow", (PyCFunction)Win_FindWindow, 1,
+ "(Point thePoint) -> (short _rv, WindowPtr theWindow)"},
+ {NULL, NULL, 0}
+};
+
+
+
+/* Return the object corresponding to the window, or NULL */
+
+PyObject *
+WinObj_WhichWindow(WindowPtr w)
+{
+ PyObject *it;
+
+ if (w == NULL) {
+ it = Py_None;
+ Py_INCREF(it);
+ } else {
+ it = (PyObject *) GetWRefCon(w);
+ if (it == NULL || !IsPointerValid((Ptr)it) || ((WindowObject *)it)->ob_itself != w || !WinObj_Check(it)) {
+ it = WinObj_New(w);
+ ((WindowObject *)it)->ob_freeit = NULL;
+ } else {
+ Py_INCREF(it);
+ }
+ }
+ return it;
+}
+
+
+void init_Win(void)
+{
+ PyObject *m;
+ PyObject *d;
+
+
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
+
+
+ m = Py_InitModule("_Win", Win_methods);
+ d = PyModule_GetDict(m);
+ Win_Error = PyMac_GetOSErrException();
+ if (Win_Error == NULL ||
+ PyDict_SetItemString(d, "Error", Win_Error) != 0)
+ return;
+ Window_Type.ob_type = &PyType_Type;
+ Py_INCREF(&Window_Type);
+ if (PyDict_SetItemString(d, "WindowType", (PyObject *)&Window_Type) != 0)
+ Py_FatalError("can't initialize WindowType");
+}
+
+/* ======================== End module _Win ========================= */
+