From a177228ff8596f2457c8f527ec919c7c6f7c60fc Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Sun, 18 Jun 1995 20:17:27 +0000 Subject: [PATCH] Added as_Resource() method to convert menu object to res object --- Mac/Modules/menu/Menumodule.c | 12 ++++++++++++ Mac/Modules/menu/menuedit.py | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c index 3712691a33c..c0164600b7f 100644 --- a/Mac/Modules/menu/Menumodule.c +++ b/Mac/Modules/menu/Menumodule.c @@ -522,6 +522,16 @@ static PyObject *MenuObj_InsertIntlResMenu(_self, _args) return _res; } +static PyObject *MenuObj_as_Resource(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + + return ResObj_New((Handle)_self->ob_itself); + +} + static PyMethodDef MenuObj_methods[] = { {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1, "() -> None"}, @@ -573,6 +583,8 @@ static PyMethodDef MenuObj_methods[] = { "(short afterItem, short scriptFilter) -> None"}, {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1, "(ResType theType, short afterItem, short scriptFilter) -> None"}, + {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1, + "Return this Menu as a Resource"}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/menu/menuedit.py b/Mac/Modules/menu/menuedit.py index e50daddb92c..7d53cd513ce 100644 --- a/Mac/Modules/menu/menuedit.py +++ b/Mac/Modules/menu/menuedit.py @@ -2,3 +2,12 @@ (Str255, 'name', InMode), ) functions.append(f) + +as_resource_body = """ +return ResObj_New((Handle)_self->ob_itself); +""" + +f = ManualGenerator("as_Resource", as_resource_body) +f.docstring = lambda : "Return this Menu as a Resource" + +methods.append(f)