| 1 | n/a | |
|---|
| 2 | n/a | /* ========================== Module _Icn =========================== */ |
|---|
| 3 | n/a | |
|---|
| 4 | n/a | #include "Python.h" |
|---|
| 5 | n/a | |
|---|
| 6 | n/a | |
|---|
| 7 | n/a | #ifndef __LP64__ |
|---|
| 8 | n/a | |
|---|
| 9 | n/a | #include "pymactoolbox.h" |
|---|
| 10 | n/a | |
|---|
| 11 | n/a | /* Macro to test whether a weak-loaded CFM function exists */ |
|---|
| 12 | n/a | #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
|---|
| 13 | n/a | PyErr_SetString(PyExc_NotImplementedError, \ |
|---|
| 14 | n/a | "Not available in this shared library/OS version"); \ |
|---|
| 15 | n/a | return NULL; \ |
|---|
| 16 | n/a | }} while(0) |
|---|
| 17 | n/a | |
|---|
| 18 | n/a | |
|---|
| 19 | n/a | #include <Carbon/Carbon.h> |
|---|
| 20 | n/a | |
|---|
| 21 | n/a | |
|---|
| 22 | n/a | static PyObject *Icn_Error; |
|---|
| 23 | n/a | |
|---|
| 24 | n/a | static PyObject *Icn_GetCIcon(PyObject *_self, PyObject *_args) |
|---|
| 25 | n/a | { |
|---|
| 26 | n/a | PyObject *_res = NULL; |
|---|
| 27 | n/a | CIconHandle _rv; |
|---|
| 28 | n/a | SInt16 iconID; |
|---|
| 29 | n/a | #ifndef GetCIcon |
|---|
| 30 | n/a | PyMac_PRECHECK(GetCIcon); |
|---|
| 31 | n/a | #endif |
|---|
| 32 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 33 | n/a | &iconID)) |
|---|
| 34 | n/a | return NULL; |
|---|
| 35 | n/a | _rv = GetCIcon(iconID); |
|---|
| 36 | n/a | _res = Py_BuildValue("O&", |
|---|
| 37 | n/a | ResObj_New, _rv); |
|---|
| 38 | n/a | return _res; |
|---|
| 39 | n/a | } |
|---|
| 40 | n/a | |
|---|
| 41 | n/a | static PyObject *Icn_PlotCIcon(PyObject *_self, PyObject *_args) |
|---|
| 42 | n/a | { |
|---|
| 43 | n/a | PyObject *_res = NULL; |
|---|
| 44 | n/a | Rect theRect; |
|---|
| 45 | n/a | CIconHandle theIcon; |
|---|
| 46 | n/a | #ifndef PlotCIcon |
|---|
| 47 | n/a | PyMac_PRECHECK(PlotCIcon); |
|---|
| 48 | n/a | #endif |
|---|
| 49 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 50 | n/a | PyMac_GetRect, &theRect, |
|---|
| 51 | n/a | ResObj_Convert, &theIcon)) |
|---|
| 52 | n/a | return NULL; |
|---|
| 53 | n/a | PlotCIcon(&theRect, |
|---|
| 54 | n/a | theIcon); |
|---|
| 55 | n/a | Py_INCREF(Py_None); |
|---|
| 56 | n/a | _res = Py_None; |
|---|
| 57 | n/a | return _res; |
|---|
| 58 | n/a | } |
|---|
| 59 | n/a | |
|---|
| 60 | n/a | static PyObject *Icn_DisposeCIcon(PyObject *_self, PyObject *_args) |
|---|
| 61 | n/a | { |
|---|
| 62 | n/a | PyObject *_res = NULL; |
|---|
| 63 | n/a | CIconHandle theIcon; |
|---|
| 64 | n/a | #ifndef DisposeCIcon |
|---|
| 65 | n/a | PyMac_PRECHECK(DisposeCIcon); |
|---|
| 66 | n/a | #endif |
|---|
| 67 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 68 | n/a | ResObj_Convert, &theIcon)) |
|---|
| 69 | n/a | return NULL; |
|---|
| 70 | n/a | DisposeCIcon(theIcon); |
|---|
| 71 | n/a | Py_INCREF(Py_None); |
|---|
| 72 | n/a | _res = Py_None; |
|---|
| 73 | n/a | return _res; |
|---|
| 74 | n/a | } |
|---|
| 75 | n/a | |
|---|
| 76 | n/a | static PyObject *Icn_GetIcon(PyObject *_self, PyObject *_args) |
|---|
| 77 | n/a | { |
|---|
| 78 | n/a | PyObject *_res = NULL; |
|---|
| 79 | n/a | Handle _rv; |
|---|
| 80 | n/a | SInt16 iconID; |
|---|
| 81 | n/a | #ifndef GetIcon |
|---|
| 82 | n/a | PyMac_PRECHECK(GetIcon); |
|---|
| 83 | n/a | #endif |
|---|
| 84 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 85 | n/a | &iconID)) |
|---|
| 86 | n/a | return NULL; |
|---|
| 87 | n/a | _rv = GetIcon(iconID); |
|---|
| 88 | n/a | _res = Py_BuildValue("O&", |
|---|
| 89 | n/a | ResObj_New, _rv); |
|---|
| 90 | n/a | return _res; |
|---|
| 91 | n/a | } |
|---|
| 92 | n/a | |
|---|
| 93 | n/a | static PyObject *Icn_PlotIcon(PyObject *_self, PyObject *_args) |
|---|
| 94 | n/a | { |
|---|
| 95 | n/a | PyObject *_res = NULL; |
|---|
| 96 | n/a | Rect theRect; |
|---|
| 97 | n/a | Handle theIcon; |
|---|
| 98 | n/a | #ifndef PlotIcon |
|---|
| 99 | n/a | PyMac_PRECHECK(PlotIcon); |
|---|
| 100 | n/a | #endif |
|---|
| 101 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 102 | n/a | PyMac_GetRect, &theRect, |
|---|
| 103 | n/a | ResObj_Convert, &theIcon)) |
|---|
| 104 | n/a | return NULL; |
|---|
| 105 | n/a | PlotIcon(&theRect, |
|---|
| 106 | n/a | theIcon); |
|---|
| 107 | n/a | Py_INCREF(Py_None); |
|---|
| 108 | n/a | _res = Py_None; |
|---|
| 109 | n/a | return _res; |
|---|
| 110 | n/a | } |
|---|
| 111 | n/a | |
|---|
| 112 | n/a | static PyObject *Icn_PlotIconID(PyObject *_self, PyObject *_args) |
|---|
| 113 | n/a | { |
|---|
| 114 | n/a | PyObject *_res = NULL; |
|---|
| 115 | n/a | OSErr _err; |
|---|
| 116 | n/a | Rect theRect; |
|---|
| 117 | n/a | IconAlignmentType align; |
|---|
| 118 | n/a | IconTransformType transform; |
|---|
| 119 | n/a | SInt16 theResID; |
|---|
| 120 | n/a | #ifndef PlotIconID |
|---|
| 121 | n/a | PyMac_PRECHECK(PlotIconID); |
|---|
| 122 | n/a | #endif |
|---|
| 123 | n/a | if (!PyArg_ParseTuple(_args, "O&hhh", |
|---|
| 124 | n/a | PyMac_GetRect, &theRect, |
|---|
| 125 | n/a | &align, |
|---|
| 126 | n/a | &transform, |
|---|
| 127 | n/a | &theResID)) |
|---|
| 128 | n/a | return NULL; |
|---|
| 129 | n/a | _err = PlotIconID(&theRect, |
|---|
| 130 | n/a | align, |
|---|
| 131 | n/a | transform, |
|---|
| 132 | n/a | theResID); |
|---|
| 133 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 134 | n/a | Py_INCREF(Py_None); |
|---|
| 135 | n/a | _res = Py_None; |
|---|
| 136 | n/a | return _res; |
|---|
| 137 | n/a | } |
|---|
| 138 | n/a | |
|---|
| 139 | n/a | static PyObject *Icn_NewIconSuite(PyObject *_self, PyObject *_args) |
|---|
| 140 | n/a | { |
|---|
| 141 | n/a | PyObject *_res = NULL; |
|---|
| 142 | n/a | OSErr _err; |
|---|
| 143 | n/a | IconSuiteRef theIconSuite; |
|---|
| 144 | n/a | #ifndef NewIconSuite |
|---|
| 145 | n/a | PyMac_PRECHECK(NewIconSuite); |
|---|
| 146 | n/a | #endif |
|---|
| 147 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 148 | n/a | return NULL; |
|---|
| 149 | n/a | _err = NewIconSuite(&theIconSuite); |
|---|
| 150 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 151 | n/a | _res = Py_BuildValue("O&", |
|---|
| 152 | n/a | ResObj_New, theIconSuite); |
|---|
| 153 | n/a | return _res; |
|---|
| 154 | n/a | } |
|---|
| 155 | n/a | |
|---|
| 156 | n/a | static PyObject *Icn_AddIconToSuite(PyObject *_self, PyObject *_args) |
|---|
| 157 | n/a | { |
|---|
| 158 | n/a | PyObject *_res = NULL; |
|---|
| 159 | n/a | OSErr _err; |
|---|
| 160 | n/a | Handle theIconData; |
|---|
| 161 | n/a | IconSuiteRef theSuite; |
|---|
| 162 | n/a | ResType theType; |
|---|
| 163 | n/a | #ifndef AddIconToSuite |
|---|
| 164 | n/a | PyMac_PRECHECK(AddIconToSuite); |
|---|
| 165 | n/a | #endif |
|---|
| 166 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 167 | n/a | ResObj_Convert, &theIconData, |
|---|
| 168 | n/a | ResObj_Convert, &theSuite, |
|---|
| 169 | n/a | PyMac_GetOSType, &theType)) |
|---|
| 170 | n/a | return NULL; |
|---|
| 171 | n/a | _err = AddIconToSuite(theIconData, |
|---|
| 172 | n/a | theSuite, |
|---|
| 173 | n/a | theType); |
|---|
| 174 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 175 | n/a | Py_INCREF(Py_None); |
|---|
| 176 | n/a | _res = Py_None; |
|---|
| 177 | n/a | return _res; |
|---|
| 178 | n/a | } |
|---|
| 179 | n/a | |
|---|
| 180 | n/a | static PyObject *Icn_GetIconFromSuite(PyObject *_self, PyObject *_args) |
|---|
| 181 | n/a | { |
|---|
| 182 | n/a | PyObject *_res = NULL; |
|---|
| 183 | n/a | OSErr _err; |
|---|
| 184 | n/a | Handle theIconData; |
|---|
| 185 | n/a | IconSuiteRef theSuite; |
|---|
| 186 | n/a | ResType theType; |
|---|
| 187 | n/a | #ifndef GetIconFromSuite |
|---|
| 188 | n/a | PyMac_PRECHECK(GetIconFromSuite); |
|---|
| 189 | n/a | #endif |
|---|
| 190 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 191 | n/a | ResObj_Convert, &theSuite, |
|---|
| 192 | n/a | PyMac_GetOSType, &theType)) |
|---|
| 193 | n/a | return NULL; |
|---|
| 194 | n/a | _err = GetIconFromSuite(&theIconData, |
|---|
| 195 | n/a | theSuite, |
|---|
| 196 | n/a | theType); |
|---|
| 197 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 198 | n/a | _res = Py_BuildValue("O&", |
|---|
| 199 | n/a | ResObj_New, theIconData); |
|---|
| 200 | n/a | return _res; |
|---|
| 201 | n/a | } |
|---|
| 202 | n/a | |
|---|
| 203 | n/a | static PyObject *Icn_GetIconSuite(PyObject *_self, PyObject *_args) |
|---|
| 204 | n/a | { |
|---|
| 205 | n/a | PyObject *_res = NULL; |
|---|
| 206 | n/a | OSErr _err; |
|---|
| 207 | n/a | IconSuiteRef theIconSuite; |
|---|
| 208 | n/a | SInt16 theResID; |
|---|
| 209 | n/a | IconSelectorValue selector; |
|---|
| 210 | n/a | #ifndef GetIconSuite |
|---|
| 211 | n/a | PyMac_PRECHECK(GetIconSuite); |
|---|
| 212 | n/a | #endif |
|---|
| 213 | n/a | if (!PyArg_ParseTuple(_args, "hl", |
|---|
| 214 | n/a | &theResID, |
|---|
| 215 | n/a | &selector)) |
|---|
| 216 | n/a | return NULL; |
|---|
| 217 | n/a | _err = GetIconSuite(&theIconSuite, |
|---|
| 218 | n/a | theResID, |
|---|
| 219 | n/a | selector); |
|---|
| 220 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 221 | n/a | _res = Py_BuildValue("O&", |
|---|
| 222 | n/a | ResObj_New, theIconSuite); |
|---|
| 223 | n/a | return _res; |
|---|
| 224 | n/a | } |
|---|
| 225 | n/a | |
|---|
| 226 | n/a | static PyObject *Icn_DisposeIconSuite(PyObject *_self, PyObject *_args) |
|---|
| 227 | n/a | { |
|---|
| 228 | n/a | PyObject *_res = NULL; |
|---|
| 229 | n/a | OSErr _err; |
|---|
| 230 | n/a | IconSuiteRef theIconSuite; |
|---|
| 231 | n/a | Boolean disposeData; |
|---|
| 232 | n/a | #ifndef DisposeIconSuite |
|---|
| 233 | n/a | PyMac_PRECHECK(DisposeIconSuite); |
|---|
| 234 | n/a | #endif |
|---|
| 235 | n/a | if (!PyArg_ParseTuple(_args, "O&b", |
|---|
| 236 | n/a | ResObj_Convert, &theIconSuite, |
|---|
| 237 | n/a | &disposeData)) |
|---|
| 238 | n/a | return NULL; |
|---|
| 239 | n/a | _err = DisposeIconSuite(theIconSuite, |
|---|
| 240 | n/a | disposeData); |
|---|
| 241 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 242 | n/a | Py_INCREF(Py_None); |
|---|
| 243 | n/a | _res = Py_None; |
|---|
| 244 | n/a | return _res; |
|---|
| 245 | n/a | } |
|---|
| 246 | n/a | |
|---|
| 247 | n/a | static PyObject *Icn_PlotIconSuite(PyObject *_self, PyObject *_args) |
|---|
| 248 | n/a | { |
|---|
| 249 | n/a | PyObject *_res = NULL; |
|---|
| 250 | n/a | OSErr _err; |
|---|
| 251 | n/a | Rect theRect; |
|---|
| 252 | n/a | IconAlignmentType align; |
|---|
| 253 | n/a | IconTransformType transform; |
|---|
| 254 | n/a | IconSuiteRef theIconSuite; |
|---|
| 255 | n/a | #ifndef PlotIconSuite |
|---|
| 256 | n/a | PyMac_PRECHECK(PlotIconSuite); |
|---|
| 257 | n/a | #endif |
|---|
| 258 | n/a | if (!PyArg_ParseTuple(_args, "O&hhO&", |
|---|
| 259 | n/a | PyMac_GetRect, &theRect, |
|---|
| 260 | n/a | &align, |
|---|
| 261 | n/a | &transform, |
|---|
| 262 | n/a | ResObj_Convert, &theIconSuite)) |
|---|
| 263 | n/a | return NULL; |
|---|
| 264 | n/a | _err = PlotIconSuite(&theRect, |
|---|
| 265 | n/a | align, |
|---|
| 266 | n/a | transform, |
|---|
| 267 | n/a | theIconSuite); |
|---|
| 268 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 269 | n/a | Py_INCREF(Py_None); |
|---|
| 270 | n/a | _res = Py_None; |
|---|
| 271 | n/a | return _res; |
|---|
| 272 | n/a | } |
|---|
| 273 | n/a | |
|---|
| 274 | n/a | static PyObject *Icn_LoadIconCache(PyObject *_self, PyObject *_args) |
|---|
| 275 | n/a | { |
|---|
| 276 | n/a | PyObject *_res = NULL; |
|---|
| 277 | n/a | OSErr _err; |
|---|
| 278 | n/a | Rect theRect; |
|---|
| 279 | n/a | IconAlignmentType align; |
|---|
| 280 | n/a | IconTransformType transform; |
|---|
| 281 | n/a | IconCacheRef theIconCache; |
|---|
| 282 | n/a | #ifndef LoadIconCache |
|---|
| 283 | n/a | PyMac_PRECHECK(LoadIconCache); |
|---|
| 284 | n/a | #endif |
|---|
| 285 | n/a | if (!PyArg_ParseTuple(_args, "O&hhO&", |
|---|
| 286 | n/a | PyMac_GetRect, &theRect, |
|---|
| 287 | n/a | &align, |
|---|
| 288 | n/a | &transform, |
|---|
| 289 | n/a | ResObj_Convert, &theIconCache)) |
|---|
| 290 | n/a | return NULL; |
|---|
| 291 | n/a | _err = LoadIconCache(&theRect, |
|---|
| 292 | n/a | align, |
|---|
| 293 | n/a | transform, |
|---|
| 294 | n/a | theIconCache); |
|---|
| 295 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 296 | n/a | Py_INCREF(Py_None); |
|---|
| 297 | n/a | _res = Py_None; |
|---|
| 298 | n/a | return _res; |
|---|
| 299 | n/a | } |
|---|
| 300 | n/a | |
|---|
| 301 | n/a | static PyObject *Icn_GetLabel(PyObject *_self, PyObject *_args) |
|---|
| 302 | n/a | { |
|---|
| 303 | n/a | PyObject *_res = NULL; |
|---|
| 304 | n/a | OSErr _err; |
|---|
| 305 | n/a | SInt16 labelNumber; |
|---|
| 306 | n/a | RGBColor labelColor; |
|---|
| 307 | n/a | Str255 labelString; |
|---|
| 308 | n/a | #ifndef GetLabel |
|---|
| 309 | n/a | PyMac_PRECHECK(GetLabel); |
|---|
| 310 | n/a | #endif |
|---|
| 311 | n/a | if (!PyArg_ParseTuple(_args, "hO&", |
|---|
| 312 | n/a | &labelNumber, |
|---|
| 313 | n/a | PyMac_GetStr255, labelString)) |
|---|
| 314 | n/a | return NULL; |
|---|
| 315 | n/a | _err = GetLabel(labelNumber, |
|---|
| 316 | n/a | &labelColor, |
|---|
| 317 | n/a | labelString); |
|---|
| 318 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 319 | n/a | _res = Py_BuildValue("O&", |
|---|
| 320 | n/a | QdRGB_New, &labelColor); |
|---|
| 321 | n/a | return _res; |
|---|
| 322 | n/a | } |
|---|
| 323 | n/a | |
|---|
| 324 | n/a | static PyObject *Icn_PtInIconID(PyObject *_self, PyObject *_args) |
|---|
| 325 | n/a | { |
|---|
| 326 | n/a | PyObject *_res = NULL; |
|---|
| 327 | n/a | Boolean _rv; |
|---|
| 328 | n/a | Point testPt; |
|---|
| 329 | n/a | Rect iconRect; |
|---|
| 330 | n/a | IconAlignmentType align; |
|---|
| 331 | n/a | SInt16 iconID; |
|---|
| 332 | n/a | #ifndef PtInIconID |
|---|
| 333 | n/a | PyMac_PRECHECK(PtInIconID); |
|---|
| 334 | n/a | #endif |
|---|
| 335 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hh", |
|---|
| 336 | n/a | PyMac_GetPoint, &testPt, |
|---|
| 337 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 338 | n/a | &align, |
|---|
| 339 | n/a | &iconID)) |
|---|
| 340 | n/a | return NULL; |
|---|
| 341 | n/a | _rv = PtInIconID(testPt, |
|---|
| 342 | n/a | &iconRect, |
|---|
| 343 | n/a | align, |
|---|
| 344 | n/a | iconID); |
|---|
| 345 | n/a | _res = Py_BuildValue("b", |
|---|
| 346 | n/a | _rv); |
|---|
| 347 | n/a | return _res; |
|---|
| 348 | n/a | } |
|---|
| 349 | n/a | |
|---|
| 350 | n/a | static PyObject *Icn_PtInIconSuite(PyObject *_self, PyObject *_args) |
|---|
| 351 | n/a | { |
|---|
| 352 | n/a | PyObject *_res = NULL; |
|---|
| 353 | n/a | Boolean _rv; |
|---|
| 354 | n/a | Point testPt; |
|---|
| 355 | n/a | Rect iconRect; |
|---|
| 356 | n/a | IconAlignmentType align; |
|---|
| 357 | n/a | IconSuiteRef theIconSuite; |
|---|
| 358 | n/a | #ifndef PtInIconSuite |
|---|
| 359 | n/a | PyMac_PRECHECK(PtInIconSuite); |
|---|
| 360 | n/a | #endif |
|---|
| 361 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hO&", |
|---|
| 362 | n/a | PyMac_GetPoint, &testPt, |
|---|
| 363 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 364 | n/a | &align, |
|---|
| 365 | n/a | ResObj_Convert, &theIconSuite)) |
|---|
| 366 | n/a | return NULL; |
|---|
| 367 | n/a | _rv = PtInIconSuite(testPt, |
|---|
| 368 | n/a | &iconRect, |
|---|
| 369 | n/a | align, |
|---|
| 370 | n/a | theIconSuite); |
|---|
| 371 | n/a | _res = Py_BuildValue("b", |
|---|
| 372 | n/a | _rv); |
|---|
| 373 | n/a | return _res; |
|---|
| 374 | n/a | } |
|---|
| 375 | n/a | |
|---|
| 376 | n/a | static PyObject *Icn_RectInIconID(PyObject *_self, PyObject *_args) |
|---|
| 377 | n/a | { |
|---|
| 378 | n/a | PyObject *_res = NULL; |
|---|
| 379 | n/a | Boolean _rv; |
|---|
| 380 | n/a | Rect testRect; |
|---|
| 381 | n/a | Rect iconRect; |
|---|
| 382 | n/a | IconAlignmentType align; |
|---|
| 383 | n/a | SInt16 iconID; |
|---|
| 384 | n/a | #ifndef RectInIconID |
|---|
| 385 | n/a | PyMac_PRECHECK(RectInIconID); |
|---|
| 386 | n/a | #endif |
|---|
| 387 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hh", |
|---|
| 388 | n/a | PyMac_GetRect, &testRect, |
|---|
| 389 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 390 | n/a | &align, |
|---|
| 391 | n/a | &iconID)) |
|---|
| 392 | n/a | return NULL; |
|---|
| 393 | n/a | _rv = RectInIconID(&testRect, |
|---|
| 394 | n/a | &iconRect, |
|---|
| 395 | n/a | align, |
|---|
| 396 | n/a | iconID); |
|---|
| 397 | n/a | _res = Py_BuildValue("b", |
|---|
| 398 | n/a | _rv); |
|---|
| 399 | n/a | return _res; |
|---|
| 400 | n/a | } |
|---|
| 401 | n/a | |
|---|
| 402 | n/a | static PyObject *Icn_RectInIconSuite(PyObject *_self, PyObject *_args) |
|---|
| 403 | n/a | { |
|---|
| 404 | n/a | PyObject *_res = NULL; |
|---|
| 405 | n/a | Boolean _rv; |
|---|
| 406 | n/a | Rect testRect; |
|---|
| 407 | n/a | Rect iconRect; |
|---|
| 408 | n/a | IconAlignmentType align; |
|---|
| 409 | n/a | IconSuiteRef theIconSuite; |
|---|
| 410 | n/a | #ifndef RectInIconSuite |
|---|
| 411 | n/a | PyMac_PRECHECK(RectInIconSuite); |
|---|
| 412 | n/a | #endif |
|---|
| 413 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hO&", |
|---|
| 414 | n/a | PyMac_GetRect, &testRect, |
|---|
| 415 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 416 | n/a | &align, |
|---|
| 417 | n/a | ResObj_Convert, &theIconSuite)) |
|---|
| 418 | n/a | return NULL; |
|---|
| 419 | n/a | _rv = RectInIconSuite(&testRect, |
|---|
| 420 | n/a | &iconRect, |
|---|
| 421 | n/a | align, |
|---|
| 422 | n/a | theIconSuite); |
|---|
| 423 | n/a | _res = Py_BuildValue("b", |
|---|
| 424 | n/a | _rv); |
|---|
| 425 | n/a | return _res; |
|---|
| 426 | n/a | } |
|---|
| 427 | n/a | |
|---|
| 428 | n/a | static PyObject *Icn_IconIDToRgn(PyObject *_self, PyObject *_args) |
|---|
| 429 | n/a | { |
|---|
| 430 | n/a | PyObject *_res = NULL; |
|---|
| 431 | n/a | OSErr _err; |
|---|
| 432 | n/a | RgnHandle theRgn; |
|---|
| 433 | n/a | Rect iconRect; |
|---|
| 434 | n/a | IconAlignmentType align; |
|---|
| 435 | n/a | SInt16 iconID; |
|---|
| 436 | n/a | #ifndef IconIDToRgn |
|---|
| 437 | n/a | PyMac_PRECHECK(IconIDToRgn); |
|---|
| 438 | n/a | #endif |
|---|
| 439 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hh", |
|---|
| 440 | n/a | ResObj_Convert, &theRgn, |
|---|
| 441 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 442 | n/a | &align, |
|---|
| 443 | n/a | &iconID)) |
|---|
| 444 | n/a | return NULL; |
|---|
| 445 | n/a | _err = IconIDToRgn(theRgn, |
|---|
| 446 | n/a | &iconRect, |
|---|
| 447 | n/a | align, |
|---|
| 448 | n/a | iconID); |
|---|
| 449 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 450 | n/a | Py_INCREF(Py_None); |
|---|
| 451 | n/a | _res = Py_None; |
|---|
| 452 | n/a | return _res; |
|---|
| 453 | n/a | } |
|---|
| 454 | n/a | |
|---|
| 455 | n/a | static PyObject *Icn_IconSuiteToRgn(PyObject *_self, PyObject *_args) |
|---|
| 456 | n/a | { |
|---|
| 457 | n/a | PyObject *_res = NULL; |
|---|
| 458 | n/a | OSErr _err; |
|---|
| 459 | n/a | RgnHandle theRgn; |
|---|
| 460 | n/a | Rect iconRect; |
|---|
| 461 | n/a | IconAlignmentType align; |
|---|
| 462 | n/a | IconSuiteRef theIconSuite; |
|---|
| 463 | n/a | #ifndef IconSuiteToRgn |
|---|
| 464 | n/a | PyMac_PRECHECK(IconSuiteToRgn); |
|---|
| 465 | n/a | #endif |
|---|
| 466 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hO&", |
|---|
| 467 | n/a | ResObj_Convert, &theRgn, |
|---|
| 468 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 469 | n/a | &align, |
|---|
| 470 | n/a | ResObj_Convert, &theIconSuite)) |
|---|
| 471 | n/a | return NULL; |
|---|
| 472 | n/a | _err = IconSuiteToRgn(theRgn, |
|---|
| 473 | n/a | &iconRect, |
|---|
| 474 | n/a | align, |
|---|
| 475 | n/a | theIconSuite); |
|---|
| 476 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 477 | n/a | Py_INCREF(Py_None); |
|---|
| 478 | n/a | _res = Py_None; |
|---|
| 479 | n/a | return _res; |
|---|
| 480 | n/a | } |
|---|
| 481 | n/a | |
|---|
| 482 | n/a | static PyObject *Icn_SetSuiteLabel(PyObject *_self, PyObject *_args) |
|---|
| 483 | n/a | { |
|---|
| 484 | n/a | PyObject *_res = NULL; |
|---|
| 485 | n/a | OSErr _err; |
|---|
| 486 | n/a | IconSuiteRef theSuite; |
|---|
| 487 | n/a | SInt16 theLabel; |
|---|
| 488 | n/a | #ifndef SetSuiteLabel |
|---|
| 489 | n/a | PyMac_PRECHECK(SetSuiteLabel); |
|---|
| 490 | n/a | #endif |
|---|
| 491 | n/a | if (!PyArg_ParseTuple(_args, "O&h", |
|---|
| 492 | n/a | ResObj_Convert, &theSuite, |
|---|
| 493 | n/a | &theLabel)) |
|---|
| 494 | n/a | return NULL; |
|---|
| 495 | n/a | _err = SetSuiteLabel(theSuite, |
|---|
| 496 | n/a | theLabel); |
|---|
| 497 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 498 | n/a | Py_INCREF(Py_None); |
|---|
| 499 | n/a | _res = Py_None; |
|---|
| 500 | n/a | return _res; |
|---|
| 501 | n/a | } |
|---|
| 502 | n/a | |
|---|
| 503 | n/a | static PyObject *Icn_GetSuiteLabel(PyObject *_self, PyObject *_args) |
|---|
| 504 | n/a | { |
|---|
| 505 | n/a | PyObject *_res = NULL; |
|---|
| 506 | n/a | SInt16 _rv; |
|---|
| 507 | n/a | IconSuiteRef theSuite; |
|---|
| 508 | n/a | #ifndef GetSuiteLabel |
|---|
| 509 | n/a | PyMac_PRECHECK(GetSuiteLabel); |
|---|
| 510 | n/a | #endif |
|---|
| 511 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 512 | n/a | ResObj_Convert, &theSuite)) |
|---|
| 513 | n/a | return NULL; |
|---|
| 514 | n/a | _rv = GetSuiteLabel(theSuite); |
|---|
| 515 | n/a | _res = Py_BuildValue("h", |
|---|
| 516 | n/a | _rv); |
|---|
| 517 | n/a | return _res; |
|---|
| 518 | n/a | } |
|---|
| 519 | n/a | |
|---|
| 520 | n/a | static PyObject *Icn_PlotIconHandle(PyObject *_self, PyObject *_args) |
|---|
| 521 | n/a | { |
|---|
| 522 | n/a | PyObject *_res = NULL; |
|---|
| 523 | n/a | OSErr _err; |
|---|
| 524 | n/a | Rect theRect; |
|---|
| 525 | n/a | IconAlignmentType align; |
|---|
| 526 | n/a | IconTransformType transform; |
|---|
| 527 | n/a | Handle theIcon; |
|---|
| 528 | n/a | #ifndef PlotIconHandle |
|---|
| 529 | n/a | PyMac_PRECHECK(PlotIconHandle); |
|---|
| 530 | n/a | #endif |
|---|
| 531 | n/a | if (!PyArg_ParseTuple(_args, "O&hhO&", |
|---|
| 532 | n/a | PyMac_GetRect, &theRect, |
|---|
| 533 | n/a | &align, |
|---|
| 534 | n/a | &transform, |
|---|
| 535 | n/a | ResObj_Convert, &theIcon)) |
|---|
| 536 | n/a | return NULL; |
|---|
| 537 | n/a | _err = PlotIconHandle(&theRect, |
|---|
| 538 | n/a | align, |
|---|
| 539 | n/a | transform, |
|---|
| 540 | n/a | theIcon); |
|---|
| 541 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 542 | n/a | Py_INCREF(Py_None); |
|---|
| 543 | n/a | _res = Py_None; |
|---|
| 544 | n/a | return _res; |
|---|
| 545 | n/a | } |
|---|
| 546 | n/a | |
|---|
| 547 | n/a | static PyObject *Icn_PlotSICNHandle(PyObject *_self, PyObject *_args) |
|---|
| 548 | n/a | { |
|---|
| 549 | n/a | PyObject *_res = NULL; |
|---|
| 550 | n/a | OSErr _err; |
|---|
| 551 | n/a | Rect theRect; |
|---|
| 552 | n/a | IconAlignmentType align; |
|---|
| 553 | n/a | IconTransformType transform; |
|---|
| 554 | n/a | Handle theSICN; |
|---|
| 555 | n/a | #ifndef PlotSICNHandle |
|---|
| 556 | n/a | PyMac_PRECHECK(PlotSICNHandle); |
|---|
| 557 | n/a | #endif |
|---|
| 558 | n/a | if (!PyArg_ParseTuple(_args, "O&hhO&", |
|---|
| 559 | n/a | PyMac_GetRect, &theRect, |
|---|
| 560 | n/a | &align, |
|---|
| 561 | n/a | &transform, |
|---|
| 562 | n/a | ResObj_Convert, &theSICN)) |
|---|
| 563 | n/a | return NULL; |
|---|
| 564 | n/a | _err = PlotSICNHandle(&theRect, |
|---|
| 565 | n/a | align, |
|---|
| 566 | n/a | transform, |
|---|
| 567 | n/a | theSICN); |
|---|
| 568 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 569 | n/a | Py_INCREF(Py_None); |
|---|
| 570 | n/a | _res = Py_None; |
|---|
| 571 | n/a | return _res; |
|---|
| 572 | n/a | } |
|---|
| 573 | n/a | |
|---|
| 574 | n/a | static PyObject *Icn_PlotCIconHandle(PyObject *_self, PyObject *_args) |
|---|
| 575 | n/a | { |
|---|
| 576 | n/a | PyObject *_res = NULL; |
|---|
| 577 | n/a | OSErr _err; |
|---|
| 578 | n/a | Rect theRect; |
|---|
| 579 | n/a | IconAlignmentType align; |
|---|
| 580 | n/a | IconTransformType transform; |
|---|
| 581 | n/a | CIconHandle theCIcon; |
|---|
| 582 | n/a | #ifndef PlotCIconHandle |
|---|
| 583 | n/a | PyMac_PRECHECK(PlotCIconHandle); |
|---|
| 584 | n/a | #endif |
|---|
| 585 | n/a | if (!PyArg_ParseTuple(_args, "O&hhO&", |
|---|
| 586 | n/a | PyMac_GetRect, &theRect, |
|---|
| 587 | n/a | &align, |
|---|
| 588 | n/a | &transform, |
|---|
| 589 | n/a | ResObj_Convert, &theCIcon)) |
|---|
| 590 | n/a | return NULL; |
|---|
| 591 | n/a | _err = PlotCIconHandle(&theRect, |
|---|
| 592 | n/a | align, |
|---|
| 593 | n/a | transform, |
|---|
| 594 | n/a | theCIcon); |
|---|
| 595 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 596 | n/a | Py_INCREF(Py_None); |
|---|
| 597 | n/a | _res = Py_None; |
|---|
| 598 | n/a | return _res; |
|---|
| 599 | n/a | } |
|---|
| 600 | n/a | |
|---|
| 601 | n/a | static PyObject *Icn_IconRefToIconFamily(PyObject *_self, PyObject *_args) |
|---|
| 602 | n/a | { |
|---|
| 603 | n/a | PyObject *_res = NULL; |
|---|
| 604 | n/a | OSErr _err; |
|---|
| 605 | n/a | IconRef theIconRef; |
|---|
| 606 | n/a | IconSelectorValue whichIcons; |
|---|
| 607 | n/a | IconFamilyHandle iconFamily; |
|---|
| 608 | n/a | #ifndef IconRefToIconFamily |
|---|
| 609 | n/a | PyMac_PRECHECK(IconRefToIconFamily); |
|---|
| 610 | n/a | #endif |
|---|
| 611 | n/a | if (!PyArg_ParseTuple(_args, "O&l", |
|---|
| 612 | n/a | ResObj_Convert, &theIconRef, |
|---|
| 613 | n/a | &whichIcons)) |
|---|
| 614 | n/a | return NULL; |
|---|
| 615 | n/a | _err = IconRefToIconFamily(theIconRef, |
|---|
| 616 | n/a | whichIcons, |
|---|
| 617 | n/a | &iconFamily); |
|---|
| 618 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 619 | n/a | _res = Py_BuildValue("O&", |
|---|
| 620 | n/a | ResObj_New, iconFamily); |
|---|
| 621 | n/a | return _res; |
|---|
| 622 | n/a | } |
|---|
| 623 | n/a | |
|---|
| 624 | n/a | static PyObject *Icn_IconFamilyToIconSuite(PyObject *_self, PyObject *_args) |
|---|
| 625 | n/a | { |
|---|
| 626 | n/a | PyObject *_res = NULL; |
|---|
| 627 | n/a | OSErr _err; |
|---|
| 628 | n/a | IconFamilyHandle iconFamily; |
|---|
| 629 | n/a | IconSelectorValue whichIcons; |
|---|
| 630 | n/a | IconSuiteRef iconSuite; |
|---|
| 631 | n/a | #ifndef IconFamilyToIconSuite |
|---|
| 632 | n/a | PyMac_PRECHECK(IconFamilyToIconSuite); |
|---|
| 633 | n/a | #endif |
|---|
| 634 | n/a | if (!PyArg_ParseTuple(_args, "O&l", |
|---|
| 635 | n/a | ResObj_Convert, &iconFamily, |
|---|
| 636 | n/a | &whichIcons)) |
|---|
| 637 | n/a | return NULL; |
|---|
| 638 | n/a | _err = IconFamilyToIconSuite(iconFamily, |
|---|
| 639 | n/a | whichIcons, |
|---|
| 640 | n/a | &iconSuite); |
|---|
| 641 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 642 | n/a | _res = Py_BuildValue("O&", |
|---|
| 643 | n/a | ResObj_New, iconSuite); |
|---|
| 644 | n/a | return _res; |
|---|
| 645 | n/a | } |
|---|
| 646 | n/a | |
|---|
| 647 | n/a | static PyObject *Icn_IconSuiteToIconFamily(PyObject *_self, PyObject *_args) |
|---|
| 648 | n/a | { |
|---|
| 649 | n/a | PyObject *_res = NULL; |
|---|
| 650 | n/a | OSErr _err; |
|---|
| 651 | n/a | IconSuiteRef iconSuite; |
|---|
| 652 | n/a | IconSelectorValue whichIcons; |
|---|
| 653 | n/a | IconFamilyHandle iconFamily; |
|---|
| 654 | n/a | #ifndef IconSuiteToIconFamily |
|---|
| 655 | n/a | PyMac_PRECHECK(IconSuiteToIconFamily); |
|---|
| 656 | n/a | #endif |
|---|
| 657 | n/a | if (!PyArg_ParseTuple(_args, "O&l", |
|---|
| 658 | n/a | ResObj_Convert, &iconSuite, |
|---|
| 659 | n/a | &whichIcons)) |
|---|
| 660 | n/a | return NULL; |
|---|
| 661 | n/a | _err = IconSuiteToIconFamily(iconSuite, |
|---|
| 662 | n/a | whichIcons, |
|---|
| 663 | n/a | &iconFamily); |
|---|
| 664 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 665 | n/a | _res = Py_BuildValue("O&", |
|---|
| 666 | n/a | ResObj_New, iconFamily); |
|---|
| 667 | n/a | return _res; |
|---|
| 668 | n/a | } |
|---|
| 669 | n/a | |
|---|
| 670 | n/a | static PyObject *Icn_SetIconFamilyData(PyObject *_self, PyObject *_args) |
|---|
| 671 | n/a | { |
|---|
| 672 | n/a | PyObject *_res = NULL; |
|---|
| 673 | n/a | OSErr _err; |
|---|
| 674 | n/a | IconFamilyHandle iconFamily; |
|---|
| 675 | n/a | OSType iconType; |
|---|
| 676 | n/a | Handle h; |
|---|
| 677 | n/a | #ifndef SetIconFamilyData |
|---|
| 678 | n/a | PyMac_PRECHECK(SetIconFamilyData); |
|---|
| 679 | n/a | #endif |
|---|
| 680 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 681 | n/a | ResObj_Convert, &iconFamily, |
|---|
| 682 | n/a | PyMac_GetOSType, &iconType, |
|---|
| 683 | n/a | ResObj_Convert, &h)) |
|---|
| 684 | n/a | return NULL; |
|---|
| 685 | n/a | _err = SetIconFamilyData(iconFamily, |
|---|
| 686 | n/a | iconType, |
|---|
| 687 | n/a | h); |
|---|
| 688 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 689 | n/a | Py_INCREF(Py_None); |
|---|
| 690 | n/a | _res = Py_None; |
|---|
| 691 | n/a | return _res; |
|---|
| 692 | n/a | } |
|---|
| 693 | n/a | |
|---|
| 694 | n/a | static PyObject *Icn_GetIconFamilyData(PyObject *_self, PyObject *_args) |
|---|
| 695 | n/a | { |
|---|
| 696 | n/a | PyObject *_res = NULL; |
|---|
| 697 | n/a | OSErr _err; |
|---|
| 698 | n/a | IconFamilyHandle iconFamily; |
|---|
| 699 | n/a | OSType iconType; |
|---|
| 700 | n/a | Handle h; |
|---|
| 701 | n/a | #ifndef GetIconFamilyData |
|---|
| 702 | n/a | PyMac_PRECHECK(GetIconFamilyData); |
|---|
| 703 | n/a | #endif |
|---|
| 704 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 705 | n/a | ResObj_Convert, &iconFamily, |
|---|
| 706 | n/a | PyMac_GetOSType, &iconType, |
|---|
| 707 | n/a | ResObj_Convert, &h)) |
|---|
| 708 | n/a | return NULL; |
|---|
| 709 | n/a | _err = GetIconFamilyData(iconFamily, |
|---|
| 710 | n/a | iconType, |
|---|
| 711 | n/a | h); |
|---|
| 712 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 713 | n/a | Py_INCREF(Py_None); |
|---|
| 714 | n/a | _res = Py_None; |
|---|
| 715 | n/a | return _res; |
|---|
| 716 | n/a | } |
|---|
| 717 | n/a | |
|---|
| 718 | n/a | static PyObject *Icn_GetIconRefOwners(PyObject *_self, PyObject *_args) |
|---|
| 719 | n/a | { |
|---|
| 720 | n/a | PyObject *_res = NULL; |
|---|
| 721 | n/a | OSErr _err; |
|---|
| 722 | n/a | IconRef theIconRef; |
|---|
| 723 | n/a | UInt16 owners; |
|---|
| 724 | n/a | #ifndef GetIconRefOwners |
|---|
| 725 | n/a | PyMac_PRECHECK(GetIconRefOwners); |
|---|
| 726 | n/a | #endif |
|---|
| 727 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 728 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 729 | n/a | return NULL; |
|---|
| 730 | n/a | _err = GetIconRefOwners(theIconRef, |
|---|
| 731 | n/a | &owners); |
|---|
| 732 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 733 | n/a | _res = Py_BuildValue("H", |
|---|
| 734 | n/a | owners); |
|---|
| 735 | n/a | return _res; |
|---|
| 736 | n/a | } |
|---|
| 737 | n/a | |
|---|
| 738 | n/a | static PyObject *Icn_AcquireIconRef(PyObject *_self, PyObject *_args) |
|---|
| 739 | n/a | { |
|---|
| 740 | n/a | PyObject *_res = NULL; |
|---|
| 741 | n/a | OSErr _err; |
|---|
| 742 | n/a | IconRef theIconRef; |
|---|
| 743 | n/a | #ifndef AcquireIconRef |
|---|
| 744 | n/a | PyMac_PRECHECK(AcquireIconRef); |
|---|
| 745 | n/a | #endif |
|---|
| 746 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 747 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 748 | n/a | return NULL; |
|---|
| 749 | n/a | _err = AcquireIconRef(theIconRef); |
|---|
| 750 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 751 | n/a | Py_INCREF(Py_None); |
|---|
| 752 | n/a | _res = Py_None; |
|---|
| 753 | n/a | return _res; |
|---|
| 754 | n/a | } |
|---|
| 755 | n/a | |
|---|
| 756 | n/a | static PyObject *Icn_ReleaseIconRef(PyObject *_self, PyObject *_args) |
|---|
| 757 | n/a | { |
|---|
| 758 | n/a | PyObject *_res = NULL; |
|---|
| 759 | n/a | OSErr _err; |
|---|
| 760 | n/a | IconRef theIconRef; |
|---|
| 761 | n/a | #ifndef ReleaseIconRef |
|---|
| 762 | n/a | PyMac_PRECHECK(ReleaseIconRef); |
|---|
| 763 | n/a | #endif |
|---|
| 764 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 765 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 766 | n/a | return NULL; |
|---|
| 767 | n/a | _err = ReleaseIconRef(theIconRef); |
|---|
| 768 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 769 | n/a | Py_INCREF(Py_None); |
|---|
| 770 | n/a | _res = Py_None; |
|---|
| 771 | n/a | return _res; |
|---|
| 772 | n/a | } |
|---|
| 773 | n/a | |
|---|
| 774 | n/a | static PyObject *Icn_GetIconRefFromFile(PyObject *_self, PyObject *_args) |
|---|
| 775 | n/a | { |
|---|
| 776 | n/a | PyObject *_res = NULL; |
|---|
| 777 | n/a | OSErr _err; |
|---|
| 778 | n/a | FSSpec theFile; |
|---|
| 779 | n/a | IconRef theIconRef; |
|---|
| 780 | n/a | SInt16 theLabel; |
|---|
| 781 | n/a | #ifndef GetIconRefFromFile |
|---|
| 782 | n/a | PyMac_PRECHECK(GetIconRefFromFile); |
|---|
| 783 | n/a | #endif |
|---|
| 784 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 785 | n/a | PyMac_GetFSSpec, &theFile)) |
|---|
| 786 | n/a | return NULL; |
|---|
| 787 | n/a | _err = GetIconRefFromFile(&theFile, |
|---|
| 788 | n/a | &theIconRef, |
|---|
| 789 | n/a | &theLabel); |
|---|
| 790 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 791 | n/a | _res = Py_BuildValue("O&h", |
|---|
| 792 | n/a | ResObj_New, theIconRef, |
|---|
| 793 | n/a | theLabel); |
|---|
| 794 | n/a | return _res; |
|---|
| 795 | n/a | } |
|---|
| 796 | n/a | |
|---|
| 797 | n/a | static PyObject *Icn_GetIconRef(PyObject *_self, PyObject *_args) |
|---|
| 798 | n/a | { |
|---|
| 799 | n/a | PyObject *_res = NULL; |
|---|
| 800 | n/a | OSErr _err; |
|---|
| 801 | n/a | SInt16 vRefNum; |
|---|
| 802 | n/a | OSType creator; |
|---|
| 803 | n/a | OSType iconType; |
|---|
| 804 | n/a | IconRef theIconRef; |
|---|
| 805 | n/a | #ifndef GetIconRef |
|---|
| 806 | n/a | PyMac_PRECHECK(GetIconRef); |
|---|
| 807 | n/a | #endif |
|---|
| 808 | n/a | if (!PyArg_ParseTuple(_args, "hO&O&", |
|---|
| 809 | n/a | &vRefNum, |
|---|
| 810 | n/a | PyMac_GetOSType, &creator, |
|---|
| 811 | n/a | PyMac_GetOSType, &iconType)) |
|---|
| 812 | n/a | return NULL; |
|---|
| 813 | n/a | _err = GetIconRef(vRefNum, |
|---|
| 814 | n/a | creator, |
|---|
| 815 | n/a | iconType, |
|---|
| 816 | n/a | &theIconRef); |
|---|
| 817 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 818 | n/a | _res = Py_BuildValue("O&", |
|---|
| 819 | n/a | ResObj_New, theIconRef); |
|---|
| 820 | n/a | return _res; |
|---|
| 821 | n/a | } |
|---|
| 822 | n/a | |
|---|
| 823 | n/a | static PyObject *Icn_GetIconRefFromFolder(PyObject *_self, PyObject *_args) |
|---|
| 824 | n/a | { |
|---|
| 825 | n/a | PyObject *_res = NULL; |
|---|
| 826 | n/a | OSErr _err; |
|---|
| 827 | n/a | SInt16 vRefNum; |
|---|
| 828 | n/a | SInt32 parentFolderID; |
|---|
| 829 | n/a | SInt32 folderID; |
|---|
| 830 | n/a | SInt8 attributes; |
|---|
| 831 | n/a | SInt8 accessPrivileges; |
|---|
| 832 | n/a | IconRef theIconRef; |
|---|
| 833 | n/a | #ifndef GetIconRefFromFolder |
|---|
| 834 | n/a | PyMac_PRECHECK(GetIconRefFromFolder); |
|---|
| 835 | n/a | #endif |
|---|
| 836 | n/a | if (!PyArg_ParseTuple(_args, "hllbb", |
|---|
| 837 | n/a | &vRefNum, |
|---|
| 838 | n/a | &parentFolderID, |
|---|
| 839 | n/a | &folderID, |
|---|
| 840 | n/a | &attributes, |
|---|
| 841 | n/a | &accessPrivileges)) |
|---|
| 842 | n/a | return NULL; |
|---|
| 843 | n/a | _err = GetIconRefFromFolder(vRefNum, |
|---|
| 844 | n/a | parentFolderID, |
|---|
| 845 | n/a | folderID, |
|---|
| 846 | n/a | attributes, |
|---|
| 847 | n/a | accessPrivileges, |
|---|
| 848 | n/a | &theIconRef); |
|---|
| 849 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 850 | n/a | _res = Py_BuildValue("O&", |
|---|
| 851 | n/a | ResObj_New, theIconRef); |
|---|
| 852 | n/a | return _res; |
|---|
| 853 | n/a | } |
|---|
| 854 | n/a | |
|---|
| 855 | n/a | static PyObject *Icn_RegisterIconRefFromIconFamily(PyObject *_self, PyObject *_args) |
|---|
| 856 | n/a | { |
|---|
| 857 | n/a | PyObject *_res = NULL; |
|---|
| 858 | n/a | OSErr _err; |
|---|
| 859 | n/a | OSType creator; |
|---|
| 860 | n/a | OSType iconType; |
|---|
| 861 | n/a | IconFamilyHandle iconFamily; |
|---|
| 862 | n/a | IconRef theIconRef; |
|---|
| 863 | n/a | #ifndef RegisterIconRefFromIconFamily |
|---|
| 864 | n/a | PyMac_PRECHECK(RegisterIconRefFromIconFamily); |
|---|
| 865 | n/a | #endif |
|---|
| 866 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 867 | n/a | PyMac_GetOSType, &creator, |
|---|
| 868 | n/a | PyMac_GetOSType, &iconType, |
|---|
| 869 | n/a | ResObj_Convert, &iconFamily)) |
|---|
| 870 | n/a | return NULL; |
|---|
| 871 | n/a | _err = RegisterIconRefFromIconFamily(creator, |
|---|
| 872 | n/a | iconType, |
|---|
| 873 | n/a | iconFamily, |
|---|
| 874 | n/a | &theIconRef); |
|---|
| 875 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 876 | n/a | _res = Py_BuildValue("O&", |
|---|
| 877 | n/a | ResObj_New, theIconRef); |
|---|
| 878 | n/a | return _res; |
|---|
| 879 | n/a | } |
|---|
| 880 | n/a | |
|---|
| 881 | n/a | static PyObject *Icn_RegisterIconRefFromResource(PyObject *_self, PyObject *_args) |
|---|
| 882 | n/a | { |
|---|
| 883 | n/a | PyObject *_res = NULL; |
|---|
| 884 | n/a | OSErr _err; |
|---|
| 885 | n/a | OSType creator; |
|---|
| 886 | n/a | OSType iconType; |
|---|
| 887 | n/a | FSSpec resourceFile; |
|---|
| 888 | n/a | SInt16 resourceID; |
|---|
| 889 | n/a | IconRef theIconRef; |
|---|
| 890 | n/a | #ifndef RegisterIconRefFromResource |
|---|
| 891 | n/a | PyMac_PRECHECK(RegisterIconRefFromResource); |
|---|
| 892 | n/a | #endif |
|---|
| 893 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&h", |
|---|
| 894 | n/a | PyMac_GetOSType, &creator, |
|---|
| 895 | n/a | PyMac_GetOSType, &iconType, |
|---|
| 896 | n/a | PyMac_GetFSSpec, &resourceFile, |
|---|
| 897 | n/a | &resourceID)) |
|---|
| 898 | n/a | return NULL; |
|---|
| 899 | n/a | _err = RegisterIconRefFromResource(creator, |
|---|
| 900 | n/a | iconType, |
|---|
| 901 | n/a | &resourceFile, |
|---|
| 902 | n/a | resourceID, |
|---|
| 903 | n/a | &theIconRef); |
|---|
| 904 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 905 | n/a | _res = Py_BuildValue("O&", |
|---|
| 906 | n/a | ResObj_New, theIconRef); |
|---|
| 907 | n/a | return _res; |
|---|
| 908 | n/a | } |
|---|
| 909 | n/a | |
|---|
| 910 | n/a | static PyObject *Icn_RegisterIconRefFromFSRef(PyObject *_self, PyObject *_args) |
|---|
| 911 | n/a | { |
|---|
| 912 | n/a | PyObject *_res = NULL; |
|---|
| 913 | n/a | OSStatus _err; |
|---|
| 914 | n/a | OSType creator; |
|---|
| 915 | n/a | OSType iconType; |
|---|
| 916 | n/a | FSRef iconFile; |
|---|
| 917 | n/a | IconRef theIconRef; |
|---|
| 918 | n/a | #ifndef RegisterIconRefFromFSRef |
|---|
| 919 | n/a | PyMac_PRECHECK(RegisterIconRefFromFSRef); |
|---|
| 920 | n/a | #endif |
|---|
| 921 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 922 | n/a | PyMac_GetOSType, &creator, |
|---|
| 923 | n/a | PyMac_GetOSType, &iconType, |
|---|
| 924 | n/a | PyMac_GetFSRef, &iconFile)) |
|---|
| 925 | n/a | return NULL; |
|---|
| 926 | n/a | _err = RegisterIconRefFromFSRef(creator, |
|---|
| 927 | n/a | iconType, |
|---|
| 928 | n/a | &iconFile, |
|---|
| 929 | n/a | &theIconRef); |
|---|
| 930 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 931 | n/a | _res = Py_BuildValue("O&", |
|---|
| 932 | n/a | ResObj_New, theIconRef); |
|---|
| 933 | n/a | return _res; |
|---|
| 934 | n/a | } |
|---|
| 935 | n/a | |
|---|
| 936 | n/a | static PyObject *Icn_UnregisterIconRef(PyObject *_self, PyObject *_args) |
|---|
| 937 | n/a | { |
|---|
| 938 | n/a | PyObject *_res = NULL; |
|---|
| 939 | n/a | OSErr _err; |
|---|
| 940 | n/a | OSType creator; |
|---|
| 941 | n/a | OSType iconType; |
|---|
| 942 | n/a | #ifndef UnregisterIconRef |
|---|
| 943 | n/a | PyMac_PRECHECK(UnregisterIconRef); |
|---|
| 944 | n/a | #endif |
|---|
| 945 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 946 | n/a | PyMac_GetOSType, &creator, |
|---|
| 947 | n/a | PyMac_GetOSType, &iconType)) |
|---|
| 948 | n/a | return NULL; |
|---|
| 949 | n/a | _err = UnregisterIconRef(creator, |
|---|
| 950 | n/a | iconType); |
|---|
| 951 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 952 | n/a | Py_INCREF(Py_None); |
|---|
| 953 | n/a | _res = Py_None; |
|---|
| 954 | n/a | return _res; |
|---|
| 955 | n/a | } |
|---|
| 956 | n/a | |
|---|
| 957 | n/a | static PyObject *Icn_UpdateIconRef(PyObject *_self, PyObject *_args) |
|---|
| 958 | n/a | { |
|---|
| 959 | n/a | PyObject *_res = NULL; |
|---|
| 960 | n/a | OSErr _err; |
|---|
| 961 | n/a | IconRef theIconRef; |
|---|
| 962 | n/a | #ifndef UpdateIconRef |
|---|
| 963 | n/a | PyMac_PRECHECK(UpdateIconRef); |
|---|
| 964 | n/a | #endif |
|---|
| 965 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 966 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 967 | n/a | return NULL; |
|---|
| 968 | n/a | _err = UpdateIconRef(theIconRef); |
|---|
| 969 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 970 | n/a | Py_INCREF(Py_None); |
|---|
| 971 | n/a | _res = Py_None; |
|---|
| 972 | n/a | return _res; |
|---|
| 973 | n/a | } |
|---|
| 974 | n/a | |
|---|
| 975 | n/a | static PyObject *Icn_OverrideIconRefFromResource(PyObject *_self, PyObject *_args) |
|---|
| 976 | n/a | { |
|---|
| 977 | n/a | PyObject *_res = NULL; |
|---|
| 978 | n/a | OSErr _err; |
|---|
| 979 | n/a | IconRef theIconRef; |
|---|
| 980 | n/a | FSSpec resourceFile; |
|---|
| 981 | n/a | SInt16 resourceID; |
|---|
| 982 | n/a | #ifndef OverrideIconRefFromResource |
|---|
| 983 | n/a | PyMac_PRECHECK(OverrideIconRefFromResource); |
|---|
| 984 | n/a | #endif |
|---|
| 985 | n/a | if (!PyArg_ParseTuple(_args, "O&O&h", |
|---|
| 986 | n/a | ResObj_Convert, &theIconRef, |
|---|
| 987 | n/a | PyMac_GetFSSpec, &resourceFile, |
|---|
| 988 | n/a | &resourceID)) |
|---|
| 989 | n/a | return NULL; |
|---|
| 990 | n/a | _err = OverrideIconRefFromResource(theIconRef, |
|---|
| 991 | n/a | &resourceFile, |
|---|
| 992 | n/a | resourceID); |
|---|
| 993 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 994 | n/a | Py_INCREF(Py_None); |
|---|
| 995 | n/a | _res = Py_None; |
|---|
| 996 | n/a | return _res; |
|---|
| 997 | n/a | } |
|---|
| 998 | n/a | |
|---|
| 999 | n/a | static PyObject *Icn_OverrideIconRef(PyObject *_self, PyObject *_args) |
|---|
| 1000 | n/a | { |
|---|
| 1001 | n/a | PyObject *_res = NULL; |
|---|
| 1002 | n/a | OSErr _err; |
|---|
| 1003 | n/a | IconRef oldIconRef; |
|---|
| 1004 | n/a | IconRef newIconRef; |
|---|
| 1005 | n/a | #ifndef OverrideIconRef |
|---|
| 1006 | n/a | PyMac_PRECHECK(OverrideIconRef); |
|---|
| 1007 | n/a | #endif |
|---|
| 1008 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 1009 | n/a | ResObj_Convert, &oldIconRef, |
|---|
| 1010 | n/a | ResObj_Convert, &newIconRef)) |
|---|
| 1011 | n/a | return NULL; |
|---|
| 1012 | n/a | _err = OverrideIconRef(oldIconRef, |
|---|
| 1013 | n/a | newIconRef); |
|---|
| 1014 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1015 | n/a | Py_INCREF(Py_None); |
|---|
| 1016 | n/a | _res = Py_None; |
|---|
| 1017 | n/a | return _res; |
|---|
| 1018 | n/a | } |
|---|
| 1019 | n/a | |
|---|
| 1020 | n/a | static PyObject *Icn_RemoveIconRefOverride(PyObject *_self, PyObject *_args) |
|---|
| 1021 | n/a | { |
|---|
| 1022 | n/a | PyObject *_res = NULL; |
|---|
| 1023 | n/a | OSErr _err; |
|---|
| 1024 | n/a | IconRef theIconRef; |
|---|
| 1025 | n/a | #ifndef RemoveIconRefOverride |
|---|
| 1026 | n/a | PyMac_PRECHECK(RemoveIconRefOverride); |
|---|
| 1027 | n/a | #endif |
|---|
| 1028 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1029 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 1030 | n/a | return NULL; |
|---|
| 1031 | n/a | _err = RemoveIconRefOverride(theIconRef); |
|---|
| 1032 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1033 | n/a | Py_INCREF(Py_None); |
|---|
| 1034 | n/a | _res = Py_None; |
|---|
| 1035 | n/a | return _res; |
|---|
| 1036 | n/a | } |
|---|
| 1037 | n/a | |
|---|
| 1038 | n/a | static PyObject *Icn_CompositeIconRef(PyObject *_self, PyObject *_args) |
|---|
| 1039 | n/a | { |
|---|
| 1040 | n/a | PyObject *_res = NULL; |
|---|
| 1041 | n/a | OSErr _err; |
|---|
| 1042 | n/a | IconRef backgroundIconRef; |
|---|
| 1043 | n/a | IconRef foregroundIconRef; |
|---|
| 1044 | n/a | IconRef compositeIconRef; |
|---|
| 1045 | n/a | #ifndef CompositeIconRef |
|---|
| 1046 | n/a | PyMac_PRECHECK(CompositeIconRef); |
|---|
| 1047 | n/a | #endif |
|---|
| 1048 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 1049 | n/a | ResObj_Convert, &backgroundIconRef, |
|---|
| 1050 | n/a | ResObj_Convert, &foregroundIconRef)) |
|---|
| 1051 | n/a | return NULL; |
|---|
| 1052 | n/a | _err = CompositeIconRef(backgroundIconRef, |
|---|
| 1053 | n/a | foregroundIconRef, |
|---|
| 1054 | n/a | &compositeIconRef); |
|---|
| 1055 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1056 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1057 | n/a | ResObj_New, compositeIconRef); |
|---|
| 1058 | n/a | return _res; |
|---|
| 1059 | n/a | } |
|---|
| 1060 | n/a | |
|---|
| 1061 | n/a | static PyObject *Icn_IsIconRefComposite(PyObject *_self, PyObject *_args) |
|---|
| 1062 | n/a | { |
|---|
| 1063 | n/a | PyObject *_res = NULL; |
|---|
| 1064 | n/a | OSErr _err; |
|---|
| 1065 | n/a | IconRef compositeIconRef; |
|---|
| 1066 | n/a | IconRef backgroundIconRef; |
|---|
| 1067 | n/a | IconRef foregroundIconRef; |
|---|
| 1068 | n/a | #ifndef IsIconRefComposite |
|---|
| 1069 | n/a | PyMac_PRECHECK(IsIconRefComposite); |
|---|
| 1070 | n/a | #endif |
|---|
| 1071 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1072 | n/a | ResObj_Convert, &compositeIconRef)) |
|---|
| 1073 | n/a | return NULL; |
|---|
| 1074 | n/a | _err = IsIconRefComposite(compositeIconRef, |
|---|
| 1075 | n/a | &backgroundIconRef, |
|---|
| 1076 | n/a | &foregroundIconRef); |
|---|
| 1077 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1078 | n/a | _res = Py_BuildValue("O&O&", |
|---|
| 1079 | n/a | ResObj_New, backgroundIconRef, |
|---|
| 1080 | n/a | ResObj_New, foregroundIconRef); |
|---|
| 1081 | n/a | return _res; |
|---|
| 1082 | n/a | } |
|---|
| 1083 | n/a | |
|---|
| 1084 | n/a | static PyObject *Icn_IsValidIconRef(PyObject *_self, PyObject *_args) |
|---|
| 1085 | n/a | { |
|---|
| 1086 | n/a | PyObject *_res = NULL; |
|---|
| 1087 | n/a | Boolean _rv; |
|---|
| 1088 | n/a | IconRef theIconRef; |
|---|
| 1089 | n/a | #ifndef IsValidIconRef |
|---|
| 1090 | n/a | PyMac_PRECHECK(IsValidIconRef); |
|---|
| 1091 | n/a | #endif |
|---|
| 1092 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1093 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 1094 | n/a | return NULL; |
|---|
| 1095 | n/a | _rv = IsValidIconRef(theIconRef); |
|---|
| 1096 | n/a | _res = Py_BuildValue("b", |
|---|
| 1097 | n/a | _rv); |
|---|
| 1098 | n/a | return _res; |
|---|
| 1099 | n/a | } |
|---|
| 1100 | n/a | |
|---|
| 1101 | n/a | static PyObject *Icn_PlotIconRef(PyObject *_self, PyObject *_args) |
|---|
| 1102 | n/a | { |
|---|
| 1103 | n/a | PyObject *_res = NULL; |
|---|
| 1104 | n/a | OSErr _err; |
|---|
| 1105 | n/a | Rect theRect; |
|---|
| 1106 | n/a | IconAlignmentType align; |
|---|
| 1107 | n/a | IconTransformType transform; |
|---|
| 1108 | n/a | IconServicesUsageFlags theIconServicesUsageFlags; |
|---|
| 1109 | n/a | IconRef theIconRef; |
|---|
| 1110 | n/a | #ifndef PlotIconRef |
|---|
| 1111 | n/a | PyMac_PRECHECK(PlotIconRef); |
|---|
| 1112 | n/a | #endif |
|---|
| 1113 | n/a | if (!PyArg_ParseTuple(_args, "O&hhlO&", |
|---|
| 1114 | n/a | PyMac_GetRect, &theRect, |
|---|
| 1115 | n/a | &align, |
|---|
| 1116 | n/a | &transform, |
|---|
| 1117 | n/a | &theIconServicesUsageFlags, |
|---|
| 1118 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 1119 | n/a | return NULL; |
|---|
| 1120 | n/a | _err = PlotIconRef(&theRect, |
|---|
| 1121 | n/a | align, |
|---|
| 1122 | n/a | transform, |
|---|
| 1123 | n/a | theIconServicesUsageFlags, |
|---|
| 1124 | n/a | theIconRef); |
|---|
| 1125 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1126 | n/a | Py_INCREF(Py_None); |
|---|
| 1127 | n/a | _res = Py_None; |
|---|
| 1128 | n/a | return _res; |
|---|
| 1129 | n/a | } |
|---|
| 1130 | n/a | |
|---|
| 1131 | n/a | static PyObject *Icn_PtInIconRef(PyObject *_self, PyObject *_args) |
|---|
| 1132 | n/a | { |
|---|
| 1133 | n/a | PyObject *_res = NULL; |
|---|
| 1134 | n/a | Boolean _rv; |
|---|
| 1135 | n/a | Point testPt; |
|---|
| 1136 | n/a | Rect iconRect; |
|---|
| 1137 | n/a | IconAlignmentType align; |
|---|
| 1138 | n/a | IconServicesUsageFlags theIconServicesUsageFlags; |
|---|
| 1139 | n/a | IconRef theIconRef; |
|---|
| 1140 | n/a | #ifndef PtInIconRef |
|---|
| 1141 | n/a | PyMac_PRECHECK(PtInIconRef); |
|---|
| 1142 | n/a | #endif |
|---|
| 1143 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hlO&", |
|---|
| 1144 | n/a | PyMac_GetPoint, &testPt, |
|---|
| 1145 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 1146 | n/a | &align, |
|---|
| 1147 | n/a | &theIconServicesUsageFlags, |
|---|
| 1148 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 1149 | n/a | return NULL; |
|---|
| 1150 | n/a | _rv = PtInIconRef(&testPt, |
|---|
| 1151 | n/a | &iconRect, |
|---|
| 1152 | n/a | align, |
|---|
| 1153 | n/a | theIconServicesUsageFlags, |
|---|
| 1154 | n/a | theIconRef); |
|---|
| 1155 | n/a | _res = Py_BuildValue("b", |
|---|
| 1156 | n/a | _rv); |
|---|
| 1157 | n/a | return _res; |
|---|
| 1158 | n/a | } |
|---|
| 1159 | n/a | |
|---|
| 1160 | n/a | static PyObject *Icn_RectInIconRef(PyObject *_self, PyObject *_args) |
|---|
| 1161 | n/a | { |
|---|
| 1162 | n/a | PyObject *_res = NULL; |
|---|
| 1163 | n/a | Boolean _rv; |
|---|
| 1164 | n/a | Rect testRect; |
|---|
| 1165 | n/a | Rect iconRect; |
|---|
| 1166 | n/a | IconAlignmentType align; |
|---|
| 1167 | n/a | IconServicesUsageFlags iconServicesUsageFlags; |
|---|
| 1168 | n/a | IconRef theIconRef; |
|---|
| 1169 | n/a | #ifndef RectInIconRef |
|---|
| 1170 | n/a | PyMac_PRECHECK(RectInIconRef); |
|---|
| 1171 | n/a | #endif |
|---|
| 1172 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hlO&", |
|---|
| 1173 | n/a | PyMac_GetRect, &testRect, |
|---|
| 1174 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 1175 | n/a | &align, |
|---|
| 1176 | n/a | &iconServicesUsageFlags, |
|---|
| 1177 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 1178 | n/a | return NULL; |
|---|
| 1179 | n/a | _rv = RectInIconRef(&testRect, |
|---|
| 1180 | n/a | &iconRect, |
|---|
| 1181 | n/a | align, |
|---|
| 1182 | n/a | iconServicesUsageFlags, |
|---|
| 1183 | n/a | theIconRef); |
|---|
| 1184 | n/a | _res = Py_BuildValue("b", |
|---|
| 1185 | n/a | _rv); |
|---|
| 1186 | n/a | return _res; |
|---|
| 1187 | n/a | } |
|---|
| 1188 | n/a | |
|---|
| 1189 | n/a | static PyObject *Icn_IconRefToRgn(PyObject *_self, PyObject *_args) |
|---|
| 1190 | n/a | { |
|---|
| 1191 | n/a | PyObject *_res = NULL; |
|---|
| 1192 | n/a | OSErr _err; |
|---|
| 1193 | n/a | RgnHandle theRgn; |
|---|
| 1194 | n/a | Rect iconRect; |
|---|
| 1195 | n/a | IconAlignmentType align; |
|---|
| 1196 | n/a | IconServicesUsageFlags iconServicesUsageFlags; |
|---|
| 1197 | n/a | IconRef theIconRef; |
|---|
| 1198 | n/a | #ifndef IconRefToRgn |
|---|
| 1199 | n/a | PyMac_PRECHECK(IconRefToRgn); |
|---|
| 1200 | n/a | #endif |
|---|
| 1201 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hlO&", |
|---|
| 1202 | n/a | ResObj_Convert, &theRgn, |
|---|
| 1203 | n/a | PyMac_GetRect, &iconRect, |
|---|
| 1204 | n/a | &align, |
|---|
| 1205 | n/a | &iconServicesUsageFlags, |
|---|
| 1206 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 1207 | n/a | return NULL; |
|---|
| 1208 | n/a | _err = IconRefToRgn(theRgn, |
|---|
| 1209 | n/a | &iconRect, |
|---|
| 1210 | n/a | align, |
|---|
| 1211 | n/a | iconServicesUsageFlags, |
|---|
| 1212 | n/a | theIconRef); |
|---|
| 1213 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1214 | n/a | Py_INCREF(Py_None); |
|---|
| 1215 | n/a | _res = Py_None; |
|---|
| 1216 | n/a | return _res; |
|---|
| 1217 | n/a | } |
|---|
| 1218 | n/a | |
|---|
| 1219 | n/a | static PyObject *Icn_GetIconSizesFromIconRef(PyObject *_self, PyObject *_args) |
|---|
| 1220 | n/a | { |
|---|
| 1221 | n/a | PyObject *_res = NULL; |
|---|
| 1222 | n/a | OSErr _err; |
|---|
| 1223 | n/a | IconSelectorValue iconSelectorInput; |
|---|
| 1224 | n/a | IconSelectorValue iconSelectorOutputPtr; |
|---|
| 1225 | n/a | IconServicesUsageFlags iconServicesUsageFlags; |
|---|
| 1226 | n/a | IconRef theIconRef; |
|---|
| 1227 | n/a | #ifndef GetIconSizesFromIconRef |
|---|
| 1228 | n/a | PyMac_PRECHECK(GetIconSizesFromIconRef); |
|---|
| 1229 | n/a | #endif |
|---|
| 1230 | n/a | if (!PyArg_ParseTuple(_args, "llO&", |
|---|
| 1231 | n/a | &iconSelectorInput, |
|---|
| 1232 | n/a | &iconServicesUsageFlags, |
|---|
| 1233 | n/a | ResObj_Convert, &theIconRef)) |
|---|
| 1234 | n/a | return NULL; |
|---|
| 1235 | n/a | _err = GetIconSizesFromIconRef(iconSelectorInput, |
|---|
| 1236 | n/a | &iconSelectorOutputPtr, |
|---|
| 1237 | n/a | iconServicesUsageFlags, |
|---|
| 1238 | n/a | theIconRef); |
|---|
| 1239 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1240 | n/a | _res = Py_BuildValue("l", |
|---|
| 1241 | n/a | iconSelectorOutputPtr); |
|---|
| 1242 | n/a | return _res; |
|---|
| 1243 | n/a | } |
|---|
| 1244 | n/a | |
|---|
| 1245 | n/a | static PyObject *Icn_FlushIconRefs(PyObject *_self, PyObject *_args) |
|---|
| 1246 | n/a | { |
|---|
| 1247 | n/a | PyObject *_res = NULL; |
|---|
| 1248 | n/a | OSErr _err; |
|---|
| 1249 | n/a | OSType creator; |
|---|
| 1250 | n/a | OSType iconType; |
|---|
| 1251 | n/a | #ifndef FlushIconRefs |
|---|
| 1252 | n/a | PyMac_PRECHECK(FlushIconRefs); |
|---|
| 1253 | n/a | #endif |
|---|
| 1254 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 1255 | n/a | PyMac_GetOSType, &creator, |
|---|
| 1256 | n/a | PyMac_GetOSType, &iconType)) |
|---|
| 1257 | n/a | return NULL; |
|---|
| 1258 | n/a | _err = FlushIconRefs(creator, |
|---|
| 1259 | n/a | iconType); |
|---|
| 1260 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1261 | n/a | Py_INCREF(Py_None); |
|---|
| 1262 | n/a | _res = Py_None; |
|---|
| 1263 | n/a | return _res; |
|---|
| 1264 | n/a | } |
|---|
| 1265 | n/a | |
|---|
| 1266 | n/a | static PyObject *Icn_FlushIconRefsByVolume(PyObject *_self, PyObject *_args) |
|---|
| 1267 | n/a | { |
|---|
| 1268 | n/a | PyObject *_res = NULL; |
|---|
| 1269 | n/a | OSErr _err; |
|---|
| 1270 | n/a | SInt16 vRefNum; |
|---|
| 1271 | n/a | #ifndef FlushIconRefsByVolume |
|---|
| 1272 | n/a | PyMac_PRECHECK(FlushIconRefsByVolume); |
|---|
| 1273 | n/a | #endif |
|---|
| 1274 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 1275 | n/a | &vRefNum)) |
|---|
| 1276 | n/a | return NULL; |
|---|
| 1277 | n/a | _err = FlushIconRefsByVolume(vRefNum); |
|---|
| 1278 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1279 | n/a | Py_INCREF(Py_None); |
|---|
| 1280 | n/a | _res = Py_None; |
|---|
| 1281 | n/a | return _res; |
|---|
| 1282 | n/a | } |
|---|
| 1283 | n/a | |
|---|
| 1284 | n/a | static PyObject *Icn_SetCustomIconsEnabled(PyObject *_self, PyObject *_args) |
|---|
| 1285 | n/a | { |
|---|
| 1286 | n/a | PyObject *_res = NULL; |
|---|
| 1287 | n/a | OSErr _err; |
|---|
| 1288 | n/a | SInt16 vRefNum; |
|---|
| 1289 | n/a | Boolean enableCustomIcons; |
|---|
| 1290 | n/a | #ifndef SetCustomIconsEnabled |
|---|
| 1291 | n/a | PyMac_PRECHECK(SetCustomIconsEnabled); |
|---|
| 1292 | n/a | #endif |
|---|
| 1293 | n/a | if (!PyArg_ParseTuple(_args, "hb", |
|---|
| 1294 | n/a | &vRefNum, |
|---|
| 1295 | n/a | &enableCustomIcons)) |
|---|
| 1296 | n/a | return NULL; |
|---|
| 1297 | n/a | _err = SetCustomIconsEnabled(vRefNum, |
|---|
| 1298 | n/a | enableCustomIcons); |
|---|
| 1299 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1300 | n/a | Py_INCREF(Py_None); |
|---|
| 1301 | n/a | _res = Py_None; |
|---|
| 1302 | n/a | return _res; |
|---|
| 1303 | n/a | } |
|---|
| 1304 | n/a | |
|---|
| 1305 | n/a | static PyObject *Icn_GetCustomIconsEnabled(PyObject *_self, PyObject *_args) |
|---|
| 1306 | n/a | { |
|---|
| 1307 | n/a | PyObject *_res = NULL; |
|---|
| 1308 | n/a | OSErr _err; |
|---|
| 1309 | n/a | SInt16 vRefNum; |
|---|
| 1310 | n/a | Boolean customIconsEnabled; |
|---|
| 1311 | n/a | #ifndef GetCustomIconsEnabled |
|---|
| 1312 | n/a | PyMac_PRECHECK(GetCustomIconsEnabled); |
|---|
| 1313 | n/a | #endif |
|---|
| 1314 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 1315 | n/a | &vRefNum)) |
|---|
| 1316 | n/a | return NULL; |
|---|
| 1317 | n/a | _err = GetCustomIconsEnabled(vRefNum, |
|---|
| 1318 | n/a | &customIconsEnabled); |
|---|
| 1319 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1320 | n/a | _res = Py_BuildValue("b", |
|---|
| 1321 | n/a | customIconsEnabled); |
|---|
| 1322 | n/a | return _res; |
|---|
| 1323 | n/a | } |
|---|
| 1324 | n/a | |
|---|
| 1325 | n/a | static PyObject *Icn_IsIconRefMaskEmpty(PyObject *_self, PyObject *_args) |
|---|
| 1326 | n/a | { |
|---|
| 1327 | n/a | PyObject *_res = NULL; |
|---|
| 1328 | n/a | Boolean _rv; |
|---|
| 1329 | n/a | IconRef iconRef; |
|---|
| 1330 | n/a | #ifndef IsIconRefMaskEmpty |
|---|
| 1331 | n/a | PyMac_PRECHECK(IsIconRefMaskEmpty); |
|---|
| 1332 | n/a | #endif |
|---|
| 1333 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1334 | n/a | ResObj_Convert, &iconRef)) |
|---|
| 1335 | n/a | return NULL; |
|---|
| 1336 | n/a | _rv = IsIconRefMaskEmpty(iconRef); |
|---|
| 1337 | n/a | _res = Py_BuildValue("b", |
|---|
| 1338 | n/a | _rv); |
|---|
| 1339 | n/a | return _res; |
|---|
| 1340 | n/a | } |
|---|
| 1341 | n/a | |
|---|
| 1342 | n/a | static PyObject *Icn_GetIconRefVariant(PyObject *_self, PyObject *_args) |
|---|
| 1343 | n/a | { |
|---|
| 1344 | n/a | PyObject *_res = NULL; |
|---|
| 1345 | n/a | IconRef _rv; |
|---|
| 1346 | n/a | IconRef inIconRef; |
|---|
| 1347 | n/a | OSType inVariant; |
|---|
| 1348 | n/a | IconTransformType outTransform; |
|---|
| 1349 | n/a | #ifndef GetIconRefVariant |
|---|
| 1350 | n/a | PyMac_PRECHECK(GetIconRefVariant); |
|---|
| 1351 | n/a | #endif |
|---|
| 1352 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 1353 | n/a | ResObj_Convert, &inIconRef, |
|---|
| 1354 | n/a | PyMac_GetOSType, &inVariant)) |
|---|
| 1355 | n/a | return NULL; |
|---|
| 1356 | n/a | _rv = GetIconRefVariant(inIconRef, |
|---|
| 1357 | n/a | inVariant, |
|---|
| 1358 | n/a | &outTransform); |
|---|
| 1359 | n/a | _res = Py_BuildValue("O&h", |
|---|
| 1360 | n/a | ResObj_New, _rv, |
|---|
| 1361 | n/a | outTransform); |
|---|
| 1362 | n/a | return _res; |
|---|
| 1363 | n/a | } |
|---|
| 1364 | n/a | |
|---|
| 1365 | n/a | static PyObject *Icn_RegisterIconRefFromIconFile(PyObject *_self, PyObject *_args) |
|---|
| 1366 | n/a | { |
|---|
| 1367 | n/a | PyObject *_res = NULL; |
|---|
| 1368 | n/a | OSErr _err; |
|---|
| 1369 | n/a | OSType creator; |
|---|
| 1370 | n/a | OSType iconType; |
|---|
| 1371 | n/a | FSSpec iconFile; |
|---|
| 1372 | n/a | IconRef theIconRef; |
|---|
| 1373 | n/a | #ifndef RegisterIconRefFromIconFile |
|---|
| 1374 | n/a | PyMac_PRECHECK(RegisterIconRefFromIconFile); |
|---|
| 1375 | n/a | #endif |
|---|
| 1376 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 1377 | n/a | PyMac_GetOSType, &creator, |
|---|
| 1378 | n/a | PyMac_GetOSType, &iconType, |
|---|
| 1379 | n/a | PyMac_GetFSSpec, &iconFile)) |
|---|
| 1380 | n/a | return NULL; |
|---|
| 1381 | n/a | _err = RegisterIconRefFromIconFile(creator, |
|---|
| 1382 | n/a | iconType, |
|---|
| 1383 | n/a | &iconFile, |
|---|
| 1384 | n/a | &theIconRef); |
|---|
| 1385 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1386 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1387 | n/a | ResObj_New, theIconRef); |
|---|
| 1388 | n/a | return _res; |
|---|
| 1389 | n/a | } |
|---|
| 1390 | n/a | |
|---|
| 1391 | n/a | static PyObject *Icn_ReadIconFile(PyObject *_self, PyObject *_args) |
|---|
| 1392 | n/a | { |
|---|
| 1393 | n/a | PyObject *_res = NULL; |
|---|
| 1394 | n/a | OSErr _err; |
|---|
| 1395 | n/a | FSSpec iconFile; |
|---|
| 1396 | n/a | IconFamilyHandle iconFamily; |
|---|
| 1397 | n/a | #ifndef ReadIconFile |
|---|
| 1398 | n/a | PyMac_PRECHECK(ReadIconFile); |
|---|
| 1399 | n/a | #endif |
|---|
| 1400 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1401 | n/a | PyMac_GetFSSpec, &iconFile)) |
|---|
| 1402 | n/a | return NULL; |
|---|
| 1403 | n/a | _err = ReadIconFile(&iconFile, |
|---|
| 1404 | n/a | &iconFamily); |
|---|
| 1405 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1406 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1407 | n/a | ResObj_New, iconFamily); |
|---|
| 1408 | n/a | return _res; |
|---|
| 1409 | n/a | } |
|---|
| 1410 | n/a | |
|---|
| 1411 | n/a | static PyObject *Icn_ReadIconFromFSRef(PyObject *_self, PyObject *_args) |
|---|
| 1412 | n/a | { |
|---|
| 1413 | n/a | PyObject *_res = NULL; |
|---|
| 1414 | n/a | OSStatus _err; |
|---|
| 1415 | n/a | FSRef ref; |
|---|
| 1416 | n/a | IconFamilyHandle iconFamily; |
|---|
| 1417 | n/a | #ifndef ReadIconFromFSRef |
|---|
| 1418 | n/a | PyMac_PRECHECK(ReadIconFromFSRef); |
|---|
| 1419 | n/a | #endif |
|---|
| 1420 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1421 | n/a | PyMac_GetFSRef, &ref)) |
|---|
| 1422 | n/a | return NULL; |
|---|
| 1423 | n/a | _err = ReadIconFromFSRef(&ref, |
|---|
| 1424 | n/a | &iconFamily); |
|---|
| 1425 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1426 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1427 | n/a | ResObj_New, iconFamily); |
|---|
| 1428 | n/a | return _res; |
|---|
| 1429 | n/a | } |
|---|
| 1430 | n/a | |
|---|
| 1431 | n/a | static PyObject *Icn_WriteIconFile(PyObject *_self, PyObject *_args) |
|---|
| 1432 | n/a | { |
|---|
| 1433 | n/a | PyObject *_res = NULL; |
|---|
| 1434 | n/a | OSErr _err; |
|---|
| 1435 | n/a | IconFamilyHandle iconFamily; |
|---|
| 1436 | n/a | FSSpec iconFile; |
|---|
| 1437 | n/a | #ifndef WriteIconFile |
|---|
| 1438 | n/a | PyMac_PRECHECK(WriteIconFile); |
|---|
| 1439 | n/a | #endif |
|---|
| 1440 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 1441 | n/a | ResObj_Convert, &iconFamily, |
|---|
| 1442 | n/a | PyMac_GetFSSpec, &iconFile)) |
|---|
| 1443 | n/a | return NULL; |
|---|
| 1444 | n/a | _err = WriteIconFile(iconFamily, |
|---|
| 1445 | n/a | &iconFile); |
|---|
| 1446 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1447 | n/a | Py_INCREF(Py_None); |
|---|
| 1448 | n/a | _res = Py_None; |
|---|
| 1449 | n/a | return _res; |
|---|
| 1450 | n/a | } |
|---|
| 1451 | n/a | #endif /* __LP64__ */ |
|---|
| 1452 | n/a | |
|---|
| 1453 | n/a | static PyMethodDef Icn_methods[] = { |
|---|
| 1454 | n/a | #ifndef __LP64__ |
|---|
| 1455 | n/a | {"GetCIcon", (PyCFunction)Icn_GetCIcon, 1, |
|---|
| 1456 | n/a | PyDoc_STR("(SInt16 iconID) -> (CIconHandle _rv)")}, |
|---|
| 1457 | n/a | {"PlotCIcon", (PyCFunction)Icn_PlotCIcon, 1, |
|---|
| 1458 | n/a | PyDoc_STR("(Rect theRect, CIconHandle theIcon) -> None")}, |
|---|
| 1459 | n/a | {"DisposeCIcon", (PyCFunction)Icn_DisposeCIcon, 1, |
|---|
| 1460 | n/a | PyDoc_STR("(CIconHandle theIcon) -> None")}, |
|---|
| 1461 | n/a | {"GetIcon", (PyCFunction)Icn_GetIcon, 1, |
|---|
| 1462 | n/a | PyDoc_STR("(SInt16 iconID) -> (Handle _rv)")}, |
|---|
| 1463 | n/a | {"PlotIcon", (PyCFunction)Icn_PlotIcon, 1, |
|---|
| 1464 | n/a | PyDoc_STR("(Rect theRect, Handle theIcon) -> None")}, |
|---|
| 1465 | n/a | {"PlotIconID", (PyCFunction)Icn_PlotIconID, 1, |
|---|
| 1466 | n/a | PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, SInt16 theResID) -> None")}, |
|---|
| 1467 | n/a | {"NewIconSuite", (PyCFunction)Icn_NewIconSuite, 1, |
|---|
| 1468 | n/a | PyDoc_STR("() -> (IconSuiteRef theIconSuite)")}, |
|---|
| 1469 | n/a | {"AddIconToSuite", (PyCFunction)Icn_AddIconToSuite, 1, |
|---|
| 1470 | n/a | PyDoc_STR("(Handle theIconData, IconSuiteRef theSuite, ResType theType) -> None")}, |
|---|
| 1471 | n/a | {"GetIconFromSuite", (PyCFunction)Icn_GetIconFromSuite, 1, |
|---|
| 1472 | n/a | PyDoc_STR("(IconSuiteRef theSuite, ResType theType) -> (Handle theIconData)")}, |
|---|
| 1473 | n/a | {"GetIconSuite", (PyCFunction)Icn_GetIconSuite, 1, |
|---|
| 1474 | n/a | PyDoc_STR("(SInt16 theResID, IconSelectorValue selector) -> (IconSuiteRef theIconSuite)")}, |
|---|
| 1475 | n/a | {"DisposeIconSuite", (PyCFunction)Icn_DisposeIconSuite, 1, |
|---|
| 1476 | n/a | PyDoc_STR("(IconSuiteRef theIconSuite, Boolean disposeData) -> None")}, |
|---|
| 1477 | n/a | {"PlotIconSuite", (PyCFunction)Icn_PlotIconSuite, 1, |
|---|
| 1478 | n/a | PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconSuiteRef theIconSuite) -> None")}, |
|---|
| 1479 | n/a | {"LoadIconCache", (PyCFunction)Icn_LoadIconCache, 1, |
|---|
| 1480 | n/a | PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconCacheRef theIconCache) -> None")}, |
|---|
| 1481 | n/a | {"GetLabel", (PyCFunction)Icn_GetLabel, 1, |
|---|
| 1482 | n/a | PyDoc_STR("(SInt16 labelNumber, Str255 labelString) -> (RGBColor labelColor)")}, |
|---|
| 1483 | n/a | {"PtInIconID", (PyCFunction)Icn_PtInIconID, 1, |
|---|
| 1484 | n/a | PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)")}, |
|---|
| 1485 | n/a | {"PtInIconSuite", (PyCFunction)Icn_PtInIconSuite, 1, |
|---|
| 1486 | n/a | PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)")}, |
|---|
| 1487 | n/a | {"RectInIconID", (PyCFunction)Icn_RectInIconID, 1, |
|---|
| 1488 | n/a | PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)")}, |
|---|
| 1489 | n/a | {"RectInIconSuite", (PyCFunction)Icn_RectInIconSuite, 1, |
|---|
| 1490 | n/a | PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)")}, |
|---|
| 1491 | n/a | {"IconIDToRgn", (PyCFunction)Icn_IconIDToRgn, 1, |
|---|
| 1492 | n/a | PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> None")}, |
|---|
| 1493 | n/a | {"IconSuiteToRgn", (PyCFunction)Icn_IconSuiteToRgn, 1, |
|---|
| 1494 | n/a | PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> None")}, |
|---|
| 1495 | n/a | {"SetSuiteLabel", (PyCFunction)Icn_SetSuiteLabel, 1, |
|---|
| 1496 | n/a | PyDoc_STR("(IconSuiteRef theSuite, SInt16 theLabel) -> None")}, |
|---|
| 1497 | n/a | {"GetSuiteLabel", (PyCFunction)Icn_GetSuiteLabel, 1, |
|---|
| 1498 | n/a | PyDoc_STR("(IconSuiteRef theSuite) -> (SInt16 _rv)")}, |
|---|
| 1499 | n/a | {"PlotIconHandle", (PyCFunction)Icn_PlotIconHandle, 1, |
|---|
| 1500 | n/a | PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon) -> None")}, |
|---|
| 1501 | n/a | {"PlotSICNHandle", (PyCFunction)Icn_PlotSICNHandle, 1, |
|---|
| 1502 | n/a | PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN) -> None")}, |
|---|
| 1503 | n/a | {"PlotCIconHandle", (PyCFunction)Icn_PlotCIconHandle, 1, |
|---|
| 1504 | n/a | PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon) -> None")}, |
|---|
| 1505 | n/a | {"IconRefToIconFamily", (PyCFunction)Icn_IconRefToIconFamily, 1, |
|---|
| 1506 | n/a | PyDoc_STR("(IconRef theIconRef, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)")}, |
|---|
| 1507 | n/a | {"IconFamilyToIconSuite", (PyCFunction)Icn_IconFamilyToIconSuite, 1, |
|---|
| 1508 | n/a | PyDoc_STR("(IconFamilyHandle iconFamily, IconSelectorValue whichIcons) -> (IconSuiteRef iconSuite)")}, |
|---|
| 1509 | n/a | {"IconSuiteToIconFamily", (PyCFunction)Icn_IconSuiteToIconFamily, 1, |
|---|
| 1510 | n/a | PyDoc_STR("(IconSuiteRef iconSuite, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)")}, |
|---|
| 1511 | n/a | {"SetIconFamilyData", (PyCFunction)Icn_SetIconFamilyData, 1, |
|---|
| 1512 | n/a | PyDoc_STR("(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None")}, |
|---|
| 1513 | n/a | {"GetIconFamilyData", (PyCFunction)Icn_GetIconFamilyData, 1, |
|---|
| 1514 | n/a | PyDoc_STR("(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None")}, |
|---|
| 1515 | n/a | {"GetIconRefOwners", (PyCFunction)Icn_GetIconRefOwners, 1, |
|---|
| 1516 | n/a | PyDoc_STR("(IconRef theIconRef) -> (UInt16 owners)")}, |
|---|
| 1517 | n/a | {"AcquireIconRef", (PyCFunction)Icn_AcquireIconRef, 1, |
|---|
| 1518 | n/a | PyDoc_STR("(IconRef theIconRef) -> None")}, |
|---|
| 1519 | n/a | {"ReleaseIconRef", (PyCFunction)Icn_ReleaseIconRef, 1, |
|---|
| 1520 | n/a | PyDoc_STR("(IconRef theIconRef) -> None")}, |
|---|
| 1521 | n/a | {"GetIconRefFromFile", (PyCFunction)Icn_GetIconRefFromFile, 1, |
|---|
| 1522 | n/a | PyDoc_STR("(FSSpec theFile) -> (IconRef theIconRef, SInt16 theLabel)")}, |
|---|
| 1523 | n/a | {"GetIconRef", (PyCFunction)Icn_GetIconRef, 1, |
|---|
| 1524 | n/a | PyDoc_STR("(SInt16 vRefNum, OSType creator, OSType iconType) -> (IconRef theIconRef)")}, |
|---|
| 1525 | n/a | {"GetIconRefFromFolder", (PyCFunction)Icn_GetIconRefFromFolder, 1, |
|---|
| 1526 | n/a | PyDoc_STR("(SInt16 vRefNum, SInt32 parentFolderID, SInt32 folderID, SInt8 attributes, SInt8 accessPrivileges) -> (IconRef theIconRef)")}, |
|---|
| 1527 | n/a | {"RegisterIconRefFromIconFamily", (PyCFunction)Icn_RegisterIconRefFromIconFamily, 1, |
|---|
| 1528 | n/a | PyDoc_STR("(OSType creator, OSType iconType, IconFamilyHandle iconFamily) -> (IconRef theIconRef)")}, |
|---|
| 1529 | n/a | {"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1, |
|---|
| 1530 | n/a | PyDoc_STR("(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)")}, |
|---|
| 1531 | n/a | {"RegisterIconRefFromFSRef", (PyCFunction)Icn_RegisterIconRefFromFSRef, 1, |
|---|
| 1532 | n/a | PyDoc_STR("(OSType creator, OSType iconType, FSRef iconFile) -> (IconRef theIconRef)")}, |
|---|
| 1533 | n/a | {"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1, |
|---|
| 1534 | n/a | PyDoc_STR("(OSType creator, OSType iconType) -> None")}, |
|---|
| 1535 | n/a | {"UpdateIconRef", (PyCFunction)Icn_UpdateIconRef, 1, |
|---|
| 1536 | n/a | PyDoc_STR("(IconRef theIconRef) -> None")}, |
|---|
| 1537 | n/a | {"OverrideIconRefFromResource", (PyCFunction)Icn_OverrideIconRefFromResource, 1, |
|---|
| 1538 | n/a | PyDoc_STR("(IconRef theIconRef, FSSpec resourceFile, SInt16 resourceID) -> None")}, |
|---|
| 1539 | n/a | {"OverrideIconRef", (PyCFunction)Icn_OverrideIconRef, 1, |
|---|
| 1540 | n/a | PyDoc_STR("(IconRef oldIconRef, IconRef newIconRef) -> None")}, |
|---|
| 1541 | n/a | {"RemoveIconRefOverride", (PyCFunction)Icn_RemoveIconRefOverride, 1, |
|---|
| 1542 | n/a | PyDoc_STR("(IconRef theIconRef) -> None")}, |
|---|
| 1543 | n/a | {"CompositeIconRef", (PyCFunction)Icn_CompositeIconRef, 1, |
|---|
| 1544 | n/a | PyDoc_STR("(IconRef backgroundIconRef, IconRef foregroundIconRef) -> (IconRef compositeIconRef)")}, |
|---|
| 1545 | n/a | {"IsIconRefComposite", (PyCFunction)Icn_IsIconRefComposite, 1, |
|---|
| 1546 | n/a | PyDoc_STR("(IconRef compositeIconRef) -> (IconRef backgroundIconRef, IconRef foregroundIconRef)")}, |
|---|
| 1547 | n/a | {"IsValidIconRef", (PyCFunction)Icn_IsValidIconRef, 1, |
|---|
| 1548 | n/a | PyDoc_STR("(IconRef theIconRef) -> (Boolean _rv)")}, |
|---|
| 1549 | n/a | {"PlotIconRef", (PyCFunction)Icn_PlotIconRef, 1, |
|---|
| 1550 | n/a | PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> None")}, |
|---|
| 1551 | n/a | {"PtInIconRef", (PyCFunction)Icn_PtInIconRef, 1, |
|---|
| 1552 | n/a | PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)")}, |
|---|
| 1553 | n/a | {"RectInIconRef", (PyCFunction)Icn_RectInIconRef, 1, |
|---|
| 1554 | n/a | PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)")}, |
|---|
| 1555 | n/a | {"IconRefToRgn", (PyCFunction)Icn_IconRefToRgn, 1, |
|---|
| 1556 | n/a | PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> None")}, |
|---|
| 1557 | n/a | {"GetIconSizesFromIconRef", (PyCFunction)Icn_GetIconSizesFromIconRef, 1, |
|---|
| 1558 | n/a | PyDoc_STR("(IconSelectorValue iconSelectorInput, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (IconSelectorValue iconSelectorOutputPtr)")}, |
|---|
| 1559 | n/a | {"FlushIconRefs", (PyCFunction)Icn_FlushIconRefs, 1, |
|---|
| 1560 | n/a | PyDoc_STR("(OSType creator, OSType iconType) -> None")}, |
|---|
| 1561 | n/a | {"FlushIconRefsByVolume", (PyCFunction)Icn_FlushIconRefsByVolume, 1, |
|---|
| 1562 | n/a | PyDoc_STR("(SInt16 vRefNum) -> None")}, |
|---|
| 1563 | n/a | {"SetCustomIconsEnabled", (PyCFunction)Icn_SetCustomIconsEnabled, 1, |
|---|
| 1564 | n/a | PyDoc_STR("(SInt16 vRefNum, Boolean enableCustomIcons) -> None")}, |
|---|
| 1565 | n/a | {"GetCustomIconsEnabled", (PyCFunction)Icn_GetCustomIconsEnabled, 1, |
|---|
| 1566 | n/a | PyDoc_STR("(SInt16 vRefNum) -> (Boolean customIconsEnabled)")}, |
|---|
| 1567 | n/a | {"IsIconRefMaskEmpty", (PyCFunction)Icn_IsIconRefMaskEmpty, 1, |
|---|
| 1568 | n/a | PyDoc_STR("(IconRef iconRef) -> (Boolean _rv)")}, |
|---|
| 1569 | n/a | {"GetIconRefVariant", (PyCFunction)Icn_GetIconRefVariant, 1, |
|---|
| 1570 | n/a | PyDoc_STR("(IconRef inIconRef, OSType inVariant) -> (IconRef _rv, IconTransformType outTransform)")}, |
|---|
| 1571 | n/a | {"RegisterIconRefFromIconFile", (PyCFunction)Icn_RegisterIconRefFromIconFile, 1, |
|---|
| 1572 | n/a | PyDoc_STR("(OSType creator, OSType iconType, FSSpec iconFile) -> (IconRef theIconRef)")}, |
|---|
| 1573 | n/a | {"ReadIconFile", (PyCFunction)Icn_ReadIconFile, 1, |
|---|
| 1574 | n/a | PyDoc_STR("(FSSpec iconFile) -> (IconFamilyHandle iconFamily)")}, |
|---|
| 1575 | n/a | {"ReadIconFromFSRef", (PyCFunction)Icn_ReadIconFromFSRef, 1, |
|---|
| 1576 | n/a | PyDoc_STR("(FSRef ref) -> (IconFamilyHandle iconFamily)")}, |
|---|
| 1577 | n/a | {"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1, |
|---|
| 1578 | n/a | PyDoc_STR("(IconFamilyHandle iconFamily, FSSpec iconFile) -> None")}, |
|---|
| 1579 | n/a | #endif /* __LP64__ */ |
|---|
| 1580 | n/a | {NULL, NULL, 0} |
|---|
| 1581 | n/a | }; |
|---|
| 1582 | n/a | |
|---|
| 1583 | n/a | |
|---|
| 1584 | n/a | |
|---|
| 1585 | n/a | |
|---|
| 1586 | n/a | void init_Icn(void) |
|---|
| 1587 | n/a | { |
|---|
| 1588 | n/a | PyObject *m; |
|---|
| 1589 | n/a | #ifndef __LP64__ |
|---|
| 1590 | n/a | PyObject *d; |
|---|
| 1591 | n/a | #endif /* __LP64__ */ |
|---|
| 1592 | n/a | |
|---|
| 1593 | n/a | |
|---|
| 1594 | n/a | |
|---|
| 1595 | n/a | |
|---|
| 1596 | n/a | m = Py_InitModule("_Icn", Icn_methods); |
|---|
| 1597 | n/a | #ifndef __LP64__ |
|---|
| 1598 | n/a | d = PyModule_GetDict(m); |
|---|
| 1599 | n/a | Icn_Error = PyMac_GetOSErrException(); |
|---|
| 1600 | n/a | if (Icn_Error == NULL || |
|---|
| 1601 | n/a | PyDict_SetItemString(d, "Error", Icn_Error) != 0) |
|---|
| 1602 | n/a | return; |
|---|
| 1603 | n/a | #endif /* __LP64__ */ |
|---|
| 1604 | n/a | } |
|---|
| 1605 | n/a | |
|---|
| 1606 | n/a | /* ======================== End module _Icn ========================= */ |
|---|
| 1607 | n/a | |
|---|