Exemplo n.º 1
0
/* get icon data from IPIcon */
OSErr	GetDataFromIPIcon(Handle *dataHandle,const IPIconRec *ipIcon,short iconKind)
{
	OSErr	err=noErr;
	
	*dataHandle = NULL;
	
	if (iconKind == kT32Data)
		*dataHandle = ipIcon->it32Data;
	else if (iconKind == kT8Mask)
		*dataHandle = ipIcon->t8mkData;
	else
	{
		if (ipIcon->iconSuite != NULL)
			err=GetIconFromSuite(dataHandle,ipIcon->iconSuite,gIconType[iconKind]);
	}
	
	return err;
}
Exemplo n.º 2
0
static PyObject *Icn_GetIconFromSuite(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	Handle theIconData;
	IconSuiteRef theSuite;
	ResType theType;
#ifndef GetIconFromSuite
	PyMac_PRECHECK(GetIconFromSuite);
#endif
	if (!PyArg_ParseTuple(_args, "O&O&",
	                      ResObj_Convert, &theSuite,
	                      PyMac_GetOSType, &theType))
		return NULL;
	_err = GetIconFromSuite(&theIconData,
	                        theSuite,
	                        theType);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("O&",
	                     ResObj_New, theIconData);
	return _res;
}