|
14 | 14 |
|
15 | 15 | /* Macro to test whether a weak-loaded CFM function exists */ |
16 | 16 | #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
17 | | - PyErr_SetString(PyExc_NotImplementedError, \ |
18 | | - "Not available in this shared library/OS version"); \ |
19 | | - return NULL; \ |
| 17 | + PyErr_SetString(PyExc_NotImplementedError, \ |
| 18 | + "Not available in this shared library/OS version"); \ |
| 19 | + return NULL; \ |
20 | 20 | }} while(0) |
21 | 21 |
|
22 | 22 |
|
@@ -2300,6 +2300,24 @@ static PyObject *WinObj_ShowWindow(WindowObject *_self, PyObject *_args) |
2300 | 2300 | return _res; |
2301 | 2301 | } |
2302 | 2302 |
|
| 2303 | +static PyObject *WinObj_AutoDispose(WindowObject *_self, PyObject *_args) |
| 2304 | +{ |
| 2305 | + PyObject *_res = NULL; |
| 2306 | + |
| 2307 | + int onoff, old = 0; |
| 2308 | + if (!PyArg_ParseTuple(_args, "i", &onoff)) |
| 2309 | + return NULL; |
| 2310 | + if ( _self->ob_freeit ) |
| 2311 | + old = 1; |
| 2312 | + if ( onoff ) |
| 2313 | + _self->ob_freeit = PyMac_AutoDisposeWindow; |
| 2314 | + else |
| 2315 | + _self->ob_freeit = NULL; |
| 2316 | + _res = Py_BuildValue("i", old); |
| 2317 | + return _res; |
| 2318 | + |
| 2319 | +} |
| 2320 | + |
2303 | 2321 | static PyMethodDef WinObj_methods[] = { |
2304 | 2322 | {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1, |
2305 | 2323 | PyDoc_STR("() -> (UInt32 outCount)")}, |
@@ -2540,6 +2558,8 @@ static PyMethodDef WinObj_methods[] = { |
2540 | 2558 | PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")}, |
2541 | 2559 | {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1, |
2542 | 2560 | PyDoc_STR("() -> None")}, |
| 2561 | + {"AutoDispose", (PyCFunction)WinObj_AutoDispose, 1, |
| 2562 | + PyDoc_STR("(int)->int. Automatically DisposeHandle the object on Python object cleanup")}, |
2543 | 2563 | {NULL, NULL, 0} |
2544 | 2564 | }; |
2545 | 2565 |
|
|
0 commit comments