Icons.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:62k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Icons.h
  3.  
  4.      Contains:   Icon Utilities and Icon Services Interfaces.
  5.  
  6.      Version:    Technology: Mac OS 8.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1990-2001 by Apple Computer, Inc. All rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ICONS__
  18. #define __ICONS__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __QUICKDRAW__
  23. #include "Quickdraw.h"
  24. #endif
  25. #ifndef __FILES__
  26. #include "Files.h"
  27. #endif
  28. #ifndef __CODEFRAGMENTS__
  29. #include "CodeFragments.h"
  30. #endif
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40. #if PRAGMA_STRUCT_ALIGN
  41.     #pragma options align=mac68k
  42. #elif PRAGMA_STRUCT_PACKPUSH
  43.     #pragma pack(push, 2)
  44. #elif PRAGMA_STRUCT_PACK
  45.     #pragma pack(2)
  46. #endif
  47. /* The following are icons for which there are both icon suites and SICNs. */
  48. /* Avoid using icon resources if possible. Use IconServices instead. */
  49. enum {
  50.     kGenericDocumentIconResource = -4000,
  51.     kGenericStationeryIconResource = -3985,
  52.     kGenericEditionFileIconResource = -3989,
  53.     kGenericApplicationIconResource = -3996,
  54.     kGenericDeskAccessoryIconResource = -3991,
  55.     kGenericFolderIconResource  = -3999,
  56.     kPrivateFolderIconResource  = -3994,
  57.     kFloppyIconResource         = -3998,
  58.     kTrashIconResource          = -3993,
  59.     kGenericRAMDiskIconResource = -3988,
  60.     kGenericCDROMIconResource   = -3987
  61. };
  62. /* The following are icons for which there are SICNs only. */
  63. /* Avoid using icon resources if possible. Use IconServices instead. */
  64. enum {
  65.     kDesktopIconResource        = -3992,
  66.     kOpenFolderIconResource     = -3997,
  67.     kGenericHardDiskIconResource = -3995,
  68.     kGenericFileServerIconResource = -3972,
  69.     kGenericSuitcaseIconResource = -3970,
  70.     kGenericMoverObjectIconResource = -3969
  71. };
  72. /* The following are icons for which there are icon suites only. */
  73. /* Avoid using icon resources if possible. Use IconServices instead. */
  74. enum {
  75.     kGenericPreferencesIconResource = -3971,
  76.     kGenericQueryDocumentIconResource = -16506,
  77.     kGenericExtensionIconResource = -16415,
  78.     kSystemFolderIconResource   = -3983,
  79.     kHelpIconResource           = -20271,
  80.     kAppleMenuFolderIconResource = -3982
  81. };
  82. /* Obsolete. Use named constants defined above. */
  83. enum {
  84.     genericDocumentIconResource = kGenericDocumentIconResource,
  85.     genericStationeryIconResource = kGenericStationeryIconResource,
  86.     genericEditionFileIconResource = kGenericEditionFileIconResource,
  87.     genericApplicationIconResource = kGenericApplicationIconResource,
  88.     genericDeskAccessoryIconResource = kGenericDeskAccessoryIconResource,
  89.     genericFolderIconResource   = kGenericFolderIconResource,
  90.     privateFolderIconResource   = kPrivateFolderIconResource,
  91.     floppyIconResource          = kFloppyIconResource,
  92.     trashIconResource           = kTrashIconResource,
  93.     genericRAMDiskIconResource  = kGenericRAMDiskIconResource,
  94.     genericCDROMIconResource    = kGenericCDROMIconResource,
  95.     desktopIconResource         = kDesktopIconResource,
  96.     openFolderIconResource      = kOpenFolderIconResource,
  97.     genericHardDiskIconResource = kGenericHardDiskIconResource,
  98.     genericFileServerIconResource = kGenericFileServerIconResource,
  99.     genericSuitcaseIconResource = kGenericSuitcaseIconResource,
  100.     genericMoverObjectIconResource = kGenericMoverObjectIconResource,
  101.     genericPreferencesIconResource = kGenericPreferencesIconResource,
  102.     genericQueryDocumentIconResource = kGenericQueryDocumentIconResource,
  103.     genericExtensionIconResource = kGenericExtensionIconResource,
  104.     systemFolderIconResource    = kSystemFolderIconResource,
  105.     appleMenuFolderIconResource = kAppleMenuFolderIconResource
  106. };
  107. /* Avoid using icon resources if possible. Use IconServices instead. */
  108. enum {
  109.     kStartupFolderIconResource  = -3981,
  110.     kOwnedFolderIconResource    = -3980,
  111.     kDropFolderIconResource     = -3979,
  112.     kSharedFolderIconResource   = -3978,
  113.     kMountedFolderIconResource  = -3977,
  114.     kControlPanelFolderIconResource = -3976,
  115.     kPrintMonitorFolderIconResource = -3975,
  116.     kPreferencesFolderIconResource = -3974,
  117.     kExtensionsFolderIconResource = -3973,
  118.     kFontsFolderIconResource    = -3968,
  119.     kFullTrashIconResource      = -3984
  120. };
  121. /* Obsolete. Use named constants defined above. */
  122. enum {
  123.     startupFolderIconResource   = kStartupFolderIconResource,
  124.     ownedFolderIconResource     = kOwnedFolderIconResource,
  125.     dropFolderIconResource      = kDropFolderIconResource,
  126.     sharedFolderIconResource    = kSharedFolderIconResource,
  127.     mountedFolderIconResource   = kMountedFolderIconResource,
  128.     controlPanelFolderIconResource = kControlPanelFolderIconResource,
  129.     printMonitorFolderIconResource = kPrintMonitorFolderIconResource,
  130.     preferencesFolderIconResource = kPreferencesFolderIconResource,
  131.     extensionsFolderIconResource = kExtensionsFolderIconResource,
  132.     fontsFolderIconResource     = kFontsFolderIconResource,
  133.     fullTrashIconResource       = kFullTrashIconResource
  134. };
  135. /* The following icon types can only be used as an icon element */
  136. /* inside a 'icns' icon family */
  137. enum {
  138.     kThumbnail32BitData         = FOUR_CHAR_CODE('it32'),
  139.     kThumbnail8BitMask          = FOUR_CHAR_CODE('t8mk')
  140. };
  141. enum {
  142.     kHuge1BitMask               = FOUR_CHAR_CODE('ich#'),
  143.     kHuge4BitData               = FOUR_CHAR_CODE('ich4'),
  144.     kHuge8BitData               = FOUR_CHAR_CODE('ich8'),
  145.     kHuge32BitData              = FOUR_CHAR_CODE('ih32'),
  146.     kHuge8BitMask               = FOUR_CHAR_CODE('h8mk')
  147. };
  148. /* The following icon types can be used as a resource type */
  149. /* or as an icon element type inside a 'icns' icon family */
  150. enum {
  151.     kLarge1BitMask              = FOUR_CHAR_CODE('ICN#'),
  152.     kLarge4BitData              = FOUR_CHAR_CODE('icl4'),
  153.     kLarge8BitData              = FOUR_CHAR_CODE('icl8'),
  154.     kLarge32BitData             = FOUR_CHAR_CODE('il32'),
  155.     kLarge8BitMask              = FOUR_CHAR_CODE('l8mk'),
  156.     kSmall1BitMask              = FOUR_CHAR_CODE('ics#'),
  157.     kSmall4BitData              = FOUR_CHAR_CODE('ics4'),
  158.     kSmall8BitData              = FOUR_CHAR_CODE('ics8'),
  159.     kSmall32BitData             = FOUR_CHAR_CODE('is32'),
  160.     kSmall8BitMask              = FOUR_CHAR_CODE('s8mk'),
  161.     kMini1BitMask               = FOUR_CHAR_CODE('icm#'),
  162.     kMini4BitData               = FOUR_CHAR_CODE('icm4'),
  163.     kMini8BitData               = FOUR_CHAR_CODE('icm8')
  164. };
  165. /*  Icon Variants */
  166. /* These can be used as an element of an 'icns' icon family */
  167. /* or as a parameter to GetIconRefVariant */
  168. enum {
  169.     kTileIconVariant            = FOUR_CHAR_CODE('tile'),
  170.     kRolloverIconVariant        = FOUR_CHAR_CODE('over'),
  171.     kDropIconVariant            = FOUR_CHAR_CODE('drop'),
  172.     kOpenIconVariant            = FOUR_CHAR_CODE('open'),
  173.     kOpenDropIconVariant        = FOUR_CHAR_CODE('odrp')
  174. };
  175. /* Obsolete. Use names defined above. */
  176. enum {
  177.     large1BitMask               = kLarge1BitMask,
  178.     large4BitData               = kLarge4BitData,
  179.     large8BitData               = kLarge8BitData,
  180.     small1BitMask               = kSmall1BitMask,
  181.     small4BitData               = kSmall4BitData,
  182.     small8BitData               = kSmall8BitData,
  183.     mini1BitMask                = kMini1BitMask,
  184.     mini4BitData                = kMini4BitData,
  185.     mini8BitData                = kMini8BitData
  186. };
  187. /* Alignment type values. */
  188. enum {
  189.     kAlignNone                  = 0x00,
  190.     kAlignVerticalCenter        = 0x01,
  191.     kAlignTop                   = 0x02,
  192.     kAlignBottom                = 0x03,
  193.     kAlignHorizontalCenter      = 0x04,
  194.     kAlignAbsoluteCenter        = kAlignVerticalCenter | kAlignHorizontalCenter,
  195.     kAlignCenterTop             = kAlignTop | kAlignHorizontalCenter,
  196.     kAlignCenterBottom          = kAlignBottom | kAlignHorizontalCenter,
  197.     kAlignLeft                  = 0x08,
  198.     kAlignCenterLeft            = kAlignVerticalCenter | kAlignLeft,
  199.     kAlignTopLeft               = kAlignTop | kAlignLeft,
  200.     kAlignBottomLeft            = kAlignBottom | kAlignLeft,
  201.     kAlignRight                 = 0x0C,
  202.     kAlignCenterRight           = kAlignVerticalCenter | kAlignRight,
  203.     kAlignTopRight              = kAlignTop | kAlignRight,
  204.     kAlignBottomRight           = kAlignBottom | kAlignRight
  205. };
  206. /* Obsolete. Use names defined above. */
  207. enum {
  208.     atNone                      = kAlignNone,
  209.     atVerticalCenter            = kAlignVerticalCenter,
  210.     atTop                       = kAlignTop,
  211.     atBottom                    = kAlignBottom,
  212.     atHorizontalCenter          = kAlignHorizontalCenter,
  213.     atAbsoluteCenter            = kAlignAbsoluteCenter,
  214.     atCenterTop                 = kAlignCenterTop,
  215.     atCenterBottom              = kAlignCenterBottom,
  216.     atLeft                      = kAlignLeft,
  217.     atCenterLeft                = kAlignCenterLeft,
  218.     atTopLeft                   = kAlignTopLeft,
  219.     atBottomLeft                = kAlignBottomLeft,
  220.     atRight                     = kAlignRight,
  221.     atCenterRight               = kAlignCenterRight,
  222.     atTopRight                  = kAlignTopRight,
  223.     atBottomRight               = kAlignBottomRight
  224. };
  225. typedef SInt16                          IconAlignmentType;
  226. /* Transform type values. */
  227. enum {
  228.     kTransformNone              = 0x00,
  229.     kTransformDisabled          = 0x01,
  230.     kTransformOffline           = 0x02,
  231.     kTransformOpen              = 0x03,
  232.     kTransformLabel1            = 0x0100,
  233.     kTransformLabel2            = 0x0200,
  234.     kTransformLabel3            = 0x0300,
  235.     kTransformLabel4            = 0x0400,
  236.     kTransformLabel5            = 0x0500,
  237.     kTransformLabel6            = 0x0600,
  238.     kTransformLabel7            = 0x0700,
  239.     kTransformSelected          = 0x4000,
  240.     kTransformSelectedDisabled  = kTransformSelected | kTransformDisabled,
  241.     kTransformSelectedOffline   = kTransformSelected | kTransformOffline,
  242.     kTransformSelectedOpen      = kTransformSelected | kTransformOpen
  243. };
  244. /* Obsolete. Use names defined above. */
  245. enum {
  246.     ttNone                      = kTransformNone,
  247.     ttDisabled                  = kTransformDisabled,
  248.     ttOffline                   = kTransformOffline,
  249.     ttOpen                      = kTransformOpen,
  250.     ttLabel1                    = kTransformLabel1,
  251.     ttLabel2                    = kTransformLabel2,
  252.     ttLabel3                    = kTransformLabel3,
  253.     ttLabel4                    = kTransformLabel4,
  254.     ttLabel5                    = kTransformLabel5,
  255.     ttLabel6                    = kTransformLabel6,
  256.     ttLabel7                    = kTransformLabel7,
  257.     ttSelected                  = kTransformSelected,
  258.     ttSelectedDisabled          = kTransformSelectedDisabled,
  259.     ttSelectedOffline           = kTransformSelectedOffline,
  260.     ttSelectedOpen              = kTransformSelectedOpen
  261. };
  262. typedef SInt16                          IconTransformType;
  263. /* Selector mask values. */
  264. enum {
  265.     kSelectorLarge1Bit          = 0x00000001,
  266.     kSelectorLarge4Bit          = 0x00000002,
  267.     kSelectorLarge8Bit          = 0x00000004,
  268.     kSelectorLarge32Bit         = 0x00000008,
  269.     kSelectorLarge8BitMask      = 0x00000010,
  270.     kSelectorSmall1Bit          = 0x00000100,
  271.     kSelectorSmall4Bit          = 0x00000200,
  272.     kSelectorSmall8Bit          = 0x00000400,
  273.     kSelectorSmall32Bit         = 0x00000800,
  274.     kSelectorSmall8BitMask      = 0x00001000,
  275.     kSelectorMini1Bit           = 0x00010000,
  276.     kSelectorMini4Bit           = 0x00020000,
  277.     kSelectorMini8Bit           = 0x00040000,
  278.     kSelectorHuge1Bit           = 0x01000000,
  279.     kSelectorHuge4Bit           = 0x02000000,
  280.     kSelectorHuge8Bit           = 0x04000000,
  281.     kSelectorHuge32Bit          = 0x08000000,
  282.     kSelectorHuge8BitMask       = 0x10000000,
  283.     kSelectorAllLargeData       = 0x000000FF,
  284.     kSelectorAllSmallData       = 0x0000FF00,
  285.     kSelectorAllMiniData        = 0x00FF0000,
  286.     kSelectorAllHugeData        = (long)0xFF000000,
  287.     kSelectorAll1BitData        = kSelectorLarge1Bit | kSelectorSmall1Bit | kSelectorMini1Bit | kSelectorHuge1Bit,
  288.     kSelectorAll4BitData        = kSelectorLarge4Bit | kSelectorSmall4Bit | kSelectorMini4Bit | kSelectorHuge4Bit,
  289.     kSelectorAll8BitData        = kSelectorLarge8Bit | kSelectorSmall8Bit | kSelectorMini8Bit | kSelectorHuge8Bit,
  290.     kSelectorAll32BitData       = kSelectorLarge32Bit | kSelectorSmall32Bit | kSelectorHuge32Bit,
  291.     kSelectorAllAvailableData   = (long)0xFFFFFFFF
  292. };
  293. /* Obsolete. Use names defined above. */
  294. enum {
  295.     svLarge1Bit                 = kSelectorLarge1Bit,
  296.     svLarge4Bit                 = kSelectorLarge4Bit,
  297.     svLarge8Bit                 = kSelectorLarge8Bit,
  298.     svSmall1Bit                 = kSelectorSmall1Bit,
  299.     svSmall4Bit                 = kSelectorSmall4Bit,
  300.     svSmall8Bit                 = kSelectorSmall8Bit,
  301.     svMini1Bit                  = kSelectorMini1Bit,
  302.     svMini4Bit                  = kSelectorMini4Bit,
  303.     svMini8Bit                  = kSelectorMini8Bit,
  304.     svAllLargeData              = kSelectorAllLargeData,
  305.     svAllSmallData              = kSelectorAllSmallData,
  306.     svAllMiniData               = kSelectorAllMiniData,
  307.     svAll1BitData               = kSelectorAll1BitData,
  308.     svAll4BitData               = kSelectorAll4BitData,
  309.     svAll8BitData               = kSelectorAll8BitData,
  310.     svAllAvailableData          = kSelectorAllAvailableData
  311. };
  312. typedef UInt32                          IconSelectorValue;
  313. typedef CALLBACK_API( OSErr , IconActionProcPtr )(ResType theType, Handle *theIcon, void *yourDataPtr);
  314. typedef CALLBACK_API( Handle , IconGetterProcPtr )(ResType theType, void *yourDataPtr);
  315. typedef STACK_UPP_TYPE(IconActionProcPtr)                       IconActionUPP;
  316. typedef STACK_UPP_TYPE(IconGetterProcPtr)                       IconGetterUPP;
  317. #if OPAQUE_UPP_TYPES
  318.     EXTERN_API(IconActionUPP)
  319.     NewIconActionUPP               (IconActionProcPtr       userRoutine);
  320.     EXTERN_API(IconGetterUPP)
  321.     NewIconGetterUPP               (IconGetterProcPtr       userRoutine);
  322.     EXTERN_API(void)
  323.     DisposeIconActionUPP           (IconActionUPP           userUPP);
  324.     EXTERN_API(void)
  325.     DisposeIconGetterUPP           (IconGetterUPP           userUPP);
  326.     EXTERN_API(OSErr)
  327.     InvokeIconActionUPP            (ResType                 theType,
  328.                                     Handle *                theIcon,
  329.                                     void *                  yourDataPtr,
  330.                                     IconActionUPP           userUPP);
  331.     EXTERN_API(Handle)
  332.     InvokeIconGetterUPP            (ResType                 theType,
  333.                                     void *                  yourDataPtr,
  334.                                     IconGetterUPP           userUPP);
  335. #else
  336.     enum { uppIconActionProcInfo = 0x00000FE0 };                    /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  337.     enum { uppIconGetterProcInfo = 0x000003F0 };                    /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  338.     #define NewIconActionUPP(userRoutine)                           (IconActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppIconActionProcInfo, GetCurrentArchitecture())
  339.     #define NewIconGetterUPP(userRoutine)                           (IconGetterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppIconGetterProcInfo, GetCurrentArchitecture())
  340.     #define DisposeIconActionUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  341.     #define DisposeIconGetterUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  342.     #define InvokeIconActionUPP(theType, theIcon, yourDataPtr, userUPP)  (OSErr)CALL_THREE_PARAMETER_UPP((userUPP), uppIconActionProcInfo, (theType), (theIcon), (yourDataPtr))
  343.     #define InvokeIconGetterUPP(theType, yourDataPtr, userUPP)      (Handle)CALL_TWO_PARAMETER_UPP((userUPP), uppIconGetterProcInfo, (theType), (yourDataPtr))
  344. #endif
  345. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  346. #define NewIconActionProc(userRoutine)                          NewIconActionUPP(userRoutine)
  347. #define NewIconGetterProc(userRoutine)                          NewIconGetterUPP(userRoutine)
  348. #define CallIconActionProc(userRoutine, theType, theIcon, yourDataPtr) InvokeIconActionUPP(theType, theIcon, yourDataPtr, userRoutine)
  349. #define CallIconGetterProc(userRoutine, theType, yourDataPtr)   InvokeIconGetterUPP(theType, yourDataPtr, userRoutine)
  350. typedef IconGetterProcPtr               IconGetter;
  351. typedef IconActionProcPtr               IconAction;
  352. /* CIconHandle, GetCIcon(), PlotCIcon(), and DisposeCIcon() moved here from Quickdraw.h*/
  353. struct CIcon {
  354.     PixMap                          iconPMap;                   /*the icon's pixMap*/
  355.     BitMap                          iconMask;                   /*the icon's mask*/
  356.     BitMap                          iconBMap;                   /*the icon's bitMap*/
  357.     Handle                          iconData;                   /*the icon's data*/
  358.     SInt16                          iconMaskData[1];            /*icon's mask and BitMap data*/
  359. };
  360. typedef struct CIcon                    CIcon;
  361. typedef CIcon *                         CIconPtr;
  362. typedef CIconPtr *                      CIconHandle;
  363. EXTERN_API( CIconHandle )
  364. GetCIcon                        (SInt16                 iconID)                             ONEWORDINLINE(0xAA1E);
  365. EXTERN_API( void )
  366. PlotCIcon                       (const Rect *           theRect,
  367.                                  CIconHandle            theIcon)                            ONEWORDINLINE(0xAA1F);
  368. EXTERN_API( void )
  369. DisposeCIcon                    (CIconHandle            theIcon)                            ONEWORDINLINE(0xAA25);
  370. /* GetIcon and PlotIcon moved here from ToolUtils*/
  371. EXTERN_API( Handle )
  372. GetIcon                         (SInt16                 iconID)                             ONEWORDINLINE(0xA9BB);
  373. EXTERN_API( void )
  374. PlotIcon                        (const Rect *           theRect,
  375.                                  Handle                 theIcon)                            ONEWORDINLINE(0xA94B);
  376. /*
  377.     Note:   IconSuiteRef and IconCacheRef should be an abstract types, 
  378.             but too much source code already relies on them being of type Handle.
  379. */
  380. typedef Handle                          IconSuiteRef;
  381. typedef Handle                          IconCacheRef;
  382. /* IconRefs are 32-bit values identifying cached icon data. IconRef 0 is invalid.*/
  383. typedef struct OpaqueIconRef*           IconRef;
  384. EXTERN_API( OSErr )
  385. PlotIconID                      (const Rect *           theRect,
  386.                                  IconAlignmentType      align,
  387.                                  IconTransformType      transform,
  388.                                  SInt16                 theResID)                           THREEWORDINLINE(0x303C, 0x0500, 0xABC9);
  389. EXTERN_API( OSErr )
  390. NewIconSuite                    (IconSuiteRef *         theIconSuite)                       THREEWORDINLINE(0x303C, 0x0207, 0xABC9);
  391. EXTERN_API( OSErr )
  392. AddIconToSuite                  (Handle                 theIconData,
  393.                                  IconSuiteRef           theSuite,
  394.                                  ResType                theType)                            THREEWORDINLINE(0x303C, 0x0608, 0xABC9);
  395. EXTERN_API( OSErr )
  396. GetIconFromSuite                (Handle *               theIconData,
  397.                                  IconSuiteRef           theSuite,
  398.                                  ResType                theType)                            THREEWORDINLINE(0x303C, 0x0609, 0xABC9);
  399. EXTERN_API( OSErr )
  400. ForEachIconDo                   (IconSuiteRef           theSuite,
  401.                                  IconSelectorValue      selector,
  402.                                  IconActionUPP          action,
  403.                                  void *                 yourDataPtr)                        THREEWORDINLINE(0x303C, 0x080A, 0xABC9);
  404. EXTERN_API( OSErr )
  405. GetIconSuite                    (IconSuiteRef *         theIconSuite,
  406.                                  SInt16                 theResID,
  407.                                  IconSelectorValue      selector)                           THREEWORDINLINE(0x303C, 0x0501, 0xABC9);
  408. EXTERN_API( OSErr )
  409. DisposeIconSuite                (IconSuiteRef           theIconSuite,
  410.                                  Boolean                disposeData)                        THREEWORDINLINE(0x303C, 0x0302, 0xABC9);
  411. EXTERN_API( OSErr )
  412. PlotIconSuite                   (const Rect *           theRect,
  413.                                  IconAlignmentType      align,
  414.                                  IconTransformType      transform,
  415.                                  IconSuiteRef           theIconSuite)                       THREEWORDINLINE(0x303C, 0x0603, 0xABC9);
  416. EXTERN_API( OSErr )
  417. MakeIconCache                   (IconCacheRef *         theCache,
  418.                                  IconGetterUPP          makeIcon,
  419.                                  void *                 yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0604, 0xABC9);
  420. EXTERN_API( OSErr )
  421. LoadIconCache                   (const Rect *           theRect,
  422.                                  IconAlignmentType      align,
  423.                                  IconTransformType      transform,
  424.                                  IconCacheRef           theIconCache)                       THREEWORDINLINE(0x303C, 0x0606, 0xABC9);
  425. EXTERN_API( OSErr )
  426. PlotIconMethod                  (const Rect *           theRect,
  427.                                  IconAlignmentType      align,
  428.                                  IconTransformType      transform,
  429.                                  IconGetterUPP          theMethod,
  430.                                  void *                 yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0805, 0xABC9);
  431. EXTERN_API( OSErr )
  432. GetLabel                        (SInt16                 labelNumber,
  433.                                  RGBColor *             labelColor,
  434.                                  Str255                 labelString)                        THREEWORDINLINE(0x303C, 0x050B, 0xABC9);
  435. EXTERN_API( Boolean )
  436. PtInIconID                      (Point                  testPt,
  437.                                  const Rect *           iconRect,
  438.                                  IconAlignmentType      align,
  439.                                  SInt16                 iconID)                             THREEWORDINLINE(0x303C, 0x060D, 0xABC9);
  440. EXTERN_API( Boolean )
  441. PtInIconSuite                   (Point                  testPt,
  442.                                  const Rect *           iconRect,
  443.                                  IconAlignmentType      align,
  444.                                  IconSuiteRef           theIconSuite)                       THREEWORDINLINE(0x303C, 0x070E, 0xABC9);
  445. EXTERN_API( Boolean )
  446. PtInIconMethod                  (Point                  testPt,
  447.                                  const Rect *           iconRect,
  448.                                  IconAlignmentType      align,
  449.                                  IconGetterUPP          theMethod,
  450.                                  void *                 yourDataPtr)                        THREEWORDINLINE(0x303C, 0x090F, 0xABC9);
  451. EXTERN_API( Boolean )
  452. RectInIconID                    (const Rect *           testRect,
  453.                                  const Rect *           iconRect,
  454.                                  IconAlignmentType      align,
  455.                                  SInt16                 iconID)                             THREEWORDINLINE(0x303C, 0x0610, 0xABC9);
  456. EXTERN_API( Boolean )
  457. RectInIconSuite                 (const Rect *           testRect,
  458.                                  const Rect *           iconRect,
  459.                                  IconAlignmentType      align,
  460.                                  IconSuiteRef           theIconSuite)                       THREEWORDINLINE(0x303C, 0x0711, 0xABC9);
  461. EXTERN_API( Boolean )
  462. RectInIconMethod                (const Rect *           testRect,
  463.                                  const Rect *           iconRect,
  464.                                  IconAlignmentType      align,
  465.                                  IconGetterUPP          theMethod,
  466.                                  void *                 yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0912, 0xABC9);
  467. EXTERN_API( OSErr )
  468. IconIDToRgn                     (RgnHandle              theRgn,
  469.                                  const Rect *           iconRect,
  470.                                  IconAlignmentType      align,
  471.                                  SInt16                 iconID)                             THREEWORDINLINE(0x303C, 0x0613, 0xABC9);
  472. EXTERN_API( OSErr )
  473. IconSuiteToRgn                  (RgnHandle              theRgn,
  474.                                  const Rect *           iconRect,
  475.                                  IconAlignmentType      align,
  476.                                  IconSuiteRef           theIconSuite)                       THREEWORDINLINE(0x303C, 0x0714, 0xABC9);
  477. EXTERN_API( OSErr )
  478. IconMethodToRgn                 (RgnHandle              theRgn,
  479.                                  const Rect *           iconRect,
  480.                                  IconAlignmentType      align,
  481.                                  IconGetterUPP          theMethod,
  482.                                  void *                 yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0915, 0xABC9);
  483. EXTERN_API( OSErr )
  484. SetSuiteLabel                   (IconSuiteRef           theSuite,
  485.                                  SInt16                 theLabel)                           THREEWORDINLINE(0x303C, 0x0316, 0xABC9);
  486. EXTERN_API( SInt16 )
  487. GetSuiteLabel                   (IconSuiteRef           theSuite)                           THREEWORDINLINE(0x303C, 0x0217, 0xABC9);
  488. EXTERN_API( OSErr )
  489. GetIconCacheData                (IconCacheRef           theCache,
  490.                                  void **                theData)                            THREEWORDINLINE(0x303C, 0x0419, 0xABC9);
  491. EXTERN_API( OSErr )
  492. SetIconCacheData                (IconCacheRef           theCache,
  493.                                  void *                 theData)                            THREEWORDINLINE(0x303C, 0x041A, 0xABC9);
  494. EXTERN_API( OSErr )
  495. GetIconCacheProc                (IconCacheRef           theCache,
  496.                                  IconGetterUPP *        theProc)                            THREEWORDINLINE(0x303C, 0x041B, 0xABC9);
  497. EXTERN_API( OSErr )
  498. SetIconCacheProc                (IconCacheRef           theCache,
  499.                                  IconGetterUPP          theProc)                            THREEWORDINLINE(0x303C, 0x041C, 0xABC9);
  500. EXTERN_API( OSErr )
  501. PlotIconHandle                  (const Rect *           theRect,
  502.                                  IconAlignmentType      align,
  503.                                  IconTransformType      transform,
  504.                                  Handle                 theIcon)                            THREEWORDINLINE(0x303C, 0x061D, 0xABC9);
  505. EXTERN_API( OSErr )
  506. PlotSICNHandle                  (const Rect *           theRect,
  507.                                  IconAlignmentType      align,
  508.                                  IconTransformType      transform,
  509.                                  Handle                 theSICN)                            THREEWORDINLINE(0x303C, 0x061E, 0xABC9);
  510. EXTERN_API( OSErr )
  511. PlotCIconHandle                 (const Rect *           theRect,
  512.                                  IconAlignmentType      align,
  513.                                  IconTransformType      transform,
  514.                                  CIconHandle            theCIcon)                           THREEWORDINLINE(0x303C, 0x061F, 0xABC9);
  515. /*
  516.    IconServices is an efficient mechanism to share icon data amongst multiple 
  517.    clients. It avoids duplication of data; it provides efficient caching, 
  518.    releasing memory when the icon data is no longer needed; it can provide
  519.    the appropriate icon for any filesystem object; it can provide commonly 
  520.    used icons (caution, note, help...); it is Appearance-savvy: the icons
  521.    are switched when appropriate.
  522.    IconServices refer to cached icon data using IconRef, a 32-bit opaque
  523.    value. IconRefs are reference counted. When there are no more "owners" 
  524.    of an IconRef, the memory used by the icon bitmap is disposed of.
  525.    Two files of same type and creator with no custom icon will have the same IconRef.
  526.    Files with custom icons will have their own IconRef.
  527. */
  528. /*
  529.    Use the special creator kSystemIconsCreator to get "standard" icons 
  530.    that are not associated with a file, such as the help icon.
  531.    Note that all lowercase creators are reserved by Apple.
  532. */
  533. enum {
  534.     kSystemIconsCreator         = FOUR_CHAR_CODE('macs')
  535. };
  536. /*
  537.    Type of the predefined/generic icons. For example, the call:
  538.       err = GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &iconRef);
  539.    will retun in iconRef the IconRef for the standard help icon.
  540. */
  541. /* Generic Finder icons */
  542. enum {
  543.     kClipboardIcon              = FOUR_CHAR_CODE('CLIP'),
  544.     kClippingUnknownTypeIcon    = FOUR_CHAR_CODE('clpu'),
  545.     kClippingPictureTypeIcon    = FOUR_CHAR_CODE('clpp'),
  546.     kClippingTextTypeIcon       = FOUR_CHAR_CODE('clpt'),
  547.     kClippingSoundTypeIcon      = FOUR_CHAR_CODE('clps'),
  548.     kDesktopIcon                = FOUR_CHAR_CODE('desk'),
  549.     kFinderIcon                 = FOUR_CHAR_CODE('FNDR'),
  550.     kFontSuitcaseIcon           = FOUR_CHAR_CODE('FFIL'),
  551.     kFullTrashIcon              = FOUR_CHAR_CODE('ftrh'),
  552.     kGenericApplicationIcon     = FOUR_CHAR_CODE('APPL'),
  553.     kGenericCDROMIcon           = FOUR_CHAR_CODE('cddr'),
  554.     kGenericControlPanelIcon    = FOUR_CHAR_CODE('APPC'),
  555.     kGenericControlStripModuleIcon = FOUR_CHAR_CODE('sdev'),
  556.     kGenericComponentIcon       = FOUR_CHAR_CODE('thng'),
  557.     kGenericDeskAccessoryIcon   = FOUR_CHAR_CODE('APPD'),
  558.     kGenericDocumentIcon        = FOUR_CHAR_CODE('docu'),
  559.     kGenericEditionFileIcon     = FOUR_CHAR_CODE('edtf'),
  560.     kGenericExtensionIcon       = FOUR_CHAR_CODE('INIT'),
  561.     kGenericFileServerIcon      = FOUR_CHAR_CODE('srvr'),
  562.     kGenericFontIcon            = FOUR_CHAR_CODE('ffil'),
  563.     kGenericFontScalerIcon      = FOUR_CHAR_CODE('sclr'),
  564.     kGenericFloppyIcon          = FOUR_CHAR_CODE('flpy'),
  565.     kGenericHardDiskIcon        = FOUR_CHAR_CODE('hdsk'),
  566.     kGenericRemovableMediaIcon  = FOUR_CHAR_CODE('rmov'),
  567.     kGenericMoverObjectIcon     = FOUR_CHAR_CODE('movr'),
  568.     kGenericPCCardIcon          = FOUR_CHAR_CODE('pcmc'),
  569.     kGenericPreferencesIcon     = FOUR_CHAR_CODE('pref'),
  570.     kGenericQueryDocumentIcon   = FOUR_CHAR_CODE('qery'),
  571.     kGenericRAMDiskIcon         = FOUR_CHAR_CODE('ramd'),
  572.     kGenericSharedLibaryIcon    = FOUR_CHAR_CODE('shlb'),
  573.     kGenericStationeryIcon      = FOUR_CHAR_CODE('sdoc'),
  574.     kGenericSuitcaseIcon        = FOUR_CHAR_CODE('suit'),
  575.     kGenericWORMIcon            = FOUR_CHAR_CODE('worm'),
  576.     kInternationResourcesIcon   = FOUR_CHAR_CODE('ifil'),
  577.     kKeyboardLayoutIcon         = FOUR_CHAR_CODE('kfil'),
  578.     kSoundFileIcon              = FOUR_CHAR_CODE('sfil'),
  579.     kSystemSuitcaseIcon         = FOUR_CHAR_CODE('zsys'),
  580.     kTrashIcon                  = FOUR_CHAR_CODE('trsh'),
  581.     kTrueTypeFontIcon           = FOUR_CHAR_CODE('tfil'),
  582.     kTrueTypeFlatFontIcon       = FOUR_CHAR_CODE('sfnt'),
  583.     kTrueTypeMultiFlatFontIcon  = FOUR_CHAR_CODE('ttcf')
  584. };
  585. /* Internet locations */
  586. enum {
  587.     kInternetLocationHTTPIcon   = FOUR_CHAR_CODE('ilht'),
  588.     kInternetLocationFTPIcon    = FOUR_CHAR_CODE('ilft'),
  589.     kInternetLocationAppleShareIcon = FOUR_CHAR_CODE('ilaf'),
  590.     kInternetLocationAppleTalkZoneIcon = FOUR_CHAR_CODE('ilat'),
  591.     kInternetLocationFileIcon   = FOUR_CHAR_CODE('ilfi'),
  592.     kInternetLocationMailIcon   = FOUR_CHAR_CODE('ilma'),
  593.     kInternetLocationNewsIcon   = FOUR_CHAR_CODE('ilnw'),
  594.     kInternetLocationNSLNeighborhoodIcon = FOUR_CHAR_CODE('ilns'),
  595.     kInternetLocationGenericIcon = FOUR_CHAR_CODE('ilge')
  596. };
  597. /* Folders */
  598. enum {
  599.     kGenericFolderIcon          = FOUR_CHAR_CODE('fldr'),
  600.     kDropFolderIcon             = FOUR_CHAR_CODE('dbox'),
  601.     kMountedFolderIcon          = FOUR_CHAR_CODE('mntd'),
  602.     kOpenFolderIcon             = FOUR_CHAR_CODE('ofld'),
  603.     kOwnedFolderIcon            = FOUR_CHAR_CODE('ownd'),
  604.     kPrivateFolderIcon          = FOUR_CHAR_CODE('prvf'),
  605.     kSharedFolderIcon           = FOUR_CHAR_CODE('shfl')
  606. };
  607. /* Sharing Privileges icons */
  608. enum {
  609.     kSharingPrivsNotApplicableIcon = FOUR_CHAR_CODE('shna'),
  610.     kSharingPrivsReadOnlyIcon   = FOUR_CHAR_CODE('shro'),
  611.     kSharingPrivsReadWriteIcon  = FOUR_CHAR_CODE('shrw'),
  612.     kSharingPrivsUnknownIcon    = FOUR_CHAR_CODE('shuk'),
  613.     kSharingPrivsWritableIcon   = FOUR_CHAR_CODE('writ')
  614. };
  615. /* Users and Groups icons */
  616. enum {
  617.     kUserFolderIcon             = FOUR_CHAR_CODE('ufld'),
  618.     kWorkgroupFolderIcon        = FOUR_CHAR_CODE('wfld'),
  619.     kGuestUserIcon              = FOUR_CHAR_CODE('gusr'),
  620.     kUserIcon                   = FOUR_CHAR_CODE('user'),
  621.     kOwnerIcon                  = FOUR_CHAR_CODE('susr'),
  622.     kGroupIcon                  = FOUR_CHAR_CODE('grup')
  623. };
  624. /* Special folders */
  625. enum {
  626.     kAppleExtrasFolderIcon      = FOUR_CHAR_CODE('aex'),
  627.     kAppleMenuFolderIcon        = FOUR_CHAR_CODE('amnu'),
  628.     kApplicationsFolderIcon     = FOUR_CHAR_CODE('apps'),
  629.     kApplicationSupportFolderIcon = FOUR_CHAR_CODE('asup'),
  630.     kAssistantsFolderIcon       = FOUR_CHAR_CODE('ast'),
  631.     kContextualMenuItemsFolderIcon = FOUR_CHAR_CODE('cmnu'),
  632.     kControlPanelDisabledFolderIcon = FOUR_CHAR_CODE('ctrD'),
  633.     kControlPanelFolderIcon     = FOUR_CHAR_CODE('ctrl'),
  634.     kControlStripModulesFolderIcon = FOUR_CHAR_CODE('sdv'),
  635.     kDocumentsFolderIcon        = FOUR_CHAR_CODE('docs'),
  636.     kExtensionsDisabledFolderIcon = FOUR_CHAR_CODE('extD'),
  637.     kExtensionsFolderIcon       = FOUR_CHAR_CODE('extn'),
  638.     kFavoritesFolderIcon        = FOUR_CHAR_CODE('favs'),
  639.     kFontsFolderIcon            = FOUR_CHAR_CODE('font'),
  640.     kHelpFolderIcon             = FOUR_CHAR_CODE('膆lp'),
  641.     kInternetFolderIcon         = FOUR_CHAR_CODE('int'),
  642.     kInternetPlugInFolderIcon   = FOUR_CHAR_CODE('膎et'),
  643.     kLocalesFolderIcon          = FOUR_CHAR_CODE('膌oc'),
  644.     kMacOSReadMeFolderIcon      = FOUR_CHAR_CODE('mor'),
  645.     kPreferencesFolderIcon      = FOUR_CHAR_CODE('prf'),
  646.     kPrinterDescriptionFolderIcon = FOUR_CHAR_CODE('ppdf'),
  647.     kPrinterDriverFolderIcon    = FOUR_CHAR_CODE('膒rd'),
  648.     kPrintMonitorFolderIcon     = FOUR_CHAR_CODE('prnt'),
  649.     kRecentApplicationsFolderIcon = FOUR_CHAR_CODE('rapp'),
  650.     kRecentDocumentsFolderIcon  = FOUR_CHAR_CODE('rdoc'),
  651.     kRecentServersFolderIcon    = FOUR_CHAR_CODE('rsrv'),
  652.     kScriptingAdditionsFolderIcon = FOUR_CHAR_CODE('膕cr'),
  653.     kSharedLibrariesFolderIcon  = FOUR_CHAR_CODE('膌ib'),
  654.     kScriptsFolderIcon          = FOUR_CHAR_CODE('scr'),
  655.     kShutdownItemsDisabledFolderIcon = FOUR_CHAR_CODE('shdD'),
  656.     kShutdownItemsFolderIcon    = FOUR_CHAR_CODE('shdf'),
  657.     kSpeakableItemsFolder       = FOUR_CHAR_CODE('spki'),
  658.     kStartupItemsDisabledFolderIcon = FOUR_CHAR_CODE('strD'),
  659.     kStartupItemsFolderIcon     = FOUR_CHAR_CODE('strt'),
  660.     kSystemExtensionDisabledFolderIcon = FOUR_CHAR_CODE('macD'),
  661.     kSystemFolderIcon           = FOUR_CHAR_CODE('macs'),
  662.     kTextEncodingsFolderIcon    = FOUR_CHAR_CODE('膖ex'),
  663.     kAppearanceFolderIcon       = FOUR_CHAR_CODE('appr'),
  664.     kUtilitiesFolderIcon        = FOUR_CHAR_CODE('uti'),
  665.     kVoicesFolderIcon           = FOUR_CHAR_CODE('fvoc'),
  666.     kColorSyncFolderIcon        = FOUR_CHAR_CODE('prof'),
  667.     kInternetSearchSitesFolderIcon = FOUR_CHAR_CODE('issf'),
  668.     kUsersFolderIcon            = FOUR_CHAR_CODE('usr')
  669. };
  670. /* Badges */
  671. enum {
  672.     kAppleScriptBadgeIcon       = FOUR_CHAR_CODE('scrp'),
  673.     kLockedBadgeIcon            = FOUR_CHAR_CODE('lbdg'),
  674.     kMountedBadgeIcon           = FOUR_CHAR_CODE('mbdg'),
  675.     kSharedBadgeIcon            = FOUR_CHAR_CODE('sbdg'),
  676.     kAliasBadgeIcon             = FOUR_CHAR_CODE('abdg')
  677. };
  678. /* Alert icons */
  679. enum {
  680.     kAlertNoteIcon              = FOUR_CHAR_CODE('note'),
  681.     kAlertCautionIcon           = FOUR_CHAR_CODE('caut'),
  682.     kAlertStopIcon              = FOUR_CHAR_CODE('stop')
  683. };
  684. /* Networking icons */
  685. enum {
  686.     kAppleTalkIcon              = FOUR_CHAR_CODE('atlk'),
  687.     kAppleTalkZoneIcon          = FOUR_CHAR_CODE('atzn'),
  688.     kAFPServerIcon              = FOUR_CHAR_CODE('afps'),
  689.     kFTPServerIcon              = FOUR_CHAR_CODE('ftps'),
  690.     kHTTPServerIcon             = FOUR_CHAR_CODE('htps'),
  691.     kGenericNetworkIcon         = FOUR_CHAR_CODE('gnet'),
  692.     kIPFileServerIcon           = FOUR_CHAR_CODE('isrv')
  693. };
  694. /* Other icons */
  695. enum {
  696.     kAppleLogoIcon              = FOUR_CHAR_CODE('capl'),
  697.     kAppleMenuIcon              = FOUR_CHAR_CODE('sapl'),
  698.     kBackwardArrowIcon          = FOUR_CHAR_CODE('baro'),
  699.     kFavoriteItemsIcon          = FOUR_CHAR_CODE('favr'),
  700.     kForwardArrowIcon           = FOUR_CHAR_CODE('faro'),
  701.     kGridIcon                   = FOUR_CHAR_CODE('grid'),
  702.     kHelpIcon                   = FOUR_CHAR_CODE('help'),
  703.     kKeepArrangedIcon           = FOUR_CHAR_CODE('arng'),
  704.     kLockedIcon                 = FOUR_CHAR_CODE('lock'),
  705.     kNoFilesIcon                = FOUR_CHAR_CODE('nfil'),
  706.     kNoFolderIcon               = FOUR_CHAR_CODE('nfld'),
  707.     kNoWriteIcon                = FOUR_CHAR_CODE('nwrt'),
  708.     kProtectedApplicationFolderIcon = FOUR_CHAR_CODE('papp'),
  709.     kProtectedSystemFolderIcon  = FOUR_CHAR_CODE('psys'),
  710.     kRecentItemsIcon            = FOUR_CHAR_CODE('rcnt'),
  711.     kShortcutIcon               = FOUR_CHAR_CODE('shrt'),
  712.     kSortAscendingIcon          = FOUR_CHAR_CODE('asnd'),
  713.     kSortDescendingIcon         = FOUR_CHAR_CODE('dsnd'),
  714.     kUnlockedIcon               = FOUR_CHAR_CODE('ulck'),
  715.     kConnectToIcon              = FOUR_CHAR_CODE('cnct')
  716. };
  717. /*  IconServicesUsageFlags */
  718. typedef UInt32                          IconServicesUsageFlags;
  719. enum {
  720.     kIconServicesNormalUsageFlag = 0
  721. };
  722. /*
  723.     IconFamily 'icns' resources contain an entire IconFamily (all sizes and depths).  
  724.    For custom icons, icns IconFamily resources of the custom icon resource ID are fetched first before
  725.    the classic custom icons (individual 'ics#, ICN#, etc) are fetched.  If the fetch of the icns resource
  726.    succeeds then the icns is looked at exclusively for the icon data.
  727.    For custom icons, new icon features such as 32-bit deep icons are only fetched from the icns resource.
  728.    This is to avoid incompatibilities with cut & paste of new style icons with an older version of the
  729.    MacOS Finder.
  730.    DriverGestalt is called with code kdgMediaIconSuite by IconServices after calling FSM to determine a
  731.    driver icon for a particular device.  The result of the kdgMediaIconSuite call to DriverGestalt should
  732.    be a pointer an an IconFamily.  In this manner driver vendors can provide rich, detailed drive icons
  733.    instead of the 1-bit variety previously supported.
  734. */
  735. enum {
  736.     kIconFamilyType             = FOUR_CHAR_CODE('icns')
  737. };
  738. struct IconFamilyElement {
  739.     OSType                          elementType;                /* 'ICN#', 'icl8', etc...*/
  740.     Size                            elementSize;                /* Size of this element*/
  741.     unsigned char                   elementData[1];
  742. };
  743. typedef struct IconFamilyElement        IconFamilyElement;
  744. struct IconFamilyResource {
  745.     OSType                          resourceType;               /* Always 'icns'*/
  746.     Size                            resourceSize;               /* Total size of this resource*/
  747.     IconFamilyElement               elements[1];
  748. };
  749. typedef struct IconFamilyResource       IconFamilyResource;
  750. typedef IconFamilyResource *            IconFamilyPtr;
  751. typedef IconFamilyPtr *                 IconFamilyHandle;
  752. /*
  753.   ==============================================================================
  754.    Initialization and Termination
  755.   ==============================================================================
  756. */
  757. /*
  758.    IconServicesInit
  759.    
  760.    Call this routine once per classic 68K application initialization.
  761.    This routine does not need to be called at boot time.
  762. */
  763. #if CALL_NOT_IN_CARBON
  764. EXTERN_API( OSErr )
  765. IconServicesInit                (CFragInitBlockPtr      initBlockPtr)                       TWOWORDINLINE(0x7015, 0xAA75);
  766. /*
  767.    IconServicesTerminate:
  768.    
  769.    Call this routine once from the termination of a classic 68K application.
  770.    This routine does not need to be called at boot time.
  771. */
  772. EXTERN_API( void )
  773. IconServicesTerminate           (void)                                                      TWOWORDINLINE(0x7016, 0xAA75);
  774. #endif  /* CALL_NOT_IN_CARBON */
  775. /*
  776.   ==============================================================================
  777.    Converting data structures
  778.   ==============================================================================
  779. */
  780. /*
  781.    IconRefToIconFamily
  782.    This routines returns a new IconFamily that contains the data corresponding
  783.    to the specified IconRef.
  784. */
  785. EXTERN_API( OSErr )
  786. IconRefToIconFamily             (IconRef                theIconRef,
  787.                                  IconSelectorValue      whichIcons,
  788.                                  IconFamilyHandle *     iconFamily)                         TWOWORDINLINE(0x7024, 0xAA75);
  789. /*
  790.    IconFamilyToIconSuite
  791.    This routine transfers the data from an icon family handle into an icon suite.
  792. */
  793. EXTERN_API( OSErr )
  794. IconFamilyToIconSuite           (IconFamilyHandle       iconFamily,
  795.                                  IconSelectorValue      whichIcons,
  796.                                  IconSuiteRef *         iconSuite)                          TWOWORDINLINE(0x7025, 0xAA75);
  797. /*
  798.    IconSuiteToIconFamily
  799.    This routine transfers the data in an icon suite into an icon family.
  800. */
  801. EXTERN_API( OSErr )
  802. IconSuiteToIconFamily           (IconSuiteRef           iconSuite,
  803.                                  IconSelectorValue      whichIcons,
  804.                                  IconFamilyHandle *     iconFamily)                         TWOWORDINLINE(0x7026, 0xAA75);
  805. /*
  806.    SetIconFamilyData
  807.    Change the data of an icon family. The data is copied.
  808.    The type can be one of the icon type, or 'PICT'.
  809.    The data will be compressed if needed.
  810. */
  811. EXTERN_API( OSErr )
  812. SetIconFamilyData               (IconFamilyHandle       iconFamily,
  813.                                  OSType                 iconType,
  814.                                  Handle                 h)                                  TWOWORDINLINE(0x7030, 0xAA75);
  815. /*
  816.    GetIconFamilyData
  817.    Return a copy of the data in the icon family.
  818.    The type can be one of the icon type, or 'PICT'
  819.    The data will be returned uncompressed.
  820.    The handle (h) will be resized as appropriate. If no data of the 
  821.    requested type is present, the handle size will be set to 0.
  822. */
  823. EXTERN_API( OSErr )
  824. GetIconFamilyData               (IconFamilyHandle       iconFamily,
  825.                                  OSType                 iconType,
  826.                                  Handle                 h)                                  TWOWORDINLINE(0x7031, 0xAA75);
  827. /*
  828.   ==============================================================================
  829.    Reference counting
  830.   ==============================================================================
  831. */
  832. /*
  833.    GetIconRefOwners
  834.    
  835.    This routine returns the reference count for the IconRef, or number of owners.
  836.    
  837.    A valid IconRef always has at least one owner.
  838. */
  839. EXTERN_API( OSErr )
  840. GetIconRefOwners                (IconRef                theIconRef,
  841.                                  UInt16 *               owners)                             TWOWORDINLINE(0x700B, 0xAA75);
  842. /*
  843.    AcquireIconRef
  844.    This routine increments the reference count for the IconRef
  845. */
  846. EXTERN_API( OSErr )
  847. AcquireIconRef                  (IconRef                theIconRef)                         TWOWORDINLINE(0x7027, 0xAA75);
  848. /*
  849.    ReleaseIconRef
  850.    
  851.    This routine decrements the reference count for the IconRef.
  852.    
  853.    When the reference count reaches 0, all memory allocated for the icon
  854.    is disposed. Any subsequent use of the IconRef is invalid.
  855. */
  856. EXTERN_API( OSErr )
  857. ReleaseIconRef                  (IconRef                theIconRef)                         TWOWORDINLINE(0x7028, 0xAA75);
  858. /*
  859.   ==============================================================================
  860.    Getting an IconRef
  861.   ==============================================================================
  862. */
  863. /*
  864.    GetIconRefFromFile
  865.    
  866.    This routine returns an icon ref for the specified file, folder or volume.
  867.    The label information is provided separately, since two files with the same icon 
  868.    but a different label would share the same iconRef. The label can be used in 
  869.    PlotIconRef() for example.
  870.    
  871.    Use this routine if you have no information about the file system object. If 
  872.    you have already done a GetCatInfo on the file and want to save some I/O, 
  873.    call GetIconRefFromFolder() if you know it's a folder with no custom icon or 
  874.    call GetIconRef() if it's a file with no custom icon.
  875.    This routine increments the reference count of the returned IconRef. Call 
  876.    ReleaseIconRef() when you're done with it.
  877. */
  878. EXTERN_API( OSErr )
  879. GetIconRefFromFile              (const FSSpec *         theFile,
  880.                                  IconRef *              theIconRef,
  881.                                  SInt16 *               theLabel)                           TWOWORDINLINE(0x7002, 0xAA75);
  882. /*
  883.    GetIconRef
  884.    
  885.    This routine returns an icon ref for an icon in the desktop database or
  886.    for a registered icon.
  887.    The system registers a set of icon such as the help icon with the creator 
  888.    code kSystemIconsCreator. See above for a list of the registered system types.
  889.    The vRefNum is used as a hint on where to look for the icon first. Use 
  890.    kOnSystemDisk if you don't know what to pass.
  891.    This routine increments the reference count of the returned IconRef. Call 
  892.    ReleaseIconRef() when you're done with it.
  893. */
  894. EXTERN_API( OSErr )
  895. GetIconRef                      (SInt16                 vRefNum,
  896.                                  OSType                 creator,
  897.                                  OSType                 iconType,
  898.                                  IconRef *              theIconRef)                         TWOWORDINLINE(0x7021, 0xAA75);
  899. /*
  900.    GetIconRefFromFolder
  901.    
  902.    This routine returns an icon ref for a folder with no custom icon.
  903.    Use the more generic, but slightly slower, GetIconRefFromFile() if
  904.    you don't already have the necessary info about the file.
  905.    Attributes should be CInfoPBRec.dirInfo.ioFlAttrib for this folder.
  906.    Access privileges should be CInfoPBRec.dirInfo.ioACUser for this folder.
  907.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  908.    when you're done with it.
  909. */
  910. EXTERN_API( OSErr )
  911. GetIconRefFromFolder            (SInt16                 vRefNum,
  912.                                  SInt32                 parentFolderID,
  913.                                  SInt32                 folderID,
  914.                                  SInt8                  attributes,
  915.                                  SInt8                  accessPrivileges,
  916.                                  IconRef *              theIconRef)                         TWOWORDINLINE(0x7022, 0xAA75);
  917. /*
  918.   ==============================================================================
  919.    Adding and modifying IconRef
  920.   ==============================================================================
  921. */
  922. /*
  923.    RegisterIconRefFromIconFamily
  924.    This routine adds a new entry to the IconRef registry. Other clients will be 
  925.    able to access it using the (creator, iconType) pair specified here.
  926.    Lower-case creators are reserved for the system.
  927.    Consider using RegisterIconRefFromResource() if possible, since the data 
  928.    registered using RegisterIconRefFromFamily() cannot be purged.
  929.    The iconFamily data is copied and the caller is reponsible for disposing of it.
  930.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  931.    when you're done with it.
  932. */
  933. EXTERN_API( OSErr )
  934. RegisterIconRefFromIconFamily   (OSType                 creator,
  935.                                  OSType                 iconType,
  936.                                  IconFamilyHandle       iconFamily,
  937.                                  IconRef *              theIconRef)                         TWOWORDINLINE(0x701C, 0xAA75);
  938. /*
  939.    RegisterIconRefFromResource
  940.    
  941.    Registers an IconRef from a resouce file.  
  942.    Lower-case creators are reserved for the system.
  943.    The icon data to be fetched is either classic icon data or an icon family.  
  944.    The 'icns' icon family is searched for before the classic icon data.
  945.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  946.    when you're done with it.
  947. */
  948. EXTERN_API( OSErr )
  949. RegisterIconRefFromResource     (OSType                 creator,
  950.                                  OSType                 iconType,
  951.                                  const FSSpec *         resourceFile,
  952.                                  SInt16                 resourceID,
  953.                                  IconRef *              theIconRef)                         TWOWORDINLINE(0x7023, 0xAA75);
  954. /*
  955.    UnregisterIconRef
  956.    
  957.    Removes the specified icon from the icon cache (if there are no users of it).  
  958.    If some clients are using this iconRef, then the IconRef will be removed when the 
  959.    last user calls ReleaseIconRef.
  960. */
  961. EXTERN_API( OSErr )
  962. UnregisterIconRef               (OSType                 creator,
  963.                                  OSType                 iconType)                           TWOWORDINLINE(0x7008, 0xAA75);
  964. /*
  965.    UpdateIconRef
  966.    
  967.    Call this routine to force an update of the data for iconRef.
  968.    
  969.    For example after changing an icon in the desktop database or changing the custom 
  970.    icon of a file. Note that after _adding_ a custom icon to file or folder, you 
  971.    need to call GetIconRefFromFile() to get a new IconRef specific to this file. 
  972.    
  973.    This routine does nothing if the IconRef is a registered icon.
  974. */
  975. EXTERN_API( OSErr )
  976. UpdateIconRef                   (IconRef                theIconRef)                         TWOWORDINLINE(0x7009, 0xAA75);
  977. /*
  978.    OverrideIconRefFromResource
  979.    
  980.    This routines replaces the bitmaps of the specified IconRef with the ones
  981.    in the specified resource file.
  982. */
  983. EXTERN_API( OSErr )
  984. OverrideIconRefFromResource     (IconRef                theIconRef,
  985.                                  const FSSpec *         resourceFile,
  986.                                  SInt16                 resourceID)                         TWOWORDINLINE(0x702A, 0xAA75);
  987. /*
  988.    OverrideIconRef
  989.    
  990.    This routines replaces the bitmaps of the specified IconRef with the ones
  991.    from the new IconRef.
  992. */
  993. EXTERN_API( OSErr )
  994. OverrideIconRef                 (IconRef                oldIconRef,
  995.                                  IconRef                newIconRef)                         TWOWORDINLINE(0x702B, 0xAA75);
  996. /*
  997.    RemoveIconRefOverride
  998.    This routine remove an override if one was applied to the icon and 
  999.    reverts back to the original bitmap data.
  1000. */
  1001. EXTERN_API( OSErr )
  1002. RemoveIconRefOverride           (IconRef                theIconRef)                         TWOWORDINLINE(0x701E, 0xAA75);
  1003. /*
  1004.   ==============================================================================
  1005.    Creating composite IconRef
  1006.   ==============================================================================
  1007. */
  1008. /*
  1009.    CompositeIconRef
  1010.    
  1011.    Superimposes an IconRef on top of another one
  1012. */
  1013. EXTERN_API( OSErr )
  1014. CompositeIconRef                (IconRef                backgroundIconRef,
  1015.                                  IconRef                foregroundIconRef,
  1016.                                  IconRef *              compositeIconRef)                   TWOWORDINLINE(0x7014, 0xAA75);
  1017. /*
  1018.    IsIconRefComposite
  1019.    Indicates if a given icon ref is a composite of two other icon refs (and which ones)
  1020.    If it isn't a composite, backgroundIconRef and foreGroundIconRef will be 0.
  1021. */
  1022. EXTERN_API( OSErr )
  1023. IsIconRefComposite              (IconRef                compositeIconRef,
  1024.                                  IconRef *              backgroundIconRef,
  1025.                                  IconRef *              foregroundIconRef)                  TWOWORDINLINE(0x701A, 0xAA75);
  1026. /*
  1027.   ==============================================================================
  1028.    Using IconRef
  1029.   ==============================================================================
  1030. */
  1031. /*
  1032.    IsValidIconRef
  1033.    Return true if the iconRef passed in is a valid icon ref
  1034. */
  1035. EXTERN_API( Boolean )
  1036. IsValidIconRef                  (IconRef                theIconRef)                         TWOWORDINLINE(0x7032, 0xAA75);
  1037. /*
  1038.    PlotIconRef
  1039.    
  1040.    This routine plots the IconRef.  It mostly takes the same parameters as 
  1041.    PlotIconSuite. Pass kIconServicesNormalUsageFlag as a default value for 
  1042.    IconServicesUsageFlags.
  1043. */
  1044. EXTERN_API( OSErr )
  1045. PlotIconRef                     (const Rect *           theRect,
  1046.                                  IconAlignmentType      align,
  1047.                                  IconTransformType      transform,
  1048.                                  IconServicesUsageFlags  theIconServicesUsageFlags,
  1049.                                  IconRef                theIconRef)                         TWOWORDINLINE(0x700E, 0xAA75);
  1050. /*
  1051.    PtInIconRef
  1052.    
  1053.    This routine indicates if testPt would hit the icon designated by iconRef.
  1054.    It mostly takes the same parameters as PtInIconSuite.
  1055.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1056. */
  1057. EXTERN_API( Boolean )
  1058. PtInIconRef                     (const Point *          testPt,
  1059.                                  const Rect *           iconRect,
  1060.                                  IconAlignmentType      align,
  1061.                                  IconServicesUsageFlags  theIconServicesUsageFlags,
  1062.                                  IconRef                theIconRef)                         TWOWORDINLINE(0x700F, 0xAA75);
  1063. /*
  1064.    RectInIconRef
  1065.    
  1066.    This routine indicates if testRect would intersect the icon designated by iconRef.
  1067.    It mostly takes the same parameters as RectInIconSuite.
  1068.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1069. */
  1070. EXTERN_API( Boolean )
  1071. RectInIconRef                   (const Rect *           testRect,
  1072.                                  const Rect *           iconRect,
  1073.                                  IconAlignmentType      align,
  1074.                                  IconServicesUsageFlags  iconServicesUsageFlags,
  1075.                                  IconRef                theIconRef)                         TWOWORDINLINE(0x7010, 0xAA75);
  1076. /*
  1077.    IconRefToRgn
  1078.    
  1079.    This routine returns a region for the icon.
  1080.    It mostly takes the same parameters as IconSuiteToRgn.
  1081.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1082. */
  1083. EXTERN_API( OSErr )
  1084. IconRefToRgn                    (RgnHandle              theRgn,
  1085.                                  const Rect *           iconRect,
  1086.                                  IconAlignmentType      align,
  1087.                                  IconServicesUsageFlags  iconServicesUsageFlags,
  1088.                                  IconRef                theIconRef)                         TWOWORDINLINE(0x7011, 0xAA75);
  1089. /*
  1090.    GetIconSizesFromIconRef
  1091.    
  1092.    This routine returns an IconSelectorValue indicating the depths and sizes of 
  1093.    icon data which are actually available.  It takes an IconSelectorValue 
  1094.    indicating which sizes/depths the caller is interested and returns an 
  1095.    IconSelectorValue indicating which sizes/depths exist.
  1096.    
  1097.    Caution:
  1098.    
  1099.    This is potentially an extremely expensive call as IconServices may be forced 
  1100.    to attempt fetching the data for the IconRef's sizes/depths which may result 
  1101.    in hitting the local disk or even the network to obtain the data to determine 
  1102.    which sizes/depths actually exist.
  1103.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1104. */
  1105. EXTERN_API( OSErr )
  1106. GetIconSizesFromIconRef         (IconSelectorValue      iconSelectorInput,
  1107.                                  IconSelectorValue *    iconSelectorOutputPtr,
  1108.                                  IconServicesUsageFlags  iconServicesUsageFlags,
  1109.                                  IconRef                theIconRef)                         TWOWORDINLINE(0x7012, 0xAA75);
  1110. /*
  1111.   ==============================================================================
  1112.    Flushing IconRef data
  1113.   ==============================================================================
  1114. */
  1115. /*
  1116.    FlushIconRefs
  1117.    
  1118.    Making this call will dispose of all the data for the specified icons if 
  1119.    the data can be reacquired, for example if the data is provided from a resource.
  1120.    '****' is a wildcard for all types or all creators.
  1121. */
  1122. EXTERN_API( OSErr )
  1123. FlushIconRefs                   (OSType                 creator,
  1124.                                  OSType                 iconType)                           TWOWORDINLINE(0x7029, 0xAA75);
  1125. /*
  1126.    FlushIconRefsByVolume
  1127.    
  1128.    This routine disposes of the data for the icons related to the indicated volume
  1129.    if this data can be reacquired, for example if the data is provided from a 
  1130.    resource.
  1131. */
  1132. EXTERN_API( OSErr )
  1133. FlushIconRefsByVolume           (SInt16                 vRefNum)                            TWOWORDINLINE(0x7018, 0xAA75);
  1134. /*
  1135.   ==============================================================================
  1136.    Controling custom icons
  1137.   ==============================================================================
  1138. */
  1139. /*
  1140.    SetCustomIconsEnabled
  1141.    
  1142.    Enable or disable custom icons on the specified volume.
  1143. */
  1144. EXTERN_API( OSErr )
  1145. SetCustomIconsEnabled           (SInt16                 vRefNum,
  1146.                                  Boolean                enableCustomIcons)                  TWOWORDINLINE(0x701F, 0xAA75);
  1147. /*
  1148.    GetCustomIconsEnabled
  1149.    
  1150.    Return true if custom icons are enabled on the specified volume, false otherwise.
  1151. */
  1152. EXTERN_API( OSErr )
  1153. GetCustomIconsEnabled           (SInt16                 vRefNum,
  1154.                                  Boolean *              customIconsEnabled)                 TWOWORDINLINE(0x7020, 0xAA75);
  1155. /*
  1156.    IsIconRefMaskEmpty
  1157.    Returns true if the mask for this icon is blank
  1158. */
  1159. EXTERN_API( Boolean )
  1160. IsIconRefMaskEmpty              (IconRef                iconRef)                            TWOWORDINLINE(0x7033, 0xAA75);
  1161. /*
  1162.    GetIconRefVariant
  1163.    Icon variants allows different images to be used with different icon state.
  1164.    For example, the 'open' variant for a folder could be represented with
  1165.    an open folder.
  1166.    Given an icon ref and a desired variant, this routine returns an icon
  1167.    ref (which may be the same as the input icon ref) and a transformation 
  1168.    which should be used with PlotIconRef() to render the icon appropriately.
  1169.    The returned icon ref should be used to do hit-testing.
  1170. */
  1171. EXTERN_API( IconRef )
  1172. GetIconRefVariant               (IconRef                inIconRef,
  1173.                                  OSType                 inVariant,
  1174.                                  IconTransformType *    outTransform)                       TWOWORDINLINE(0x7034, 0xAA75);
  1175. /*
  1176.   ==============================================================================
  1177.    Icon files (.icns files)
  1178.   ==============================================================================
  1179. */
  1180. /*
  1181.    RegisterIconRefFromIconFile
  1182.    This routine adds a new entry to the IconRef registry. Other clients will be 
  1183.    able to access it using the (creator, iconType) pair specified here.
  1184.    Lower-case creators are reserved for the system.
  1185.    If the creator is kSystemIconsCreator and the iconType is 0, a new IconRef
  1186.    is always returned. Otherwise, if the creator and type have already been
  1187.    registered, the previously registered IconRef is returned.
  1188.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  1189.    when you're done with it.
  1190. */
  1191. EXTERN_API( OSErr )
  1192. RegisterIconRefFromIconFile     (OSType                 creator,
  1193.                                  OSType                 iconType,
  1194.                                  const FSSpec *         iconFile,
  1195.                                  IconRef *              theIconRef)                         TWOWORDINLINE(0x7035, 0xAA75);
  1196. /*
  1197.    ReadIconFile
  1198.    Read the specified icon file into the icon family handle.
  1199.    The caller is responsible for disposing the iconFamily
  1200. */
  1201. EXTERN_API( OSErr )
  1202. ReadIconFile                    (const FSSpec *         iconFile,
  1203.                                  IconFamilyHandle *     iconFamily)                         TWOWORDINLINE(0x7036, 0xAA75);
  1204. /*
  1205.    WriteIconFile
  1206.    Write the iconFamily handle to the specified file
  1207. */
  1208. EXTERN_API( OSErr )
  1209. WriteIconFile                   (IconFamilyHandle       iconFamily,
  1210.                                  const FSSpec *         iconFile)                           TWOWORDINLINE(0x7037, 0xAA75);
  1211. #if PRAGMA_STRUCT_ALIGN
  1212.     #pragma options align=reset
  1213. #elif PRAGMA_STRUCT_PACKPUSH
  1214.     #pragma pack(pop)
  1215. #elif PRAGMA_STRUCT_PACK
  1216.     #pragma pack()
  1217. #endif
  1218. #ifdef PRAGMA_IMPORT_OFF
  1219. #pragma import off
  1220. #elif PRAGMA_IMPORT
  1221. #pragma import reset
  1222. #endif
  1223. #ifdef __cplusplus
  1224. }
  1225. #endif
  1226. #endif /* __ICONS__ */