diff options
author | Just van Rossum <just@letterror.com> | 2002-01-08 11:49:31 (GMT) |
---|---|---|
committer | Just van Rossum <just@letterror.com> | 2002-01-08 11:49:31 (GMT) |
commit | ec0107f0232325152bd74cf973c5da9358eecd24 (patch) | |
tree | d671fea559527cc86b1cc0e6de5e8cdbb303ce37 /Mac/Modules | |
parent | 925f14427416c1c5a8c6e71d17daac20e248c7b0 (diff) | |
download | cpython-ec0107f0232325152bd74cf973c5da9358eecd24.zip cpython-ec0107f0232325152bd74cf973c5da9358eecd24.tar.gz cpython-ec0107f0232325152bd74cf973c5da9358eecd24.tar.bz2 |
Today's Carbon Toolbox addition: CarbonEvt.TrackMouseLocation() and friends.
Diffstat (limited to 'Mac/Modules')
-rw-r--r-- | Mac/Modules/carbonevt/CarbonEvtscan.py | 6 | ||||
-rw-r--r-- | Mac/Modules/carbonevt/CarbonEvtsupport.py | 5 | ||||
-rwxr-xr-x | Mac/Modules/carbonevt/_CarbonEvtmodule.c | 78 |
3 files changed, 86 insertions, 3 deletions
diff --git a/Mac/Modules/carbonevt/CarbonEvtscan.py b/Mac/Modules/carbonevt/CarbonEvtscan.py index 37faa54..3539196 100644 --- a/Mac/Modules/carbonevt/CarbonEvtscan.py +++ b/Mac/Modules/carbonevt/CarbonEvtscan.py @@ -63,9 +63,9 @@ class CarbonEvents_Scanner(Scanner_OSX): return [ "sHandler", "MacCreateEvent", - "TrackMouseLocationWithOptions", - "TrackMouseLocation", - "TrackMouseRegion", +# "TrackMouseLocationWithOptions", +# "TrackMouseLocation", +# "TrackMouseRegion", "RegisterToolboxObjectClass", "UnregisterToolboxObjectClass", "ProcessHICommand", diff --git a/Mac/Modules/carbonevt/CarbonEvtsupport.py b/Mac/Modules/carbonevt/CarbonEvtsupport.py index 8ed13eb..cbaca2a 100644 --- a/Mac/Modules/carbonevt/CarbonEvtsupport.py +++ b/Mac/Modules/carbonevt/CarbonEvtsupport.py @@ -68,6 +68,11 @@ class EventHandlerRefMethod(OSErrMethodGenerator): OutRbrace() +RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") +GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj") +MouseTrackingResult = UInt16 + + includestuff = r""" #ifdef WITHOUT_FRAMEWORKS #include <CarbonEvents.h> diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c index 8488a2f..2099cff 100755 --- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c +++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c @@ -1390,6 +1390,78 @@ static PyObject *CarbonEvents_GetCurrentEventTime(PyObject *_self, PyObject *_ar return _res; } +static PyObject *CarbonEvents_TrackMouseLocation(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + GrafPtr inPort; + Point outPt; + UInt16 outResult; + if (!PyArg_ParseTuple(_args, "O&", + GrafObj_Convert, &inPort)) + return NULL; + _err = TrackMouseLocation(inPort, + &outPt, + &outResult); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&H", + PyMac_BuildPoint, outPt, + outResult); + return _res; +} + +static PyObject *CarbonEvents_TrackMouseLocationWithOptions(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + GrafPtr inPort; + OptionBits inOptions; + double inTimeout; + Point outPt; + UInt32 outModifiers; + UInt16 outResult; + if (!PyArg_ParseTuple(_args, "O&ld", + GrafObj_Convert, &inPort, + &inOptions, + &inTimeout)) + return NULL; + _err = TrackMouseLocationWithOptions(inPort, + inOptions, + inTimeout, + &outPt, + &outModifiers, + &outResult); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&lH", + PyMac_BuildPoint, outPt, + outModifiers, + outResult); + return _res; +} + +static PyObject *CarbonEvents_TrackMouseRegion(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + GrafPtr inPort; + RgnHandle inRegion; + Boolean ioWasInRgn; + UInt16 outResult; + if (!PyArg_ParseTuple(_args, "O&O&", + GrafObj_Convert, &inPort, + ResObj_Convert, &inRegion)) + return NULL; + _err = TrackMouseRegion(inPort, + inRegion, + &ioWasInRgn, + &outResult); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("bH", + ioWasInRgn, + outResult); + return _res; +} + static PyObject *CarbonEvents_GetLastUserEventTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1718,6 +1790,12 @@ static PyMethodDef CarbonEvents_methods[] = { "() -> (EventQueueRef _rv)"}, {"GetCurrentEventTime", (PyCFunction)CarbonEvents_GetCurrentEventTime, 1, "() -> (double _rv)"}, + {"TrackMouseLocation", (PyCFunction)CarbonEvents_TrackMouseLocation, 1, + "(GrafPtr inPort) -> (Point outPt, UInt16 outResult)"}, + {"TrackMouseLocationWithOptions", (PyCFunction)CarbonEvents_TrackMouseLocationWithOptions, 1, + "(GrafPtr inPort, OptionBits inOptions, double inTimeout) -> (Point outPt, UInt32 outModifiers, UInt16 outResult)"}, + {"TrackMouseRegion", (PyCFunction)CarbonEvents_TrackMouseRegion, 1, + "(GrafPtr inPort, RgnHandle inRegion) -> (Boolean ioWasInRgn, UInt16 outResult)"}, {"GetLastUserEventTime", (PyCFunction)CarbonEvents_GetLastUserEventTime, 1, "() -> (double _rv)"}, {"GetWindowEventTarget", (PyCFunction)CarbonEvents_GetWindowEventTarget, 1, |