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.
LibHeaders/MainUtils.h
#ifndef __MAINUTILS__ |
#define __MAINUTILS__ |
#ifndef __AUTOCURSOR__ |
#include "AutoCursor.h" |
#endif |
/*--------------------------------------------------------------------------------------- |
// File: MainUtils.h |
// Date: August 7, 1989 |
// |
// Mods: 8/7/89 thru 5/11/90 JMP Various mods. |
// May 12, 1990 JMP Added EqualStruct() prototype. |
// |
// By Mike Puckett, Macintosh CPU Software Quality, x4-1332. |
// © 1989 - 1990, Apple Computer, Inc. |
//--------------------------------------------------------------------------------------- |
*/ |
/* Useful Definitions ------------------------------------------------------------------- |
*/ |
#define arrowCursor (short)(-1) /* Used by UseCursor() to select the arrow. */ |
/* KeysDown() returns true if the the keys described in theMask are in the |
// place in the keymap pointed to by thePtr. Several common ptrs and masks |
// are defined below. |
*/ |
#define C_S_O_MASK ((unsigned short)0x8005) /* cmd-shift-option */ |
#define C_S_O_PTR (short)3 |
#define C_S_O C_S_O_MASK,C_S_O_PTR |
#define S_O_MASK ((unsigned short)0x0005) /* shift-option */ |
#define S_O_PTR (short)3 |
#define S_O S_O_MASK,S_O_PTR |
#define C_O_MASK ((unsigned short)0x8004) /* cmd-option */ |
#define C_O_PTR (short)3 |
#define C_O C_O_MASK,C_O_PTR |
#define CMDKEY_MASK ((unsigned short)0x8000) /* cmd */ |
#define CMDKEY_PTR (short)3 |
#define CMDKEY CMDKEY_MASK,CMDKEY_PTR |
#define OPKEY_MASK ((unsigned short)0x0004) /* option */ |
#define OPKEY_PTR (short)3 |
#define OPKEY OPKEY_MASK,OPKEY_PTR |
#define SHIFT_MASK ((unsigned short)0x0001) /* shift */ |
#define SHIFT_PTR (short)3 |
#define SHIFT SHIFT_MASK,SHIFT_PTR |
#define CNTRL_MASK ((unsigned short)0x0008) /* control */ |
#define CNTRL_PTR (short)3 |
#define CNTRL_KEY CNTRL_MASK,CNTRL_PTR |
#define PERIOD_MASK ((unsigned short)0x0080) /* period */ |
#define PERIOD_PTR (short)2 |
#define PERIOD_KEY PERIOD_MASK,PERIOD_PTR |
#define ESC_MASK ((unsigned short)0x2000) /* escape */ |
#define ESC_PTR (short)3 |
#define ESC_KEY ESC_MASK,ESC_PTR |
#define CMD_PERIOD() (KeysDown(CMDKEY) && KeysDown(PERIOD_KEY)) |
#define SAVECURSOR(c) (*c = TheCrsr) |
/* EscapeRecord is a publically undefined record for use with the routines |
// BeginEscape(), Escape(), and EndEscape(). Each of the Escape routines |
// uses the pointer to this record, EscapePtr. |
*/ |
typedef struct EscapeRecord *EscapePtr; |
#define stdEscTime 250L /* 250 milliseconds */ |
/* For UpdateWindows() and ActivateWindow(), the eventHandler has the following |
// interface. |
*/ |
#ifndef THINK_C |
typedef pascal void (* EvtHndlrProcPtr)(EventRecord *theEvent); |
#else |
typedef ProcPtr EvtHndlrProcPtr; |
#endif |
/* The Routines ------------------------------------------------------------------------- |
*/ |
#ifdef __safe_link |
extern "C" { |
#endif |
extern pascal void ClearStruct( Ptr structPtr, |
long sizeofStruct); |
extern pascal Boolean EqualStruct( Ptr structPtr1, |
Ptr structPtr2, |
long sizeofStruct); |
#ifdef THINK_C |
extern pascal Boolean EqualCursor( Cursor *c1, |
Cursor *c2); |
extern pascal Boolean EqualBits16( Bits16 b1, |
Bits16 b2); |
#endif |
extern pascal void WaitSnd( EvtHndlrProcPtr eventHandler); |
extern pascal void KillSnd( void); |
extern pascal Boolean PlaySnd( short rsrcID); |
extern pascal void UseCursor( short cursorID); |
extern pascal void RestoreCursor( Cursor *theCursor); |
extern pascal void PressKeys( short theMask, |
short thePtr); |
extern pascal void UnpressKeys( short theMask, |
short thePtr); |
extern pascal Boolean KeysDown( short theMask, |
short thePtr); |
extern pascal Boolean KeyOrMouseAction(); |
extern pascal EscapePtr BeginEscape( long escapeTime); |
extern pascal Boolean Escape( EscapePtr escapePtr); |
extern pascal void EndEscape( EscapePtr escapePtr); |
extern pascal void InitManagers( ProcPtr resumeProc, |
AutoCursor *autoCursor, |
short numMoreMasters); |
extern pascal void HandleDiskEvent( EventRecord *theEvent, |
EvtHndlrProcPtr eventHandler); |
extern pascal void StandardWDrag( WindowPtr theWindow, |
Point anchorPoint); |
extern pascal Boolean StandardWZoom( WindowPtr theWindow, |
short zoomType, |
Point anchorPoint, |
Point *maxZoomSize); |
extern pascal Boolean StandardWGrow( WindowPtr theWindow, |
short growBoxSize, |
Point anchorPoint, |
Point *deltaSize); |
extern pascal Boolean NextEvent( short eventMask, |
EventRecord *theEvent, |
long sleepTime, |
RgnHandle mouseMovedRgn); |
extern pascal void ActivateWindow( WindowPtr theWindow, |
Boolean activate, |
EvtHndlrProcPtr eventHandler); |
extern pascal void UpdateWindows( EvtHndlrProcPtr eventHandler); |
#ifdef __safe_link |
} |
#endif |
#endif |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-10-10