home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / Icons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  11.5 KB  |  323 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Icons.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __ICONS__
  18. #define __ICONS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __QUICKDRAW__
  27. #include <Quickdraw.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <QuickdrawText.h>                                    */
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. #if GENERATINGPOWERPC
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. #ifdef __CFM68K__
  41. #pragma lib_export on
  42. #endif
  43.  
  44.  
  45. enum {
  46. /* The following are icons for which there are both icon suites and SICNs. */
  47.     genericDocumentIconResource    = -4000,
  48.     genericStationeryIconResource = -3985,
  49.     genericEditionFileIconResource = -3989,
  50.     genericApplicationIconResource = -3996,
  51.     genericDeskAccessoryIconResource = -3991,
  52.     genericFolderIconResource    = -3999,
  53.     privateFolderIconResource    = -3994,
  54.     floppyIconResource            = -3998,
  55.     trashIconResource            = -3993,
  56. /* The following are icons for which there are SICNs only. */
  57.     desktopIconResource            = -3992,
  58.     openFolderIconResource        = -3997,
  59.     genericHardDiskIconResource    = -3995,
  60.     genericFileServerIconResource = -3972,
  61.     genericSuitcaseIconResource    = -3970,
  62.     genericMoverObjectIconResource = -3969,
  63. /* The following are icons for which there are icon suites only. */
  64.     genericPreferencesIconResource = -3971,
  65.     genericQueryDocumentIconResource = -16506,
  66.     genericExtensionIconResource = -16415,
  67.     systemFolderIconResource    = -3983,
  68.     appleMenuFolderIconResource    = -3982
  69. };
  70.  
  71. enum {
  72.     startupFolderIconResource    = -3981,
  73.     ownedFolderIconResource        = -3980,
  74.     dropFolderIconResource        = -3979,
  75.     sharedFolderIconResource    = -3978,
  76.     mountedFolderIconResource    = -3977,
  77.     controlPanelFolderIconResource = -3976,
  78.     printMonitorFolderIconResource = -3975,
  79.     preferencesFolderIconResource = -3974,
  80.     extensionsFolderIconResource = -3973,
  81.     fontsFolderIconResource        = -3968,
  82.     fullTrashIconResource        = -3984,
  83.     large1BitMask                = 'ICN#',
  84.     large4BitData                = 'icl4',
  85.     large8BitData                = 'icl8',
  86.     small1BitMask                = 'ics#',
  87.     small4BitData                = 'ics4',
  88.     small8BitData                = 'ics8',
  89.     mini1BitMask                = 'icm#',
  90.     mini4BitData                = 'icm4',
  91.     mini8BitData                = 'icm8'
  92. };
  93.  
  94. /*  alignment type values  */
  95. enum {
  96.     atNone                        = 0x0,
  97.     atVerticalCenter            = 0x1,
  98.     atTop                        = 0x2,
  99.     atBottom                    = 0x3,
  100.     atHorizontalCenter            = 0x4,
  101.     atAbsoluteCenter            = atVerticalCenter | atHorizontalCenter,
  102.     atCenterTop                    = atTop | atHorizontalCenter,
  103.     atCenterBottom                = atBottom | atHorizontalCenter,
  104.     atLeft                        = 0x8,
  105.     atCenterLeft                = atVerticalCenter | atLeft,
  106.     atTopLeft                    = atTop | atLeft,
  107.     atBottomLeft                = atBottom | atLeft,
  108.     atRight                        = 0xC,
  109.     atCenterRight                = atVerticalCenter | atRight,
  110.     atTopRight                    = atTop | atRight,
  111.     atBottomRight                = atBottom | atRight
  112. };
  113.  
  114. typedef short IconAlignmentType;
  115.  
  116. /*  transform type values  */
  117.  
  118. enum {
  119.     ttNone                        = 0x0,
  120.     ttDisabled                    = 0x1,
  121.     ttOffline                    = 0x2,
  122.     ttOpen                        = 0x3,
  123.     ttLabel1                    = 0x0100,
  124.     ttLabel2                    = 0x0200,
  125.     ttLabel3                    = 0x0300,
  126.     ttLabel4                    = 0x0400,
  127.     ttLabel5                    = 0x0500,
  128.     ttLabel6                    = 0x0600,
  129.     ttLabel7                    = 0x0700,
  130.     ttSelected                    = 0x4000,
  131.     ttSelectedDisabled            = ttSelected | ttDisabled,
  132.     ttSelectedOffline            = ttSelected | ttOffline,
  133.     ttSelectedOpen                = ttSelected | ttOpen
  134. };
  135.  
  136. typedef short IconTransformType;
  137.  
  138. /*  Selector mask values  */
  139.  
  140. enum {
  141.     svLarge1Bit                    = 0x00000001,
  142.     svLarge4Bit                    = 0x00000002,
  143.     svLarge8Bit                    = 0x00000004,
  144.     svSmall1Bit                    = 0x00000100,
  145.     svSmall4Bit                    = 0x00000200,
  146.     svSmall8Bit                    = 0x00000400,
  147.     svMini1Bit                    = 0x00010000,
  148.     svMini4Bit                    = 0x00020000,
  149.     svMini8Bit                    = 0x00040000,
  150.     svAllLargeData                = 0x000000ff,
  151.     svAllSmallData                = 0x0000ff00,
  152.     svAllMiniData                = 0x00ff0000,
  153.     svAll1BitData                = svLarge1Bit | svSmall1Bit | svMini1Bit,
  154.     svAll4BitData                = svLarge4Bit | svSmall4Bit | svMini4Bit,
  155.     svAll8BitData                = svLarge8Bit | svSmall8Bit | svMini8Bit,
  156.     svAllAvailableData            = 0xffffffffL
  157. };
  158.  
  159. typedef unsigned long IconSelectorValue;
  160.  
  161. typedef pascal OSErr (*IconActionProcPtr)(ResType theType, Handle *theIcon, void *yourDataPtr);
  162.  
  163. #if GENERATINGCFM
  164. typedef UniversalProcPtr IconActionUPP;
  165. #else
  166. typedef IconActionProcPtr IconActionUPP;
  167. #endif
  168.  
  169. enum {
  170.     uppIconActionProcInfo = kPascalStackBased
  171.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  172.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType)))
  173.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle*)))
  174.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void*)))
  175. };
  176.  
  177. #if GENERATINGCFM
  178. #define NewIconActionProc(userRoutine)        \
  179.         (IconActionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppIconActionProcInfo, GetCurrentArchitecture())
  180. #else
  181. #define NewIconActionProc(userRoutine)        \
  182.         ((IconActionUPP) (userRoutine))
  183. #endif
  184.  
  185. #if GENERATINGCFM
  186. #define CallIconActionProc(userRoutine, theType, theIcon, yourDataPtr)        \
  187.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppIconActionProcInfo, (theType), (theIcon), (yourDataPtr))
  188. #else
  189. #define CallIconActionProc(userRoutine, theType, theIcon, yourDataPtr)        \
  190.         (*(userRoutine))((theType), (theIcon), (yourDataPtr))
  191. #endif
  192.  
  193. typedef IconActionProcPtr IconAction;
  194.  
  195. typedef pascal Handle (*IconGetterProcPtr)(ResType theType, void *yourDataPtr);
  196.  
  197. #if GENERATINGCFM
  198. typedef UniversalProcPtr IconGetterUPP;
  199. #else
  200. typedef IconGetterProcPtr IconGetterUPP;
  201. #endif
  202.  
  203. enum {
  204.     uppIconGetterProcInfo = kPascalStackBased
  205.          | RESULT_SIZE(SIZE_CODE(sizeof(Handle)))
  206.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType)))
  207.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  208. };
  209.  
  210. #if GENERATINGCFM
  211. #define NewIconGetterProc(userRoutine)        \
  212.         (IconGetterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppIconGetterProcInfo, GetCurrentArchitecture())
  213. #else
  214. #define NewIconGetterProc(userRoutine)        \
  215.         ((IconGetterUPP) (userRoutine))
  216. #endif
  217.  
  218. #if GENERATINGCFM
  219. #define CallIconGetterProc(userRoutine, theType, yourDataPtr)        \
  220.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppIconGetterProcInfo, (theType), (yourDataPtr))
  221. #else
  222. #define CallIconGetterProc(userRoutine, theType, yourDataPtr)        \
  223.         (*(userRoutine))((theType), (yourDataPtr))
  224. #endif
  225.  
  226. typedef IconGetterProcPtr IconGetter;
  227.  
  228. #if !OLDROUTINELOCATIONS
  229. struct CIcon {
  230.     PixMap                            iconPMap;                    /*the icon's pixMap*/
  231.     BitMap                            iconMask;                    /*the icon's mask*/
  232.     BitMap                            iconBMap;                    /*the icon's bitMap*/
  233.     Handle                            iconData;                    /*the icon's data*/
  234.     short                            iconMaskData[1];            /*icon's mask and BitMap data*/
  235. };
  236. typedef struct CIcon CIcon, *CIconPtr, **CIconHandle;
  237.  
  238. extern pascal CIconHandle GetCIcon(short iconID)
  239.  ONEWORDINLINE(0xAA1E);
  240. extern pascal void PlotCIcon(const Rect *theRect, CIconHandle theIcon)
  241.  ONEWORDINLINE(0xAA1F);
  242. extern pascal void DisposeCIcon(CIconHandle theIcon)
  243.  ONEWORDINLINE(0xAA25);
  244. extern pascal Handle GetIcon(short iconID)
  245.  ONEWORDINLINE(0xA9BB);
  246. extern pascal void PlotIcon(const Rect *theRect, Handle theIcon)
  247.  ONEWORDINLINE(0xA94B);
  248. #endif
  249. extern pascal OSErr PlotIconID(const Rect *theRect, IconAlignmentType align, IconTransformType transform, short theResID)
  250.  THREEWORDINLINE(0x303C, 0x0500, 0xABC9);
  251. extern pascal OSErr NewIconSuite(Handle *theIconSuite)
  252.  THREEWORDINLINE(0x303C, 0x0207, 0xABC9);
  253. extern pascal OSErr AddIconToSuite(Handle theIconData, Handle theSuite, ResType theType)
  254.  THREEWORDINLINE(0x303C, 0x0608, 0xABC9);
  255. extern pascal OSErr GetIconFromSuite(Handle *theIconData, Handle theSuite, ResType theType)
  256.  THREEWORDINLINE(0x303C, 0x0609, 0xABC9);
  257. extern pascal OSErr ForEachIconDo(Handle theSuite, IconSelectorValue selector, IconActionUPP action, void *yourDataPtr)
  258.  THREEWORDINLINE(0x303C, 0x080A, 0xABC9);
  259. extern pascal OSErr GetIconSuite(Handle *theIconSuite, short theResID, IconSelectorValue selector)
  260.  THREEWORDINLINE(0x303C, 0x0501, 0xABC9);
  261. extern pascal OSErr DisposeIconSuite(Handle theIconSuite, Boolean disposeData)
  262.  THREEWORDINLINE(0x303C, 0x0302, 0xABC9);
  263. extern pascal OSErr PlotIconSuite(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIconSuite)
  264.  THREEWORDINLINE(0x303C, 0x0603, 0xABC9);
  265. extern pascal OSErr MakeIconCache(Handle *theHandle, IconGetterUPP makeIcon, void *yourDataPtr)
  266.  THREEWORDINLINE(0x303C, 0x0604, 0xABC9);
  267. extern pascal OSErr LoadIconCache(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIconCache)
  268.  THREEWORDINLINE(0x303C, 0x0606, 0xABC9);
  269. extern pascal OSErr PlotIconMethod(const Rect *theRect, IconAlignmentType align, IconTransformType transform, IconGetterUPP theMethod, void *yourDataPtr)
  270.  THREEWORDINLINE(0x303C, 0x0805, 0xABC9);
  271. extern pascal OSErr GetLabel(short labelNumber, RGBColor *labelColor, Str255 labelString)
  272.  THREEWORDINLINE(0x303C, 0x050B, 0xABC9);
  273. extern pascal Boolean PtInIconID(Point testPt, const Rect *iconRect, IconAlignmentType align, short iconID)
  274.  THREEWORDINLINE(0x303C, 0x060D, 0xABC9);
  275. extern pascal Boolean PtInIconSuite(Point testPt, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  276.  THREEWORDINLINE(0x303C, 0x070E, 0xABC9);
  277. extern pascal Boolean PtInIconMethod(Point testPt, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  278.  THREEWORDINLINE(0x303C, 0x090F, 0xABC9);
  279. extern pascal Boolean RectInIconID(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, short iconID)
  280.  THREEWORDINLINE(0x303C, 0x0610, 0xABC9);
  281. extern pascal Boolean RectInIconSuite(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  282.  THREEWORDINLINE(0x303C, 0x0711, 0xABC9);
  283. extern pascal Boolean RectInIconMethod(const Rect *testRect, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  284.  THREEWORDINLINE(0x303C, 0x0912, 0xABC9);
  285. extern pascal OSErr IconIDToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, short iconID)
  286.  THREEWORDINLINE(0x303C, 0x0613, 0xABC9);
  287. extern pascal OSErr IconSuiteToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, Handle theIconSuite)
  288.  THREEWORDINLINE(0x303C, 0x0714, 0xABC9);
  289. extern pascal OSErr IconMethodToRgn(RgnHandle theRgn, const Rect *iconRect, IconAlignmentType align, IconGetterUPP theMethod, void *yourDataPtr)
  290.  THREEWORDINLINE(0x303C, 0x0915, 0xABC9);
  291. extern pascal OSErr SetSuiteLabel(Handle theSuite, short theLabel)
  292.  THREEWORDINLINE(0x303C, 0x0316, 0xABC9);
  293. extern pascal short GetSuiteLabel(Handle theSuite)
  294.  THREEWORDINLINE(0x303C, 0x0217, 0xABC9);
  295. extern pascal OSErr GetIconCacheData(Handle theCache, void **theData)
  296.  THREEWORDINLINE(0x303C, 0x0419, 0xABC9);
  297. extern pascal OSErr SetIconCacheData(Handle theCache, void *theData)
  298.  THREEWORDINLINE(0x303C, 0x041A, 0xABC9);
  299. extern pascal OSErr GetIconCacheProc(Handle theCache, IconGetterUPP *theProc)
  300.  THREEWORDINLINE(0x303C, 0x041B, 0xABC9);
  301. extern pascal OSErr SetIconCacheProc(Handle theCache, IconGetterUPP theProc)
  302.  THREEWORDINLINE(0x303C, 0x041C, 0xABC9);
  303. extern pascal OSErr PlotIconHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon)
  304.  THREEWORDINLINE(0x303C, 0x061D, 0xABC9);
  305. extern pascal OSErr PlotSICNHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN)
  306.  THREEWORDINLINE(0x303C, 0x061E, 0xABC9);
  307. extern pascal OSErr PlotCIconHandle(const Rect *theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon)
  308.  THREEWORDINLINE(0x303C, 0x061F, 0xABC9);
  309.  
  310. #ifdef __CFM68K__
  311. #pragma lib_export off
  312. #endif
  313.  
  314. #if GENERATINGPOWERPC
  315. #pragma options align=reset
  316. #endif
  317.  
  318. #ifdef __cplusplus
  319. }
  320. #endif
  321.  
  322. #endif /* __ICONS__ */
  323.