Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
SampConstants.h
/*------------------------------------------------------------------------------ |
* |
* Apple Developer Technical Support |
* |
* Constants |
* |
* Program: AEObject-Edition Sample |
* File: SampConstants.h - C Source |
* |
* by: C.K. Haun <TR> |
* |
* Copyright © 1990-1992 Apple Computer, Inc. |
* All rights reserved. |
* |
*------------------------------------------------------------------------------ |
* All the constants for this application |
*------------------------------------------------------------------------------*/ |
/* ¥¥¥¥ NOTE ¥¥¥¥ You will find NO (0) #defines for numbers in this file! */ |
/* I have converted everything to 'enum's */ |
/* Why? One good reason. You cannot redefine an enum, the compiler will */ |
/* issue an error if you do. Whereas #defines can be redefined */ |
/* constantly, and you will only see an error if you have -warnings full */ |
/* turned on. */ |
/* So enums are safer, you cannot accidentally redefine a constant and */ |
/* have a nightmare of a time trying to figure out why your code doesn't work */ |
/* They also are easier to work with for things like menu item numbers, if you add or delete */ |
/* an item all you do is add or take out the name, the numbering is automatically updated*/ |
/* menu constants */ |
enum {kAppleMenu = 128, |
kFileMenu,kEditMenu, |
kToolsMenu, |
kAEMenu, |
kEditionMenu, |
kWindowMenu, |
kColorMenu}; |
enum {kOurMenuBar = 148}; |
enum {kNewItem = 1, |
kOpenItem, |
kCloseItem, |
kSaveItem, |
kSaveAsItem, |
kBlankFile1, |
kPrintItem, |
kBlankFile2, |
kPreferences, |
kBlankFile3, |
kQuitItem }; |
/* edit menu constants */ |
enum {kUndoItem = 1, |
kBlankEdit1, |
kCutItem, |
kCopyItem, |
kPasteItem, |
kClearItem, |
kBlankEdit2, |
kPublishItem, |
kSubscribeItem, |
kSoptionsItem, |
kBorders, |
kBlankEdit3, |
kClapNum}; |
enum {kAboutItem = 1, |
kAboutBox = 128}; |
/* Tool menu constants */ |
enum {kLineItem = 1, |
kRectItem, |
kOvalItem, |
kTextBoxItem, |
kSelectItem = 6}; |
enum {kTopDown = 0x8000}; |
/* AE menu constants */ |
enum {kInteractionItem=1, |
kAddressItem, |
kReplyItem, |
kBlankAE, |
kShowAEWind, |
kBlankAE2, |
kWindowObjChar, |
kTextObjectChar, |
kShapeObjectChar, |
kBlankAE3, |
kSendGetDataAE, |
kSendSetDataAE}; |
/* GetData submenu items */ |
enum {kGetDataSubmenu=1, |
kSetDataSubmenu, |
kNewElementSubmenu}; |
/* these are the same for the get and set submenus */ |
enum {kWindowBoundsItem=1, |
kWindowTitleItem, |
kWindowVisiblityItem, |
kDataBlank1, |
kAllText, |
kWordText, |
kDataBlank2, |
kShapeItem |
}; |
/* */ |
/* this is for the new element submenu */ |
enum { |
kNewEWindowItem=1, |
kNewEBlank1, |
kNewETextItem, |
kNewEWordItem, |
kNewEBlank2 |
}; |
/* color menu */ |
enum {kBlackColorItem=1, |
kBlueColorItem, |
kGreenColorItem, |
kRedColorItem, |
kYellowColorItem, |
kCustomColorItem}; |
/* string resource */ |
enum {kUndoStringsRes = 1001, |
kClipBoardStrings, |
kGeneralStrings}; |
enum {kPrefsFileString = 1001, |
kHelpString}; |
/* general string constants */ |
enum {kDotPub = 1, |
kSavePromptString, |
kPubOptString, |
kSubOptString, |
kShowBString, |
kHideBString, |
kSaveDotsString, |
kSaveNDotsString, |
kShowClipString, |
kHideClipString, |
kShowAEString, |
kHideAEString, |
kAESSavePrompt, |
kAESDefaultName, |
kTrueWord, |
kFalseWord, |
kSayRectangle, |
kSettingVis, |
kSettingBounds, |
kSettingTitle, |
kII, |
kIII, |
kIIII, |
kIIIII, |
kSettingShape, |
kBringForward, |
kErrorToSay, |
kCPick, |
kNewSCol, |
kPPCPrompt1, |
kPPCPrompt2, |
kUCanxString, |
kUnknownError |
}; |
/* clipboard type content constants */ |
enum { kClipUnused= 1, |
kClipEmpty, |
kClipHasPict, |
kClipHasText, |
kClipHasSub}; |
/* alerts */ |
enum {kNoMoreWindows =1000, |
kDirtyAlert, |
kNoSize, |
kNoAppleEvents, |
kNoEditionManager, |
kCanxSub, |
kBadMix}; |
/* additional DITLs for publisher and subscriber boxes */ |
enum{ kExpandedDITL= 2000, |
kExpandedSubDITL}; |
enum {kNotInYet =134}; |
enum {kSampHelp =300}; |
enum {kEdInfo =133}; |
/* dialogs */ |
enum {kInteractionDialog = 301, |
kAddressingDialog, |
kReplyModeDialog}; |
/* item numbers for these dialogs */ |
enum {kSelfIItem=6, |
kLocalIItem, |
kAllIItem, |
kNeverIItem, |
kCanIItem, |
kAlwaysIItem, |
kSwitchLItem}; |
enum {kSelfAddressCurrItem=4, |
kSelfAddressPSNItem, |
kOtherAppItem, |
kOtherNameItem, |
kSelectProcItem}; |
enum {kNoReplyItem=4, |
kWaitReplyItem, |
kQueueReplyItem}; |
enum {kSetWindowObject = 400, |
kSetTextObject, |
kSetShapeObject}; |
/* item numbers for setData dialog */ |
enum {kSetDDialog =600}; |
enum {kMakeVisItem=5, |
kMakeInvisItem, |
kRectTextItem, |
kRectEdit1, |
kRectEdit2, |
kRectEdit3, |
kRectEdit4, |
kNewTitleWordsItem, |
kNewTitleEditLineItem, |
kNewTextItem, |
kNewText, |
kNewWordItem, |
kNewTitleWordsItem2, |
kNewTitleEditLineItem2, |
kNewSBoundsRadio, |
kNewSColorRadio, |
kNewSColorButton |
}; |
enum { |
kWPosRadio = 5, |
kWTitleRadioSet, |
kWPosNum = 8, |
kWTitleELine |
}; |
enum {kBringAEForwardCheck=4, |
kVerboseCheck, |
kSaveWindCheck, |
kSaveTextCheck, |
kSaveShapeCheck, |
kFred, |
kSaveInteractCheck, |
kSaveTargetCheck, |
kSaveReplyCheck, |
kFBox1, |
kFBox2, |
kFBox3}; |
enum {kPreferencesBox = 800}; |
/* window object */ |
enum {kWByIndex = 5, |
kWByName, |
kWIndexNum = 8, |
kWIndexName}; |
/* text */ |
enum {kTextONumber = 5, |
kWordIndex, |
kWordIndexString=8}; |
/* shape dialog */ |
enum { |
kLineRadio=3, |
kRectangleRadio, |
kOvalRadio, |
kSByIndexRadio, |
kSIEditLine = 8}; |
/* window templates */ |
enum{ kClipWindow =128, |
kAEStatusWindowID = 5000, |
kDocWindow = 8888}; |
/* some general number constants */ |
enum {kResumeMask = 1}; /* bit of message field for resume vs. suspend */ |
enum {kMinHeight = 150}; /* cannot shrink a window shorter than this */ |
enum {kArrowArea =4}; |
enum {kBorderArea = 7}; |
enum {kMaxTextPreview = 200}; |
enum {kWFormAbs = 5, |
kWFormProp, |
kWindowNumber = 8, |
kWTitleRadio, |
kWindowTitleText, |
kWGray1, |
kWGray2}; |
enum { kCurrentPrefsVersion = 0x101}; |
enum {kVertScroll = 1, |
kHorizScroll}; |
enum {kMyTrue = -1}; /* all bits on */ |
enum {kExpandedItem= 1}; |
enum {kGetSecInfo =2}; |
enum {kNegFour = -4, |
kFour=4}; |
/* window kind numbers */ |
enum {kDocumentWindow = 1000, |
kClipboardWindow, |
kAEStatusWindow}; |
enum {kBadHInstall= 8080}; |
enum {kMyAppNameString = 1000}; |
enum {kMarchTime = 15}; |
/* drawing action codes */ |
enum{ kNoAction= 0, |
kCantUndo= 0, |
kDrawLine, |
kDrawRect, |
kDrawOval, |
kTextBox, |
kSelectStuff, |
kMoveObject /* <ckh 1.0.2>*/ |
}; |
enum {kSavedOnce = 0x80}; /* for publisher saved info */ |
enum {kNeverSaved =0}; |
enum {kFakeKey = 555}; /* used in TextSections file */ |
/* constants for text section checking */ |
enum {kKeyStroke=0, |
kAdding, |
kRemoving}; |
/* key codes */ |
enum { |
kEnterKey = 0x3, |
kReturnKey = 0x0d, |
kEscKey = 0x1B, |
kLeftArrow, |
kRightArrow, |
kUpArrow, |
kDownArrow, |
kSpace}; |
/* section types for my accounting */ |
enum {kPictType =0, |
kTextType, |
kCustomType}; |
enum {kSectionDirty = 0x80}; /* a bit flag */ |
/* my error codes */ |
#define kErrorStringResourceType 'ERST' |
enum {kMySecNotFound = -80, |
kWeirdSizeErr=-8666, |
kTheErrorStrings = 128 |
}; |
/* shape type defines */ |
enum {kLineShape=0, |
kRectShape, |
kOvalShape, |
kPictShape |
}; |
enum {kSelfCur=0, |
kSelfPSN, |
kOtherApp}; |
enum {kExtremeNeg = (-32768),kExtremePos = (32767 - 1)}; |
enum {k64k= 65535}; |
enum {kBaseMadFred = 134}; |
/* two private resources type I use */ |
#define rMyTextRecordType 'MTRT' |
#define rMyTextBlock 'MTBT' |
#define kMySignature 'CKD1' |
#define kMyDocumentFileType 'FREd' |
#define kMyPrefsResType 'MPRF' |
#define kMyPrefsFileType 'PREF' |
#define kMPWSignature 'MPS ' |
#define kGenericTEXTWord 'TEXT' |
#define kGenericPICTWord 'PICT' |
#define kRECTType 'RECT' |
/* My own constants for AE things */ |
/* These of course can be anything you like, since they never leave */ |
/* your application */ |
#define pAnyCharTextStyles 'acts' |
#define kAEMyShape 'MYSP' |
/* my PString type */ |
#define typeMyPString 'MPST' |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14