BigEasy/IconUtilsPriv.h

 
#ifndef __ICONUTILSPRIV__
#define __ICONUTILSPRIV__
 
#define labelColorBase  -16392
 
#ifndef REZ
 
#ifndef __TYPES__
#include <Types.h>
#endif
 
#ifndef __ICONS__
#include <Icons.h>
#endif
 
#ifndef __QUICKDRAW__
#include <QuickDraw.h>
#endif
 
#define genericIconBase                     -4000
#define popupMenuSymbolResource             -3990
#define standalonePopupMenuSymbolResource   -3986
 
#define genericMailboxIconResource          -3987   /* excise from 7.0 */
#define genericLetterIconResource           -3988   /* excise from 7.0 */
 
#define noMaskFound     -1000                       /* error numbers */
#define haltIterator    -1001
 
#define SUITE   0
#define CACHE   1
 
enum
{
    largeIcon1 = 0,
    largeIcon4,
    largeIcon8,
    smallIcon1,
    smallIcon4,
    smallIcon8,
    miniIcon1,
    miniIcon4,
    miniIcon8,
    aCIcon = 128
};
 
typedef unsigned short IconType;
 
#define IconSpace (miniIcon8 + 1)
#define IconDepthSpace (smallIcon1 - largeIcon1)
#define IconSizeSpace (IconSpace / IconDepthSpace)
 
#define transformMask 0x3
#define labelMask 0x0f00
#define labelShift 8
 
typedef pascal OSErr (*IconAction)(ResType theType, Handle *theIcon, void *yourDataPtr);
typedef pascal Handle (*IconGetter)(ResType theType, void *yourDataPtr);
 
typedef struct
{
    unsigned short  type;
    unsigned short  label;
    Handle          table[IconSpace];
} IconSuite;
 
typedef IconSuite *IconSuitePtr;
typedef IconSuitePtr *IconSuiteHandle;
 
typedef struct
{
    IconSuite       theSuite;
    void            *userPtr;
    IconGetter      userMethod;
} IconCache;
 
typedef IconCache *IconCachePtr;
typedef IconCachePtr *IconCacheHandle;
 
#define Labels      8
#define Sets        8
 
typedef struct
{
    GDHandle        theDevice;
    long            theSeed;
    unsigned long   checkMask,
                    checkResults,
                    disabledCheckMask,
                    disabledCheckResults;
} DeviceCheck;
 
typedef Handle Strings[Labels];
 
typedef struct
{
    Strings             labelStrings;
    long                seeds[Labels * Sets];
    CTabHandle          colorTables[Labels * Sets],
                        originals[2];
    RGBColor            labelColors[Labels];
    unsigned char       **indexLists[2];
    GDHandle            virtualScreen;
#if TheFuture
    GrafPtr             printerPortCache;
#endif
    long                deviceListSize;
    DeviceCheck         deviceCheckList[1];
} GlobalIconData;
 
typedef GlobalIconData  *GlobalIconDataPtr;
typedef GlobalIconDataPtr *GlobalIconDataHandle;
 
/*  Selector mask values  */
typedef unsigned long   IconSelectorValue;  
#define svLarge1Bit         0x00000001
#define svLarge4Bit         0x00000002
#define svLarge8Bit         0x00000004
#define svSmall1Bit         0x00000100
#define svSmall4Bit         0x00000200
#define svSmall8Bit         0x00000400
#define svMini1Bit          0x00010000
#define svMini4Bit          0x00020000
#define svMini8Bit          0x00040000
#define svAllLargeData      0x000000ff
#define svAllSmallData      0x0000ff00
#define svAllMiniData       0x00ff0000
#define svAll1BitData       (svLarge1Bit | svSmall1Bit | svMini1Bit)
#define svAll4BitData       (svLarge4Bit | svSmall4Bit | svMini4Bit)
#define svAll8BitData       (svLarge8Bit | svSmall8Bit | svMini8Bit)
#define svAllAvailableData  0xffffffff
 
/*  alignment type values  */
typedef short   IconAlignmentType;  
#define atNone              0x0
#define atVerticalCenter    0x1
#define atTop               0x2
#define atBottom            0x3
#define atHorizontalCenter  0x4
#define atAbsoluteCenter    (atVerticalCenter | atHorizontalCenter)
#define atCenterTop         (atTop | atHorizontalCenter)
#define atCenterBottom      (atBottom | atHorizontalCenter)
#define atLeft              0x8
#define atCenterLeft        (atVerticalCenter | atLeft)
#define atTopLeft           (atTop | atLeft)
#define atBottomLeft        (atBottom | atLeft)
#define atRight             0xC
#define atCenterRight       (atVerticalCenter | atRight)
#define atTopRight          (atTop | atRight)
#define atBottomRight       (atBottom | atRight)
 
 
/*  transform type values  */
typedef short   IconTransformType;  
#define ttNone              0x0
#define ttDisabled          0x1
#define ttOffline           0x2
#define ttOpen              0x3
#define ttLabel1            0x0100
#define ttLabel2            0x0200
#define ttLabel3            0x0300
#define ttLabel4            0x0400
#define ttLabel5            0x0500
#define ttLabel6            0x0600
#define ttLabel7            0x0700
#define ttSelected          0x4000
#define ttSelectedDisabled  (ttSelected | ttDisabled)
#define ttSelectedOffline   (ttSelected | ttOffline)
#define ttSelectedOpen      (ttSelected | ttOpen)
 
#ifdef __cplusplus
extern "C" {
#endif
 
pascal OSErr PlotIconID(const Rect *theRect,
                            IconAlignmentType align,
                            IconTransformType transform,
                            short theResID)
    = {0x303C, 0x0500, 0xABC9};
    
pascal OSErr NewIconSuite(Handle *theIconSuite)
    = {0x303C, 0x0207, 0xABC9};
    
pascal OSErr AddIconToSuite(Handle theIconData,
                            Handle theSuite,
                            ResType theType)
    = {0x303C, 0x0608, 0xABC9};
    
pascal OSErr GetIconFromSuite(Handle *theIconData,
                            Handle theSuite,
                            ResType theType)
    = {0x303C, 0x0609, 0xABC9};
    
pascal OSErr ForEachIconDo(Handle theSuite,
                            IconSelectorValue selector,
                            IconAction action,
                            void *yourDataPtr)
    = {0x303C, 0x080A, 0xABC9};
    
pascal OSErr GetIconSuite(Handle *theIconSuite,
                            short theResID,
                            IconSelectorValue selector)
    = {0x303C, 0x0501, 0xABC9};
    
pascal OSErr DisposeIconSuite(Handle theIconSuite,
                            Boolean disposeData)
    = {0x303C, 0x0302, 0xABC9};
    
pascal OSErr PlotIconSuite(const Rect *theRect,
                            IconAlignmentType align,
                            IconTransformType transform,
                            Handle theIconSuite)
    = {0x303C, 0x0603, 0xABC9};
    
pascal OSErr MakeIconCache(Handle *theHandle,
                            IconGetter makeIcon,
                            void *yourDataPtr)
    = {0x303C, 0x0604, 0xABC9};
    
pascal OSErr LoadIconCache(const Rect *theRect,
                            IconAlignmentType align,
                            IconTransformType transform,
                            Handle theIconCache)
    = {0x303C, 0x0606, 0xABC9};
 
pascal OSErr PlotIconMethod(const Rect *theRect,
                            IconAlignmentType align,
                            IconTransformType transform,
                            IconGetter theMethod,
                            void *yourDataPtr)
    = {0x303C, 0x0805, 0xABC9};
    
pascal OSErr GetLabel(short labelNumber,
                            RGBColor *labelColor,
                            Str255 labelString)
    = {0x303c, 0x050B, 0xABC9};
    
pascal Boolean PtInIconID(Point testPt,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            short iconID)
    = {0x303c, 0x060D, 0xABC9};
    
pascal Boolean PtInIconSuite(Point testPt,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            Handle theIconSuite)
    = {0x303c, 0x070E, 0xABC9};
    
pascal Boolean PtInIconMethod(Point testPt,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            IconGetter theMethod,
                            void *yourDataPtr)
    = {0x303c, 0x090F, 0xABC9};
    
pascal Boolean RectInIconID(Rect *testRect,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            short iconID)
    = {0x303c, 0x0610, 0xABC9};
    
pascal Boolean RectInIconSuite(Rect *testRect,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            Handle theIconSuite)
    = {0x303c, 0x0711, 0xABC9};
    
pascal Boolean RectInIconMethod(Rect *testRect,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            IconGetter theMethod,
                            void *yourDataPtr)
    = {0x303c, 0x0912, 0xABC9};
    
pascal OSErr IconIDToRgn(RgnHandle theRgn,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            short iconID)
    = {0x303c, 0x0613, 0xABC9};
    
pascal OSErr IconSuiteToRgn(RgnHandle theRgn,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            Handle theIconSuite)
    = {0x303c, 0x0714, 0xABC9};
    
pascal OSErr IconMethodToRgn(RgnHandle theRgn,
                            Rect *iconRect,
                            IconAlignmentType alignment,
                            IconGetter theMethod,
                            void *yourDataPtr)
    = {0x303c, 0x0915, 0xABC9};
    
pascal OSErr SetSuiteLabel(Handle theSuite, short theLabel)
    = {0x303C, 0x0316, 0xABC9};
 
pascal short GetSuiteLabel(Handle theSuite)
    = {0x303C, 0x0217, 0xABC9};
 
pascal void SetIconDevice(GDHandle theScreen)
    = {0x303C, 0x0218, 0xABC9};
        
pascal void GetIconDevice(GDHandle *theScreen)
    = {0x303C, 0x0220, 0xABC9};
    
pascal OSErr GetIconCacheData(Handle theCache, void **theData)
    = {0x303C, 0x0419, 0xABC9};
        
pascal OSErr SetIconCacheData(Handle theCache, void *theData)
    = {0x303C, 0x041A, 0xABC9};
        
pascal OSErr GetIconCacheProc(Handle theCache, IconGetter *theProc)
    = {0x303C, 0x041B, 0xABC9};
        
pascal OSErr SetIconCacheProc(Handle theCache, IconGetter theProc)
    = {0x303C, 0x041C, 0xABC9};
    
pascal OSErr PlotIconHandle(const Rect *theRect,
                            IconAlignmentType align,
                            IconTransformType transform,
                            Handle theIcon)
    = {0x303C, 0x061D, 0xABC9};
    
pascal OSErr PlotSICNHandle(const Rect *theRect,
                            IconAlignmentType align,
                            IconTransformType transform,
                            Handle theSICN)
    = {0x303C, 0x061E, 0xABC9};
    
pascal OSErr PlotCIconHandle(const Rect *theRect,
                            IconAlignmentType align,
                            IconTransformType transform,
                            CIconHandle theCIcon)
    = {0x303C, 0x061F, 0xABC9};
    
pascal OSErr SetLabel(short labelNumber, const RGBColor *, ConstStr255Param)
    = {0x303C, 0x050C, 0xABC9};
 
#ifdef __cplusplus
}
#endif
 
#endif  /*  #ifndef REZ */
#endif  /*  #ifndef __ICONUTILSPRIV__   */