]> granicus.if.org Git - python/commitdiff
Regenerated from Universal Headers 3.0.1. Some new calls are
authorJack Jansen <jack.jansen@cwi.nl>
Fri, 20 Feb 1998 16:02:09 +0000 (16:02 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Fri, 20 Feb 1998 16:02:09 +0000 (16:02 +0000)
blacklisted, because they are not available in classic 68k programs,
and bgen doesn't have a way to put #ifdef/#endif in the generated
code. For now we only implement calls that work on all three models.

28 files changed:
Mac/Modules/ae/AEmodule.c
Mac/Modules/ae/aescan.py
Mac/Modules/ae/aesupport.py
Mac/Modules/cm/cmscan.py
Mac/Modules/ctl/Ctlmodule.c
Mac/Modules/ctl/ctlscan.py
Mac/Modules/ctl/ctlsupport.py
Mac/Modules/dlg/Dlgmodule.c
Mac/Modules/dlg/dlgscan.py
Mac/Modules/dlg/dlgsupport.py
Mac/Modules/evt/Evtmodule.c
Mac/Modules/fm/fmscan.py
Mac/Modules/help/Helpmodule.c
Mac/Modules/help/helpscan.py
Mac/Modules/list/Listmodule.c
Mac/Modules/list/listscan.py
Mac/Modules/list/listsupport.py
Mac/Modules/menu/Menumodule.c
Mac/Modules/qd/Qdmodule.c
Mac/Modules/qd/qdscan.py
Mac/Modules/qt/qtscan.py
Mac/Modules/res/Resmodule.c
Mac/Modules/snd/Sndmodule.c
Mac/Modules/snd/sndscan.py
Mac/Modules/te/TEmodule.c
Mac/Modules/win/Winmodule.c
Mac/Modules/win/winscan.py
Mac/Modules/win/winsupport.py

index ed20b40aa2d99d016ff9264300c2d4ed7ab96ced..31274307166d83c3570a6b90d15c68487f7b87e4 100644 (file)
@@ -125,6 +125,117 @@ static void AEDesc_dealloc(self)
        PyMem_DEL(self);
 }
 
+static PyObject *AEDesc_AESend(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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_AECoerceDesc(_self, _args)
        AEDescObject *_self;
        PyObject *_args;
@@ -617,118 +728,19 @@ static PyObject *AEDesc_AEPutAttributeDesc(_self, _args)
        return _res;
 }
 
-static PyObject *AEDesc_AESend(_self, _args)
-       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(_self, _args)
-       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(_self, _args)
-       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(_self, _args)
-       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(_self, _args)
-       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(_self, _args)
-       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 PyMethodDef AEDesc_methods[] = {
+       {"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"},
        {"AECoerceDesc", (PyCFunction)AEDesc_AECoerceDesc, 1,
         "(DescType toType) -> (AEDesc result)"},
        {"AEDuplicateDesc", (PyCFunction)AEDesc_AEDuplicateDesc, 1,
@@ -769,18 +781,6 @@ static PyMethodDef AEDesc_methods[] = {
         "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"},
        {"AEPutAttributeDesc", (PyCFunction)AEDesc_AEPutAttributeDesc, 1,
         "(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"},
-       {"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"},
        {NULL, NULL, 0}
 };
 
@@ -829,118 +829,6 @@ PyTypeObject AEDesc_Type = {
 /* --------------------- End object type AEDesc --------------------- */
 
 
-static PyObject *AE_AECreateDesc(_self, _args)
-       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_AECoercePtr(_self, _args)
-       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_AECreateList(_self, _args)
-       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(_self, _args)
-       PyObject *_self;
-       PyObject *_args;
-{
-       PyObject *_res = NULL;
-       OSErr _err;
-       AEEventClass theAEEventClass;
-       AEEventID theAEEventID;
-       AEAddressDesc target;
-       short returnID;
-       long 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;
-}
-
 static PyObject *AE_AEProcessAppleEvent(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -1102,15 +990,119 @@ static PyObject *AE_AEManagerInfo(_self, _args)
        return _res;
 }
 
+static PyObject *AE_AECoercePtr(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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&hh",
+                             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;
+}
+
 static PyMethodDef AE_methods[] = {
-       {"AECreateDesc", (PyCFunction)AE_AECreateDesc, 1,
-        "(DescType typeCode, Buffer dataPtr) -> (AEDesc result)"},
-       {"AECoercePtr", (PyCFunction)AE_AECoercePtr, 1,
-        "(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)"},
-       {"AECreateList", (PyCFunction)AE_AECreateList, 1,
-        "(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"},
-       {"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1,
-        "(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, short returnID, long transactionID) -> (AppleEvent result)"},
        {"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1,
         "(EventRecord theEventRecord) -> None"},
        {"AEGetInteractionAllowed", (PyCFunction)AE_AEGetInteractionAllowed, 1,
@@ -1127,6 +1119,14 @@ static PyMethodDef AE_methods[] = {
         "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"},
        {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1,
         "(AEKeyword keyWord) -> (long result)"},
+       {"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)"},
        {NULL, NULL, 0}
 };
 
index 4317195665f545fa4cfdd9a07268cad23891f9d4..620a91c8a749cf10a37739b71063b4ba16f9124f 100644 (file)
@@ -19,7 +19,7 @@ def main():
        input = "AERegistry.h"
        output = "@dummy-registry.py"
        defsoutput = TOOLBOXDIR + "AERegistry.py"
-       scanner = AppleEventsScanner(input, output, defsoutput)
+       scanner = AppleEventsRegScanner(input, output, defsoutput)
        scanner.scan()
        scanner.close()
        print "=== Scanning AEObjects.h for defines ==="
@@ -32,11 +32,19 @@ def main():
        scanner = AppleEventsScanner(input, output, defsoutput)
        scanner.scan()
        scanner.close()
-       print "=== Scanning AppleEvents.py ==="
+       print "=== Scanning AEDataModel.h ==="
+       input = "AEDataModel.h"
+       output = "aedatamodelgen.py"
+       defsoutput = TOOLBOXDIR + "AEDataModel.py"
+       scanner = AppleEventsScanner(input, output, defsoutput)
+       
+       scanner.scan()
+       scanner.close()
+       print "=== Scanning AppleEvents.h ==="
        input = "AppleEvents.h"
        output = "aegen.py"
        defsoutput = TOOLBOXDIR + "AppleEvents.py"
-       scanner = AppleEventsScanner(input, output, defsoutput)
+       scanner = AppleEventsRegScanner(input, output, defsoutput)
        scanner.scan()
        scanner.close()
        print "=== Done Scanning and Generating, now doing 'import aesupport' ==="
@@ -102,5 +110,13 @@ class AppleEventsScanner(Scanner):
                         [("AEDescList_ptr", "*", "InMode")]),
                        ]
 
+       def writeinitialdefs(self):
+               self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
+class AppleEventsRegScanner(AppleEventsScanner):
+       def writeinitialdefs(self):
+               self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+               self.defsfile.write("from AEDataModel import *\n")
+
 if __name__ == "__main__":
        main()
index ee6ee7a0aa52ad2c1d92bdf15dcdfe88957724fa..f2c947fcb836fd08354aebeb7e585f36243fc426 100644 (file)
@@ -13,6 +13,9 @@ AEArrayType = Type("AEArrayType", "c")
 AESendMode = Type("AESendMode", "l")
 AESendPriority = Type("AESendPriority", "h")
 AEInteractAllowed = Type("AEInteractAllowed", "b")
+AEReturnID = Type("AEReturnID", "h")
+AETransactionID = Type("AETransactionID", "h")
+
 
 
 AEEventClass = OSTypeType('AEEventClass')
@@ -199,6 +202,7 @@ functions = []
 aedescmethods = []
 
 execfile('aegen.py')
+execfile('aedatamodelgen.py')
 
 for f in functions: module.add(f)
 for f in aedescmethods: aedescobject.add(f)
index ea2dc2fc2ff9289d3c88e96ab0b19a2613cd155d..3e091a6dd86b08758eb077fa3d78f06b5d387449 100644 (file)
@@ -6,7 +6,7 @@ from scantools import Scanner
 from bgenlocations import TOOLBOXDIR
 
 LONG = "Components"
-SHORT = "Cm"
+SHORT = "cm"
 
 def main():
        input = "Components.h"
@@ -38,6 +38,9 @@ class MyScanner(Scanner):
                                listname = "ci_methods"
                return classname, listname
 
+       def writeinitialdefs(self):
+               self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
        def makeblacklistnames(self):
                return [
                        "OpenADefaultComponent",
index 573f581fb90eb9b27249fd7318e346b535fabfa9..e043b61d73d85e7b143a5358a4366cb04c274ba6 100644 (file)
@@ -47,11 +47,37 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
 #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
 
 extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */
+extern PyObject *QdRGB_New(RGBColorPtr);
+extern QdRGB_Convert(PyObject *, RGBColorPtr);
 
 #ifdef THINK_C
 #define  ControlActionUPP ProcPtr
 #endif
 
+/*
+** Parse/generate ControlFontStyleRec records
+*/
+#if 0 /* Not needed */
+PyObject *ControlFontStyle_New(itself)
+       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
+
+ControlFontStyle_Convert(v, itself)
+       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);
+}
+
 static PyObject *Ctl_Error;
 
 /* ---------------------- Object type Control ----------------------- */
@@ -96,6 +122,22 @@ static void CtlObj_dealloc(self)
        PyMem_DEL(self);
 }
 
+static PyObject *CtlObj_HiliteControl(_self, _args)
+       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(_self, _args)
        ControlObject *_self;
        PyObject *_args;
@@ -122,6 +164,85 @@ static PyObject *CtlObj_HideControl(_self, _args)
        return _res;
 }
 
+static PyObject *CtlObj_IsControlActive(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
        ControlObject *_self;
        PyObject *_args;
@@ -135,17 +256,73 @@ static PyObject *CtlObj_Draw1Control(_self, _args)
        return _res;
 }
 
-static PyObject *CtlObj_HiliteControl(_self, _args)
+static PyObject *CtlObj_GetBestControlRect(_self, _args)
        ControlObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       ControlPartCode hiliteState;
-       if (!PyArg_ParseTuple(_args, "h",
-                             &hiliteState))
+       OSErr _err;
+       Rect outRect;
+       SInt16 outBaseLineOffset;
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       HiliteControl(_self->ob_itself,
-                     hiliteState);
+       _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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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;
@@ -157,12 +334,12 @@ static PyObject *CtlObj_TrackControl(_self, _args)
 {
        PyObject *_res = NULL;
        ControlPartCode _rv;
-       Point thePoint;
+       Point startPoint;
        if (!PyArg_ParseTuple(_args, "O&",
-                             PyMac_GetPoint, &thePoint))
+                             PyMac_GetPoint, &startPoint))
                return NULL;
        _rv = TrackControl(_self->ob_itself,
-                          thePoint,
+                          startPoint,
                           (ControlActionUPP)0);
        _res = Py_BuildValue("h",
                             _rv);
@@ -200,12 +377,35 @@ static PyObject *CtlObj_TestControl(_self, _args)
 {
        PyObject *_res = NULL;
        ControlPartCode _rv;
-       Point thePoint;
+       Point testPoint;
        if (!PyArg_ParseTuple(_args, "O&",
-                             PyMac_GetPoint, &thePoint))
+                             PyMac_GetPoint, &testPoint))
                return NULL;
        _rv = TestControl(_self->ob_itself,
-                         thePoint);
+                         testPoint);
+       _res = Py_BuildValue("h",
+                            _rv);
+       return _res;
+}
+
+static PyObject *CtlObj_HandleControlKey(_self, _args)
+       ControlObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       SInt16 _rv;
+       SInt16 inKeyCode;
+       SInt16 inCharCode;
+       SInt16 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;
@@ -376,7 +576,7 @@ static PyObject *CtlObj_GetControlVariant(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       SInt16 _rv;
+       ControlVariant _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
        _rv = GetControlVariant(_self->ob_itself);
@@ -462,6 +662,174 @@ static PyObject *CtlObj_SetControlColor(_self, _args)
        return _res;
 }
 
+static PyObject *CtlObj_SendControlMessage(_self, _args)
+       ControlObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       SInt32 _rv;
+       SInt16 inMessage;
+       SInt32 inParam;
+       if (!PyArg_ParseTuple(_args, "hl",
+                             &inMessage,
+                             &inParam))
+               return NULL;
+       _rv = SendControlMessage(_self->ob_itself,
+                                inMessage,
+                                inParam);
+       _res = Py_BuildValue("l",
+                            _rv);
+       return _res;
+}
+
+static PyObject *CtlObj_EmbedControl(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       ControlObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       OSErr _err;
+       SInt16 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(_self, _args)
+       ControlObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       OSErr _err;
+       SInt16 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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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;
+}
+
 static PyObject *CtlObj_as_Resource(_self, _args)
        ControlObject *_self;
        PyObject *_args;
@@ -492,20 +860,40 @@ static PyObject *CtlObj_DisposeControl(_self, _args)
 }
 
 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"},
-       {"HiliteControl", (PyCFunction)CtlObj_HiliteControl, 1,
-        "(ControlPartCode hiliteState) -> 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"},
        {"TrackControl", (PyCFunction)CtlObj_TrackControl, 1,
-        "(Point thePoint) -> (ControlPartCode _rv)"},
+        "(Point startPoint) -> (ControlPartCode _rv)"},
        {"DragControl", (PyCFunction)CtlObj_DragControl, 1,
         "(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None"},
        {"TestControl", (PyCFunction)CtlObj_TestControl, 1,
-        "(Point thePoint) -> (ControlPartCode _rv)"},
+        "(Point testPoint) -> (ControlPartCode _rv)"},
+       {"HandleControlKey", (PyCFunction)CtlObj_HandleControlKey, 1,
+        "(SInt16 inKeyCode, SInt16 inCharCode, SInt16 inModifiers) -> (SInt16 _rv)"},
        {"MoveControl", (PyCFunction)CtlObj_MoveControl, 1,
         "(SInt16 h, SInt16 v) -> None"},
        {"SizeControl", (PyCFunction)CtlObj_SizeControl, 1,
@@ -527,7 +915,7 @@ static PyMethodDef CtlObj_methods[] = {
        {"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1,
         "(SInt16 newMaximum) -> None"},
        {"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1,
-        "() -> (SInt16 _rv)"},
+        "() -> (ControlVariant _rv)"},
        {"SetControlAction", (PyCFunction)CtlObj_SetControlAction, 1,
         "() -> None"},
        {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1,
@@ -538,6 +926,24 @@ static PyMethodDef CtlObj_methods[] = {
         "() -> (Boolean _rv, AuxCtlHandle acHndl)"},
        {"SetControlColor", (PyCFunction)CtlObj_SetControlColor, 1,
         "(CCTabHandle newColorTable) -> None"},
+       {"SendControlMessage", (PyCFunction)CtlObj_SendControlMessage, 1,
+        "(SInt16 inMessage, SInt32 inParam) -> (SInt32 _rv)"},
+       {"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,
+        "() -> (SInt16 outNumChildren)"},
+       {"GetIndexedSubControl", (PyCFunction)CtlObj_GetIndexedSubControl, 1,
+        "(SInt16 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)"},
        {"as_Resource", (PyCFunction)CtlObj_as_Resource, 1,
         "Return this Control as a Resource"},
        {"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1,
@@ -578,35 +984,35 @@ static PyObject *Ctl_NewControl(_self, _args)
 {
        PyObject *_res = NULL;
        ControlHandle _rv;
-       WindowPtr theWindow;
+       WindowPtr owningWindow;
        Rect boundsRect;
-       Str255 title;
-       Boolean visible;
-       SInt16 value;
-       SInt16 min;
-       SInt16 max;
+       Str255 controlTitle;
+       Boolean initiallyVisible;
+       SInt16 initialValue;
+       SInt16 minimumValue;
+       SInt16 maximumValue;
        SInt16 procID;
-       SInt32 refCon;
+       SInt32 controlReference;
        if (!PyArg_ParseTuple(_args, "O&O&O&bhhhhl",
-                             WinObj_Convert, &theWindow,
+                             WinObj_Convert, &owningWindow,
                              PyMac_GetRect, &boundsRect,
-                             PyMac_GetStr255, title,
-                             &visible,
-                             &value,
-                             &min,
-                             &max,
+                             PyMac_GetStr255, controlTitle,
+                             &initiallyVisible,
+                             &initialValue,
+                             &minimumValue,
+                             &maximumValue,
                              &procID,
-                             &refCon))
+                             &controlReference))
                return NULL;
-       _rv = NewControl(theWindow,
+       _rv = NewControl(owningWindow,
                         &boundsRect,
-                        title,
-                        visible,
-                        value,
-                        min,
-                        max,
+                        controlTitle,
+                        initiallyVisible,
+                        initialValue,
+                        minimumValue,
+                        maximumValue,
                         procID,
-                        refCon);
+                        controlReference);
        _res = Py_BuildValue("O&",
                             CtlObj_New, _rv);
        return _res;
@@ -618,14 +1024,14 @@ static PyObject *Ctl_GetNewControl(_self, _args)
 {
        PyObject *_res = NULL;
        ControlHandle _rv;
-       SInt16 controlID;
-       WindowPtr owner;
+       SInt16 resourceID;
+       WindowPtr owningWindow;
        if (!PyArg_ParseTuple(_args, "hO&",
-                             &controlID,
-                             WinObj_Convert, &owner))
+                             &resourceID,
+                             WinObj_Convert, &owningWindow))
                return NULL;
-       _rv = GetNewControl(controlID,
-                           owner);
+       _rv = GetNewControl(resourceID,
+                           owningWindow);
        _res = Py_BuildValue("O&",
                             CtlObj_New, _rv);
        return _res;
@@ -670,14 +1076,14 @@ static PyObject *Ctl_FindControl(_self, _args)
 {
        PyObject *_res = NULL;
        ControlPartCode _rv;
-       Point thePoint;
+       Point testPoint;
        WindowPtr theWindow;
        ControlHandle theControl;
        if (!PyArg_ParseTuple(_args, "O&O&",
-                             PyMac_GetPoint, &thePoint,
+                             PyMac_GetPoint, &testPoint,
                              WinObj_Convert, &theWindow))
                return NULL;
-       _rv = FindControl(thePoint,
+       _rv = FindControl(testPoint,
                          theWindow,
                          &theControl);
        _res = Py_BuildValue("hO&",
@@ -686,17 +1092,225 @@ static PyObject *Ctl_FindControl(_self, _args)
        return _res;
 }
 
+static PyObject *Ctl_FindControlUnderMouse(_self, _args)
+       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(_self, _args)
+       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;
+}
+
+static PyObject *Ctl_DumpControlHierarchy(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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;
+}
+
 static PyMethodDef Ctl_methods[] = {
        {"NewControl", (PyCFunction)Ctl_NewControl, 1,
-        "(WindowPtr theWindow, Rect boundsRect, Str255 title, Boolean visible, SInt16 value, SInt16 min, SInt16 max, SInt16 procID, SInt32 refCon) -> (ControlHandle _rv)"},
+        "(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 controlID, WindowPtr owner) -> (ControlHandle _rv)"},
+        "(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 thePoint, WindowPtr theWindow) -> (ControlPartCode _rv, ControlHandle theControl)"},
+        "(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"},
+       {"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"},
        {NULL, NULL, 0}
 };
 
index 1f870c929c80132144abdc9a04541a8b157b66d1..311295bdec389169faefbf5ee8ac8eac9fcb95b5 100644 (file)
@@ -28,17 +28,39 @@ class MyScanner(Scanner):
                                listname = "methods"
                return classname, listname
 
+       def writeinitialdefs(self):
+               self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+               self.defsfile.write("from TextEdit import *\n")
+               self.defsfile.write("from QuickDraw import *\n")
+               self.defsfile.write("\n")
+
        def makeblacklistnames(self):
                return [
                        'DisposeControl', # Generated manually
                        'KillControls', # Implied by close of dialog
                        'SetCtlAction',
+                       'kControlBevelButtonCenterPopupGlyphTag', # Constant with funny definition
+                       'kControlProgressBarIndeterminateTag', # ditto
+                       # The following are unavailable for static 68k (appearance manager)
+                       'GetBevelButtonMenuValue',
+                       'SetBevelButtonMenuValue',
+                       'GetBevelButtonMenuHandle',
+                       'SetBevelButtonTransform',
+                       'SetBevelButtonGraphicAlignment',
+                       'SetBevelButtonTextAlignment',
+                       'SetBevelButtonTextPlacement',
+                       'SetImageWellTransform',
+                       'GetTabContentRect',
+                       'SetTabEnabled',
+                       'SetDisclosureTriangleLastValue',
                        ]
 
        def makeblacklisttypes(self):
                return [
                        'ProcPtr',
                        'ControlActionUPP',
+                       'ControlButtonContentInfoPtr',
+                       'Ptr',
                        ]
 
        def makerepairinstructions(self):
index 50efd9466128d386da82c261cd2227b5f848b41f..a905970b8fe347b42a24f8344d494b12a3b91ad9 100644 (file)
@@ -33,6 +33,16 @@ CCTabHandle = OpaqueByValueType("CCTabHandle", "ResObj")
 AuxCtlHandle = OpaqueByValueType("AuxCtlHandle", "ResObj")
 ControlPartCode = Type("ControlPartCode", "h")
 DragConstraint = Type("DragConstraint", "h")
+ControlVariant = Type("ControlVariant", "h")
+IconTransformType = Type("IconTransformType", "h")
+ControlButtonGraphicAlignment = Type("ControlButtonGraphicAlignment", "h")
+ControlButtonTextAlignment = Type("ControlButtonTextAlignment", "h")
+ControlButtonTextPlacement = Type("ControlButtonTextPlacement", "h")
+ControlContentType = Type("ControlContentType", "h")
+ControlFocusPart = Type("ControlFocusPart", "h")
+
+ControlFontStyleRec = OpaqueType('ControlFontStyleRec', 'ControlFontStyle')
+ControlFontStyleRec_ptr = ControlFontStyleRec
 
 includestuff = includestuff + """
 #include <%s>""" % MACHEADERFILE + """
@@ -40,10 +50,36 @@ includestuff = includestuff + """
 #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
 
 extern PyObject *CtlObj_WhichControl(ControlHandle); /* Forward */
+extern PyObject *QdRGB_New(RGBColorPtr);
+extern QdRGB_Convert(PyObject *, RGBColorPtr);
 
 #ifdef THINK_C
 #define  ControlActionUPP ProcPtr
 #endif
+
+/*
+** Parse/generate ControlFontStyleRec records
+*/
+#if 0 /* Not needed */
+PyObject *ControlFontStyle_New(itself)
+       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
+
+ControlFontStyle_Convert(v, itself)
+       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);
+}
 """
 
 finalstuff = finalstuff + """
index 7ca2a59947748b18a149f4c1597c4c02da44282a..75f8b285957a7caef5c391f4787804143b6ed909 100644 (file)
@@ -184,61 +184,12 @@ static PyObject *DlgObj_UpdateDialog(_self, _args)
        return _res;
 }
 
-static PyObject *DlgObj_GetDialogItem(_self, _args)
-       DialogObject *_self;
-       PyObject *_args;
-{
-       PyObject *_res = NULL;
-       short itemNo;
-       short 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(_self, _args)
-       DialogObject *_self;
-       PyObject *_args;
-{
-       PyObject *_res = NULL;
-       short itemNo;
-       short 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_HideDialogItem(_self, _args)
        DialogObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short itemNo;
+       DialogItemIndex itemNo;
        if (!PyArg_ParseTuple(_args, "h",
                              &itemNo))
                return NULL;
@@ -254,7 +205,7 @@ static PyObject *DlgObj_ShowDialogItem(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short itemNo;
+       DialogItemIndex itemNo;
        if (!PyArg_ParseTuple(_args, "h",
                              &itemNo))
                return NULL;
@@ -265,34 +216,12 @@ static PyObject *DlgObj_ShowDialogItem(_self, _args)
        return _res;
 }
 
-static PyObject *DlgObj_SelectDialogItemText(_self, _args)
-       DialogObject *_self;
-       PyObject *_args;
-{
-       PyObject *_res = NULL;
-       short itemNo;
-       short strtSel;
-       short 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_FindDialogItem(_self, _args)
        DialogObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
+       DialogItemIndexZeroBased _rv;
        Point thePt;
        if (!PyArg_ParseTuple(_args, "O&",
                              PyMac_GetPoint, &thePt))
@@ -356,6 +285,77 @@ static PyObject *DlgObj_DialogDelete(_self, _args)
        return _res;
 }
 
+static PyObject *DlgObj_GetDialogItem(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
        DialogObject *_self;
        PyObject *_args;
@@ -380,7 +380,7 @@ static PyObject *DlgObj_CountDITL(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
+       DialogItemIndex _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
        _rv = CountDITL(_self->ob_itself);
@@ -394,7 +394,7 @@ static PyObject *DlgObj_ShortenDITL(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short numberItems;
+       DialogItemIndex numberItems;
        if (!PyArg_ParseTuple(_args, "h",
                              &numberItems))
                return NULL;
@@ -412,7 +412,7 @@ static PyObject *DlgObj_StdFilterProc(_self, _args)
        PyObject *_res = NULL;
        Boolean _rv;
        EventRecord event;
-       short itemHit;
+       DialogItemIndex itemHit;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
        _rv = StdFilterProc(_self->ob_itself,
@@ -431,7 +431,7 @@ static PyObject *DlgObj_SetDialogDefaultItem(_self, _args)
 {
        PyObject *_res = NULL;
        OSErr _err;
-       short newItem;
+       DialogItemIndex newItem;
        if (!PyArg_ParseTuple(_args, "h",
                              &newItem))
                return NULL;
@@ -449,7 +449,7 @@ static PyObject *DlgObj_SetDialogCancelItem(_self, _args)
 {
        PyObject *_res = NULL;
        OSErr _err;
-       short newItem;
+       DialogItemIndex newItem;
        if (!PyArg_ParseTuple(_args, "h",
                              &newItem))
                return NULL;
@@ -479,6 +479,89 @@ static PyObject *DlgObj_SetDialogTracksCursor(_self, _args)
        return _res;
 }
 
+static PyObject *DlgObj_AutoSizeDialog(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       DialogObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       OSErr _err;
+       SInt16 inItemNo;
+       SInt16 inHeight;
+       SInt16 inWidth;
+       if (!PyArg_ParseTuple(_args, "hhh",
+                             &inItemNo,
+                             &inHeight,
+                             &inWidth))
+               return NULL;
+       _err = SizeDialogItem(_self->ob_itself,
+                             inItemNo,
+                             inHeight,
+                             inWidth);
+       if (_err != noErr) return PyMac_Error(_err);
+       Py_INCREF(Py_None);
+       _res = Py_None;
+       return _res;
+}
+
 static PyObject *DlgObj_GetDialogWindow(_self, _args)
        DialogObject *_self;
        PyObject *_args;
@@ -553,18 +636,12 @@ static PyMethodDef DlgObj_methods[] = {
         "() -> None"},
        {"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1,
         "(RgnHandle updateRgn) -> None"},
-       {"GetDialogItem", (PyCFunction)DlgObj_GetDialogItem, 1,
-        "(short itemNo) -> (short itemType, Handle item, Rect box)"},
-       {"SetDialogItem", (PyCFunction)DlgObj_SetDialogItem, 1,
-        "(short itemNo, short itemType, Handle item, Rect box) -> None"},
        {"HideDialogItem", (PyCFunction)DlgObj_HideDialogItem, 1,
-        "(short itemNo) -> None"},
+        "(DialogItemIndex itemNo) -> None"},
        {"ShowDialogItem", (PyCFunction)DlgObj_ShowDialogItem, 1,
-        "(short itemNo) -> None"},
-       {"SelectDialogItemText", (PyCFunction)DlgObj_SelectDialogItemText, 1,
-        "(short itemNo, short strtSel, short endSel) -> None"},
+        "(DialogItemIndex itemNo) -> None"},
        {"FindDialogItem", (PyCFunction)DlgObj_FindDialogItem, 1,
-        "(Point thePt) -> (short _rv)"},
+        "(Point thePt) -> (DialogItemIndexZeroBased _rv)"},
        {"DialogCut", (PyCFunction)DlgObj_DialogCut, 1,
         "() -> None"},
        {"DialogPaste", (PyCFunction)DlgObj_DialogPaste, 1,
@@ -573,20 +650,34 @@ static PyMethodDef DlgObj_methods[] = {
         "() -> 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,
-        "() -> (short _rv)"},
+        "() -> (DialogItemIndex _rv)"},
        {"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1,
-        "(short numberItems) -> None"},
+        "(DialogItemIndex numberItems) -> None"},
        {"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1,
-        "() -> (Boolean _rv, EventRecord event, short itemHit)"},
+        "() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"},
        {"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1,
-        "(short newItem) -> None"},
+        "(DialogItemIndex newItem) -> None"},
        {"SetDialogCancelItem", (PyCFunction)DlgObj_SetDialogCancelItem, 1,
-        "(short newItem) -> None"},
+        "(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 inHeight, SInt16 inWidth) -> None"},
        {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1,
         "() -> (DialogPtr _rv)"},
        {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1,
@@ -636,11 +727,11 @@ static PyObject *Dlg_NewDialog(_self, _args)
        Rect boundsRect;
        Str255 title;
        Boolean visible;
-       short procID;
+       SInt16 procID;
        WindowPtr behind;
        Boolean goAwayFlag;
-       long refCon;
-       Handle itmLstHndl;
+       SInt32 refCon;
+       Handle items;
        if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&",
                              PyMac_GetRect, &boundsRect,
                              PyMac_GetStr255, title,
@@ -649,7 +740,7 @@ static PyObject *Dlg_NewDialog(_self, _args)
                              WinObj_Convert, &behind,
                              &goAwayFlag,
                              &refCon,
-                             ResObj_Convert, &itmLstHndl))
+                             ResObj_Convert, &items))
                return NULL;
        _rv = NewDialog((void *)0,
                        &boundsRect,
@@ -659,7 +750,7 @@ static PyObject *Dlg_NewDialog(_self, _args)
                        behind,
                        goAwayFlag,
                        refCon,
-                       itmLstHndl);
+                       items);
        _res = Py_BuildValue("O&",
                             DlgObj_New, _rv);
        return _res;
@@ -671,7 +762,7 @@ static PyObject *Dlg_GetNewDialog(_self, _args)
 {
        PyObject *_res = NULL;
        DialogPtr _rv;
-       short dialogID;
+       SInt16 dialogID;
        WindowPtr behind;
        if (!PyArg_ParseTuple(_args, "hO&",
                              &dialogID,
@@ -685,27 +776,41 @@ static PyObject *Dlg_GetNewDialog(_self, _args)
        return _res;
 }
 
-static PyObject *Dlg_ParamText(_self, _args)
+static PyObject *Dlg_NewColorDialog(_self, _args)
        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))
+       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;
-       ParamText(param0,
-                 param1,
-                 param2,
-                 param3);
-       Py_INCREF(Py_None);
-       _res = Py_None;
+       _rv = NewColorDialog((void *)0,
+                            &boundsRect,
+                            title,
+                            visible,
+                            procID,
+                            behind,
+                            goAwayFlag,
+                            refCon,
+                            items);
+       _res = Py_BuildValue("O&",
+                            DlgObj_New, _rv);
        return _res;
 }
 
@@ -715,7 +820,7 @@ static PyObject *Dlg_ModalDialog(_self, _args)
 {
        PyObject *_res = NULL;
        PyObject* modalFilter;
-       short itemHit;
+       DialogItemIndex itemHit;
        if (!PyArg_ParseTuple(_args, "O",
                              &modalFilter))
                return NULL;
@@ -750,7 +855,7 @@ static PyObject *Dlg_DialogSelect(_self, _args)
        Boolean _rv;
        EventRecord theEvent;
        DialogPtr theDialog;
-       short itemHit;
+       DialogItemIndex itemHit;
        if (!PyArg_ParseTuple(_args, "O&",
                              PyMac_GetEventRecord, &theEvent))
                return NULL;
@@ -769,8 +874,8 @@ static PyObject *Dlg_Alert(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
-       short alertID;
+       DialogItemIndex _rv;
+       SInt16 alertID;
        PyObject* modalFilter;
        if (!PyArg_ParseTuple(_args, "hO",
                              &alertID,
@@ -788,8 +893,8 @@ static PyObject *Dlg_StopAlert(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
-       short alertID;
+       DialogItemIndex _rv;
+       SInt16 alertID;
        PyObject* modalFilter;
        if (!PyArg_ParseTuple(_args, "hO",
                              &alertID,
@@ -807,8 +912,8 @@ static PyObject *Dlg_NoteAlert(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
-       short alertID;
+       DialogItemIndex _rv;
+       SInt16 alertID;
        PyObject* modalFilter;
        if (!PyArg_ParseTuple(_args, "hO",
                              &alertID,
@@ -826,8 +931,8 @@ static PyObject *Dlg_CautionAlert(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
-       short alertID;
+       DialogItemIndex _rv;
+       SInt16 alertID;
        PyObject* modalFilter;
        if (!PyArg_ParseTuple(_args, "hO",
                              &alertID,
@@ -840,6 +945,30 @@ static PyObject *Dlg_CautionAlert(_self, _args)
        return _res;
 }
 
+static PyObject *Dlg_ParamText(_self, _args)
+       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(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -875,55 +1004,32 @@ static PyObject *Dlg_SetDialogItemText(_self, _args)
        return _res;
 }
 
-static PyObject *Dlg_NewColorDialog(_self, _args)
+static PyObject *Dlg_GetAlertStage(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       DialogPtr _rv;
-       Rect boundsRect;
-       Str255 title;
-       Boolean visible;
-       short procID;
-       WindowPtr behind;
-       Boolean goAwayFlag;
-       long 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))
+       SInt16 _rv;
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = NewColorDialog((void *)0,
-                            &boundsRect,
-                            title,
-                            visible,
-                            procID,
-                            behind,
-                            goAwayFlag,
-                            refCon,
-                            items);
-       _res = Py_BuildValue("O&",
-                            DlgObj_New, _rv);
+       _rv = GetAlertStage();
+       _res = Py_BuildValue("h",
+                            _rv);
        return _res;
 }
 
-static PyObject *Dlg_GetAlertStage(_self, _args)
+static PyObject *Dlg_SetDialogFont(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
-       if (!PyArg_ParseTuple(_args, ""))
+       SInt16 value;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &value))
                return NULL;
-       _rv = GetAlertStage();
-       _res = Py_BuildValue("h",
-                            _rv);
+       SetDialogFont(value);
+       Py_INCREF(Py_None);
+       _res = Py_None;
        return _res;
 }
 
@@ -940,54 +1046,82 @@ static PyObject *Dlg_ResetAlertStage(_self, _args)
        return _res;
 }
 
-static PyObject *Dlg_SetDialogFont(_self, _args)
+static PyObject *Dlg_NewFeaturesDialog(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short value;
-       if (!PyArg_ParseTuple(_args, "h",
-                             &value))
+       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;
-       SetDialogFont(value);
-       Py_INCREF(Py_None);
-       _res = Py_None;
+       _rv = NewFeaturesDialog((void *)0,
+                               &inBoundsRect,
+                               inTitle,
+                               inIsVisible,
+                               inProcID,
+                               inBehind,
+                               inGoAwayFlag,
+                               inRefCon,
+                               inItemListHandle,
+                               inFlags);
+       _res = Py_BuildValue("O&",
+                            DlgObj_New, _rv);
        return _res;
 }
 
 static PyMethodDef Dlg_methods[] = {
        {"NewDialog", (PyCFunction)Dlg_NewDialog, 1,
-        "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon, Handle itmLstHndl) -> (DialogPtr _rv)"},
+        "(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)"},
        {"GetNewDialog", (PyCFunction)Dlg_GetNewDialog, 1,
-        "(short dialogID, WindowPtr behind) -> (DialogPtr _rv)"},
-       {"ParamText", (PyCFunction)Dlg_ParamText, 1,
-        "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"},
+        "(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) -> (short itemHit)"},
+        "(PyObject* modalFilter) -> (DialogItemIndex itemHit)"},
        {"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1,
         "(EventRecord theEvent) -> (Boolean _rv)"},
        {"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1,
-        "(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, short itemHit)"},
+        "(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, DialogItemIndex itemHit)"},
        {"Alert", (PyCFunction)Dlg_Alert, 1,
-        "(short alertID, PyObject* modalFilter) -> (short _rv)"},
+        "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"},
        {"StopAlert", (PyCFunction)Dlg_StopAlert, 1,
-        "(short alertID, PyObject* modalFilter) -> (short _rv)"},
+        "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"},
        {"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1,
-        "(short alertID, PyObject* modalFilter) -> (short _rv)"},
+        "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"},
        {"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1,
-        "(short alertID, PyObject* modalFilter) -> (short _rv)"},
+        "(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"},
-       {"NewColorDialog", (PyCFunction)Dlg_NewColorDialog, 1,
-        "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon, Handle items) -> (DialogPtr _rv)"},
        {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1,
-        "() -> (short _rv)"},
+        "() -> (SInt16 _rv)"},
+       {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1,
+        "(SInt16 value) -> None"},
        {"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1,
         "() -> None"},
-       {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1,
-        "(short value) -> None"},
+       {"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)"},
        {NULL, NULL, 0}
 };
 
index 31c88dd33c8da74ca2423eb354cb67ce09f4223b..d51a2d1e26bb9b742ff9f76c0091e037d64c27fd 100644 (file)
@@ -51,6 +51,7 @@ class MyScanner(Scanner):
 
        def makeblacklisttypes(self):
                return [
+                       "AlertStdAlertParamPtr",        # Too much work, for now
                        ]
 
        def makerepairinstructions(self):
index 14bef36808bead94f9486d06bf1adf5c5563f79a..b8531ca9e7c542c3afba6a096b583c83f8164b2b 100644 (file)
@@ -24,6 +24,11 @@ ModalFilterUPP = ModalFilterProcPtr
 RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
 
 DITLMethod = Type("DITLMethod", "h")
+DialogItemIndex = Type("DialogItemIndex", "h")
+DialogItemType = Type("DialogItemType", "h")
+DialogItemIndexZeroBased = Type("DialogItemIndexZeroBased", "h")
+AlertType = Type("AlertType", "h")
+StringPtr = Str255
 
 includestuff = includestuff + """
 #include <Dialogs.h>
index b5bc57307521632d22f63da65567ed03190709b7..edd8bc7a22c0f3b6004aef256025eabc5e28656b 100644 (file)
@@ -48,192 +48,192 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
 
 static PyObject *Evt_Error;
 
-static PyObject *Evt_GetCaretTime(_self, _args)
+static PyObject *Evt_GetMouse(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       UInt32 _rv;
+       Point mouseLoc;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = GetCaretTime();
-       _res = Py_BuildValue("l",
-                            _rv);
+       GetMouse(&mouseLoc);
+       _res = Py_BuildValue("O&",
+                            PyMac_BuildPoint, mouseLoc);
        return _res;
 }
 
-static PyObject *Evt_SetEventMask(_self, _args)
+static PyObject *Evt_Button(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       EventMask value;
-       if (!PyArg_ParseTuple(_args, "h",
-                             &value))
+       Boolean _rv;
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       SetEventMask(value);
-       Py_INCREF(Py_None);
-       _res = Py_None;
+       _rv = Button();
+       _res = Py_BuildValue("b",
+                            _rv);
        return _res;
 }
 
-static PyObject *Evt_GetDblTime(_self, _args)
+static PyObject *Evt_StillDown(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       UInt32 _rv;
+       Boolean _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = GetDblTime();
-       _res = Py_BuildValue("l",
+       _rv = StillDown();
+       _res = Py_BuildValue("b",
                             _rv);
        return _res;
 }
 
-static PyObject *Evt_GetNextEvent(_self, _args)
+static PyObject *Evt_WaitMouseUp(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        Boolean _rv;
-       EventMask eventMask;
-       EventRecord theEvent;
-       if (!PyArg_ParseTuple(_args, "h",
-                             &eventMask))
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = GetNextEvent(eventMask,
-                          &theEvent);
-       _res = Py_BuildValue("bO&",
-                            _rv,
-                            PyMac_BuildEventRecord, &theEvent);
+       _rv = WaitMouseUp();
+       _res = Py_BuildValue("b",
+                            _rv);
        return _res;
 }
 
-static PyObject *Evt_WaitNextEvent(_self, _args)
+static PyObject *Evt_TickCount(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Boolean _rv;
-       EventMask eventMask;
-       EventRecord theEvent;
-       UInt32 sleep;
-       if (!PyArg_ParseTuple(_args, "hl",
-                             &eventMask,
-                             &sleep))
+       UInt32 _rv;
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = WaitNextEvent(eventMask,
-                           &theEvent,
-                           sleep,
-                           (RgnHandle)0);
-       _res = Py_BuildValue("bO&",
-                            _rv,
-                            PyMac_BuildEventRecord, &theEvent);
+       _rv = TickCount();
+       _res = Py_BuildValue("l",
+                            _rv);
        return _res;
 }
 
-static PyObject *Evt_EventAvail(_self, _args)
+static PyObject *Evt_GetCaretTime(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Boolean _rv;
-       EventMask eventMask;
-       EventRecord theEvent;
-       if (!PyArg_ParseTuple(_args, "h",
-                             &eventMask))
+       UInt32 _rv;
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = EventAvail(eventMask,
-                        &theEvent);
-       _res = Py_BuildValue("bO&",
-                            _rv,
-                            PyMac_BuildEventRecord, &theEvent);
+       _rv = GetCaretTime();
+       _res = Py_BuildValue("l",
+                            _rv);
        return _res;
 }
 
-static PyObject *Evt_GetMouse(_self, _args)
+static PyObject *Evt_GetKeys(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Point mouseLoc;
+       KeyMap theKeys__out__;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       GetMouse(&mouseLoc);
-       _res = Py_BuildValue("O&",
-                            PyMac_BuildPoint, mouseLoc);
+       GetKeys(theKeys__out__);
+       _res = Py_BuildValue("s#",
+                            (char *)&theKeys__out__, (int)sizeof(KeyMap));
+ theKeys__error__: ;
        return _res;
 }
 
-static PyObject *Evt_Button(_self, _args)
+static PyObject *Evt_GetDblTime(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Boolean _rv;
+       UInt32 _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = Button();
-       _res = Py_BuildValue("b",
+       _rv = GetDblTime();
+       _res = Py_BuildValue("l",
                             _rv);
        return _res;
 }
 
-static PyObject *Evt_StillDown(_self, _args)
+static PyObject *Evt_SetEventMask(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Boolean _rv;
-       if (!PyArg_ParseTuple(_args, ""))
+       EventMask value;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &value))
                return NULL;
-       _rv = StillDown();
-       _res = Py_BuildValue("b",
-                            _rv);
+       SetEventMask(value);
+       Py_INCREF(Py_None);
+       _res = Py_None;
        return _res;
 }
 
-static PyObject *Evt_WaitMouseUp(_self, _args)
+static PyObject *Evt_GetNextEvent(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        Boolean _rv;
-       if (!PyArg_ParseTuple(_args, ""))
+       EventMask eventMask;
+       EventRecord theEvent;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &eventMask))
                return NULL;
-       _rv = WaitMouseUp();
-       _res = Py_BuildValue("b",
-                            _rv);
+       _rv = GetNextEvent(eventMask,
+                          &theEvent);
+       _res = Py_BuildValue("bO&",
+                            _rv,
+                            PyMac_BuildEventRecord, &theEvent);
        return _res;
 }
 
-static PyObject *Evt_GetKeys(_self, _args)
+static PyObject *Evt_WaitNextEvent(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       KeyMap theKeys__out__;
-       if (!PyArg_ParseTuple(_args, ""))
+       Boolean _rv;
+       EventMask eventMask;
+       EventRecord theEvent;
+       UInt32 sleep;
+       if (!PyArg_ParseTuple(_args, "hl",
+                             &eventMask,
+                             &sleep))
                return NULL;
-       GetKeys(theKeys__out__);
-       _res = Py_BuildValue("s#",
-                            (char *)&theKeys__out__, (int)sizeof(KeyMap));
- theKeys__error__: ;
+       _rv = WaitNextEvent(eventMask,
+                           &theEvent,
+                           sleep,
+                           (RgnHandle)0);
+       _res = Py_BuildValue("bO&",
+                            _rv,
+                            PyMac_BuildEventRecord, &theEvent);
        return _res;
 }
 
-static PyObject *Evt_TickCount(_self, _args)
+static PyObject *Evt_EventAvail(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       UInt32 _rv;
-       if (!PyArg_ParseTuple(_args, ""))
+       Boolean _rv;
+       EventMask eventMask;
+       EventRecord theEvent;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &eventMask))
                return NULL;
-       _rv = TickCount();
-       _res = Py_BuildValue("l",
-                            _rv);
+       _rv = EventAvail(eventMask,
+                        &theEvent);
+       _res = Py_BuildValue("bO&",
+                            _rv,
+                            PyMac_BuildEventRecord, &theEvent);
        return _res;
 }
 
@@ -361,18 +361,6 @@ static PyObject *Evt_SystemEvent(_self, _args)
 }
 
 static PyMethodDef Evt_methods[] = {
-       {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
-        "() -> (UInt32 _rv)"},
-       {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
-        "(EventMask value) -> None"},
-       {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
-        "() -> (UInt32 _rv)"},
-       {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
-        "(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
-       {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
-        "(EventMask eventMask, UInt32 sleep) -> (Boolean _rv, EventRecord theEvent)"},
-       {"EventAvail", (PyCFunction)Evt_EventAvail, 1,
-        "(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
        {"GetMouse", (PyCFunction)Evt_GetMouse, 1,
         "() -> (Point mouseLoc)"},
        {"Button", (PyCFunction)Evt_Button, 1,
@@ -381,10 +369,22 @@ static PyMethodDef Evt_methods[] = {
         "() -> (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)"},
-       {"TickCount", (PyCFunction)Evt_TickCount, 1,
+       {"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)"},
+       {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
+        "(EventMask eventMask, UInt32 sleep) -> (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"},
        {"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1,
index 1a5d6a81622871a8a50b66cab0bf86b10dc0b9e4..3f0e51b97129f791317c43be0d4b5e9dc9f936c0 100644 (file)
@@ -6,7 +6,7 @@ from scantools import Scanner
 from bgenlocations import TOOLBOXDIR
 
 LONG = "Fonts"
-SHORT = "Fm"
+SHORT = "fm"
 
 def main():
        input = "Fonts.h"
@@ -29,6 +29,11 @@ class MyScanner(Scanner):
        def makeblacklistnames(self):
                return [
                        "OutlineMetrics",       # Too complicated
+                       "AntiTextIsAntiAliased",        # XXXX Missing from library...
+                       "AntiTextGetEnabled",
+                       "AntiTextSetEnabled",
+                       "AntiTextGetApplicationAware",
+                       "AntiTextSetApplicationAware",
                        ]
 
        def makeblacklisttypes(self):
index e6cb0a286e2966936b25bd70db8196f450d5124a..9f5c6c45ae6e5a63ef3b7a980d452b5fbaf22c62 100644 (file)
@@ -54,7 +54,7 @@ static PyObject *Help_HMGetHelpMenuHandle(_self, _args)
 {
        PyObject *_res = NULL;
        OSErr _err;
-       MenuRef mh;
+       MenuHandle mh;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
        _err = HMGetHelpMenuHandle(&mh);
@@ -79,6 +79,20 @@ static PyObject *Help_HMRemoveBalloon(_self, _args)
        return _res;
 }
 
+static PyObject *Help_HMIsBalloon(_self, _args)
+       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(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -110,20 +124,6 @@ static PyObject *Help_HMSetBalloons(_self, _args)
        return _res;
 }
 
-static PyObject *Help_HMIsBalloon(_self, _args)
-       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_HMSetFont(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -303,15 +303,15 @@ static PyObject *Help_HMGetBalloonWindow(_self, _args)
 
 static PyMethodDef Help_methods[] = {
        {"HMGetHelpMenuHandle", (PyCFunction)Help_HMGetHelpMenuHandle, 1,
-        "() -> (MenuRef mh)"},
+        "() -> (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"},
-       {"HMIsBalloon", (PyCFunction)Help_HMIsBalloon, 1,
-        "() -> (Boolean _rv)"},
        {"HMSetFont", (PyCFunction)Help_HMSetFont, 1,
         "(SInt16 font) -> None"},
        {"HMSetFontSize", (PyCFunction)Help_HMSetFontSize, 1,
index ddc83b7269056d45b35526274ab619cd75ea2185..3b1db65df10062bf060adc22d3a6722299799e02 100644 (file)
@@ -33,6 +33,9 @@ class MyScanner(Scanner):
                                listname = "methods"
                return classname, listname
 
+       def writeinitialdefs(self):
+               self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
        def makeblacklistnames(self):
                return [
                        ]
index e0eace926a82bd5b024001a2ca7505163f5b5c34..9b09341af73738c33237933c0c60e1142f7ed766 100644 (file)
@@ -54,11 +54,11 @@ PyTypeObject List_Type;
 
 typedef struct ListObject {
        PyObject_HEAD
-       ListRef ob_itself;
+       ListHandle ob_itself;
 } ListObject;
 
 PyObject *ListObj_New(itself)
-       ListRef itself;
+       ListHandle itself;
 {
        ListObject *it;
        if (itself == NULL) {
@@ -72,7 +72,7 @@ PyObject *ListObj_New(itself)
 }
 ListObj_Convert(v, p_itself)
        PyObject *v;
-       ListRef *p_itself;
+       ListHandle *p_itself;
 {
        if (!ListObj_Check(v))
        {
@@ -615,7 +615,7 @@ static PyObject *List_LNew(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       ListRef _rv;
+       ListHandle _rv;
        Rect rView;
        Rect dataBounds;
        Point cSize;
@@ -652,7 +652,7 @@ static PyObject *List_LNew(_self, _args)
 
 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) -> (ListRef _rv)"},
+        "(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)"},
        {NULL, NULL, 0}
 };
 
index ea11ba42dfa849312573e007c7dfed62849a8e0b..dbaed68eaf35ebda1cbf12901b7e0f1487287a90 100644 (file)
@@ -7,7 +7,7 @@ from bgenlocations import TOOLBOXDIR
 
 LONG = "Lists"
 SHORT = "list"
-OBJECT = "ListRef"
+OBJECT = "ListHandle"
 
 def main():
        input = LONG + ".h"
index 026953c09b02e4829bd3178140e477a135a40333..686875d26d655f523807a73f3bcb3ec2f1bad9e4 100644 (file)
@@ -13,7 +13,7 @@ KIND = 'Handle'                               # Usually 'Ptr' or 'Handle'
 
 # The following is *usually* unchanged but may still require tuning
 MODPREFIX = MODNAME                    # The prefix for module-wide routines
-OBJECTTYPE = "ListRef"         # The C type used to represent them
+OBJECTTYPE = "ListHandle"              # The C type used to represent them
 OBJECTPREFIX = MODPREFIX + 'Obj'       # The prefix for object methods
 INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
 OUTPUTFILE = MODNAME + "module.c"      # The file generated by this program
@@ -21,7 +21,7 @@ OUTPUTFILE = MODNAME + "module.c"     # The file generated by this program
 from macsupport import *
 
 # Create the type objects
-ListRef = OpaqueByValueType("ListRef", "ListObj")
+ListHandle = OpaqueByValueType("ListHandle", "ListObj")
 Cell = Point
 VarOutBufferShortsize = VarHeapOutputBufferType('char', 'short', 's')  # (buf, &len)
 InBufferShortsize = VarInputBufferType('char', 'short', 's')           # (buf, len)
index b09d47d8bd23b05b18ab988ea2489c576c743ac4..ee3becbbee5aeb7a3127a5ae17af3906c9964c87 100644 (file)
@@ -118,22 +118,6 @@ static PyObject *MenuObj_AppendMenu(_self, _args)
        return _res;
 }
 
-static PyObject *MenuObj_AppendResMenu(_self, _args)
-       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_InsertResMenu(_self, _args)
        MenuObject *_self;
        PyObject *_args;
@@ -169,6 +153,22 @@ static PyObject *MenuObj_InsertMenu(_self, _args)
        return _res;
 }
 
+static PyObject *MenuObj_AppendResMenu(_self, _args)
+       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_InsertMenuItem(_self, _args)
        MenuObject *_self;
        PyObject *_args;
@@ -241,91 +241,77 @@ static PyObject *MenuObj_GetMenuItemText(_self, _args)
        return _res;
 }
 
-static PyObject *MenuObj_DisableItem(_self, _args)
+static PyObject *MenuObj_SetItemMark(_self, _args)
        MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        short item;
-       if (!PyArg_ParseTuple(_args, "h",
-                             &item))
+       CharParameter markChar;
+       if (!PyArg_ParseTuple(_args, "hh",
+                             &item,
+                             &markChar))
                return NULL;
-       DisableItem(_self->ob_itself,
-                   item);
+       SetItemMark(_self->ob_itself,
+                   item,
+                   markChar);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *MenuObj_EnableItem(_self, _args)
+static PyObject *MenuObj_GetItemMark(_self, _args)
        MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        short item;
+       CharParameter markChar;
        if (!PyArg_ParseTuple(_args, "h",
                              &item))
                return NULL;
-       EnableItem(_self->ob_itself,
-                  item);
-       Py_INCREF(Py_None);
-       _res = Py_None;
-       return _res;
-}
-
-static PyObject *MenuObj_CheckItem(_self, _args)
-       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;
+       GetItemMark(_self->ob_itself,
+                   item,
+                   &markChar);
+       _res = Py_BuildValue("h",
+                            markChar);
        return _res;
 }
 
-static PyObject *MenuObj_SetItemMark(_self, _args)
+static PyObject *MenuObj_SetItemCmd(_self, _args)
        MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        short item;
-       short markChar;
+       CharParameter cmdChar;
        if (!PyArg_ParseTuple(_args, "hh",
                              &item,
-                             &markChar))
+                             &cmdChar))
                return NULL;
-       SetItemMark(_self->ob_itself,
-                   item,
-                   markChar);
+       SetItemCmd(_self->ob_itself,
+                  item,
+                  cmdChar);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *MenuObj_GetItemMark(_self, _args)
+static PyObject *MenuObj_GetItemCmd(_self, _args)
        MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        short item;
-       short markChar;
+       CharParameter cmdChar;
        if (!PyArg_ParseTuple(_args, "h",
                              &item))
                return NULL;
-       GetItemMark(_self->ob_itself,
-                   item,
-                   &markChar);
+       GetItemCmd(_self->ob_itself,
+                  item,
+                  &cmdChar);
        _res = Py_BuildValue("h",
-                            markChar);
+                            cmdChar);
        return _res;
 }
 
@@ -372,7 +358,7 @@ static PyObject *MenuObj_SetItemStyle(_self, _args)
 {
        PyObject *_res = NULL;
        short item;
-       short chStyle;
+       Style chStyle;
        if (!PyArg_ParseTuple(_args, "hh",
                              &item,
                              &chStyle))
@@ -416,52 +402,33 @@ static PyObject *MenuObj_CalcMenuSize(_self, _args)
        return _res;
 }
 
-static PyObject *MenuObj_CountMItems(_self, _args)
-       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;
-}
-
-static PyObject *MenuObj_GetItemCmd(_self, _args)
+static PyObject *MenuObj_DisableItem(_self, _args)
        MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        short item;
-       short cmdChar;
        if (!PyArg_ParseTuple(_args, "h",
                              &item))
                return NULL;
-       GetItemCmd(_self->ob_itself,
-                  item,
-                  &cmdChar);
-       _res = Py_BuildValue("h",
-                            cmdChar);
+       DisableItem(_self->ob_itself,
+                   item);
+       Py_INCREF(Py_None);
+       _res = Py_None;
        return _res;
 }
 
-static PyObject *MenuObj_SetItemCmd(_self, _args)
+static PyObject *MenuObj_EnableItem(_self, _args)
        MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        short item;
-       short cmdChar;
-       if (!PyArg_ParseTuple(_args, "hh",
-                             &item,
-                             &cmdChar))
+       if (!PyArg_ParseTuple(_args, "h",
+                             &item))
                return NULL;
-       SetItemCmd(_self->ob_itself,
-                  item,
-                  cmdChar);
+       EnableItem(_self->ob_itself,
+                  item);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
@@ -490,6 +457,39 @@ static PyObject *MenuObj_PopUpMenuSelect(_self, _args)
        return _res;
 }
 
+static PyObject *MenuObj_CheckItem(_self, _args)
+       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;
+}
+
+static PyObject *MenuObj_CountMItems(_self, _args)
+       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;
+}
+
 static PyObject *MenuObj_InsertFontResMenu(_self, _args)
        MenuObject *_self;
        PyObject *_args;
@@ -531,255 +531,582 @@ static PyObject *MenuObj_InsertIntlResMenu(_self, _args)
        return _res;
 }
 
-static PyObject *MenuObj_as_Resource(_self, _args)
+static PyObject *MenuObj_SetMenuItemCommandID(_self, _args)
        MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-
-       return ResObj_New((Handle)_self->ob_itself);
-
+       OSErr _err;
+       SInt16 inItem;
+       UInt32 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 PyMethodDef MenuObj_methods[] = {
-       {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1,
-        "() -> None"},
-       {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
-        "(Str255 data) -> None"},
-       {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1,
-        "(ResType theType) -> None"},
-       {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1,
-        "(ResType theType, short afterItem) -> None"},
-       {"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1,
-        "(short beforeID) -> None"},
-       {"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1,
-        "(Str255 itemString, short afterItem) -> None"},
-       {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1,
-        "(short item) -> None"},
-       {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1,
-        "(short item, Str255 itemString) -> None"},
-       {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1,
-        "(short item) -> (Str255 itemString)"},
-       {"DisableItem", (PyCFunction)MenuObj_DisableItem, 1,
-        "(short item) -> None"},
-       {"EnableItem", (PyCFunction)MenuObj_EnableItem, 1,
-        "(short item) -> None"},
-       {"CheckItem", (PyCFunction)MenuObj_CheckItem, 1,
-        "(short item, Boolean checked) -> None"},
-       {"SetItemMark", (PyCFunction)MenuObj_SetItemMark, 1,
-        "(short item, short markChar) -> None"},
-       {"GetItemMark", (PyCFunction)MenuObj_GetItemMark, 1,
-        "(short item) -> (short markChar)"},
-       {"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, short chStyle) -> None"},
-       {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1,
-        "(short item) -> (Style chStyle)"},
-       {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
-        "() -> None"},
-       {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1,
-        "() -> (short _rv)"},
-       {"GetItemCmd", (PyCFunction)MenuObj_GetItemCmd, 1,
-        "(short item) -> (short cmdChar)"},
-       {"SetItemCmd", (PyCFunction)MenuObj_SetItemCmd, 1,
-        "(short item, short cmdChar) -> None"},
-       {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1,
-        "(short top, short left, short popUpItem) -> (long _rv)"},
-       {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1,
-        "(short afterItem, short scriptFilter) -> None"},
-       {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1,
-        "(ResType theType, short afterItem, short scriptFilter) -> None"},
-       {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1,
-        "Return this Menu as a Resource"},
-       {NULL, NULL, 0}
-};
-
-PyMethodChain MenuObj_chain = { MenuObj_methods, NULL };
+static PyObject *MenuObj_GetMenuItemCommandID(_self, _args)
+       MenuObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       OSErr _err;
+       SInt16 inItem;
+       UInt32 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_getattr(self, name)
-       MenuObject *self;
-       char *name;
+static PyObject *MenuObj_SetMenuItemModifiers(_self, _args)
+       MenuObject *_self;
+       PyObject *_args;
 {
-       return Py_FindMethodInChain(&MenuObj_chain, (PyObject *)self, name);
+       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;
 }
 
-#define MenuObj_setattr NULL
+static PyObject *MenuObj_GetMenuItemModifiers(_self, _args)
+       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;
+}
 
-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*/
-};
+static PyObject *MenuObj_SetMenuItemIconHandle(_self, _args)
+       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;
+}
 
-/* ---------------------- End object type Menu ---------------------- */
+static PyObject *MenuObj_GetMenuItemIconHandle(_self, _args)
+       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(_self, _args)
+       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 *Menu_GetMBarHeight(_self, _args)
-       PyObject *_self;
+static PyObject *MenuObj_GetMenuItemTextEncoding(_self, _args)
+       MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
-       if (!PyArg_ParseTuple(_args, ""))
+       OSErr _err;
+       SInt16 inItem;
+       TextEncoding outScriptID;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &inItem))
                return NULL;
-       _rv = GetMBarHeight();
-       _res = Py_BuildValue("h",
-                            _rv);
+       _err = GetMenuItemTextEncoding(_self->ob_itself,
+                                      inItem,
+                                      &outScriptID);
+       if (_err != noErr) return PyMac_Error(_err);
+       _res = Py_BuildValue("l",
+                            outScriptID);
        return _res;
 }
 
-static PyObject *Menu_InitMenus(_self, _args)
-       PyObject *_self;
+static PyObject *MenuObj_SetMenuItemHierarchicalID(_self, _args)
+       MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
+       OSErr _err;
+       SInt16 inItem;
+       SInt16 inHierID;
+       if (!PyArg_ParseTuple(_args, "hh",
+                             &inItem,
+                             &inHierID))
                return NULL;
-       InitMenus();
+       _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 *Menu_NewMenu(_self, _args)
-       PyObject *_self;
+static PyObject *MenuObj_GetMenuItemHierarchicalID(_self, _args)
+       MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       MenuHandle _rv;
-       short menuID;
-       Str255 menuTitle;
-       if (!PyArg_ParseTuple(_args, "hO&",
-                             &menuID,
-                             PyMac_GetStr255, menuTitle))
+       OSErr _err;
+       SInt16 inItem;
+       SInt16 outHierID;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &inItem))
                return NULL;
-       _rv = NewMenu(menuID,
-                     menuTitle);
-       _res = Py_BuildValue("O&",
-                            MenuObj_New, _rv);
+       _err = GetMenuItemHierarchicalID(_self->ob_itself,
+                                        inItem,
+                                        &outHierID);
+       if (_err != noErr) return PyMac_Error(_err);
+       _res = Py_BuildValue("h",
+                            outHierID);
        return _res;
 }
 
-static PyObject *Menu_GetMenu(_self, _args)
-       PyObject *_self;
+static PyObject *MenuObj_SetMenuItemFontID(_self, _args)
+       MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       MenuHandle _rv;
-       short resourceID;
+       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(_self, _args)
+       MenuObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       OSErr _err;
+       SInt16 inItem;
+       SInt16 outFontID;
        if (!PyArg_ParseTuple(_args, "h",
-                             &resourceID))
+                             &inItem))
                return NULL;
-       _rv = GetMenu(resourceID);
-       _res = Py_BuildValue("O&",
-                            MenuObj_New, _rv);
+       _err = GetMenuItemFontID(_self->ob_itself,
+                                inItem,
+                                &outFontID);
+       if (_err != noErr) return PyMac_Error(_err);
+       _res = Py_BuildValue("h",
+                            outFontID);
        return _res;
 }
 
-static PyObject *Menu_DrawMenuBar(_self, _args)
-       PyObject *_self;
+static PyObject *MenuObj_SetMenuItemRefCon(_self, _args)
+       MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
+       OSErr _err;
+       SInt16 inItem;
+       UInt32 inRefCon;
+       if (!PyArg_ParseTuple(_args, "hl",
+                             &inItem,
+                             &inRefCon))
                return NULL;
-       DrawMenuBar();
+       _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 *Menu_InvalMenuBar(_self, _args)
-       PyObject *_self;
+static PyObject *MenuObj_GetMenuItemRefCon(_self, _args)
+       MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
+       OSErr _err;
+       SInt16 inItem;
+       UInt32 outRefCon;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &inItem))
                return NULL;
-       InvalMenuBar();
+       _err = GetMenuItemRefCon(_self->ob_itself,
+                                inItem,
+                                &outRefCon);
+       if (_err != noErr) return PyMac_Error(_err);
+       _res = Py_BuildValue("l",
+                            outRefCon);
+       return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemRefCon2(_self, _args)
+       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;
 }
 
-static PyObject *Menu_DeleteMenu(_self, _args)
-       PyObject *_self;
+static PyObject *MenuObj_GetMenuItemRefCon2(_self, _args)
+       MenuObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short menuID;
+       OSErr _err;
+       SInt16 inItem;
+       UInt32 outRefCon2;
        if (!PyArg_ParseTuple(_args, "h",
-                             &menuID))
+                             &inItem))
                return NULL;
-       DeleteMenu(menuID);
+       _err = GetMenuItemRefCon2(_self->ob_itself,
+                                 inItem,
+                                 &outRefCon2);
+       if (_err != noErr) return PyMac_Error(_err);
+       _res = Py_BuildValue("l",
+                            outRefCon2);
+       return _res;
+}
+
+static PyObject *MenuObj_SetMenuItemKeyGlyph(_self, _args)
+       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 *Menu_ClearMenuBar(_self, _args)
+static PyObject *MenuObj_GetMenuItemKeyGlyph(_self, _args)
+       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_as_Resource(_self, _args)
+       MenuObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+
+       return ResObj_New((Handle)_self->ob_itself);
+
+}
+
+static PyMethodDef MenuObj_methods[] = {
+       {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1,
+        "() -> None"},
+       {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
+        "(Str255 data) -> None"},
+       {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1,
+        "(ResType theType, short afterItem) -> None"},
+       {"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1,
+        "(short beforeID) -> None"},
+       {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1,
+        "(ResType theType) -> None"},
+       {"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1,
+        "(Str255 itemString, short afterItem) -> None"},
+       {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1,
+        "(short item) -> None"},
+       {"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, Style chStyle) -> None"},
+       {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1,
+        "(short item) -> (Style chStyle)"},
+       {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
+        "() -> None"},
+       {"DisableItem", (PyCFunction)MenuObj_DisableItem, 1,
+        "(short item) -> None"},
+       {"EnableItem", (PyCFunction)MenuObj_EnableItem, 1,
+        "(short item) -> None"},
+       {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1,
+        "(short top, short left, short popUpItem) -> (long _rv)"},
+       {"CheckItem", (PyCFunction)MenuObj_CheckItem, 1,
+        "(short item, Boolean checked) -> None"},
+       {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1,
+        "() -> (short _rv)"},
+       {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1,
+        "(short afterItem, short scriptFilter) -> None"},
+       {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1,
+        "(ResType theType, short afterItem, short scriptFilter) -> None"},
+       {"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1,
+        "(SInt16 inItem, UInt32 inCommandID) -> None"},
+       {"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1,
+        "(SInt16 inItem) -> (UInt32 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, SInt16 inHierID) -> None"},
+       {"GetMenuItemHierarchicalID", (PyCFunction)MenuObj_GetMenuItemHierarchicalID, 1,
+        "(SInt16 inItem) -> (SInt16 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)"},
+       {"SetMenuItemRefCon2", (PyCFunction)MenuObj_SetMenuItemRefCon2, 1,
+        "(SInt16 inItem, UInt32 inRefCon2) -> None"},
+       {"GetMenuItemRefCon2", (PyCFunction)MenuObj_GetMenuItemRefCon2, 1,
+        "(SInt16 inItem) -> (UInt32 outRefCon2)"},
+       {"SetMenuItemKeyGlyph", (PyCFunction)MenuObj_SetMenuItemKeyGlyph, 1,
+        "(SInt16 inItem, SInt16 inGlyph) -> None"},
+       {"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1,
+        "(SInt16 inItem) -> (SInt16 outGlyph)"},
+       {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1,
+        "Return this Menu as a Resource"},
+       {NULL, NULL, 0}
+};
+
+PyMethodChain MenuObj_chain = { MenuObj_methods, NULL };
+
+static PyObject *MenuObj_getattr(self, name)
+       MenuObject *self;
+       char *name;
+{
+       return Py_FindMethodInChain(&MenuObj_chain, (PyObject *)self, name);
+}
+
+#define MenuObj_setattr 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*/
+};
+
+/* ---------------------- End object type Menu ---------------------- */
+
+
+static PyObject *Menu_GetMBarHeight(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
+       short _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       ClearMenuBar();
+       _rv = GetMBarHeight();
+       _res = Py_BuildValue("h",
+                            _rv);
+       return _res;
+}
+
+static PyObject *Menu_InitMenus(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       if (!PyArg_ParseTuple(_args, ""))
+               return NULL;
+       InitMenus();
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *Menu_GetNewMBar(_self, _args)
+static PyObject *Menu_NewMenu(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Handle _rv;
-       short menuBarID;
-       if (!PyArg_ParseTuple(_args, "h",
-                             &menuBarID))
+       MenuHandle _rv;
+       short menuID;
+       Str255 menuTitle;
+       if (!PyArg_ParseTuple(_args, "hO&",
+                             &menuID,
+                             PyMac_GetStr255, menuTitle))
                return NULL;
-       _rv = GetNewMBar(menuBarID);
+       _rv = NewMenu(menuID,
+                     menuTitle);
        _res = Py_BuildValue("O&",
-                            ResObj_New, _rv);
+                            MenuObj_New, _rv);
        return _res;
 }
 
-static PyObject *Menu_GetMenuBar(_self, _args)
+static PyObject *Menu_GetMenu(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Handle _rv;
-       if (!PyArg_ParseTuple(_args, ""))
+       MenuHandle _rv;
+       short resourceID;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &resourceID))
                return NULL;
-       _rv = GetMenuBar();
+       _rv = GetMenu(resourceID);
        _res = Py_BuildValue("O&",
-                            ResObj_New, _rv);
+                            MenuObj_New, _rv);
        return _res;
 }
 
-static PyObject *Menu_SetMenuBar(_self, _args)
+static PyObject *Menu_DeleteMenu(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Handle menuList;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             ResObj_Convert, &menuList))
+       short menuID;
+       if (!PyArg_ParseTuple(_args, "h",
+                             &menuID))
                return NULL;
-       SetMenuBar(menuList);
+       DeleteMenu(menuID);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
@@ -791,7 +1118,7 @@ static PyObject *Menu_MenuKey(_self, _args)
 {
        PyObject *_res = NULL;
        long _rv;
-       short ch;
+       CharParameter ch;
        if (!PyArg_ParseTuple(_args, "h",
                              &ch))
                return NULL;
@@ -847,34 +1174,61 @@ static PyObject *Menu_FlashMenuBar(_self, _args)
        return _res;
 }
 
-static PyObject *Menu_SetMenuFlash(_self, _args)
+static PyObject *Menu_MenuChoice(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short count;
-       if (!PyArg_ParseTuple(_args, "h",
-                             &count))
+       long _rv;
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       SetMenuFlash(count);
+       _rv = MenuChoice();
+       _res = Py_BuildValue("l",
+                            _rv);
+       return _res;
+}
+
+static PyObject *Menu_DeleteMCEntries(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       short 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_MenuSelect(_self, _args)
+static PyObject *Menu_DrawMenuBar(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       long _rv;
-       Point startPt;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             PyMac_GetPoint, &startPt))
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = MenuSelect(startPt);
-       _res = Py_BuildValue("l",
-                            _rv);
+       DrawMenuBar();
+       Py_INCREF(Py_None);
+       _res = Py_None;
+       return _res;
+}
+
+static PyObject *Menu_InvalMenuBar(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       if (!PyArg_ParseTuple(_args, ""))
+               return NULL;
+       InvalMenuBar();
+       Py_INCREF(Py_None);
+       _res = Py_None;
        return _res;
 }
 
@@ -893,33 +1247,30 @@ static PyObject *Menu_InitProcMenu(_self, _args)
        return _res;
 }
 
-static PyObject *Menu_MenuChoice(_self, _args)
+static PyObject *Menu_GetMenuBar(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       long _rv;
+       Handle _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = MenuChoice();
-       _res = Py_BuildValue("l",
-                            _rv);
+       _rv = GetMenuBar();
+       _res = Py_BuildValue("O&",
+                            ResObj_New, _rv);
        return _res;
 }
 
-static PyObject *Menu_DeleteMCEntries(_self, _args)
+static PyObject *Menu_SetMenuBar(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short menuID;
-       short menuItem;
-       if (!PyArg_ParseTuple(_args, "hh",
-                             &menuID,
-                             &menuItem))
+       Handle menuList;
+       if (!PyArg_ParseTuple(_args, "O&",
+                             ResObj_Convert, &menuList))
                return NULL;
-       DeleteMCEntries(menuID,
-                       menuItem);
+       SetMenuBar(menuList);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
@@ -956,6 +1307,82 @@ static PyObject *Menu_SystemMenu(_self, _args)
        return _res;
 }
 
+static PyObject *Menu_GetNewMBar(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       Handle _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_ClearMenuBar(_self, _args)
+       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_SetMenuFlash(_self, _args)
+       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;
+}
+
+static PyObject *Menu_MenuSelect(_self, _args)
+       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_MenuEvent(_self, _args)
+       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_OpenDeskAcc(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -980,42 +1407,44 @@ static PyMethodDef Menu_methods[] = {
         "(short menuID, Str255 menuTitle) -> (MenuHandle _rv)"},
        {"GetMenu", (PyCFunction)Menu_GetMenu, 1,
         "(short resourceID) -> (MenuHandle _rv)"},
-       {"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1,
-        "() -> None"},
-       {"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1,
-        "() -> None"},
        {"DeleteMenu", (PyCFunction)Menu_DeleteMenu, 1,
         "(short menuID) -> None"},
-       {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1,
-        "() -> None"},
-       {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1,
-        "(short menuBarID) -> (Handle _rv)"},
-       {"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1,
-        "() -> (Handle _rv)"},
-       {"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1,
-        "(Handle menuList) -> None"},
        {"MenuKey", (PyCFunction)Menu_MenuKey, 1,
-        "(short ch) -> (long _rv)"},
+        "(CharParameter ch) -> (long _rv)"},
        {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1,
         "(short menuID) -> None"},
        {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1,
         "(short menuID) -> (MenuHandle _rv)"},
        {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1,
         "(short menuID) -> None"},
-       {"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1,
-        "(short count) -> None"},
-       {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1,
-        "(Point startPt) -> (long _rv)"},
-       {"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1,
-        "(short resID) -> None"},
        {"MenuChoice", (PyCFunction)Menu_MenuChoice, 1,
         "() -> (long _rv)"},
        {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1,
         "(short menuID, short menuItem) -> None"},
+       {"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1,
+        "() -> None"},
+       {"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1,
+        "() -> None"},
+       {"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1,
+        "(short resID) -> None"},
+       {"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1,
+        "() -> (Handle _rv)"},
+       {"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1,
+        "(Handle menuList) -> None"},
        {"SystemEdit", (PyCFunction)Menu_SystemEdit, 1,
         "(short editCmd) -> (Boolean _rv)"},
        {"SystemMenu", (PyCFunction)Menu_SystemMenu, 1,
         "(long menuResult) -> None"},
+       {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1,
+        "(short menuBarID) -> (Handle _rv)"},
+       {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1,
+        "() -> None"},
+       {"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1,
+        "(short count) -> None"},
+       {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1,
+        "(Point startPt) -> (long _rv)"},
+       {"MenuEvent", (PyCFunction)Menu_MenuEvent, 1,
+        "(EventRecord inEvent) -> (UInt32 _rv)"},
        {"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1,
         "(Str255 name) -> None"},
        {NULL, NULL, 0}
index f294d318ea730bc9c92197662b6bd57a5eec28c5..0fb1a7b6f6b387460efb53cbf49135b5ee30530e 100644 (file)
@@ -3586,6 +3586,38 @@ static PyObject *Qd_GetIndPattern(_self, _args)
        return _res;
 }
 
+static PyObject *Qd_SlopeFromAngle(_self, _args)
+       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(_self, _args)
+       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_TextFont(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -3606,7 +3638,7 @@ static PyObject *Qd_TextFace(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short face;
+       Style face;
        if (!PyArg_ParseTuple(_args, "h",
                              &face))
                return NULL;
@@ -3666,8 +3698,8 @@ static PyObject *Qd_DrawChar(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short ch;
-       if (!PyArg_ParseTuple(_args, "h",
+       CharParameter ch;
+       if (!PyArg_ParseTuple(_args, "c",
                              &ch))
                return NULL;
        DrawChar(ch);
@@ -3721,8 +3753,8 @@ static PyObject *Qd_CharWidth(_self, _args)
 {
        PyObject *_res = NULL;
        short _rv;
-       short ch;
-       if (!PyArg_ParseTuple(_args, "h",
+       CharParameter ch;
+       if (!PyArg_ParseTuple(_args, "c",
                              &ch))
                return NULL;
        _rv = CharWidth(ch);
@@ -4215,10 +4247,14 @@ static PyMethodDef Qd_methods[] = {
         "() -> (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)"},
        {"TextFont", (PyCFunction)Qd_TextFont, 1,
         "(short font) -> None"},
        {"TextFace", (PyCFunction)Qd_TextFace, 1,
-        "(short face) -> None"},
+        "(Style face) -> None"},
        {"TextMode", (PyCFunction)Qd_TextMode, 1,
         "(short mode) -> None"},
        {"TextSize", (PyCFunction)Qd_TextSize, 1,
@@ -4226,13 +4262,13 @@ static PyMethodDef Qd_methods[] = {
        {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
         "(Fixed extra) -> None"},
        {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
-        "(short ch) -> None"},
+        "(CharParameter ch) -> None"},
        {"DrawString", (PyCFunction)Qd_DrawString, 1,
         "(Str255 s) -> None"},
        {"DrawText", (PyCFunction)Qd_DrawText, 1,
         "(Buffer textBuf, short firstByte, short byteCount) -> None"},
        {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
-        "(short ch) -> (short _rv)"},
+        "(CharParameter ch) -> (short _rv)"},
        {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
         "(Str255 s) -> (short _rv)"},
        {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
index cd5409eeba5734b6584495913d9b72c4f56bf1d1..46adaaa585a21b2496bced1f253bfd40944381e4 100644 (file)
@@ -72,6 +72,8 @@ class MyScanner(Scanner):
                        'InitCPort',
                        'CloseCPort',
                        'BitMapToRegionGlue',
+                       'StdOpcode',    # XXXX Missing from library...
+
                        ]
 
        def makeblacklisttypes(self):
index 3cef0f91c1306eb1b2fe69cce5c01a4de81613c2..ebef23bbb2b75a50c8dcdeb0cee8f32fe2120baa 100644 (file)
@@ -32,6 +32,9 @@ class MyScanner(Scanner):
                                listname = t + "_methods"
                return classname, listname
 
+       def writeinitialdefs(self):
+               self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
        def makeblacklistnames(self):
                return [
                        "DisposeMovie",         # Done on python-object disposal
index f4ed648deab3ea3258931b14339a173783bb8f23..879a88737a57a4d1c13c056e692743597f66e908 100644 (file)
@@ -605,7 +605,7 @@ static PyObject *Res_ResError(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
+       OSErr _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
        _rv = ResError();
@@ -1275,7 +1275,7 @@ static PyMethodDef Res_methods[] = {
        {"CloseResFile", (PyCFunction)Res_CloseResFile, 1,
         "(short refNum) -> None"},
        {"ResError", (PyCFunction)Res_ResError, 1,
-        "() -> (short _rv)"},
+        "() -> (OSErr _rv)"},
        {"CurResFile", (PyCFunction)Res_CurResFile, 1,
         "() -> (short _rv)"},
        {"CreateResFile", (PyCFunction)Res_CreateResFile, 1,
index 36d9fd2b36647fc0c11fd7a1e9e95113e44be93d..06031ab77c1836319b2f7b20106321308e6fff0c 100644 (file)
@@ -171,14 +171,14 @@ static PyObject *SndCh_SndPlay(_self, _args)
 {
        PyObject *_res = NULL;
        OSErr _err;
-       SndListHandle sndHdl;
+       SndListHandle sndHandle;
        Boolean async;
        if (!PyArg_ParseTuple(_args, "O&b",
-                             ResObj_Convert, &sndHdl,
+                             ResObj_Convert, &sndHandle,
                              &async))
                return NULL;
        _err = SndPlay(_self->ob_itself,
-                      sndHdl,
+                      sndHandle,
                       async);
        if (_err != noErr) return PyMac_Error(_err);
        Py_INCREF(Py_None);
@@ -276,7 +276,7 @@ static PyMethodDef SndCh_methods[] = {
        {"SndDoImmediate", (PyCFunction)SndCh_SndDoImmediate, 1,
         "(SndCommand cmd) -> None"},
        {"SndPlay", (PyCFunction)SndCh_SndPlay, 1,
-        "(SndListHandle sndHdl, Boolean async) -> None"},
+        "(SndListHandle sndHandle, Boolean async) -> None"},
        {"SndStartFilePlay", (PyCFunction)SndCh_SndStartFilePlay, 1,
         "(short fRefNum, short resNum, long bufferSize, Boolean async) -> None"},
        {"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1,
@@ -315,6 +315,21 @@ staticforward PyTypeObject SndChannel_Type = {
 /* ------------------- End object type SndChannel ------------------- */
 
 
+static PyObject *Snd_SysBeep(_self, _args)
+       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(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -712,7 +727,244 @@ static PyObject *Snd_GetSoundHeaderOffset(_self, _args)
        return _res;
 }
 
+static PyObject *Snd_SPBVersion(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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_SPBPauseRecording(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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(_self, _args)
+       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_SPBMillisecondsToBytes(_self, _args)
+       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(_self, _args)
+       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[] = {
+       {"SysBeep", (PyCFunction)Snd_SysBeep, 1,
+        "(short duration) -> None"},
        {"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1,
         "(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)"},
        {"SndControl", (PyCFunction)Snd_SndControl, 1,
@@ -745,6 +997,30 @@ static PyMethodDef Snd_methods[] = {
         "(long level) -> None"},
        {"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1,
         "(SndListHandle sndHandle) -> (long offset)"},
+       {"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"},
+       {"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)"},
+       {"SPBMillisecondsToBytes", (PyCFunction)Snd_SPBMillisecondsToBytes, 1,
+        "(long inRefNum) -> (long milliseconds)"},
+       {"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1,
+        "(long inRefNum) -> (long byteCount)"},
        {NULL, NULL, 0}
 };
 
index 249aa5749430131d4fdfb66810a23bfca7881d04..af5ecbb765790fd7c285eb1f3639c00d3ee6d3c2 100644 (file)
@@ -31,6 +31,9 @@ class SoundScanner(Scanner):
                                listname = "sndmethods"
                return classname, listname
 
+       def writeinitialdefs(self):
+               self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
        def makeblacklistnames(self):
                return [
                        'SndDisposeChannel',            # automatic on deallocation
@@ -44,9 +47,12 @@ class SoundScanner(Scanner):
                        'GetSoundPreference',
                        'SetSoundPreference',
                        'GetCompressionInfo',
+                       'GetCompressionName',
                        # Calls with void_ptr arguments (to be done).
                        'SndGetInfo',
                        'SndSetInfo',
+                       'SPBGetDeviceInfo',
+                       'SPBSetDeviceInfo',
                        # And old calls that are no longer supported
                        'SetSoundVol',
                        'GetSoundVol',
@@ -60,6 +66,13 @@ class SoundScanner(Scanner):
                        "UnsignedFixed",
                        # Don't have the time to dig into this...
                        "Component",
+                       "ComponentInstance",
+                       "SoundComponentDataPtr",
+                       "SoundComponentData",
+                       "SoundComponentData_ptr",
+                       "SoundConverter",
+                       "ModalFilterUPP",
+                       "SPBPtr",
                        ]
 
        def makerepairinstructions(self):
index 611c262d8e1d5fa94cde97678f6bbc4e6f004efb..70891fffcc728cc55b74077fa5e1e3f32e791406 100644 (file)
@@ -216,8 +216,8 @@ static PyObject *TEObj_TEKey(_self, _args)
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short key;
-       if (!PyArg_ParseTuple(_args, "h",
+       CharParameter key;
+       if (!PyArg_ParseTuple(_args, "c",
                              &key))
                return NULL;
        TEKey(key,
@@ -736,7 +736,7 @@ static PyMethodDef TEObj_methods[] = {
        {"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1,
         "() -> None"},
        {"TEKey", (PyCFunction)TEObj_TEKey, 1,
-        "(short key) -> None"},
+        "(CharParameter key) -> None"},
        {"TECut", (PyCFunction)TEObj_TECut, 1,
         "() -> None"},
        {"TECopy", (PyCFunction)TEObj_TECopy, 1,
index eb5b046b46cfac090a852f0bf34b399630db65d0..ea24d6255b5557043fd5777061e5476d1653d64f 100644 (file)
@@ -102,220 +102,201 @@ static void WinObj_dealloc(self)
        PyMem_DEL(self);
 }
 
-static PyObject *WinObj_GetWTitle(_self, _args)
-       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_SelectWindow(_self, _args)
+static PyObject *WinObj_SetWinColor(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
+       WCTabHandle newColorTable;
+       if (!PyArg_ParseTuple(_args, "O&",
+                             ResObj_Convert, &newColorTable))
                return NULL;
-       SelectWindow(_self->ob_itself);
+       SetWinColor(_self->ob_itself,
+                   newColorTable);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_HideWindow(_self, _args)
+static PyObject *WinObj_ClipAbove(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       HideWindow(_self->ob_itself);
+       ClipAbove(_self->ob_itself);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_ShowWindow(_self, _args)
+static PyObject *WinObj_SaveOld(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       ShowWindow(_self->ob_itself);
+       SaveOld(_self->ob_itself);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_ShowHide(_self, _args)
+static PyObject *WinObj_DrawNew(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Boolean showFlag;
+       Boolean update;
        if (!PyArg_ParseTuple(_args, "b",
-                             &showFlag))
+                             &update))
                return NULL;
-       ShowHide(_self->ob_itself,
-                showFlag);
+       DrawNew(_self->ob_itself,
+               update);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_HiliteWindow(_self, _args)
+static PyObject *WinObj_PaintOne(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Boolean fHilite;
-       if (!PyArg_ParseTuple(_args, "b",
-                             &fHilite))
+       RgnHandle clobberedRgn;
+       if (!PyArg_ParseTuple(_args, "O&",
+                             ResObj_Convert, &clobberedRgn))
                return NULL;
-       HiliteWindow(_self->ob_itself,
-                    fHilite);
+       PaintOne(_self->ob_itself,
+                clobberedRgn);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_BringToFront(_self, _args)
+static PyObject *WinObj_PaintBehind(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
+       RgnHandle clobberedRgn;
+       if (!PyArg_ParseTuple(_args, "O&",
+                             ResObj_Convert, &clobberedRgn))
                return NULL;
-       BringToFront(_self->ob_itself);
+       PaintBehind(_self->ob_itself,
+                   clobberedRgn);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_SendBehind(_self, _args)
+static PyObject *WinObj_CalcVis(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       WindowPtr behindWindow;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             WinObj_Convert, &behindWindow))
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       SendBehind(_self->ob_itself,
-                  behindWindow);
+       CalcVis(_self->ob_itself);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_DrawGrowIcon(_self, _args)
+static PyObject *WinObj_CalcVisBehind(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
+       RgnHandle clobberedRgn;
+       if (!PyArg_ParseTuple(_args, "O&",
+                             ResObj_Convert, &clobberedRgn))
                return NULL;
-       DrawGrowIcon(_self->ob_itself);
+       CalcVisBehind(_self->ob_itself,
+                     clobberedRgn);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_MoveWindow(_self, _args)
+static PyObject *WinObj_BringToFront(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short hGlobal;
-       short vGlobal;
-       Boolean front;
-       if (!PyArg_ParseTuple(_args, "hhb",
-                             &hGlobal,
-                             &vGlobal,
-                             &front))
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       MoveWindow(_self->ob_itself,
-                  hGlobal,
-                  vGlobal,
-                  front);
+       BringToFront(_self->ob_itself);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_SizeWindow(_self, _args)
+static PyObject *WinObj_SendBehind(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short w;
-       short h;
-       Boolean fUpdate;
-       if (!PyArg_ParseTuple(_args, "hhb",
-                             &w,
-                             &h,
-                             &fUpdate))
+       WindowPtr behindWindow;
+       if (!PyArg_ParseTuple(_args, "O&",
+                             WinObj_Convert, &behindWindow))
                return NULL;
-       SizeWindow(_self->ob_itself,
-                  w,
-                  h,
-                  fUpdate);
+       SendBehind(_self->ob_itself,
+                  behindWindow);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_ZoomWindow(_self, _args)
+static PyObject *WinObj_SelectWindow(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short partCode;
-       Boolean front;
-       if (!PyArg_ParseTuple(_args, "hb",
-                             &partCode,
-                             &front))
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       ZoomWindow(_self->ob_itself,
-                  partCode,
-                  front);
+       SelectWindow(_self->ob_itself);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_BeginUpdate(_self, _args)
+static PyObject *WinObj_GetWindowFeatures(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
+       OSStatus _rv;
+       UInt32 outFeatures;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       BeginUpdate(_self->ob_itself);
-       Py_INCREF(Py_None);
-       _res = Py_None;
+       _rv = GetWindowFeatures(_self->ob_itself,
+                               &outFeatures);
+       _res = Py_BuildValue("ll",
+                            _rv,
+                            outFeatures);
        return _res;
 }
 
-static PyObject *WinObj_EndUpdate(_self, _args)
+static PyObject *WinObj_GetWindowRegion(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
+       OSStatus _rv;
+       WindowRegionCode inRegionCode;
+       RgnHandle ioWinRgn;
+       if (!PyArg_ParseTuple(_args, "hO&",
+                             &inRegionCode,
+                             ResObj_Convert, &ioWinRgn))
                return NULL;
-       EndUpdate(_self->ob_itself);
-       Py_INCREF(Py_None);
-       _res = Py_None;
+       _rv = GetWindowRegion(_self->ob_itself,
+                             inRegionCode,
+                             ioWinRgn);
+       _res = Py_BuildValue("l",
+                            _rv);
        return _res;
 }
 
@@ -379,208 +360,230 @@ static PyObject *WinObj_GetWindowPic(_self, _args)
        return _res;
 }
 
-static PyObject *WinObj_ClipAbove(_self, _args)
+static PyObject *WinObj_GetWVariant(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
+       short _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       ClipAbove(_self->ob_itself);
-       Py_INCREF(Py_None);
-       _res = Py_None;
+       _rv = GetWVariant(_self->ob_itself);
+       _res = Py_BuildValue("h",
+                            _rv);
        return _res;
 }
 
-static PyObject *WinObj_SaveOld(_self, _args)
+static PyObject *WinObj_BeginUpdate(_self, _args)
        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;
-}
-
-static PyObject *WinObj_DrawNew(_self, _args)
-       WindowObject *_self;
-       PyObject *_args;
-{
-       PyObject *_res = NULL;
-       Boolean update;
-       if (!PyArg_ParseTuple(_args, "b",
-                             &update))
-               return NULL;
-       DrawNew(_self->ob_itself,
-               update);
+       BeginUpdate(_self->ob_itself);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_PaintOne(_self, _args)
+static PyObject *WinObj_EndUpdate(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       RgnHandle clobberedRgn;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             ResObj_Convert, &clobberedRgn))
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       PaintOne(_self->ob_itself,
-                clobberedRgn);
+       EndUpdate(_self->ob_itself);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_PaintBehind(_self, _args)
+static PyObject *WinObj_DrawGrowIcon(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       RgnHandle clobberedRgn;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             ResObj_Convert, &clobberedRgn))
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       PaintBehind(_self->ob_itself,
-                   clobberedRgn);
+       DrawGrowIcon(_self->ob_itself);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_CalcVis(_self, _args)
+static PyObject *WinObj_HiliteWindow(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
+       Boolean fHilite;
+       if (!PyArg_ParseTuple(_args, "b",
+                             &fHilite))
                return NULL;
-       CalcVis(_self->ob_itself);
+       HiliteWindow(_self->ob_itself,
+                    fHilite);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_CalcVisBehind(_self, _args)
+static PyObject *WinObj_SetWTitle(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       RgnHandle clobberedRgn;
+       Str255 title;
        if (!PyArg_ParseTuple(_args, "O&",
-                             ResObj_Convert, &clobberedRgn))
+                             PyMac_GetStr255, title))
                return NULL;
-       CalcVisBehind(_self->ob_itself,
-                     clobberedRgn);
+       SetWTitle(_self->ob_itself,
+                 title);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_GrowWindow(_self, _args)
+static PyObject *WinObj_GetWTitle(_self, _args)
        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))
+       Str255 title;
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = GrowWindow(_self->ob_itself,
-                        startPt,
-                        &bBox);
-       _res = Py_BuildValue("l",
-                            _rv);
+       GetWTitle(_self->ob_itself,
+                 title);
+       _res = Py_BuildValue("O&",
+                            PyMac_BuildStr255, title);
        return _res;
 }
 
-static PyObject *WinObj_TrackBox(_self, _args)
+static PyObject *WinObj_IsWindowCollapsable(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
        Boolean _rv;
-       Point thePt;
-       short partCode;
-       if (!PyArg_ParseTuple(_args, "O&h",
-                             PyMac_GetPoint, &thePt,
-                             &partCode))
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       _rv = TrackBox(_self->ob_itself,
-                      thePt,
-                      partCode);
+       _rv = IsWindowCollapsable(_self->ob_itself);
        _res = Py_BuildValue("b",
                             _rv);
        return _res;
 }
 
-static PyObject *WinObj_SetWinColor(_self, _args)
+static PyObject *WinObj_IsWindowCollapsed(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       WCTabHandle newColorTable;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             ResObj_Convert, &newColorTable))
+       Boolean _rv;
+       if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       SetWinColor(_self->ob_itself,
-                   newColorTable);
-       Py_INCREF(Py_None);
-       _res = Py_None;
+       _rv = IsWindowCollapsed(_self->ob_itself);
+       _res = Py_BuildValue("b",
+                            _rv);
        return _res;
 }
 
-static PyObject *WinObj_GetWVariant(_self, _args)
+static PyObject *WinObj_CollapseWindow(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
-       if (!PyArg_ParseTuple(_args, ""))
+       OSStatus _rv;
+       Boolean inCollapseIt;
+       if (!PyArg_ParseTuple(_args, "b",
+                             &inCollapseIt))
                return NULL;
-       _rv = GetWVariant(_self->ob_itself);
-       _res = Py_BuildValue("h",
+       _rv = CollapseWindow(_self->ob_itself,
+                            inCollapseIt);
+       _res = Py_BuildValue("l",
                             _rv);
        return _res;
 }
 
-static PyObject *WinObj_SetWTitle(_self, _args)
+static PyObject *WinObj_MoveWindow(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Str255 title;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             PyMac_GetStr255, title))
+       short hGlobal;
+       short vGlobal;
+       Boolean front;
+       if (!PyArg_ParseTuple(_args, "hhb",
+                             &hGlobal,
+                             &vGlobal,
+                             &front))
                return NULL;
-       SetWTitle(_self->ob_itself,
-                 title);
+       MoveWindow(_self->ob_itself,
+                  hGlobal,
+                  vGlobal,
+                  front);
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
 }
 
-static PyObject *WinObj_TrackGoAway(_self, _args)
+static PyObject *WinObj_SizeWindow(_self, _args)
        WindowObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       Boolean _rv;
-       Point thePt;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             PyMac_GetPoint, &thePt))
+       short w;
+       short h;
+       Boolean fUpdate;
+       if (!PyArg_ParseTuple(_args, "hhb",
+                             &w,
+                             &h,
+                             &fUpdate))
                return NULL;
-       _rv = TrackGoAway(_self->ob_itself,
-                         thePt);
-       _res = Py_BuildValue("b",
+       SizeWindow(_self->ob_itself,
+                  w,
+                  h,
+                  fUpdate);
+       Py_INCREF(Py_None);
+       _res = Py_None;
+       return _res;
+}
+
+static PyObject *WinObj_ZoomWindow(_self, _args)
+       WindowObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       short 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_GrowWindow(_self, _args)
+       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;
 }
@@ -604,6 +607,85 @@ static PyObject *WinObj_DragWindow(_self, _args)
        return _res;
 }
 
+static PyObject *WinObj_HideWindow(_self, _args)
+       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_ShowWindow(_self, _args)
+       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 PyObject *WinObj_ShowHide(_self, _args)
+       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;
+}
+
+static PyObject *WinObj_TrackBox(_self, _args)
+       WindowObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       Boolean _rv;
+       Point thePt;
+       short 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(_self, _args)
+       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;
+}
+
 static PyObject *WinObj_GetAuxWin(_self, _args)
        WindowObject *_self;
        PyObject *_args;
@@ -873,34 +955,32 @@ static PyObject *WinObj_SetWindowUserState(_self, _args)
 }
 
 static PyMethodDef WinObj_methods[] = {
-       {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1,
-        "() -> (Str255 title)"},
-       {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1,
+       {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1,
+        "(WCTabHandle newColorTable) -> None"},
+       {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
         "() -> None"},
-       {"HideWindow", (PyCFunction)WinObj_HideWindow, 1,
+       {"SaveOld", (PyCFunction)WinObj_SaveOld, 1,
         "() -> None"},
-       {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1,
+       {"DrawNew", (PyCFunction)WinObj_DrawNew, 1,
+        "(Boolean update) -> None"},
+       {"PaintOne", (PyCFunction)WinObj_PaintOne, 1,
+        "(RgnHandle clobberedRgn) -> None"},
+       {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1,
+        "(RgnHandle clobberedRgn) -> None"},
+       {"CalcVis", (PyCFunction)WinObj_CalcVis, 1,
         "() -> None"},
-       {"ShowHide", (PyCFunction)WinObj_ShowHide, 1,
-        "(Boolean showFlag) -> None"},
-       {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1,
-        "(Boolean fHilite) -> None"},
+       {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1,
+        "(RgnHandle clobberedRgn) -> None"},
        {"BringToFront", (PyCFunction)WinObj_BringToFront, 1,
         "() -> None"},
        {"SendBehind", (PyCFunction)WinObj_SendBehind, 1,
         "(WindowPtr behindWindow) -> None"},
-       {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1,
-        "() -> None"},
-       {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,
-        "(short hGlobal, short vGlobal, Boolean front) -> None"},
-       {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1,
-        "(short w, short h, Boolean fUpdate) -> None"},
-       {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1,
-        "(short partCode, Boolean front) -> None"},
-       {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1,
-        "() -> None"},
-       {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1,
+       {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1,
         "() -> None"},
+       {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1,
+        "() -> (OSStatus _rv, UInt32 outFeatures)"},
+       {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1,
+        "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> (OSStatus _rv)"},
        {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1,
         "(long data) -> None"},
        {"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1,
@@ -909,34 +989,46 @@ static PyMethodDef WinObj_methods[] = {
         "(PicHandle pic) -> None"},
        {"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1,
         "() -> (PicHandle _rv)"},
-       {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
+       {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1,
+        "() -> (short _rv)"},
+       {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1,
         "() -> None"},
-       {"SaveOld", (PyCFunction)WinObj_SaveOld, 1,
+       {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1,
         "() -> None"},
-       {"DrawNew", (PyCFunction)WinObj_DrawNew, 1,
-        "(Boolean update) -> None"},
-       {"PaintOne", (PyCFunction)WinObj_PaintOne, 1,
-        "(RgnHandle clobberedRgn) -> None"},
-       {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1,
-        "(RgnHandle clobberedRgn) -> None"},
-       {"CalcVis", (PyCFunction)WinObj_CalcVis, 1,
+       {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1,
         "() -> None"},
-       {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1,
-        "(RgnHandle clobberedRgn) -> None"},
+       {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1,
+        "(Boolean fHilite) -> None"},
+       {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1,
+        "(Str255 title) -> None"},
+       {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1,
+        "() -> (Str255 title)"},
+       {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1,
+        "() -> (Boolean _rv)"},
+       {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1,
+        "() -> (Boolean _rv)"},
+       {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1,
+        "(Boolean inCollapseIt) -> (OSStatus _rv)"},
+       {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,
+        "(short hGlobal, short vGlobal, Boolean front) -> None"},
+       {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1,
+        "(short w, short h, Boolean fUpdate) -> None"},
+       {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1,
+        "(short partCode, Boolean front) -> None"},
        {"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1,
         "(Point startPt, Rect bBox) -> (long _rv)"},
+       {"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
+        "(Point startPt, Rect boundsRect) -> None"},
+       {"HideWindow", (PyCFunction)WinObj_HideWindow, 1,
+        "() -> None"},
+       {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1,
+        "() -> None"},
+       {"ShowHide", (PyCFunction)WinObj_ShowHide, 1,
+        "(Boolean showFlag) -> None"},
        {"TrackBox", (PyCFunction)WinObj_TrackBox, 1,
         "(Point thePt, short partCode) -> (Boolean _rv)"},
-       {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1,
-        "(WCTabHandle newColorTable) -> None"},
-       {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1,
-        "() -> (short _rv)"},
-       {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1,
-        "(Str255 title) -> None"},
        {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1,
         "(Point thePt) -> (Boolean _rv)"},
-       {"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
-        "(Point startPt, Rect boundsRect) -> None"},
        {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1,
         "() -> (Boolean _rv, AuxWinHandle awHndl)"},
        {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1,
@@ -1003,48 +1095,27 @@ PyTypeObject Window_Type = {
 /* --------------------- End object type Window --------------------- */
 
 
-static PyObject *Win_GetGrayRgn(_self, _args)
+static PyObject *Win_GetNewCWindow(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       RgnHandle _rv;
-       if (!PyArg_ParseTuple(_args, ""))
+       WindowPtr _rv;
+       short windowID;
+       WindowPtr behind;
+       if (!PyArg_ParseTuple(_args, "hO&",
+                             &windowID,
+                             WinObj_Convert, &behind))
                return NULL;
-       _rv = GetGrayRgn();
+       _rv = GetNewCWindow(windowID,
+                           (void *)0,
+                           behind);
        _res = Py_BuildValue("O&",
-                            ResObj_New, _rv);
+                            WinObj_New, _rv);
        return _res;
 }
 
-static PyObject *Win_InitWindows(_self, _args)
-       PyObject *_self;
-       PyObject *_args;
-{
-       PyObject *_res = NULL;
-       if (!PyArg_ParseTuple(_args, ""))
-               return NULL;
-       InitWindows();
-       Py_INCREF(Py_None);
-       _res = Py_None;
-       return _res;
-}
-
-static PyObject *Win_GetWMgrPort(_self, _args)
-       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;
-}
-
-static PyObject *Win_NewWindow(_self, _args)
+static PyObject *Win_NewWindow(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
@@ -1099,6 +1170,91 @@ static PyObject *Win_GetNewWindow(_self, _args)
        return _res;
 }
 
+static PyObject *Win_NewCWindow(_self, _args)
+       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_SetDeskCPat(_self, _args)
+       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;
+}
+
+static PyObject *Win_CheckUpdate(_self, _args)
+       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_FindWindow(_self, _args)
+       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 PyObject *Win_FrontWindow(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -1113,6 +1269,47 @@ static PyObject *Win_FrontWindow(_self, _args)
        return _res;
 }
 
+static PyObject *Win_InitWindows(_self, _args)
+       PyObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       if (!PyArg_ParseTuple(_args, ""))
+               return NULL;
+       InitWindows();
+       Py_INCREF(Py_None);
+       _res = Py_None;
+       return _res;
+}
+
+static PyObject *Win_GetWMgrPort(_self, _args)
+       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;
+}
+
+static PyObject *Win_GetCWMgrPort(_self, _args)
+       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;
+}
+
 static PyObject *Win_InvalRect(_self, _args)
        PyObject *_self;
        PyObject *_args;
@@ -1173,38 +1370,19 @@ static PyObject *Win_ValidRgn(_self, _args)
        return _res;
 }
 
-static PyObject *Win_CheckUpdate(_self, _args)
-       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_FindWindow(_self, _args)
+static PyObject *Win_CollapseAllWindows(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       short _rv;
-       Point thePoint;
-       WindowPtr theWindow;
-       if (!PyArg_ParseTuple(_args, "O&",
-                             PyMac_GetPoint, &thePoint))
+       OSStatus _rv;
+       Boolean inCollapseEm;
+       if (!PyArg_ParseTuple(_args, "b",
+                             &inCollapseEm))
                return NULL;
-       _rv = FindWindow(thePoint,
-                        &theWindow);
-       _res = Py_BuildValue("hO&",
-                            _rv,
-                            WinObj_WhichWindow, theWindow);
+       _rv = CollapseAllWindows(inCollapseEm);
+       _res = Py_BuildValue("l",
+                            _rv);
        return _res;
 }
 
@@ -1227,87 +1405,17 @@ static PyObject *Win_PinRect(_self, _args)
        return _res;
 }
 
-static PyObject *Win_GetCWMgrPort(_self, _args)
+static PyObject *Win_GetGrayRgn(_self, _args)
        PyObject *_self;
        PyObject *_args;
 {
        PyObject *_res = NULL;
-       CGrafPtr wMgrCPort;
+       RgnHandle _rv;
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
-       GetCWMgrPort(&wMgrCPort);
-       _res = Py_BuildValue("O&",
-                            GrafObj_New, wMgrCPort);
-       return _res;
-}
-
-static PyObject *Win_SetDeskCPat(_self, _args)
-       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;
-}
-
-static PyObject *Win_NewCWindow(_self, _args)
-       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_GetNewCWindow(_self, _args)
-       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);
+       _rv = GetGrayRgn();
        _res = Py_BuildValue("O&",
-                            WinObj_New, _rv);
+                            ResObj_New, _rv);
        return _res;
 }
 
@@ -1326,18 +1434,28 @@ static PyObject *Win_WhichWindow(_self, _args)
 }
 
 static PyMethodDef Win_methods[] = {
-       {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1,
-        "() -> (RgnHandle _rv)"},
-       {"InitWindows", (PyCFunction)Win_InitWindows, 1,
-        "() -> None"},
-       {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1,
-        "() -> (GrafPtr wPort)"},
+       {"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)"},
+       {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1,
+        "(PixPatHandle deskPixPat) -> None"},
+       {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1,
+        "() -> (Boolean _rv, EventRecord theEvent)"},
+       {"FindWindow", (PyCFunction)Win_FindWindow, 1,
+        "(Point thePoint) -> (short _rv, WindowPtr theWindow)"},
        {"FrontWindow", (PyCFunction)Win_FrontWindow, 1,
         "() -> (WindowPtr _rv)"},
+       {"InitWindows", (PyCFunction)Win_InitWindows, 1,
+        "() -> None"},
+       {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1,
+        "() -> (GrafPtr wPort)"},
+       {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1,
+        "() -> (CGrafPtr wMgrCPort)"},
        {"InvalRect", (PyCFunction)Win_InvalRect, 1,
         "(Rect badRect) -> None"},
        {"InvalRgn", (PyCFunction)Win_InvalRgn, 1,
@@ -1346,20 +1464,12 @@ static PyMethodDef Win_methods[] = {
         "(Rect goodRect) -> None"},
        {"ValidRgn", (PyCFunction)Win_ValidRgn, 1,
         "(RgnHandle goodRgn) -> None"},
-       {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1,
-        "() -> (Boolean _rv, EventRecord theEvent)"},
-       {"FindWindow", (PyCFunction)Win_FindWindow, 1,
-        "(Point thePoint) -> (short _rv, WindowPtr theWindow)"},
+       {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1,
+        "(Boolean inCollapseEm) -> (OSStatus _rv)"},
        {"PinRect", (PyCFunction)Win_PinRect, 1,
         "(Rect theRect, Point thePt) -> (long _rv)"},
-       {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1,
-        "() -> (CGrafPtr wMgrCPort)"},
-       {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1,
-        "(PixPatHandle deskPixPat) -> None"},
-       {"NewCWindow", (PyCFunction)Win_NewCWindow, 1,
-        "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
-       {"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1,
-        "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"},
+       {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1,
+        "() -> (RgnHandle _rv)"},
        {"WhichWindow", (PyCFunction)Win_WhichWindow, 1,
         "Resolve an integer WindowPtr address to a Window object"},
        {NULL, NULL, 0}
index cafe36f4129dda00c545aeff728c34c02ed89bc3..ae0462f821e31f9fa1bcff15d15c44573199721b 100644 (file)
@@ -6,7 +6,7 @@ from bgenlocations import TOOLBOXDIR
 from scantools import Scanner
 
 def main():
-       input = "Windows.h"
+       input = "MacWindows.h"
        output = "wingen.py"
        defsoutput = TOOLBOXDIR + "Windows.py"
        scanner = MyScanner(input, output, defsoutput)
@@ -28,6 +28,9 @@ class MyScanner(Scanner):
                                listname = "methods"
                return classname, listname
 
+       def writeinitialdefs(self):
+               self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+
        def makeblacklistnames(self):
                return [
                        'DisposeWindow', # Implied when the object is deleted
index 5b1b45e2cede7217198e8a3e5bdf2c88e896f534..001a4a463399aad7cf372516937ff67dd2707f3d 100644 (file)
@@ -38,6 +38,8 @@ WCTabHandle = OpaqueByValueType("WCTabHandle", "ResObj")
 AuxWinHandle = OpaqueByValueType("AuxWinHandle", "ResObj")
 PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
 
+WindowRegionCode = Type("WindowRegionCode", "h")
+
 includestuff = includestuff + """
 #include <%s>""" % MACHEADERFILE + """