diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1999-12-19 00:05:50 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1999-12-19 00:05:50 (GMT) |
commit | 1f9249cea92082a478c611c5762cf48b5752ccaf (patch) | |
tree | 182e631b7268d7469b3e65f31de971e13d0f2391 /Mac/Modules/ctl/ctlsupport.py | |
parent | 54b9ce1c4f400239eda936972e2133dffb242344 (diff) | |
download | cpython-1f9249cea92082a478c611c5762cf48b5752ccaf.zip cpython-1f9249cea92082a478c611c5762cf48b5752ccaf.tar.gz cpython-1f9249cea92082a478c611c5762cf48b5752ccaf.tar.bz2 |
Added {Get,Set}ControlDataHandle methods. These are {Get,Set}ControlData for
keys that expect a Handle, and have a ResObj as parameter.
Diffstat (limited to 'Mac/Modules/ctl/ctlsupport.py')
-rw-r--r-- | Mac/Modules/ctl/ctlsupport.py | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py index 70ae285..4a4620f 100644 --- a/Mac/Modules/ctl/ctlsupport.py +++ b/Mac/Modules/ctl/ctlsupport.py @@ -331,7 +331,77 @@ return _res; f = ManualGenerator("GetControlData", getcontroldata_body); f.docstring = lambda: "(part, type) -> String" object.add(f) -# end CJW + +# Manual Generator for SetControlDataHandle +setcontroldatahandle_body = """ +OSErr _err; +ControlPartCode inPart; +ResType inTagName; +Handle buffer; + +if (!PyArg_ParseTuple(_args, "hO&O&", + &inPart, + PyMac_GetOSType, &inTagName, + OptResObj_Convert, buffer)) + return NULL; + +_err = SetControlData(_self->ob_itself, + inPart, + inTagName, + sizeof(buffer), + (Ptr)buffer); + +if (_err != noErr) + return PyMac_Error(_err); +_res = Py_None; +return _res; +""" + +f = ManualGenerator("SetControlDataHandle", setcontroldatahandle_body); +f.docstring = lambda: "(ResObj) -> None" +object.add(f) + +# Manual Generator for GetControlDataHandle +getcontroldatahandle_body = """ +OSErr _err; +ControlPartCode inPart; +ResType inTagName; +Size bufferSize; +Handle hdl; + +if (!PyArg_ParseTuple(_args, "hO&", + &inPart, + PyMac_GetOSType, &inTagName)) + return NULL; + +/* Check it is handle-sized */ +_err = GetControlDataSize(_self->ob_itself, + inPart, + inTagName, + &bufferSize); +if (_err != noErr) + return PyMac_Error(_err); +if (bufferSize != sizeof(Handle)) { + PyErr_SetString(Ctl_Error, "GetControlDataSize() != sizeof(Handle)"); + return NULL; +} + +_err = GetControlData(_self->ob_itself, + inPart, + inTagName, + sizeof(Handle), + (Ptr)&hdl, + &bufferSize); + +if (_err != noErr) { + return PyMac_Error(_err); +} +return Py_BuildValue("O&", OptResObj_New, hdl); +""" + +f = ManualGenerator("GetControlDataHandle", getcontroldatahandle_body); +f.docstring = lambda: "(part, type) -> ResObj" +object.add(f) # And manual generators to get/set popup menu information getpopupdata_body = """ |