CreateDirWCustIcon.h

/*
    File:       CreateDirWCustIcon.h
    
    Description:This snippet demonstrates how to create a directory and how to steal a custom
                icon from another directory by CatMoving the "Icon\r" file from the other
                directory.
 
    Author:     VMC
 
    Copyright:  Copyright: © 1999 by Apple Computer, Inc.
                all rights reserved.
    
    Disclaimer: You may incorporate this sample code into your applications without
                restriction, though the sample code has been provided "AS IS" and the
                responsibility for its operation is 100% yours.  However, what you are
                not permitted to do is to redistribute the source as "DSC Sample Code"
                after having made changes. If you're going to re-distribute the source,
                we require that you make it clear in the source that the code was
                descended from Apple Sample Code, but that you've made changes.
    
    Change History (most recent first):
                6/25/99 Updated for Metrowerks Codewarror Pro 2.1(KG)
 
*/
 
 
/*****  #includes   *****/
#include    <QuickDraw.h>
#include    <Fonts.h>
#include    <Menus.h>
#include    <Events.h>
#include    <Gestalt.h>
#include    <Windows.h>
#include    <Dialogs.h>
#include    <Desk.h>
#include    <Resources.h>
#include    <SegLoad.h>
#include    <ToolUtils.h>
#include    <Types.h>
#include    <AppleEvents.h>
#include    <Files.h>
#include    <ConditionalMacros.h>
#include    <DiskInit.h>
 
 
/*****  #defines    *****/
#define     NIL                 0L          /*  could also be written  "0x00000000"     */
#define     UNIMPLEMENTED       0xA89F      /* A-trap code for unimplemented function   */
#define     WAITNEXTEVENT       0xA860      /* A-trap code for WaitNextEvent()          */
 
/*  kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
#define kExtremeNeg             -32700
#define kExtremePos             32700
 
 
#define     WINDOWID            2000
#define     PUTINFRONT          (WindowPtr) -1L
 
#define     ABOUTID             5000
 
#define     APPLEMENU           5001
#define         appleABOUT      1
#define     FILEMENU            5002
#define         fileQUIT        1
#define     EDITMENU            5003
#define         editUNDO        1
            /* ---------- */
#define         editCUT         3
#define         editCOPY        4
#define         editPASTE       5
#define         editCLEAR       6
#define         editSELECTALL   7
 
#define     TESTMENU                5004
#define         testDOTHETEST       1
 
#define     MAXMENUS            4
#define     FIRSTMENUID         5001
 
#define     TESTALERTID         6000
#define     BADSYSTEMID         6001
#define     BADQUICKDRAWID      6002
#define     NOAPPLEEVENTS       6003
 
 
// Handy macros
#define TopLeft(aRect)  (* (Point *) &(aRect).top)
#define BotRight(aRect) (* (Point *) &(aRect).bottom)
/*****     Prototypes      *****/
void        main(void);
void        initApp(void);
Boolean     checkGestaltFeatures(void);
Boolean     installAEHandlers();
void        setUpMenus(void);
void        setUpWindow(void);
void        setUpMenus(void);
void        doHighLevel(EventRecord *eventRec);
void        doMousedown(EventRecord *eventRec);
void        doKey(EventRecord *eventRec);
void        doUpdate(EventRecord *eventRec);
void        dispatch(long menuResult);
void        doAppleCmds (short theItem);
void        doFileCmds (short theItem);
void        doTestCmds (short theItem);
void        doTheTest(void);
void        makeCustomIconFolder(FSSpec *iconFileSpec);
 
pascal OSErr    DoOpenAppAE(AppleEvent theAppleEvent, AppleEvent reply, long refCon);
pascal OSErr    DoOpenDocAE(AppleEvent theAppleEvent, AppleEvent reply, long refCon);
pascal OSErr    DoPrintDocAE(AppleEvent theAppleEvent, AppleEvent reply, long refCon);
pascal OSErr    DoQuitAppAE(AppleEvent theAppleEvent, AppleEvent reply, long refCon);