Quick update to the README file. For intros and books we now point to
[python/dscho.git] / Mac / Modules / icn / Icnmodule.c
blob9420d3787f9584a7695aad4933480f16db8224fc
2 /* =========================== Module Icn =========================== */
4 #include "Python.h"
8 #define SystemSevenOrLater 1
10 #include "macglue.h"
11 #include <Memory.h>
12 #include <Dialogs.h>
13 #include <Menus.h>
14 #include <Controls.h>
16 extern PyObject *ResObj_New(Handle);
17 extern int ResObj_Convert(PyObject *, Handle *);
18 extern PyObject *OptResObj_New(Handle);
19 extern int OptResObj_Convert(PyObject *, Handle *);
21 extern PyObject *WinObj_New(WindowPtr);
22 extern int WinObj_Convert(PyObject *, WindowPtr *);
23 extern PyTypeObject Window_Type;
24 #define WinObj_Check(x) ((x)->ob_type == &Window_Type)
26 extern PyObject *DlgObj_New(DialogPtr);
27 extern int DlgObj_Convert(PyObject *, DialogPtr *);
28 extern PyTypeObject Dialog_Type;
29 #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
31 extern PyObject *MenuObj_New(MenuHandle);
32 extern int MenuObj_Convert(PyObject *, MenuHandle *);
34 extern PyObject *CtlObj_New(ControlHandle);
35 extern int CtlObj_Convert(PyObject *, ControlHandle *);
37 extern PyObject *GrafObj_New(GrafPtr);
38 extern int GrafObj_Convert(PyObject *, GrafPtr *);
40 extern PyObject *BMObj_New(BitMapPtr);
41 extern int BMObj_Convert(PyObject *, BitMapPtr *);
43 extern PyObject *WinObj_WhichWindow(WindowPtr);
45 #include <Icons.h>
47 /* Exported by Qdmodule.c: */
48 extern PyObject *QdRGB_New(RGBColor *);
49 extern int QdRGB_Convert(PyObject *, RGBColor *);
51 #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
53 static PyObject *Icn_Error;
55 static PyObject *Icn_GetCIcon(_self, _args)
56 PyObject *_self;
57 PyObject *_args;
59 PyObject *_res = NULL;
60 CIconHandle _rv;
61 SInt16 iconID;
62 if (!PyArg_ParseTuple(_args, "h",
63 &iconID))
64 return NULL;
65 _rv = GetCIcon(iconID);
66 _res = Py_BuildValue("O&",
67 ResObj_New, _rv);
68 return _res;
71 static PyObject *Icn_PlotCIcon(_self, _args)
72 PyObject *_self;
73 PyObject *_args;
75 PyObject *_res = NULL;
76 Rect theRect;
77 CIconHandle theIcon;
78 if (!PyArg_ParseTuple(_args, "O&O&",
79 PyMac_GetRect, &theRect,
80 ResObj_Convert, &theIcon))
81 return NULL;
82 PlotCIcon(&theRect,
83 theIcon);
84 Py_INCREF(Py_None);
85 _res = Py_None;
86 return _res;
89 static PyObject *Icn_DisposeCIcon(_self, _args)
90 PyObject *_self;
91 PyObject *_args;
93 PyObject *_res = NULL;
94 CIconHandle theIcon;
95 if (!PyArg_ParseTuple(_args, "O&",
96 ResObj_Convert, &theIcon))
97 return NULL;
98 DisposeCIcon(theIcon);
99 Py_INCREF(Py_None);
100 _res = Py_None;
101 return _res;
104 static PyObject *Icn_GetIcon(_self, _args)
105 PyObject *_self;
106 PyObject *_args;
108 PyObject *_res = NULL;
109 Handle _rv;
110 SInt16 iconID;
111 if (!PyArg_ParseTuple(_args, "h",
112 &iconID))
113 return NULL;
114 _rv = GetIcon(iconID);
115 _res = Py_BuildValue("O&",
116 ResObj_New, _rv);
117 return _res;
120 static PyObject *Icn_PlotIcon(_self, _args)
121 PyObject *_self;
122 PyObject *_args;
124 PyObject *_res = NULL;
125 Rect theRect;
126 Handle theIcon;
127 if (!PyArg_ParseTuple(_args, "O&O&",
128 PyMac_GetRect, &theRect,
129 ResObj_Convert, &theIcon))
130 return NULL;
131 PlotIcon(&theRect,
132 theIcon);
133 Py_INCREF(Py_None);
134 _res = Py_None;
135 return _res;
138 static PyObject *Icn_PlotIconID(_self, _args)
139 PyObject *_self;
140 PyObject *_args;
142 PyObject *_res = NULL;
143 OSErr _err;
144 Rect theRect;
145 IconAlignmentType align;
146 IconTransformType transform;
147 SInt16 theResID;
148 if (!PyArg_ParseTuple(_args, "O&hhh",
149 PyMac_GetRect, &theRect,
150 &align,
151 &transform,
152 &theResID))
153 return NULL;
154 _err = PlotIconID(&theRect,
155 align,
156 transform,
157 theResID);
158 if (_err != noErr) return PyMac_Error(_err);
159 Py_INCREF(Py_None);
160 _res = Py_None;
161 return _res;
164 static PyObject *Icn_NewIconSuite(_self, _args)
165 PyObject *_self;
166 PyObject *_args;
168 PyObject *_res = NULL;
169 OSErr _err;
170 IconSuiteRef theIconSuite;
171 if (!PyArg_ParseTuple(_args, ""))
172 return NULL;
173 _err = NewIconSuite(&theIconSuite);
174 if (_err != noErr) return PyMac_Error(_err);
175 _res = Py_BuildValue("O&",
176 ResObj_New, theIconSuite);
177 return _res;
180 static PyObject *Icn_AddIconToSuite(_self, _args)
181 PyObject *_self;
182 PyObject *_args;
184 PyObject *_res = NULL;
185 OSErr _err;
186 Handle theIconData;
187 IconSuiteRef theSuite;
188 ResType theType;
189 if (!PyArg_ParseTuple(_args, "O&O&O&",
190 ResObj_Convert, &theIconData,
191 ResObj_Convert, &theSuite,
192 PyMac_GetOSType, &theType))
193 return NULL;
194 _err = AddIconToSuite(theIconData,
195 theSuite,
196 theType);
197 if (_err != noErr) return PyMac_Error(_err);
198 Py_INCREF(Py_None);
199 _res = Py_None;
200 return _res;
203 static PyObject *Icn_GetIconFromSuite(_self, _args)
204 PyObject *_self;
205 PyObject *_args;
207 PyObject *_res = NULL;
208 OSErr _err;
209 Handle theIconData;
210 IconSuiteRef theSuite;
211 ResType theType;
212 if (!PyArg_ParseTuple(_args, "O&O&",
213 ResObj_Convert, &theSuite,
214 PyMac_GetOSType, &theType))
215 return NULL;
216 _err = GetIconFromSuite(&theIconData,
217 theSuite,
218 theType);
219 if (_err != noErr) return PyMac_Error(_err);
220 _res = Py_BuildValue("O&",
221 ResObj_New, theIconData);
222 return _res;
225 static PyObject *Icn_GetIconSuite(_self, _args)
226 PyObject *_self;
227 PyObject *_args;
229 PyObject *_res = NULL;
230 OSErr _err;
231 IconSuiteRef theIconSuite;
232 SInt16 theResID;
233 IconSelectorValue selector;
234 if (!PyArg_ParseTuple(_args, "hl",
235 &theResID,
236 &selector))
237 return NULL;
238 _err = GetIconSuite(&theIconSuite,
239 theResID,
240 selector);
241 if (_err != noErr) return PyMac_Error(_err);
242 _res = Py_BuildValue("O&",
243 ResObj_New, theIconSuite);
244 return _res;
247 static PyObject *Icn_DisposeIconSuite(_self, _args)
248 PyObject *_self;
249 PyObject *_args;
251 PyObject *_res = NULL;
252 OSErr _err;
253 IconSuiteRef theIconSuite;
254 Boolean disposeData;
255 if (!PyArg_ParseTuple(_args, "O&b",
256 ResObj_Convert, &theIconSuite,
257 &disposeData))
258 return NULL;
259 _err = DisposeIconSuite(theIconSuite,
260 disposeData);
261 if (_err != noErr) return PyMac_Error(_err);
262 Py_INCREF(Py_None);
263 _res = Py_None;
264 return _res;
267 static PyObject *Icn_PlotIconSuite(_self, _args)
268 PyObject *_self;
269 PyObject *_args;
271 PyObject *_res = NULL;
272 OSErr _err;
273 Rect theRect;
274 IconAlignmentType align;
275 IconTransformType transform;
276 IconSuiteRef theIconSuite;
277 if (!PyArg_ParseTuple(_args, "O&hhO&",
278 PyMac_GetRect, &theRect,
279 &align,
280 &transform,
281 ResObj_Convert, &theIconSuite))
282 return NULL;
283 _err = PlotIconSuite(&theRect,
284 align,
285 transform,
286 theIconSuite);
287 if (_err != noErr) return PyMac_Error(_err);
288 Py_INCREF(Py_None);
289 _res = Py_None;
290 return _res;
293 static PyObject *Icn_LoadIconCache(_self, _args)
294 PyObject *_self;
295 PyObject *_args;
297 PyObject *_res = NULL;
298 OSErr _err;
299 Rect theRect;
300 IconAlignmentType align;
301 IconTransformType transform;
302 IconCacheRef theIconCache;
303 if (!PyArg_ParseTuple(_args, "O&hhO&",
304 PyMac_GetRect, &theRect,
305 &align,
306 &transform,
307 ResObj_Convert, &theIconCache))
308 return NULL;
309 _err = LoadIconCache(&theRect,
310 align,
311 transform,
312 theIconCache);
313 if (_err != noErr) return PyMac_Error(_err);
314 Py_INCREF(Py_None);
315 _res = Py_None;
316 return _res;
319 static PyObject *Icn_GetLabel(_self, _args)
320 PyObject *_self;
321 PyObject *_args;
323 PyObject *_res = NULL;
324 OSErr _err;
325 SInt16 labelNumber;
326 RGBColor labelColor;
327 Str255 labelString;
328 if (!PyArg_ParseTuple(_args, "hO&",
329 &labelNumber,
330 PyMac_GetStr255, labelString))
331 return NULL;
332 _err = GetLabel(labelNumber,
333 &labelColor,
334 labelString);
335 if (_err != noErr) return PyMac_Error(_err);
336 _res = Py_BuildValue("O&",
337 QdRGB_New, &labelColor);
338 return _res;
341 static PyObject *Icn_PtInIconID(_self, _args)
342 PyObject *_self;
343 PyObject *_args;
345 PyObject *_res = NULL;
346 Boolean _rv;
347 Point testPt;
348 Rect iconRect;
349 IconAlignmentType align;
350 SInt16 iconID;
351 if (!PyArg_ParseTuple(_args, "O&O&hh",
352 PyMac_GetPoint, &testPt,
353 PyMac_GetRect, &iconRect,
354 &align,
355 &iconID))
356 return NULL;
357 _rv = PtInIconID(testPt,
358 &iconRect,
359 align,
360 iconID);
361 _res = Py_BuildValue("b",
362 _rv);
363 return _res;
366 static PyObject *Icn_PtInIconSuite(_self, _args)
367 PyObject *_self;
368 PyObject *_args;
370 PyObject *_res = NULL;
371 Boolean _rv;
372 Point testPt;
373 Rect iconRect;
374 IconAlignmentType align;
375 IconSuiteRef theIconSuite;
376 if (!PyArg_ParseTuple(_args, "O&O&hO&",
377 PyMac_GetPoint, &testPt,
378 PyMac_GetRect, &iconRect,
379 &align,
380 ResObj_Convert, &theIconSuite))
381 return NULL;
382 _rv = PtInIconSuite(testPt,
383 &iconRect,
384 align,
385 theIconSuite);
386 _res = Py_BuildValue("b",
387 _rv);
388 return _res;
391 static PyObject *Icn_RectInIconID(_self, _args)
392 PyObject *_self;
393 PyObject *_args;
395 PyObject *_res = NULL;
396 Boolean _rv;
397 Rect testRect;
398 Rect iconRect;
399 IconAlignmentType align;
400 SInt16 iconID;
401 if (!PyArg_ParseTuple(_args, "O&O&hh",
402 PyMac_GetRect, &testRect,
403 PyMac_GetRect, &iconRect,
404 &align,
405 &iconID))
406 return NULL;
407 _rv = RectInIconID(&testRect,
408 &iconRect,
409 align,
410 iconID);
411 _res = Py_BuildValue("b",
412 _rv);
413 return _res;
416 static PyObject *Icn_RectInIconSuite(_self, _args)
417 PyObject *_self;
418 PyObject *_args;
420 PyObject *_res = NULL;
421 Boolean _rv;
422 Rect testRect;
423 Rect iconRect;
424 IconAlignmentType align;
425 IconSuiteRef theIconSuite;
426 if (!PyArg_ParseTuple(_args, "O&O&hO&",
427 PyMac_GetRect, &testRect,
428 PyMac_GetRect, &iconRect,
429 &align,
430 ResObj_Convert, &theIconSuite))
431 return NULL;
432 _rv = RectInIconSuite(&testRect,
433 &iconRect,
434 align,
435 theIconSuite);
436 _res = Py_BuildValue("b",
437 _rv);
438 return _res;
441 static PyObject *Icn_IconIDToRgn(_self, _args)
442 PyObject *_self;
443 PyObject *_args;
445 PyObject *_res = NULL;
446 OSErr _err;
447 RgnHandle theRgn;
448 Rect iconRect;
449 IconAlignmentType align;
450 SInt16 iconID;
451 if (!PyArg_ParseTuple(_args, "O&O&hh",
452 ResObj_Convert, &theRgn,
453 PyMac_GetRect, &iconRect,
454 &align,
455 &iconID))
456 return NULL;
457 _err = IconIDToRgn(theRgn,
458 &iconRect,
459 align,
460 iconID);
461 if (_err != noErr) return PyMac_Error(_err);
462 Py_INCREF(Py_None);
463 _res = Py_None;
464 return _res;
467 static PyObject *Icn_IconSuiteToRgn(_self, _args)
468 PyObject *_self;
469 PyObject *_args;
471 PyObject *_res = NULL;
472 OSErr _err;
473 RgnHandle theRgn;
474 Rect iconRect;
475 IconAlignmentType align;
476 IconSuiteRef theIconSuite;
477 if (!PyArg_ParseTuple(_args, "O&O&hO&",
478 ResObj_Convert, &theRgn,
479 PyMac_GetRect, &iconRect,
480 &align,
481 ResObj_Convert, &theIconSuite))
482 return NULL;
483 _err = IconSuiteToRgn(theRgn,
484 &iconRect,
485 align,
486 theIconSuite);
487 if (_err != noErr) return PyMac_Error(_err);
488 Py_INCREF(Py_None);
489 _res = Py_None;
490 return _res;
493 static PyObject *Icn_SetSuiteLabel(_self, _args)
494 PyObject *_self;
495 PyObject *_args;
497 PyObject *_res = NULL;
498 OSErr _err;
499 IconSuiteRef theSuite;
500 SInt16 theLabel;
501 if (!PyArg_ParseTuple(_args, "O&h",
502 ResObj_Convert, &theSuite,
503 &theLabel))
504 return NULL;
505 _err = SetSuiteLabel(theSuite,
506 theLabel);
507 if (_err != noErr) return PyMac_Error(_err);
508 Py_INCREF(Py_None);
509 _res = Py_None;
510 return _res;
513 static PyObject *Icn_GetSuiteLabel(_self, _args)
514 PyObject *_self;
515 PyObject *_args;
517 PyObject *_res = NULL;
518 SInt16 _rv;
519 IconSuiteRef theSuite;
520 if (!PyArg_ParseTuple(_args, "O&",
521 ResObj_Convert, &theSuite))
522 return NULL;
523 _rv = GetSuiteLabel(theSuite);
524 _res = Py_BuildValue("h",
525 _rv);
526 return _res;
529 static PyObject *Icn_PlotIconHandle(_self, _args)
530 PyObject *_self;
531 PyObject *_args;
533 PyObject *_res = NULL;
534 OSErr _err;
535 Rect theRect;
536 IconAlignmentType align;
537 IconTransformType transform;
538 Handle theIcon;
539 if (!PyArg_ParseTuple(_args, "O&hhO&",
540 PyMac_GetRect, &theRect,
541 &align,
542 &transform,
543 ResObj_Convert, &theIcon))
544 return NULL;
545 _err = PlotIconHandle(&theRect,
546 align,
547 transform,
548 theIcon);
549 if (_err != noErr) return PyMac_Error(_err);
550 Py_INCREF(Py_None);
551 _res = Py_None;
552 return _res;
555 static PyObject *Icn_PlotSICNHandle(_self, _args)
556 PyObject *_self;
557 PyObject *_args;
559 PyObject *_res = NULL;
560 OSErr _err;
561 Rect theRect;
562 IconAlignmentType align;
563 IconTransformType transform;
564 Handle theSICN;
565 if (!PyArg_ParseTuple(_args, "O&hhO&",
566 PyMac_GetRect, &theRect,
567 &align,
568 &transform,
569 ResObj_Convert, &theSICN))
570 return NULL;
571 _err = PlotSICNHandle(&theRect,
572 align,
573 transform,
574 theSICN);
575 if (_err != noErr) return PyMac_Error(_err);
576 Py_INCREF(Py_None);
577 _res = Py_None;
578 return _res;
581 static PyObject *Icn_PlotCIconHandle(_self, _args)
582 PyObject *_self;
583 PyObject *_args;
585 PyObject *_res = NULL;
586 OSErr _err;
587 Rect theRect;
588 IconAlignmentType align;
589 IconTransformType transform;
590 CIconHandle theCIcon;
591 if (!PyArg_ParseTuple(_args, "O&hhO&",
592 PyMac_GetRect, &theRect,
593 &align,
594 &transform,
595 ResObj_Convert, &theCIcon))
596 return NULL;
597 _err = PlotCIconHandle(&theRect,
598 align,
599 transform,
600 theCIcon);
601 if (_err != noErr) return PyMac_Error(_err);
602 Py_INCREF(Py_None);
603 _res = Py_None;
604 return _res;
607 static PyObject *Icn_IconServicesTerminate(_self, _args)
608 PyObject *_self;
609 PyObject *_args;
611 PyObject *_res = NULL;
612 if (!PyArg_ParseTuple(_args, ""))
613 return NULL;
614 IconServicesTerminate();
615 Py_INCREF(Py_None);
616 _res = Py_None;
617 return _res;
620 static PyObject *Icn_IconRefToIconFamily(_self, _args)
621 PyObject *_self;
622 PyObject *_args;
624 PyObject *_res = NULL;
625 OSErr _err;
626 IconRef theIconRef;
627 IconSelectorValue whichIcons;
628 IconFamilyHandle iconFamily;
629 if (!PyArg_ParseTuple(_args, "O&l",
630 ResObj_Convert, &theIconRef,
631 &whichIcons))
632 return NULL;
633 _err = IconRefToIconFamily(theIconRef,
634 whichIcons,
635 &iconFamily);
636 if (_err != noErr) return PyMac_Error(_err);
637 _res = Py_BuildValue("O&",
638 ResObj_New, iconFamily);
639 return _res;
642 static PyObject *Icn_IconFamilyToIconSuite(_self, _args)
643 PyObject *_self;
644 PyObject *_args;
646 PyObject *_res = NULL;
647 OSErr _err;
648 IconFamilyHandle iconFamily;
649 IconSelectorValue whichIcons;
650 IconSuiteRef iconSuite;
651 if (!PyArg_ParseTuple(_args, "O&l",
652 ResObj_Convert, &iconFamily,
653 &whichIcons))
654 return NULL;
655 _err = IconFamilyToIconSuite(iconFamily,
656 whichIcons,
657 &iconSuite);
658 if (_err != noErr) return PyMac_Error(_err);
659 _res = Py_BuildValue("O&",
660 ResObj_New, iconSuite);
661 return _res;
664 static PyObject *Icn_IconSuiteToIconFamily(_self, _args)
665 PyObject *_self;
666 PyObject *_args;
668 PyObject *_res = NULL;
669 OSErr _err;
670 IconSuiteRef iconSuite;
671 IconSelectorValue whichIcons;
672 IconFamilyHandle iconFamily;
673 if (!PyArg_ParseTuple(_args, "O&l",
674 ResObj_Convert, &iconSuite,
675 &whichIcons))
676 return NULL;
677 _err = IconSuiteToIconFamily(iconSuite,
678 whichIcons,
679 &iconFamily);
680 if (_err != noErr) return PyMac_Error(_err);
681 _res = Py_BuildValue("O&",
682 ResObj_New, iconFamily);
683 return _res;
686 static PyObject *Icn_SetIconFamilyData(_self, _args)
687 PyObject *_self;
688 PyObject *_args;
690 PyObject *_res = NULL;
691 OSErr _err;
692 IconFamilyHandle iconFamily;
693 OSType iconType;
694 Handle h;
695 if (!PyArg_ParseTuple(_args, "O&O&O&",
696 ResObj_Convert, &iconFamily,
697 PyMac_GetOSType, &iconType,
698 ResObj_Convert, &h))
699 return NULL;
700 _err = SetIconFamilyData(iconFamily,
701 iconType,
703 if (_err != noErr) return PyMac_Error(_err);
704 Py_INCREF(Py_None);
705 _res = Py_None;
706 return _res;
709 static PyObject *Icn_GetIconFamilyData(_self, _args)
710 PyObject *_self;
711 PyObject *_args;
713 PyObject *_res = NULL;
714 OSErr _err;
715 IconFamilyHandle iconFamily;
716 OSType iconType;
717 Handle h;
718 if (!PyArg_ParseTuple(_args, "O&O&O&",
719 ResObj_Convert, &iconFamily,
720 PyMac_GetOSType, &iconType,
721 ResObj_Convert, &h))
722 return NULL;
723 _err = GetIconFamilyData(iconFamily,
724 iconType,
726 if (_err != noErr) return PyMac_Error(_err);
727 Py_INCREF(Py_None);
728 _res = Py_None;
729 return _res;
732 static PyObject *Icn_GetIconRefOwners(_self, _args)
733 PyObject *_self;
734 PyObject *_args;
736 PyObject *_res = NULL;
737 OSErr _err;
738 IconRef theIconRef;
739 UInt16 owners;
740 if (!PyArg_ParseTuple(_args, "O&",
741 ResObj_Convert, &theIconRef))
742 return NULL;
743 _err = GetIconRefOwners(theIconRef,
744 &owners);
745 if (_err != noErr) return PyMac_Error(_err);
746 _res = Py_BuildValue("h",
747 owners);
748 return _res;
751 static PyObject *Icn_AcquireIconRef(_self, _args)
752 PyObject *_self;
753 PyObject *_args;
755 PyObject *_res = NULL;
756 OSErr _err;
757 IconRef theIconRef;
758 if (!PyArg_ParseTuple(_args, "O&",
759 ResObj_Convert, &theIconRef))
760 return NULL;
761 _err = AcquireIconRef(theIconRef);
762 if (_err != noErr) return PyMac_Error(_err);
763 Py_INCREF(Py_None);
764 _res = Py_None;
765 return _res;
768 static PyObject *Icn_ReleaseIconRef(_self, _args)
769 PyObject *_self;
770 PyObject *_args;
772 PyObject *_res = NULL;
773 OSErr _err;
774 IconRef theIconRef;
775 if (!PyArg_ParseTuple(_args, "O&",
776 ResObj_Convert, &theIconRef))
777 return NULL;
778 _err = ReleaseIconRef(theIconRef);
779 if (_err != noErr) return PyMac_Error(_err);
780 Py_INCREF(Py_None);
781 _res = Py_None;
782 return _res;
785 static PyObject *Icn_GetIconRefFromFile(_self, _args)
786 PyObject *_self;
787 PyObject *_args;
789 PyObject *_res = NULL;
790 OSErr _err;
791 FSSpec theFile;
792 IconRef theIconRef;
793 SInt16 theLabel;
794 if (!PyArg_ParseTuple(_args, "O&",
795 PyMac_GetFSSpec, &theFile))
796 return NULL;
797 _err = GetIconRefFromFile(&theFile,
798 &theIconRef,
799 &theLabel);
800 if (_err != noErr) return PyMac_Error(_err);
801 _res = Py_BuildValue("O&h",
802 ResObj_New, theIconRef,
803 theLabel);
804 return _res;
807 static PyObject *Icn_GetIconRef(_self, _args)
808 PyObject *_self;
809 PyObject *_args;
811 PyObject *_res = NULL;
812 OSErr _err;
813 SInt16 vRefNum;
814 OSType creator;
815 OSType iconType;
816 IconRef theIconRef;
817 if (!PyArg_ParseTuple(_args, "hO&O&",
818 &vRefNum,
819 PyMac_GetOSType, &creator,
820 PyMac_GetOSType, &iconType))
821 return NULL;
822 _err = GetIconRef(vRefNum,
823 creator,
824 iconType,
825 &theIconRef);
826 if (_err != noErr) return PyMac_Error(_err);
827 _res = Py_BuildValue("O&",
828 ResObj_New, theIconRef);
829 return _res;
832 static PyObject *Icn_GetIconRefFromFolder(_self, _args)
833 PyObject *_self;
834 PyObject *_args;
836 PyObject *_res = NULL;
837 OSErr _err;
838 SInt16 vRefNum;
839 SInt32 parentFolderID;
840 SInt32 folderID;
841 SInt8 attributes;
842 SInt8 accessPrivileges;
843 IconRef theIconRef;
844 if (!PyArg_ParseTuple(_args, "hllbb",
845 &vRefNum,
846 &parentFolderID,
847 &folderID,
848 &attributes,
849 &accessPrivileges))
850 return NULL;
851 _err = GetIconRefFromFolder(vRefNum,
852 parentFolderID,
853 folderID,
854 attributes,
855 accessPrivileges,
856 &theIconRef);
857 if (_err != noErr) return PyMac_Error(_err);
858 _res = Py_BuildValue("O&",
859 ResObj_New, theIconRef);
860 return _res;
863 static PyObject *Icn_RegisterIconRefFromIconFamily(_self, _args)
864 PyObject *_self;
865 PyObject *_args;
867 PyObject *_res = NULL;
868 OSErr _err;
869 OSType creator;
870 OSType iconType;
871 IconFamilyHandle iconFamily;
872 IconRef theIconRef;
873 if (!PyArg_ParseTuple(_args, "O&O&O&",
874 PyMac_GetOSType, &creator,
875 PyMac_GetOSType, &iconType,
876 ResObj_Convert, &iconFamily))
877 return NULL;
878 _err = RegisterIconRefFromIconFamily(creator,
879 iconType,
880 iconFamily,
881 &theIconRef);
882 if (_err != noErr) return PyMac_Error(_err);
883 _res = Py_BuildValue("O&",
884 ResObj_New, theIconRef);
885 return _res;
888 static PyObject *Icn_RegisterIconRefFromResource(_self, _args)
889 PyObject *_self;
890 PyObject *_args;
892 PyObject *_res = NULL;
893 OSErr _err;
894 OSType creator;
895 OSType iconType;
896 FSSpec resourceFile;
897 SInt16 resourceID;
898 IconRef theIconRef;
899 if (!PyArg_ParseTuple(_args, "O&O&O&h",
900 PyMac_GetOSType, &creator,
901 PyMac_GetOSType, &iconType,
902 PyMac_GetFSSpec, &resourceFile,
903 &resourceID))
904 return NULL;
905 _err = RegisterIconRefFromResource(creator,
906 iconType,
907 &resourceFile,
908 resourceID,
909 &theIconRef);
910 if (_err != noErr) return PyMac_Error(_err);
911 _res = Py_BuildValue("O&",
912 ResObj_New, theIconRef);
913 return _res;
916 static PyObject *Icn_UnregisterIconRef(_self, _args)
917 PyObject *_self;
918 PyObject *_args;
920 PyObject *_res = NULL;
921 OSErr _err;
922 OSType creator;
923 OSType iconType;
924 if (!PyArg_ParseTuple(_args, "O&O&",
925 PyMac_GetOSType, &creator,
926 PyMac_GetOSType, &iconType))
927 return NULL;
928 _err = UnregisterIconRef(creator,
929 iconType);
930 if (_err != noErr) return PyMac_Error(_err);
931 Py_INCREF(Py_None);
932 _res = Py_None;
933 return _res;
936 static PyObject *Icn_UpdateIconRef(_self, _args)
937 PyObject *_self;
938 PyObject *_args;
940 PyObject *_res = NULL;
941 OSErr _err;
942 IconRef theIconRef;
943 if (!PyArg_ParseTuple(_args, "O&",
944 ResObj_Convert, &theIconRef))
945 return NULL;
946 _err = UpdateIconRef(theIconRef);
947 if (_err != noErr) return PyMac_Error(_err);
948 Py_INCREF(Py_None);
949 _res = Py_None;
950 return _res;
953 static PyObject *Icn_OverrideIconRefFromResource(_self, _args)
954 PyObject *_self;
955 PyObject *_args;
957 PyObject *_res = NULL;
958 OSErr _err;
959 IconRef theIconRef;
960 FSSpec resourceFile;
961 SInt16 resourceID;
962 if (!PyArg_ParseTuple(_args, "O&O&h",
963 ResObj_Convert, &theIconRef,
964 PyMac_GetFSSpec, &resourceFile,
965 &resourceID))
966 return NULL;
967 _err = OverrideIconRefFromResource(theIconRef,
968 &resourceFile,
969 resourceID);
970 if (_err != noErr) return PyMac_Error(_err);
971 Py_INCREF(Py_None);
972 _res = Py_None;
973 return _res;
976 static PyObject *Icn_OverrideIconRef(_self, _args)
977 PyObject *_self;
978 PyObject *_args;
980 PyObject *_res = NULL;
981 OSErr _err;
982 IconRef oldIconRef;
983 IconRef newIconRef;
984 if (!PyArg_ParseTuple(_args, "O&O&",
985 ResObj_Convert, &oldIconRef,
986 ResObj_Convert, &newIconRef))
987 return NULL;
988 _err = OverrideIconRef(oldIconRef,
989 newIconRef);
990 if (_err != noErr) return PyMac_Error(_err);
991 Py_INCREF(Py_None);
992 _res = Py_None;
993 return _res;
996 static PyObject *Icn_RemoveIconRefOverride(_self, _args)
997 PyObject *_self;
998 PyObject *_args;
1000 PyObject *_res = NULL;
1001 OSErr _err;
1002 IconRef theIconRef;
1003 if (!PyArg_ParseTuple(_args, "O&",
1004 ResObj_Convert, &theIconRef))
1005 return NULL;
1006 _err = RemoveIconRefOverride(theIconRef);
1007 if (_err != noErr) return PyMac_Error(_err);
1008 Py_INCREF(Py_None);
1009 _res = Py_None;
1010 return _res;
1013 static PyObject *Icn_CompositeIconRef(_self, _args)
1014 PyObject *_self;
1015 PyObject *_args;
1017 PyObject *_res = NULL;
1018 OSErr _err;
1019 IconRef backgroundIconRef;
1020 IconRef foregroundIconRef;
1021 IconRef compositeIconRef;
1022 if (!PyArg_ParseTuple(_args, "O&O&",
1023 ResObj_Convert, &backgroundIconRef,
1024 ResObj_Convert, &foregroundIconRef))
1025 return NULL;
1026 _err = CompositeIconRef(backgroundIconRef,
1027 foregroundIconRef,
1028 &compositeIconRef);
1029 if (_err != noErr) return PyMac_Error(_err);
1030 _res = Py_BuildValue("O&",
1031 ResObj_New, compositeIconRef);
1032 return _res;
1035 static PyObject *Icn_IsIconRefComposite(_self, _args)
1036 PyObject *_self;
1037 PyObject *_args;
1039 PyObject *_res = NULL;
1040 OSErr _err;
1041 IconRef compositeIconRef;
1042 IconRef backgroundIconRef;
1043 IconRef foregroundIconRef;
1044 if (!PyArg_ParseTuple(_args, "O&",
1045 ResObj_Convert, &compositeIconRef))
1046 return NULL;
1047 _err = IsIconRefComposite(compositeIconRef,
1048 &backgroundIconRef,
1049 &foregroundIconRef);
1050 if (_err != noErr) return PyMac_Error(_err);
1051 _res = Py_BuildValue("O&O&",
1052 ResObj_New, backgroundIconRef,
1053 ResObj_New, foregroundIconRef);
1054 return _res;
1057 static PyObject *Icn_IsValidIconRef(_self, _args)
1058 PyObject *_self;
1059 PyObject *_args;
1061 PyObject *_res = NULL;
1062 Boolean _rv;
1063 IconRef theIconRef;
1064 if (!PyArg_ParseTuple(_args, "O&",
1065 ResObj_Convert, &theIconRef))
1066 return NULL;
1067 _rv = IsValidIconRef(theIconRef);
1068 _res = Py_BuildValue("b",
1069 _rv);
1070 return _res;
1073 static PyObject *Icn_PlotIconRef(_self, _args)
1074 PyObject *_self;
1075 PyObject *_args;
1077 PyObject *_res = NULL;
1078 OSErr _err;
1079 Rect theRect;
1080 IconAlignmentType align;
1081 IconTransformType transform;
1082 IconServicesUsageFlags theIconServicesUsageFlags;
1083 IconRef theIconRef;
1084 if (!PyArg_ParseTuple(_args, "O&hhlO&",
1085 PyMac_GetRect, &theRect,
1086 &align,
1087 &transform,
1088 &theIconServicesUsageFlags,
1089 ResObj_Convert, &theIconRef))
1090 return NULL;
1091 _err = PlotIconRef(&theRect,
1092 align,
1093 transform,
1094 theIconServicesUsageFlags,
1095 theIconRef);
1096 if (_err != noErr) return PyMac_Error(_err);
1097 Py_INCREF(Py_None);
1098 _res = Py_None;
1099 return _res;
1102 static PyObject *Icn_PtInIconRef(_self, _args)
1103 PyObject *_self;
1104 PyObject *_args;
1106 PyObject *_res = NULL;
1107 Boolean _rv;
1108 Point testPt;
1109 Rect iconRect;
1110 IconAlignmentType align;
1111 IconServicesUsageFlags theIconServicesUsageFlags;
1112 IconRef theIconRef;
1113 if (!PyArg_ParseTuple(_args, "O&O&hlO&",
1114 PyMac_GetPoint, &testPt,
1115 PyMac_GetRect, &iconRect,
1116 &align,
1117 &theIconServicesUsageFlags,
1118 ResObj_Convert, &theIconRef))
1119 return NULL;
1120 _rv = PtInIconRef(&testPt,
1121 &iconRect,
1122 align,
1123 theIconServicesUsageFlags,
1124 theIconRef);
1125 _res = Py_BuildValue("b",
1126 _rv);
1127 return _res;
1130 static PyObject *Icn_RectInIconRef(_self, _args)
1131 PyObject *_self;
1132 PyObject *_args;
1134 PyObject *_res = NULL;
1135 Boolean _rv;
1136 Rect testRect;
1137 Rect iconRect;
1138 IconAlignmentType align;
1139 IconServicesUsageFlags iconServicesUsageFlags;
1140 IconRef theIconRef;
1141 if (!PyArg_ParseTuple(_args, "O&O&hlO&",
1142 PyMac_GetRect, &testRect,
1143 PyMac_GetRect, &iconRect,
1144 &align,
1145 &iconServicesUsageFlags,
1146 ResObj_Convert, &theIconRef))
1147 return NULL;
1148 _rv = RectInIconRef(&testRect,
1149 &iconRect,
1150 align,
1151 iconServicesUsageFlags,
1152 theIconRef);
1153 _res = Py_BuildValue("b",
1154 _rv);
1155 return _res;
1158 static PyObject *Icn_IconRefToRgn(_self, _args)
1159 PyObject *_self;
1160 PyObject *_args;
1162 PyObject *_res = NULL;
1163 OSErr _err;
1164 RgnHandle theRgn;
1165 Rect iconRect;
1166 IconAlignmentType align;
1167 IconServicesUsageFlags iconServicesUsageFlags;
1168 IconRef theIconRef;
1169 if (!PyArg_ParseTuple(_args, "O&O&hlO&",
1170 ResObj_Convert, &theRgn,
1171 PyMac_GetRect, &iconRect,
1172 &align,
1173 &iconServicesUsageFlags,
1174 ResObj_Convert, &theIconRef))
1175 return NULL;
1176 _err = IconRefToRgn(theRgn,
1177 &iconRect,
1178 align,
1179 iconServicesUsageFlags,
1180 theIconRef);
1181 if (_err != noErr) return PyMac_Error(_err);
1182 Py_INCREF(Py_None);
1183 _res = Py_None;
1184 return _res;
1187 static PyObject *Icn_GetIconSizesFromIconRef(_self, _args)
1188 PyObject *_self;
1189 PyObject *_args;
1191 PyObject *_res = NULL;
1192 OSErr _err;
1193 IconSelectorValue iconSelectorInput;
1194 IconSelectorValue iconSelectorOutputPtr;
1195 IconServicesUsageFlags iconServicesUsageFlags;
1196 IconRef theIconRef;
1197 if (!PyArg_ParseTuple(_args, "llO&",
1198 &iconSelectorInput,
1199 &iconServicesUsageFlags,
1200 ResObj_Convert, &theIconRef))
1201 return NULL;
1202 _err = GetIconSizesFromIconRef(iconSelectorInput,
1203 &iconSelectorOutputPtr,
1204 iconServicesUsageFlags,
1205 theIconRef);
1206 if (_err != noErr) return PyMac_Error(_err);
1207 _res = Py_BuildValue("l",
1208 iconSelectorOutputPtr);
1209 return _res;
1212 static PyObject *Icn_FlushIconRefs(_self, _args)
1213 PyObject *_self;
1214 PyObject *_args;
1216 PyObject *_res = NULL;
1217 OSErr _err;
1218 OSType creator;
1219 OSType iconType;
1220 if (!PyArg_ParseTuple(_args, "O&O&",
1221 PyMac_GetOSType, &creator,
1222 PyMac_GetOSType, &iconType))
1223 return NULL;
1224 _err = FlushIconRefs(creator,
1225 iconType);
1226 if (_err != noErr) return PyMac_Error(_err);
1227 Py_INCREF(Py_None);
1228 _res = Py_None;
1229 return _res;
1232 static PyObject *Icn_FlushIconRefsByVolume(_self, _args)
1233 PyObject *_self;
1234 PyObject *_args;
1236 PyObject *_res = NULL;
1237 OSErr _err;
1238 SInt16 vRefNum;
1239 if (!PyArg_ParseTuple(_args, "h",
1240 &vRefNum))
1241 return NULL;
1242 _err = FlushIconRefsByVolume(vRefNum);
1243 if (_err != noErr) return PyMac_Error(_err);
1244 Py_INCREF(Py_None);
1245 _res = Py_None;
1246 return _res;
1249 static PyObject *Icn_SetCustomIconsEnabled(_self, _args)
1250 PyObject *_self;
1251 PyObject *_args;
1253 PyObject *_res = NULL;
1254 OSErr _err;
1255 SInt16 vRefNum;
1256 Boolean enableCustomIcons;
1257 if (!PyArg_ParseTuple(_args, "hb",
1258 &vRefNum,
1259 &enableCustomIcons))
1260 return NULL;
1261 _err = SetCustomIconsEnabled(vRefNum,
1262 enableCustomIcons);
1263 if (_err != noErr) return PyMac_Error(_err);
1264 Py_INCREF(Py_None);
1265 _res = Py_None;
1266 return _res;
1269 static PyObject *Icn_GetCustomIconsEnabled(_self, _args)
1270 PyObject *_self;
1271 PyObject *_args;
1273 PyObject *_res = NULL;
1274 OSErr _err;
1275 SInt16 vRefNum;
1276 Boolean customIconsEnabled;
1277 if (!PyArg_ParseTuple(_args, "h",
1278 &vRefNum))
1279 return NULL;
1280 _err = GetCustomIconsEnabled(vRefNum,
1281 &customIconsEnabled);
1282 if (_err != noErr) return PyMac_Error(_err);
1283 _res = Py_BuildValue("b",
1284 customIconsEnabled);
1285 return _res;
1288 static PyMethodDef Icn_methods[] = {
1289 {"GetCIcon", (PyCFunction)Icn_GetCIcon, 1,
1290 "(SInt16 iconID) -> (CIconHandle _rv)"},
1291 {"PlotCIcon", (PyCFunction)Icn_PlotCIcon, 1,
1292 "(Rect theRect, CIconHandle theIcon) -> None"},
1293 {"DisposeCIcon", (PyCFunction)Icn_DisposeCIcon, 1,
1294 "(CIconHandle theIcon) -> None"},
1295 {"GetIcon", (PyCFunction)Icn_GetIcon, 1,
1296 "(SInt16 iconID) -> (Handle _rv)"},
1297 {"PlotIcon", (PyCFunction)Icn_PlotIcon, 1,
1298 "(Rect theRect, Handle theIcon) -> None"},
1299 {"PlotIconID", (PyCFunction)Icn_PlotIconID, 1,
1300 "(Rect theRect, IconAlignmentType align, IconTransformType transform, SInt16 theResID) -> None"},
1301 {"NewIconSuite", (PyCFunction)Icn_NewIconSuite, 1,
1302 "() -> (IconSuiteRef theIconSuite)"},
1303 {"AddIconToSuite", (PyCFunction)Icn_AddIconToSuite, 1,
1304 "(Handle theIconData, IconSuiteRef theSuite, ResType theType) -> None"},
1305 {"GetIconFromSuite", (PyCFunction)Icn_GetIconFromSuite, 1,
1306 "(IconSuiteRef theSuite, ResType theType) -> (Handle theIconData)"},
1307 {"GetIconSuite", (PyCFunction)Icn_GetIconSuite, 1,
1308 "(SInt16 theResID, IconSelectorValue selector) -> (IconSuiteRef theIconSuite)"},
1309 {"DisposeIconSuite", (PyCFunction)Icn_DisposeIconSuite, 1,
1310 "(IconSuiteRef theIconSuite, Boolean disposeData) -> None"},
1311 {"PlotIconSuite", (PyCFunction)Icn_PlotIconSuite, 1,
1312 "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconSuiteRef theIconSuite) -> None"},
1313 {"LoadIconCache", (PyCFunction)Icn_LoadIconCache, 1,
1314 "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconCacheRef theIconCache) -> None"},
1315 {"GetLabel", (PyCFunction)Icn_GetLabel, 1,
1316 "(SInt16 labelNumber, Str255 labelString) -> (RGBColor labelColor)"},
1317 {"PtInIconID", (PyCFunction)Icn_PtInIconID, 1,
1318 "(Point testPt, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)"},
1319 {"PtInIconSuite", (PyCFunction)Icn_PtInIconSuite, 1,
1320 "(Point testPt, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)"},
1321 {"RectInIconID", (PyCFunction)Icn_RectInIconID, 1,
1322 "(Rect testRect, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)"},
1323 {"RectInIconSuite", (PyCFunction)Icn_RectInIconSuite, 1,
1324 "(Rect testRect, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)"},
1325 {"IconIDToRgn", (PyCFunction)Icn_IconIDToRgn, 1,
1326 "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> None"},
1327 {"IconSuiteToRgn", (PyCFunction)Icn_IconSuiteToRgn, 1,
1328 "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> None"},
1329 {"SetSuiteLabel", (PyCFunction)Icn_SetSuiteLabel, 1,
1330 "(IconSuiteRef theSuite, SInt16 theLabel) -> None"},
1331 {"GetSuiteLabel", (PyCFunction)Icn_GetSuiteLabel, 1,
1332 "(IconSuiteRef theSuite) -> (SInt16 _rv)"},
1333 {"PlotIconHandle", (PyCFunction)Icn_PlotIconHandle, 1,
1334 "(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon) -> None"},
1335 {"PlotSICNHandle", (PyCFunction)Icn_PlotSICNHandle, 1,
1336 "(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN) -> None"},
1337 {"PlotCIconHandle", (PyCFunction)Icn_PlotCIconHandle, 1,
1338 "(Rect theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon) -> None"},
1339 {"IconServicesTerminate", (PyCFunction)Icn_IconServicesTerminate, 1,
1340 "() -> None"},
1341 {"IconRefToIconFamily", (PyCFunction)Icn_IconRefToIconFamily, 1,
1342 "(IconRef theIconRef, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)"},
1343 {"IconFamilyToIconSuite", (PyCFunction)Icn_IconFamilyToIconSuite, 1,
1344 "(IconFamilyHandle iconFamily, IconSelectorValue whichIcons) -> (IconSuiteRef iconSuite)"},
1345 {"IconSuiteToIconFamily", (PyCFunction)Icn_IconSuiteToIconFamily, 1,
1346 "(IconSuiteRef iconSuite, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)"},
1347 {"SetIconFamilyData", (PyCFunction)Icn_SetIconFamilyData, 1,
1348 "(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None"},
1349 {"GetIconFamilyData", (PyCFunction)Icn_GetIconFamilyData, 1,
1350 "(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None"},
1351 {"GetIconRefOwners", (PyCFunction)Icn_GetIconRefOwners, 1,
1352 "(IconRef theIconRef) -> (UInt16 owners)"},
1353 {"AcquireIconRef", (PyCFunction)Icn_AcquireIconRef, 1,
1354 "(IconRef theIconRef) -> None"},
1355 {"ReleaseIconRef", (PyCFunction)Icn_ReleaseIconRef, 1,
1356 "(IconRef theIconRef) -> None"},
1357 {"GetIconRefFromFile", (PyCFunction)Icn_GetIconRefFromFile, 1,
1358 "(FSSpec theFile) -> (IconRef theIconRef, SInt16 theLabel)"},
1359 {"GetIconRef", (PyCFunction)Icn_GetIconRef, 1,
1360 "(SInt16 vRefNum, OSType creator, OSType iconType) -> (IconRef theIconRef)"},
1361 {"GetIconRefFromFolder", (PyCFunction)Icn_GetIconRefFromFolder, 1,
1362 "(SInt16 vRefNum, SInt32 parentFolderID, SInt32 folderID, SInt8 attributes, SInt8 accessPrivileges) -> (IconRef theIconRef)"},
1363 {"RegisterIconRefFromIconFamily", (PyCFunction)Icn_RegisterIconRefFromIconFamily, 1,
1364 "(OSType creator, OSType iconType, IconFamilyHandle iconFamily) -> (IconRef theIconRef)"},
1365 {"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1,
1366 "(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)"},
1367 {"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1,
1368 "(OSType creator, OSType iconType) -> None"},
1369 {"UpdateIconRef", (PyCFunction)Icn_UpdateIconRef, 1,
1370 "(IconRef theIconRef) -> None"},
1371 {"OverrideIconRefFromResource", (PyCFunction)Icn_OverrideIconRefFromResource, 1,
1372 "(IconRef theIconRef, FSSpec resourceFile, SInt16 resourceID) -> None"},
1373 {"OverrideIconRef", (PyCFunction)Icn_OverrideIconRef, 1,
1374 "(IconRef oldIconRef, IconRef newIconRef) -> None"},
1375 {"RemoveIconRefOverride", (PyCFunction)Icn_RemoveIconRefOverride, 1,
1376 "(IconRef theIconRef) -> None"},
1377 {"CompositeIconRef", (PyCFunction)Icn_CompositeIconRef, 1,
1378 "(IconRef backgroundIconRef, IconRef foregroundIconRef) -> (IconRef compositeIconRef)"},
1379 {"IsIconRefComposite", (PyCFunction)Icn_IsIconRefComposite, 1,
1380 "(IconRef compositeIconRef) -> (IconRef backgroundIconRef, IconRef foregroundIconRef)"},
1381 {"IsValidIconRef", (PyCFunction)Icn_IsValidIconRef, 1,
1382 "(IconRef theIconRef) -> (Boolean _rv)"},
1383 {"PlotIconRef", (PyCFunction)Icn_PlotIconRef, 1,
1384 "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> None"},
1385 {"PtInIconRef", (PyCFunction)Icn_PtInIconRef, 1,
1386 "(Point testPt, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)"},
1387 {"RectInIconRef", (PyCFunction)Icn_RectInIconRef, 1,
1388 "(Rect testRect, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)"},
1389 {"IconRefToRgn", (PyCFunction)Icn_IconRefToRgn, 1,
1390 "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> None"},
1391 {"GetIconSizesFromIconRef", (PyCFunction)Icn_GetIconSizesFromIconRef, 1,
1392 "(IconSelectorValue iconSelectorInput, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (IconSelectorValue iconSelectorOutputPtr)"},
1393 {"FlushIconRefs", (PyCFunction)Icn_FlushIconRefs, 1,
1394 "(OSType creator, OSType iconType) -> None"},
1395 {"FlushIconRefsByVolume", (PyCFunction)Icn_FlushIconRefsByVolume, 1,
1396 "(SInt16 vRefNum) -> None"},
1397 {"SetCustomIconsEnabled", (PyCFunction)Icn_SetCustomIconsEnabled, 1,
1398 "(SInt16 vRefNum, Boolean enableCustomIcons) -> None"},
1399 {"GetCustomIconsEnabled", (PyCFunction)Icn_GetCustomIconsEnabled, 1,
1400 "(SInt16 vRefNum) -> (Boolean customIconsEnabled)"},
1401 {NULL, NULL, 0}
1407 void initIcn()
1409 PyObject *m;
1410 PyObject *d;
1415 m = Py_InitModule("Icn", Icn_methods);
1416 d = PyModule_GetDict(m);
1417 Icn_Error = PyMac_GetOSErrException();
1418 if (Icn_Error == NULL ||
1419 PyDict_SetItemString(d, "Error", Icn_Error) != 0)
1420 Py_FatalError("can't initialize Icn.Error");
1423 /* ========================= End module Icn ========================= */