CLUTSample.r

/*------------------------------------------------------------------------------
#
#   Apple Macintosh Developer Technical Support
#
#   CLUTSample
#
#   CLUTSample.r    -   Rez Source
#
#   Loosely based in the sample SAMPLE this program shows
#   how to create a window and display on it the colors of the CLUT
#   associated with the device the window sits on top of.
#
#   Left to the curious reader are some improvements such as, remembering the
#   positions of each open window, so if you use this program to monitor your
#   color tables it will position the windows in the last place you opened them.
#   The treatment of direct devices is kind of 'casual' a better color display may 
#   be appropriate. Last, it may be desireable to change the size of the color
#   rectangles depending on the depth of the color table.
 
#   Check Sample sources for more detailed documentation.
 
#   Copyright © 1990 Apple Computer, Inc.
#   All rights reserved.
*/
 
#include "Types.r"
 
#include "CLUTSample.h"
 
 
/* this is a definition for a resource which contains only a rectangle */
 
type 'RECT' {
    rect;
};
 
 
/* we use an MBAR resource to conveniently load all the menus */
 
resource 'MBAR' (rMenuBar, preload) {
    { mApple, mFile };  /* two menus */
};
 
 
resource 'MENU' (mApple, preload) {
    mApple, textMenuProc,
    AllItems & ~MenuItem2,  /* Disable dashed line, enable About and DAs */
    enabled, apple,
    {
        "About SampleÉ",
            noicon, nokey, nomark, plain;
        "-",
            noicon, nokey, nomark, plain
    }
};
 
resource 'MENU' (mFile, preload) {
    mFile, textMenuProc,
    0xFFB,              /* enable items */
    enabled, "File",
    {
        "New",
            noicon, "N", nomark, plain;
        "Close",
            noicon, "W", nomark, plain;
        "-",
            noicon, nokey, nomark, plain;
        "Quit",
            noicon, "Q", nomark, plain
    }
};
 
/* this ALRT and DITL are used as an About screen */
 
resource 'DITL' (128) {
    {   /* array DITLarray: 5 elements */
        /* [1] */
        {88, 180, 108, 260},
        Button {
            enabled,
            "OK"
        },
        /* [2] */
        {8, 8, 24, 214},
        StaticText {
            disabled,
            "Clut Window"
        },
        /* [3] */
        {32, 8, 48, 237},
        StaticText {
            disabled,
            "Copyright © 1990"
        },
        /* [4] */
        {56, 8, 72, 186},
        StaticText {
            disabled,
            "Dennis Hescox- DTS"
        },
        /* [5] */
        {80, 24, 112, 167},
        StaticText {
            disabled,
            ""
        }
    }
};
 
resource 'ALRT' (128) {
    {40, 20, 160, 292},
    128,
    {   /* array: 4 elements */
        /* [1] */
        OK, visible, silent,
        /* [2] */
        OK, visible, silent,
        /* [3] */
        OK, visible, silent,
        /* [4] */
        OK, visible, silent
    }
};
 
 
/* this ALRT and DITL are used as an error screen */
 
resource 'ALRT' (rUserAlert, purgeable) {
    {40, 20, 120, 260},
    rUserAlert,
    { /* array: 4 elements */
        /* [1] */
        OK, visible, silent,
        /* [2] */
        OK, visible, silent,
        /* [3] */
        OK, visible, silent,
        /* [4] */
        OK, visible, silent
    }
};
 
 
resource 'DITL' (rUserAlert, purgeable) {
    { /* array DITLarray: 3 elements */
        /* [1] */
        {50, 150, 70, 230},
        Button {
            enabled,
            "OK"
        },
        /* [2] */
        {10, 60, 30, 230},
        StaticText {
            disabled,
            "CLUTSample - Error occurred!"
        },
        /* [3] */
        {8, 8, 40, 40},
        Icon {
            disabled,
            2
        }
    }
};
 
 
resource 'WIND' (rWindow, preload, purgeable) {
    {358, 570, 422, 634},
    documentProc, visible, noGoAway, 0x0, "CLUT"
};
 
 
/* here is the quintessential MultiFinder friendliness device, the SIZE resource */
 
resource 'SIZE' (-1) {
    dontSaveScreen,
    acceptSuspendResumeEvents,
    enableOptionSwitch,
    canBackground,              /* we can background; we don't currently, but our sleep value */
                                /* guarantees we don't hog the Mac while we are in the background */
    multiFinderAware,           /* this says we do our own activate/deactivate; don't fake us out */
    backgroundAndForeground,    /* this is definitely not a background-only application! */
    dontGetFrontClicks,         /* change this is if you want "do first click" behavior like the Finder */
    ignoreChildDiedEvents,      /* essentially, I'm not a debugger (sub-launching) */
    not32BitCompatible,         /* this app should not be run in 32-bit address space */
    reserved,
    reserved,
    reserved,
    reserved,
    reserved,
    reserved,
    reserved,
    kPrefSize * 1024,
    kMinSize * 1024 
};