Just van Rossum | 7ec1c85 | 2001-12-13 21:24:37 +0000 | [diff] [blame] | 1 | # FindControlUnderMouse() returns an existing control, not a new one, |
| 2 | # so create this one by hand. |
| 3 | f = Function(ExistingControlHandle, 'FindControlUnderMouse', |
| 4 | (Point, 'inWhere', InMode), |
| 5 | (WindowRef, 'inWindow', InMode), |
| 6 | (SInt16, 'outPart', OutMode), |
| 7 | ) |
| 8 | functions.append(f) |
| 9 | |
Jack Jansen | e058189 | 1999-02-07 14:02:03 +0000 | [diff] [blame] | 10 | f = Function(ControlHandle, 'as_Control', |
Tim Peters | 182b5ac | 2004-07-18 06:16:08 +0000 | [diff] [blame] | 11 | (Handle, 'h', InMode)) |
Jack Jansen | e058189 | 1999-02-07 14:02:03 +0000 | [diff] [blame] | 12 | functions.append(f) |
| 13 | |
Jack Jansen | a1a0fef | 1999-12-23 14:32:06 +0000 | [diff] [blame] | 14 | f = Method(Handle, 'as_Resource', (ControlHandle, 'ctl', InMode)) |
Jack Jansen | 5d56f4b | 1995-06-18 20:16:33 +0000 | [diff] [blame] | 15 | methods.append(f) |
Jack Jansen | cfb60ee | 1996-10-01 10:46:46 +0000 | [diff] [blame] | 16 | |
Jack Jansen | 1a7d5b1 | 2000-03-21 16:25:23 +0000 | [diff] [blame] | 17 | f = Method(void, 'GetControlRect', (ControlHandle, 'ctl', InMode), (Rect, 'rect', OutMode)) |
| 18 | methods.append(f) |
| 19 | |
Jack Jansen | cfb60ee | 1996-10-01 10:46:46 +0000 | [diff] [blame] | 20 | DisposeControl_body = """ |
Tim Peters | 182b5ac | 2004-07-18 06:16:08 +0000 | [diff] [blame] | 21 | if (!PyArg_ParseTuple(_args, "")) |
| 22 | return NULL; |
| 23 | if ( _self->ob_itself ) { |
| 24 | SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */ |
| 25 | DisposeControl(_self->ob_itself); |
| 26 | _self->ob_itself = NULL; |
| 27 | } |
| 28 | Py_INCREF(Py_None); |
| 29 | _res = Py_None; |
| 30 | return _res; |
Jack Jansen | cfb60ee | 1996-10-01 10:46:46 +0000 | [diff] [blame] | 31 | """ |
| 32 | |
| 33 | f = ManualGenerator("DisposeControl", DisposeControl_body) |
| 34 | f.docstring = lambda : "() -> None" |
| 35 | |
| 36 | methods.append(f) |
Just van Rossum | 7ec1c85 | 2001-12-13 21:24:37 +0000 | [diff] [blame] | 37 | |
| 38 | # All CreateXxxXxxControl() functions return a new object in an output |
| 39 | # parameter; these should however be managed by us (we're creating them |
| 40 | # after all), so set the type to ControlRef. |
| 41 | for f in functions: |
Tim Peters | 182b5ac | 2004-07-18 06:16:08 +0000 | [diff] [blame] | 42 | if f.name.startswith("Create"): |
| 43 | v = f.argumentList[-1] |
| 44 | if v.type == ExistingControlHandle: |
| 45 | v.type = ControlRef |