summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-06-18 20:16:33 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-06-18 20:16:33 (GMT)
commit5d56f4b4034476ae65412277175aa5254eb741cb (patch)
treea223b8c62421999393dcd627c97229c12e48e71b /Mac
parent80adc227d2d0a1854685e8ed5e3c273cc39fcd8b (diff)
downloadcpython-5d56f4b4034476ae65412277175aa5254eb741cb.zip
cpython-5d56f4b4034476ae65412277175aa5254eb741cb.tar.gz
cpython-5d56f4b4034476ae65412277175aa5254eb741cb.tar.bz2
Added as_Resource() method to convert ctl object to res object
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/ctl/Ctlmodule.c12
-rw-r--r--Mac/Modules/ctl/ctledit.py8
-rw-r--r--Mac/Modules/ctl/ctlsupport.py1
3 files changed, 21 insertions, 0 deletions
diff --git a/Mac/Modules/ctl/Ctlmodule.c b/Mac/Modules/ctl/Ctlmodule.c
index ed37de0..7267cd7 100644
--- a/Mac/Modules/ctl/Ctlmodule.c
+++ b/Mac/Modules/ctl/Ctlmodule.c
@@ -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
index 0000000..d877012
--- /dev/null
+++ b/Mac/Modules/ctl/ctledit.py
@@ -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)
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py
index 245a725..a8b45a5 100644
--- a/Mac/Modules/ctl/ctlsupport.py
+++ b/Mac/Modules/ctl/ctlsupport.py
@@ -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)