Unified handle-conversion scheme to
handle = Ctl.as_Resource(ctl)
ctl = Ctl.as_Control(handle)
and similarly for List, Menu, TE. The old handle.as_Control() methods are
still there for backward compatability.
diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c
index 52308b7..e40ace7 100644
--- a/Mac/Modules/menu/Menumodule.c
+++ b/Mac/Modules/menu/Menumodule.c
@@ -48,6 +48,7 @@
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
#define as_Menu(h) ((MenuHandle)h)
+#define as_Resource(h) ((Handle)h)
static PyObject *Menu_Error;
@@ -1123,9 +1124,13 @@
PyObject *_args;
{
PyObject *_res = NULL;
-
- return ResObj_New((Handle)_self->ob_itself);
-
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = as_Resource(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
}
static PyObject *MenuObj_AppendMenu(_self, _args)
@@ -1291,7 +1296,7 @@
{"IsMenuItemIconEnabled", (PyCFunction)MenuObj_IsMenuItemIconEnabled, 1,
"(UInt16 item) -> (Boolean _rv)"},
{"as_Resource", (PyCFunction)MenuObj_as_Resource, 1,
- "Return this Menu as a Resource"},
+ "() -> (Handle _rv)"},
{"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
"(Str255 data) -> None"},
{"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1,