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.
MacIncludes.h
/* |
File: MacIncludes.h |
Contains: This file contains all of the Mac includes that one needs |
Version: SimpleText 1.4 or later |
** Copyright 1993-1996 Apple Computer. All rights reserved. |
** |
** 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. |
*/ |
#ifndef __MACINCLUDES__ |
#define __MACINCLUDES__ |
#ifndef BUILDING_FOR_SYSTEM7 |
#define BUILDING_FOR_SYSTEM7 1 |
#endif |
#ifndef FOR_OPAQUE_SYSTEM_DATA_STRUCTURES |
#define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 0 |
#endif |
#ifndef PRAGMA_IMPORT_SUPPORTED |
#define PRAGMA_IMPORT_SUPPORTED 0 |
#endif |
#include <StdArg.h> |
#include <Limits.h> |
#include <Types.h> |
#include <Resources.h> |
#include <QuickDraw.h> |
#include <Fonts.h> |
#include <Events.h> |
#include <Windows.h> |
#include <Menus.h> |
#include <TextEdit.h> |
#include <Dialogs.h> |
#include <ToolUtils.h> |
#include <Memory.h> |
#include <SegLoad.h> |
#include <Files.h> |
#include <OSUtils.h> |
#include <Traps.h> |
#include <Script.h> |
#include <ColorPicker.h> |
#include <FixMath.h> |
#include <Packages.h> |
#include <Math.h> |
#include <Palettes.h> |
#include <QDOffscreen.h> |
#include <DeskBus.h> |
#include <StdLib.h> |
#include <StdArg.h> |
#include <Strings.h> |
#include <StdIO.h> |
#include <Sound.h> |
#include <Errors.h> |
#include <AppleEvents.h> |
#include <DiskInit.h> |
#include <Retrace.h> |
#include <Folders.h> |
#include <Lists.h> |
#include <CTBUtilities.h> |
#include <Gestalt.h> |
#include <Finder.h> |
#include <Scrap.h> |
#include <Devices.h> |
#include <Video.h> |
#include <Aliases.h> |
#include <SoundInput.h> |
#include <Movies.h> |
#include <Printing.h> |
#include <Balloons.h> |
#include <MixedMode.h> |
#include <Drag.h> |
#include <TSMTE.h> |
#include <AppleGuide.h> |
#include <Speech.h> |
#include <Icons.h> |
#include <LowMem.h> |
#include <GXMath.h> |
#include <GXGraphics.h> |
#include <GXEnvironment.h> |
#include <GXFonts.h> |
#include <GXLayout.h> |
#include <GXPrinting.h> |
#include <GXMessages.h> |
#include <CodeFragments.h> |
#include <TextUtils.h> |
// ----- BEGINNING OF SWIPED MACROS ----- |
// Things that should be in the standard Maxwell versions of headers, but |
// are not. Probably should clean up a bit w.r.t. using window refs and the like |
#define GetWindowPort(aWindowRef) ( (CGrafPtr) aWindowRef) |
#define GetWindowKind(aWindowRef) ( *(SInt16 *) (((UInt8 *) aWindowRef) + sizeof(GrafPort))) |
#define GetWindowUpdateRgn(aWindowRef, aRgnHandle) CopyRgn( *(RgnHandle *)(((UInt8 *) aWindowRef) + sizeof(GrafPort) + 0xE), \ |
aRgnHandle ) |
#define GetNextWindow(aWindowRef) ( *(WindowRef *) (((UInt8 *) aWindowRef) + sizeof(GrafPort) + 0x24)) |
#define GetWindowStructureRgn(aWindowRef, aRgnHandle) CopyRgn( *(RgnHandle *)(((UInt8 *) aWindowRef) + sizeof(GrafPort) + 0x6), \ |
aRgnHandle ) |
#define GetWindowContentRgn(aWindowRef, aRgnHandle) CopyRgn( *(RgnHandle *)(((UInt8 *) aWindowRef) + sizeof(GrafPort) + 0xA), \ |
aRgnHandle ) |
#define GetDialogWindow(dialog) ((WindowRef) dialog) |
#define GetDialogKeyboardFocusItem(dialog) ((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1) |
// ----- END OF SWIPED MACROS ----- |
#include "AGFile.h" |
// Balloons.h |
#define kDefaultBalloonVariant 2 |
// Fonts.h |
#if !GENERATINGPOWERPC |
pascal short GetDefFontSize(void) |
= {0x3EB8,0x0BA8,0x6604,0x3EBC,0x000C}; |
#endif |
// GXPrinterDrivers.h |
#if GENERATINGPOWERPC |
// in the old library, these are not automagically remapped from the |
// forward messages, so we do so via Macros. At some point, can remove |
// this once SCM libs catch up. |
#undef Forward_GXPrintingEvent |
#undef Forward_GXCompleteSpoolFile |
#undef Send_GXSpoolResource |
// Jason Yeo: the follwoing 3 functions used to be extern Psacal OSErr .... |
extern OSErr Forward_GXPrintingEvent(EventRecord *evtRecord, Boolean filterEvent); |
extern OSErr Forward_GXCompleteSpoolFile(gxSpoolFile theSpoolFile); |
extern OSErr Send_GXSpoolResource(gxSpoolFile theSpoolFile, Handle theResource, ResType theType, long id); |
#endif |
// For looking at all of our windows, not just the visible ones. |
#define LMGetFirstWindow() (* (WindowRef*) 0x9D6) |
// No glue for this either, sigh. |
#define TESetClickLoop(L,H) ((**(H)).clickLoop = (L)) |
// defines I like to use all of the time |
extern void _DataInit(); // part of Runtime library |
#define TopLeft(aRect) (* (Point *) &(aRect).top) |
#define BotRight(aRect) (* (Point *) &(aRect).bottom) |
#define RectWidth(aRect) ((aRect).right - (aRect).left) |
#define RectHeight(aRect) ((aRect).bottom - (aRect).top) |
#define Max(X, Y) ( ((X)>(Y)) ? (X) : (Y) ) |
#define Min(X, Y) ( ((X)>(Y)) ? (Y) : (X) ) |
#define Pin(VALUE, MIN, MAX) ( ((VALUE) < (MIN)) ? (MIN) : ( ((VALUE) > (MAX)) ? (MAX) : (VALUE) ) ) |
#define nrequire(CONDITION, LABEL) if (true) {if ((CONDITION)) goto LABEL; } |
#define require(CONDITION, LABEL) if (true) {if (!(CONDITION)) goto LABEL; } |
// The Pascal equivalent of strcpy, takes two Pascal string pointers |
#define PSTRCPY(P1, P2) BlockMove(P2, P1, P2[0]+1) |
// Concatante one character C onto the string S |
#define CHARCAT(S, C) S[(S[0]+1)] = C; S[0]++; |
/* The Pascal equivalent of strcat, takes two Pascal string pointers */ |
#define PSTRCAT(P1, P2) \ |
BlockMove(&P2[1], &P1[(P1[0]+1)], P2[0]); \ |
P1[0] += P2[0]; |
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION < 0x300) |
#define CheckMenuItem(menu, item, checked) CheckItem(menu, item, checked) |
#endif |
#endif /* __MACINCLUDES__ */ |
/* |
* The following drag enums and typedefs are from the beta 3.0 version of Interfaces and Libraries upon |
* which SimpleText was orginally built. Since the 3.0 version was removed, they |
* are necessary for compatibilty with the 2.x interfaces and libraries. |
* |
* Should these be put back in future versions of Interface files, you can just remove these declarations. |
* |
*/ |
enum { |
kDragTrackingEnterHandler = 1, /* drag has entered handler*/ |
kDragTrackingEnterWindow = 2, /* drag has entered window*/ |
kDragTrackingInWindow = 3, /* drag is moving within window*/ |
kDragTrackingLeaveWindow = 4, /* drag has exited window*/ |
kDragTrackingLeaveHandler = 5 /* drag has exited handler*/ |
}; |
enum { |
kNullCharCode = 0, |
kHomeCharCode = 1, |
kEnterCharCode = 3, |
kEndCharCode = 4, |
kHelpCharCode = 5, |
kBellCharCode = 7, |
kBackspaceCharCode = 8, |
kTabCharCode = 9, |
kLineFeedCharCode = 10, |
kVerticalTabCharCode = 11, |
kPageUpCharCode = 11, |
kFormFeedCharCode = 12, |
kPageDownCharCode = 12, |
kReturnCharCode = 13, |
kFunctionKeyCharCode = 16, |
kEscapeCharCode = 27, |
kClearCharCode = 27, |
kLeftArrowCharCode = 28, |
kRightArrowCharCode = 29, |
kUpArrowCharCode = 30, |
kDownArrowCharCode = 31, |
kDeleteCharCode = 127, |
kNonBreakingSpaceCharCode = 202 |
}; |
/* |
_______________________________________________________________________________________________________ |
¥ DRAG ATTRIBUTES |
_________________________________________________________________________________________________________ |
*/ |
typedef OptionBits DragAttributes; |
enum { |
kDragHasLeftSenderWindow = (1L << 0), /* drag has left the source window since TrackDrag*/ |
kDragInsideSenderApplication = (1L << 1), /* drag is occurring within the sender application*/ |
kDragInsideSenderWindow = (1L << 2) /* drag is occurring within the sender window*/ |
}; |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14