summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/icn/_Icnmodule.c
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-12-03 23:20:13 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-12-03 23:20:13 (GMT)
commitda6081fccb71541004e3f36f57a9c0971a969e3b (patch)
tree1e2beac551e87964061e6fd9bfca22b35f1c7f2a /Mac/Modules/icn/_Icnmodule.c
parentfe3fe4adb5c7a72bfec3c5b7b8ec5e42d8ccc625 (diff)
downloadcpython-da6081fccb71541004e3f36f57a9c0971a969e3b.zip
cpython-da6081fccb71541004e3f36f57a9c0971a969e3b.tar.gz
cpython-da6081fccb71541004e3f36f57a9c0971a969e3b.tar.bz2
Ported to Universal Headers 3.4.2. Qd and Qt remain to be done.
Completely untested.
Diffstat (limited to 'Mac/Modules/icn/_Icnmodule.c')
-rw-r--r--Mac/Modules/icn/_Icnmodule.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/Mac/Modules/icn/_Icnmodule.c b/Mac/Modules/icn/_Icnmodule.c
index bbd59ab..2b43ed4 100644
--- a/Mac/Modules/icn/_Icnmodule.c
+++ b/Mac/Modules/icn/_Icnmodule.c
@@ -906,6 +906,32 @@ static PyObject *Icn_RegisterIconRefFromResource(PyObject *_self, PyObject *_arg
return _res;
}
+static PyObject *Icn_RegisterIconRefFromFSRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType creator;
+ OSType iconType;
+ FSRef iconFile;
+ IconRef theIconRef;
+#ifndef RegisterIconRefFromFSRef
+ PyMac_PRECHECK(RegisterIconRefFromFSRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetOSType, &creator,
+ PyMac_GetOSType, &iconType,
+ PyMac_GetFSRef, &iconFile))
+ return NULL;
+ _err = RegisterIconRefFromFSRef(creator,
+ iconType,
+ &iconFile,
+ &theIconRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, theIconRef);
+ return _res;
+}
+
static PyObject *Icn_UnregisterIconRef(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1381,6 +1407,26 @@ static PyObject *Icn_ReadIconFile(PyObject *_self, PyObject *_args)
return _res;
}
+static PyObject *Icn_ReadIconFromFSRef(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ FSRef ref;
+ IconFamilyHandle iconFamily;
+#ifndef ReadIconFromFSRef
+ PyMac_PRECHECK(ReadIconFromFSRef);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &ref))
+ return NULL;
+ _err = ReadIconFromFSRef(&ref,
+ &iconFamily);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, iconFamily);
+ return _res;
+}
+
static PyObject *Icn_WriteIconFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1479,6 +1525,8 @@ static PyMethodDef Icn_methods[] = {
PyDoc_STR("(OSType creator, OSType iconType, IconFamilyHandle iconFamily) -> (IconRef theIconRef)")},
{"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1,
PyDoc_STR("(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)")},
+ {"RegisterIconRefFromFSRef", (PyCFunction)Icn_RegisterIconRefFromFSRef, 1,
+ PyDoc_STR("(OSType creator, OSType iconType, FSRef iconFile) -> (IconRef theIconRef)")},
{"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1,
PyDoc_STR("(OSType creator, OSType iconType) -> None")},
{"UpdateIconRef", (PyCFunction)Icn_UpdateIconRef, 1,
@@ -1521,6 +1569,8 @@ static PyMethodDef Icn_methods[] = {
PyDoc_STR("(OSType creator, OSType iconType, FSSpec iconFile) -> (IconRef theIconRef)")},
{"ReadIconFile", (PyCFunction)Icn_ReadIconFile, 1,
PyDoc_STR("(FSSpec iconFile) -> (IconFamilyHandle iconFamily)")},
+ {"ReadIconFromFSRef", (PyCFunction)Icn_ReadIconFromFSRef, 1,
+ PyDoc_STR("(FSRef ref) -> (IconFamilyHandle iconFamily)")},
{"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1,
PyDoc_STR("(IconFamilyHandle iconFamily, FSSpec iconFile) -> None")},
{NULL, NULL, 0}