Added methods as_Menu and as_Control to convert a resource

to those object types

You can now set the data attribute of a resource with the expected
semantics (but you have to call ChangedResource yourself)
This commit is contained in:
Jack Jansen 1995-06-18 20:20:27 +00:00
parent a177228ff8
commit 1e054024c1
3 changed files with 97 additions and 1 deletions

View file

@ -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"))