mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
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:
parent
a177228ff8
commit
1e054024c1
3 changed files with 97 additions and 1 deletions
|
@ -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"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue