Regenerated from Universal Headers 3.0.1. Some new calls are

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.
This commit is contained in:
Jack Jansen 1998-02-20 16:02:09 +00:00
parent cbe6a53d1f
commit 21f96872f2
28 changed files with 3151 additions and 1434 deletions

View 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}
};

View 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 @@ def makerepairinstructions(self):
[("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()

View file

@ -13,6 +13,9 @@
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 @@ def outputGetattrHook(self):
aedescmethods = []
execfile('aegen.py')
execfile('aedatamodelgen.py')
for f in functions: module.add(f)
for f in aedescmethods: aedescobject.add(f)

View file

@ -6,7 +6,7 @@
from bgenlocations import TOOLBOXDIR
LONG = "Components"
SHORT = "Cm"
SHORT = "cm"
def main():
input = "Components.h"
@ -38,6 +38,9 @@ def destination(self, type, name, arglist):
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",

View 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}
};

View file

@ -28,17 +28,39 @@ def destination(self, type, name, arglist):
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):

View file

@ -33,6 +33,16 @@
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 @@
#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 + """

View 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,50 +1004,12 @@ static PyObject *Dlg_SetDialogItemText(_self, _args)
return _res;
}
static PyObject *Dlg_NewColorDialog(_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))
return NULL;
_rv = NewColorDialog((void *)0,
&boundsRect,
title,
visible,
procID,
behind,
goAwayFlag,
refCon,
items);
_res = Py_BuildValue("O&",
DlgObj_New, _rv);
return _res;
}
static PyObject *Dlg_GetAlertStage(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
SInt16 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetAlertStage();
@ -927,6 +1018,21 @@ static PyObject *Dlg_GetAlertStage(_self, _args)
return _res;
}
static PyObject *Dlg_SetDialogFont(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
SInt16 value;
if (!PyArg_ParseTuple(_args, "h",
&value))
return NULL;
SetDialogFont(value);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Dlg_ResetAlertStage(_self, _args)
PyObject *_self;
PyObject *_args;
@ -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}
};

View file

@ -51,6 +51,7 @@ def makeblacklistnames(self):
def makeblacklisttypes(self):
return [
"AlertStdAlertParamPtr", # Too much work, for now
]
def makerepairinstructions(self):

View file

@ -24,6 +24,11 @@
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>

View file

@ -48,6 +48,76 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
static PyObject *Evt_Error;
static PyObject *Evt_GetMouse(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Point mouseLoc;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
GetMouse(&mouseLoc);
_res = Py_BuildValue("O&",
PyMac_BuildPoint, mouseLoc);
return _res;
}
static PyObject *Evt_Button(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = Button();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_StillDown(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = StillDown();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_WaitMouseUp(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = WaitMouseUp();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_TickCount(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = TickCount();
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *Evt_GetCaretTime(_self, _args)
PyObject *_self;
PyObject *_args;
@ -62,6 +132,35 @@ static PyObject *Evt_GetCaretTime(_self, _args)
return _res;
}
static PyObject *Evt_GetKeys(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
KeyMap theKeys__out__;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
GetKeys(theKeys__out__);
_res = Py_BuildValue("s#",
(char *)&theKeys__out__, (int)sizeof(KeyMap));
theKeys__error__: ;
return _res;
}
static PyObject *Evt_GetDblTime(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetDblTime();
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *Evt_SetEventMask(_self, _args)
PyObject *_self;
PyObject *_args;
@ -77,20 +176,6 @@ static PyObject *Evt_SetEventMask(_self, _args)
return _res;
}
static PyObject *Evt_GetDblTime(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetDblTime();
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *Evt_GetNextEvent(_self, _args)
PyObject *_self;
PyObject *_args;
@ -152,91 +237,6 @@ static PyObject *Evt_EventAvail(_self, _args)
return _res;
}
static PyObject *Evt_GetMouse(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Point mouseLoc;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
GetMouse(&mouseLoc);
_res = Py_BuildValue("O&",
PyMac_BuildPoint, mouseLoc);
return _res;
}
static PyObject *Evt_Button(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = Button();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_StillDown(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = StillDown();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_WaitMouseUp(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = WaitMouseUp();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_GetKeys(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
KeyMap theKeys__out__;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
GetKeys(theKeys__out__);
_res = Py_BuildValue("s#",
(char *)&theKeys__out__, (int)sizeof(KeyMap));
theKeys__error__: ;
return _res;
}
static PyObject *Evt_TickCount(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = TickCount();
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *Evt_PostEvent(_self, _args)
PyObject *_self;
PyObject *_args;
@ -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)"},
{"GetKeys", (PyCFunction)Evt_GetKeys, 1,
"() -> (KeyMap theKeys)"},
{"TickCount", (PyCFunction)Evt_TickCount, 1,
"() -> (UInt32 _rv)"},
{"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
"() -> (UInt32 _rv)"},
{"GetKeys", (PyCFunction)Evt_GetKeys, 1,
"() -> (KeyMap theKeys)"},
{"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
"() -> (UInt32 _rv)"},
{"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
"(EventMask value) -> None"},
{"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
"(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
{"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,

View file

@ -6,7 +6,7 @@
from bgenlocations import TOOLBOXDIR
LONG = "Fonts"
SHORT = "Fm"
SHORT = "fm"
def main():
input = "Fonts.h"
@ -29,6 +29,11 @@ def destination(self, type, name, arglist):
def makeblacklistnames(self):
return [
"OutlineMetrics", # Too complicated
"AntiTextIsAntiAliased", # XXXX Missing from library...
"AntiTextGetEnabled",
"AntiTextSetEnabled",
"AntiTextGetApplicationAware",
"AntiTextSetApplicationAware",
]
def makeblacklisttypes(self):

View 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,

View file

@ -33,6 +33,9 @@ def destination(self, type, name, arglist):
listname = "methods"
return classname, listname
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
def makeblacklistnames(self):
return [
]

View 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}
};

View file

@ -7,7 +7,7 @@
LONG = "Lists"
SHORT = "list"
OBJECT = "ListRef"
OBJECT = "ListHandle"
def main():
input = LONG + ".h"

View file

@ -13,7 +13,7 @@
# 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 @@
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)

File diff suppressed because it is too large Load diff

View 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,

View file

@ -72,6 +72,8 @@ def makeblacklistnames(self):
'InitCPort',
'CloseCPort',
'BitMapToRegionGlue',
'StdOpcode', # XXXX Missing from library...
]
def makeblacklisttypes(self):

View file

@ -32,6 +32,9 @@ def destination(self, type, name, arglist):
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

View 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,

View 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}
};

View file

@ -31,6 +31,9 @@ def destination(self, type, name, arglist):
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 @@ def makeblacklistnames(self):
'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 @@ def makeblacklisttypes(self):
"UnsignedFixed",
# Don't have the time to dig into this...
"Component",
"ComponentInstance",
"SoundComponentDataPtr",
"SoundComponentData",
"SoundComponentData_ptr",
"SoundConverter",
"ModalFilterUPP",
"SPBPtr",
]
def makerepairinstructions(self):

View 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,

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@
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 @@ def destination(self, type, name, arglist):
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

View file

@ -38,6 +38,8 @@
AuxWinHandle = OpaqueByValueType("AuxWinHandle", "ResObj")
PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
WindowRegionCode = Type("WindowRegionCode", "h")
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """