summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/res/resedit.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Modules/res/resedit.py')
-rw-r--r--Mac/Modules/res/resedit.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Mac/Modules/res/resedit.py b/Mac/Modules/res/resedit.py
index 5e54ef2..bffec5f 100644
--- a/Mac/Modules/res/resedit.py
+++ b/Mac/Modules/res/resedit.py
@@ -23,3 +23,19 @@ The created resource object is actually just a handle.
Apply AddResource() to write it to a resource file.
"""
functions.append(f)
+
+# Convert resources to other things.
+
+as_xxx_body = """
+return %sObj_New((%sHandle)_self->ob_itself);
+"""
+
+def genresconverter(longname, shortname):
+
+ f = ManualGenerator("as_%s"%longname, as_xxx_body%(shortname, longname))
+ docstring = "Return this resource/handle as a %s"%longname
+ f.docstring = lambda docstring=docstring: docstring
+ return f
+
+resmethods.append(genresconverter("Control", "Ctl"))
+resmethods.append(genresconverter("Menu", "Menu"))