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.
OffSample.h
/*------------------------------------------------------------------------------ |
# |
# Apple Macintosh Developer Technical Support |
# |
# Offscreen Buffer Sample Application |
# |
# OffSample |
# |
# POffSample.h - Rez Include Source |
# |
# Copyright © 1989 Apple Computer, Inc. |
# All rights reserved. |
# |
# Versions: |
# 1.00 04/89 |
# 1.01 06/92 |
# |
# Components: |
# OffSample.p April 1, 1989 |
# OffSample.r April 1, 1989 |
# OffSample.h April 1, 1989 |
# OffSample.rsrc April 1, 1989 |
# POffSample.make April 1, 1989 |
# |
# Requirements: |
# Offscreen.p April 1, 1989 |
# Offscreen.inc1.p April 1, 1989 |
# UFailure.p November 1, 1988 |
# UFailure.inc1.p November 1, 1988 |
# UFailure.a November 1, 1988 |
# |
# OffSample demonstrates the usage of the Offscreen |
# unit. It shows how to use offscreen pixmaps and |
# bitmaps to produce flicker-free updating with a |
# minimum of re-structuring of code. OffSample attempts |
# to reduce the amount of 'knowledge' that it has of |
# the offscreen structure so as to minimize its |
# dependence on that unit. |
# |
# OffSample emphasizes using the Offscreen unit; it |
# is not intended to be viewed as a complete application |
# from which to base some larger effort. Instead, its |
# method of using offscreen bitmaps and pixmaps should |
# be studied and adapted to other applications that |
# desire features such as flicker-free updating. |
# |
------------------------------------------------------------------------------*/ |
#define kMinSize 75 /* application's minimum size (in K) */ |
#define kPrefSize 245 /* application's preferred size (in K) */ |
#define rMenuBar 128 /* application's menu bar */ |
#define rAboutAlert 128 /* about alert */ |
#define rUserAlert 129 /* error user alert */ |
#define rWindow 128 /* application's window */ |
/* kSysEnvironsVersion is passed to SysEnvirons to tell it which version of the |
SysEnvRec we understand. */ |
#define kSysEnvironsVersion 1 |
/* kOSEvent is the event number of the suspend/resume and mouse-moved events sent |
by MultiFinder. Once we determine that an event is an osEvent, we look at the |
high byte of the message sent to determine which kind it is. To differentiate |
suspend and resume events we check the resumeMask bit. */ |
#define kOSEvent app4Evt /* event used by MultiFinder */ |
#define kSuspendResumeMessage 1 /* high byte of suspend/resume event message */ |
#define kResumeMask 1 /* bit of message field for resume vs. suspend */ |
#define kMouseMovedMessage 0xFA /* high byte of mouse-moved event message */ |
#define sErrStrings 128 |
#define kNoBackBuff 128 |
#define kNoEditBuff 129 |
#define kTitle 130 |
#define kColorPrompt 131 |
#define kNoWantBack 132 |
#define kNoWantEdit 133 |
/* The following constants are used to identify menus and their items. The menu IDs |
have an "m" prefix and the item numbers within each menu have an "i" prefix. */ |
#define mApple 128 /* Apple menu */ |
#define iAbout 1 |
#define mFile 129 /* File menu */ |
#define iNew 1 |
#define iClose 4 |
#define iQuit 12 |
#define mEdit 130 /* Edit menu */ |
#define iUndo 1 |
#define iCut 3 |
#define iCopy 4 |
#define iPaste 5 |
#define iClear 6 |
#define mShape 131 /* Shape menu */ |
#define mSpecial 132 /* Special menu */ |
#define iUseBack 1 |
#define iUseEdit 2 |
#define iPickColor 4 |
/* kTopLeft - This is for positioning the Disk Initialization dialogs. */ |
#define kDITop 0x0050 |
#define kDILeft 0x0070 |
/* kMinHeap - This is the minimum result from the following equation: |
ORD(GetApplLimit) - ORD(ApplicZone) |
for the application to run. It will insure that enough memory will |
be around for reasonable-sized scraps, FKEYs, etc. to exist with the |
application, and still give the application some 'breathing room'. |
To derive this number, we ran under a MultiFinder partition that was |
our requested minimum size, as given in the 'SIZE' resource. */ |
#define kMinHeap 66 * 1024 |
/* kMinSpace - This is the minimum result from PurgeSpace, when called |
at initialization time, for the application to run. This number acts |
as a double-check to insure that there really is enough memory for the |
application to run, including what has been taken up already by |
pre-loaded resources, the scrap, code, and other sundry memory blocks. */ |
#define kMinSpace 49 * 1024 |
/* kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */ |
#define kExtremeNeg -32768 |
#define kExtremePos 32767 - 1 /* required to address an old region bug */ |
/* these #defines are used to set enable/disable flags of a menu */ |
#define AllItems 0b1111111111111111111111111111111 /* 31 flags */ |
#define NoItems 0b0000000000000000000000000000000 |
#define MenuItem1 0b0000000000000000000000000000001 |
#define MenuItem2 0b0000000000000000000000000000010 |
#define MenuItem3 0b0000000000000000000000000000100 |
#define MenuItem4 0b0000000000000000000000000001000 |
#define MenuItem5 0b0000000000000000000000000010000 |
#define MenuItem6 0b0000000000000000000000000100000 |
#define MenuItem7 0b0000000000000000000000001000000 |
#define MenuItem8 0b0000000000000000000000010000000 |
#define MenuItem9 0b0000000000000000000000100000000 |
#define MenuItem10 0b0000000000000000000001000000000 |
#define MenuItem11 0b0000000000000000000010000000000 |
#define MenuItem12 0b0000000000000000000100000000000 |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14