]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added as_Resource() method to convert ctl object to res object
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 18 Jun 1995 20:16:33 +0000 (20:16 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 18 Jun 1995 20:16:33 +0000 (20:16 +0000)
Mac/Modules/ctl/Ctlmodule.c
Mac/Modules/ctl/ctledit.py [new file with mode: 0644]
Mac/Modules/ctl/ctlsupport.py

index ed37de0744ff39063fba7f813e9758a1da1003cb..7267cd7880f8d3a08974da4b383357633305770f 100644 (file)
@@ -432,6 +432,16 @@ static PyObject *CtlObj_GetControlReference(_self, _args)
        return _res;
 }
 
+static PyObject *CtlObj_as_Resource(_self, _args)
+       ControlObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+
+       return ResObj_New((Handle)_self->ob_itself);
+
+}
+
 static PyMethodDef CtlObj_methods[] = {
        {"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1,
         "() -> None"},
@@ -477,6 +487,8 @@ static PyMethodDef CtlObj_methods[] = {
         "(SInt32 data) -> None"},
        {"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1,
         "() -> (SInt32 _rv)"},
+       {"as_Resource", (PyCFunction)CtlObj_as_Resource, 1,
+        "Return this Control as a Resource"},
        {NULL, NULL, 0}
 };
 
diff --git a/Mac/Modules/ctl/ctledit.py b/Mac/Modules/ctl/ctledit.py
new file mode 100644 (file)
index 0000000..d877012
--- /dev/null
@@ -0,0 +1,8 @@
+as_resource_body = """
+return ResObj_New((Handle)_self->ob_itself);
+"""
+
+f = ManualGenerator("as_Resource", as_resource_body)
+f.docstring = lambda : "Return this Control as a Resource"
+
+methods.append(f)
index 245a7253503b3eafa139dc0a1d3186c38197b789..a8b45a582063391aa48a52e39af1dbf8a4b68511 100644 (file)
@@ -82,6 +82,7 @@ Method = OSErrMethodGenerator
 functions = []
 methods = []
 execfile(INPUTFILE)
+execfile('ctledit.py')
 
 # add the populated lists to the generator groups
 for f in functions: module.add(f)