summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/icn
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
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')
-rw-r--r--Mac/Modules/icn/_Icnmodule.c50
-rw-r--r--Mac/Modules/icn/icnscan.py4
-rw-r--r--Mac/Modules/icn/icnsupport.py1
3 files changed, 55 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}
diff --git a/Mac/Modules/icn/icnscan.py b/Mac/Modules/icn/icnscan.py
index 138cc62..c6a39f3 100644
--- a/Mac/Modules/icn/icnscan.py
+++ b/Mac/Modules/icn/icnscan.py
@@ -48,6 +48,8 @@ class MyScanner(Scanner):
"err",
# OS8 only
'IconServicesTerminate',
+ # Lazy, right now.
+ "GetIconRefFromFileInfo"
]
def makeblacklisttypes(self):
@@ -55,6 +57,7 @@ class MyScanner(Scanner):
"IconActionUPP",
"IconGetterUPP",
"CFragInitBlockPtr",
+ "CGRect_ptr",
]
def makerepairinstructions(self):
@@ -63,6 +66,7 @@ class MyScanner(Scanner):
def writeinitialdefs(self):
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
+ self.defsfile.write("from Carbon.Files import *\n")
if __name__ == "__main__":
main()
diff --git a/Mac/Modules/icn/icnsupport.py b/Mac/Modules/icn/icnsupport.py
index 9b4a68f..ef1dbf3 100644
--- a/Mac/Modules/icn/icnsupport.py
+++ b/Mac/Modules/icn/icnsupport.py
@@ -32,6 +32,7 @@ IconTransformType = Type("IconTransformType", "h")
IconSelectorValue = Type("IconSelectorValue", "l")
IconServicesUsageFlags = Type("IconServicesUsageFlags", "l")
RGBColor = OpaqueType("RGBColor", "QdRGB")
+CGContextRef = OpaqueByValueType("CGContextRef", "CGContextRefObj")
#WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)