← Using the Macintosh Toolbox with C, Second Edition

Using the Macintosh Toolbox with C, Second Edition

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

USING THE MACINTOSH TOOLBOX WITH C

SYBEX USING THE MACINTOSH® TOOLBOX WITH C SECOND EDITION Fred A. Huxham David Burnard Jim Takatsuka New—Featuring THINK C Concise Introduction & Reference Create Full Scale Applications the System an[...]velopment tools.

A book cover photo showing a beige keyboard, a tuning fork resting on printed sheet music, a blue floppy disk, a computer mouse on a dark cloth, pencils, a yellow paper with small icons, and a pixel-grid graphic, with a maroon title banner and maroon subtitle bars.

Reading notes: Keyboard key labels and small text on the yellow page are partially cut off or obscured, so the yellow page fragment 'the System an' and 'velopment tools.' is partial and the missing words are not inferred. The Sybex vertical text on the left edge is partly cropped, read as SYBEX. Music notation and tiny keyboard key legends were not transcribed as they are not running copy.

Printed product names
THINK C
Languages
English
PDF page 1

s •• . ~ •• ••••••••• •••••• ······•·· ·····• . \• ............ ..........-'" "' ""' ~ f ) \ .. . ,.. ..~.,......... \. \ .,\\········· ·••····•

Reading notes: The supplied extracted text consists only of dots, dashes, and stray marks with no legible words, so no headline, product, price, date, or language could be identified. Any visible layout or artwork could not be confirmed from the supplied text alone.

PDF page 2

------------------------------------------------------- Macintosh Quick Toolbox Reference QuickDraw GrafPort Routines void InitGraf(Ptr globalPtr); void OpenPort(GrafPtr port); void InitPort(GrafPtr port); void ClosePort(GrafPtr port); void SetPort(GrafPtr port); void GetPort(GrafPtr *port); void GrafDevice(int device); void SetPortBits(BitMap *bm); void PortSize(int width,height); void MovePortTo(int leftGlobal,topGlobal); void SetOrigin(int h,v); void SetClip(RqnHandle rgn); void GetClip(RgnHandle rgn); void ClipRect(Rect *r); void BackPat(Pattern *pat); Cursor Handling void InitCursor (); void SetCursor(Cursor void HideCursor (); void ShowCursor (); void ObscureCursor () ; Pen and Line Drawing void HidePen () ; void ShowPen () ; *crsr); void GetPen(Point *pt); void GetPenState(PenState *pnState); void SetPenState(*PenState *pnState); void PenSize(int width,height); void PenMode(int mode); void PenPat(Pattern *pat); void PenNormal(); void MoveTo(int h,v); void Move(int h,v); void LineTo(int h,v); void Line(int h,v); Text Drawing void TextFont(int font); void TextFace(int style); void TextMode(int mode); void TextSize(int size); void SpaceExtra(long extra); void DrawChar(char ch); void DrawText(Ptr textBuf; int firstByte,byteCount); int CharWidth(char ch); int StringWidth(Str255 *s); int TextWidth(Ptr textbuf; int fir~tByte,byteCount); void GetFontinfo(Fontinfo *info); Color void ForeColor(long color); void BackColor(long color); void ColorBit(int whichBit); Calculations with Rectangles void SetRect(Rect *r; int left,top,right,bottom); void OffsetRect(Rect *r; int dv,dh); void InsetRect(Rect *r; int dv,dh); char SectRect(Rect *srcl,*src2,*destRect); void UnionRect(Rect *srcl,*src2,*destRect); char PtinRect(Point pt; Rect *r); void Pt2Rect(Point ptl,pt2; Rect *dstRect); void PtToAngle(Rect *r; Point pt; int *angle); char EqualRect(Rect *rectl,*rect2); char EmptyRect(Rect *r); Graphic Operations on Rectangles void FrameRect(Rect *r); void PaintRect(Rect *r); void EraseRect(Rect *r); void InvertRect(Rect *r); void FillRect(Rect *r; Pattern *pat); Graphic Operations on Ovals void FrameOval(Rect *r); void PaintOvall(Rect *r); void EraseOval(Rect *r); void InvertOval(Rect *r); void FillOval(Rect *r; Pattern *pat); Graphic Operations on Rounded-Corner Rectangles void FrameRoundRect(Rect *r; int ovalWidth,ovalHeight);

Reading notes: The source is a technical API reference rather than an advertisement, poster, or page with a headline, products, prices, or dates, so those fields are empty or null. The title 'Macintosh Quick Toolbox Reference' is not treated as a headline because it is not presented as advertising copy. Extraction errors include the garbled 'fir~tByte' in the TextWidth declaration and the displaced '*crsr);' fragment in the SetCursor declaration, which appears after the HideCursor/ShowPen line. Some declarations are split across lines or contain irregular spacing, such as 'void PortSize(int width,height);' and 'void SetPenState(*PenState *pnState);', which may not match the original layout. Possible OCR or extraction artifacts also appear in 'RqnHandle' and 'PaintOvall', which may be original typos or transcription errors. The transcript is intentionally empty because the exact extracted text is preserved separately, so no reading-order transcription was produced.

Languages
English
PDF page 3

------------------------------------------------------- void PaintRoundRect(Rect *r; int ovalWidth,ovalHeiqht); void EraseRoundRect(Rect *r; int ovalWidth,ovalHeiqht); void InvertRoundRect(Rect *r; int ovalWidth,ovalHeiqht); void FillRoundRect(Rect *r;· int ovalWidth,ovalHeiqht; Pattern *pat); Graphic Operations on Arcs and Wedges void FrameArc(Rect *r; int startAnqle,arcAnqle); void PaintArc(Rect *r; int startAnqle,arcAnqle); void EraseArc(Rect *r; int startAnqle,arcAnqle); void InvertArc(Rect *r; int startAnqle,arcAnqle); void FillArc(Rect *r; int startAnqle,arcAnqle; Pattern *pat); Calculations with Regions RqnBandle NewRgn(); void OpenRgn () ; void CloseRgn(RqnBandle dstRqn); void DisposeRgn(RqnHandle rqn); void CopyRgn(RqnHandle srcRqn,dstRqn); void SetEmptyRgn(RqnHandle rqn); void SetRectRgn(RqnHandle rqn; int left,top,riqht,bottom); void RectRgn(RqnHandle rqn; Rect *r); void OffsetRgn(RqnBandle rqn; int dv,dh); void InsetRgn(RqnHandle rqn; int dv,dh); void SectRgn(RqnHandle srcRqnA,srcRqnB,dstRqn); void UnionRgn(RqnHandle srcRqnA,srcRqnB,dstRqn); void DiffRgn(RqnHandle srcRqnA,srcRqnB,dstRqn); void XorRgn(RqnHandle srcRqnA,srcRqnB,dstRqn); char PtinRgn(Point pt; RqnHandle rqn); char EqualRgn(RqnHandle rqnA,rqnB); char EqaualRgn(RqnHandle rqnA,rqnB); char EmptyRgn(RqnHandle rqn); Graphic Operations on Regions void FrameRgn(RqnHandle rqn); void PaintRgn(RqnHandle rqn); void EraseRgn(RqnBandle rqn); void InvertRgn(RqnHandle rqn); void FillRgn(RqnHandle rqn; Pattern *pat); Bit Transfer Operations void ScrollRect(Rect *r; int dv,dh; RqnHandle updateRqn) ; void CopyBits(BitMap *srcBits,*dstBits; Rect *srcRect,*dstRect; int mode; RqnHandle maskRqn); Pictures PicHandle OpenPicture(Rect *picFrame); void PicComment(int kind,dataSize; Handle dataHandle); void ClosePicture(); void DrawPicture(PicHandle myPicture; Rect *dstRect); void KillPicture(PicHandle myPicture); Calculations with Polygons PolyHandle OpenPoly(); void ClosePoly(); void KillPoly(PolyBandle poly); void OffsetPoly(PolyBandle poly; int dv,dh); Graphic Operations on Polygons void FramePoly(PolyBandle poly); void PaintPoly(PolyBandle poly); void ErasePoly(PolyBandle poly); void InvertPoly(PolyBandle poly); void FillPoly(PolyHandle poly; Pattern *pat); Calculations with Points void AddPt(Point srcPt,*dstPt); void SubPt(Point srcPt,*dstPt); void SetPt(Point *pt; int h,v); char EqualPt(Point ptl,pt2); void LocalToGlobal(Point *pt); void GlobalToLocal(Point *pt); Miscellaneous Routines int Random () ; char GetPixel(int h,v); void StuffHex(Ptr thinqPtr;Str255 *s); void ScalePt(Point *pt; Rect *srcRect,*dstRect); void MapPt(Point *pt;Rect *srcRect,*dstRect); void MapRect(Rect *r,*srcRect,*dstRect); void MapRgn(RqnHandle rqn; Rect *srcRect,*dstRect); void MapPoly(PolyHandle poly; Rect *srcRect,*dstRect);

Reading notes: OCR damage in function signatures (e.g., 'ovalHeiqht', 'startAnqle', 'EqaualRgn') Mixed reading order in column-split text lines

Languages
English
PDF page 4

USING THE MACINTOSH TOOLBOX WITH C

A page with a gray rectangular panel containing bold black sans-serif capital title text, with a short dashed black line above the panel on white background.

Reading notes: Title is set in mixed-size capitals (larger U, M, T, and C with smaller letters for SING, THE, INTOSH, WITH), transcribed here in uniform capitals; no dates or prices visible.

Languages
English
PDF page 5

USING THE MACINTOSH TOOLBOX WITH C

USING THE MACINTOSH® TOOLBOX WITH c Second Edition Fred A. Huxham David Burnard Jim Takatsuka e• SAN FRANCISCO• PARIS• DiisSELDORF • SOEST

Reading notes: Stray character 'c' after 'WITH' may be a damaged or stylized glyph rather than a word Publisher location line 'SAN FRANCISCO • PARIS • DUSSELDORF • SOEST' contains possibly misrendered letters (e.g., 'DiisSELDORF')

Printed product names
MACINTOSH
Languages
English
PDF page 6

Acquisitions Editor: Dianne King Supervising Editor: Joanne Cuthbertson Copy Editor: Gina Jaber Editor (First Edition): Geta Carlson Technical Editor: Dan Tauber Wonl Processors: Scott Campbell and Chris Mockel Book Designer & Chapter Art: Suzanne Albertson Technical Illustrations: Jeff Giese Saeen Graphics: Soitja Schenk Typesetters: Charles Cowens and Suzanne Albertson Proofreader: Vanessa Miller Indexer: Paul Geisert Cover Designer: Thomas Ingalls + Associates Cover Photographer: Michael Lamotte Macintosh is nrademark licensed to Apple Computer, Inc. MC68000 is a trademark of Motorola, Inc. Apple, Switcher, Resource Compiler, Resource Editor, QuickDraw, Finder, Inside Macintosh, and Lisa are trademarks of Apple Computer, Inc. Mac C is a trademark of Consulair Corporation. MacDraw and MacPaint are trademarks of Apple Computer, Inc. MacWrj.te is a trademarlc of F.ncore Systems and Apple Computer, Inc. Think C is a trademark of Symantec Corp. Word and Excel are trademarks of Microsoft Corp. Jazz is a trademark of Lotus Development Corp. MacDraft is a trademarlc of Leonard G. Barton. Fedit is a trademark of John Mitchell. SetFile 20 and BaseTool Desk Aci:essories © 1985 Fred, Sam, and Dave Software. SYBEX is a registered trademark of SYBEX, Inc. SYBEX is not affiliated with any manufacturer. Every effort has been made to supply complete and accurate information. However, SYBEX assumes no respon- sibility for its use, nor for any infringements of patents or other rights of third parties which would result. F°ll'St Edition copyright 1986 SYBEX Inc. Copyright© 1989 SYBEX Inc., 2021 Challenger Drive# 100, Alameda, CA 94501. World rights reserved. No part of this publication may be stored in a retrieval system, transmitted, or reproduced in any way, including but not limited to photocopy, photograph, magnetic or other record, without prior agreement and written permission of the publisher. Library of Congress Card Number: 89-62280 ISBN: 0-89588-572- 7 Manufaclured in the United States of America 10 9 8 7 6 5

Reading notes: Some words are garbled by OCR, such as 'nrademark', 'trademarlc', 'Wonl', 'Saeen', and 'F°ll'St', which were interpreted from context. Copyright address and number are partly obscured by OCR errors.

Printed product names
Macintosh · MC68000 · Switcher · Resource Compiler · Resource Editor · QuickDraw · Finder · Inside Macintosh · Lisa · Mac C · MacDraw · MacPaint · Think C · Word · Excel · Jazz · MacDraft · Fedit · SetFile 20
Printed dates
1985 · 1986 · 1989 · 2021
Languages
English
PDF page 7

The image is a fully blank white page with no visible artwork, layout, or text.

Reading notes: No visible text or imagery was found on the page, so the transcript and printed fields are empty.

PDF page 8

Acknowledgments Our sincere thanks to Steve Rimmer for his time in preparing this revision. Writing this book was quite an experience for the three of us and there were a lot of people who helped us through. We'd like to thank Wil- liam Adams, Reese Jones, Raines Cohen, Nicole Kowalski, Don Yost, and Steve Costa for their encouragement and support throughout the course of this project. We'd also like to thank everyone who showed up at the BMUG Developers Group meetings at UC Berkeley and at our classes at Lawrence Livermore National Laboratories for keeping us on our toes by proving that even the simplest of examples can be laden with bugs. World-famous desk accessory author Sam Roberts of Fred, Sam, and Dave Software proved to be a lot of help (and great fun) in the realization of this book. Our C guru, Peter Moore, made some valuable contributions in proofreading a lot of the example routines and sample source code. Steve Capps and Larry Kenyon provided technical assis- tance on some of the more esoteric workings of the file system, for which we are very grateful. Finally, JT would like to extend a special "mahalo" to Rick Iwamoto and Robert Antonio for doing a terrific job holding down the fort while he was writing. FH also would like to thank Jennifer Iscol for being his best friend throughout the ups and downs of the book. Without all of these people, this book would never have made it out in any reasonable period of time. Once again, we would like to thank them all very much. Fred, Dave, and Jim

Languages
English
PDF page 9

----- Contents at a Glance Introduction xvi 1 The Macintosh Toolbox and the User Interface 1 2 Using the Event Manager 18 3 An Introduction to the Window Manager 42 4 Using the Menu Manager 76 5 Drawing with QuickDraw 100 6 Memory Management 162 7 Using Multiple Windows 184 8 Text Editing with the Toolbox 208 9 Resources 278 10 Controls 294 11 Alerts and Dialogs 324 12 The Macintosh File System 362 13 Finishing Touches 454 A C Calling Conventions 472 B Error Codes and Reserved Resource Types 498 c ASCII Chart of the Macintosh System Font 510 Index 514

Reading notes: Source appears to be a table of contents rather than advertising copy; no headline, products, prices, or dates are explicitly present.

Languages
English
PDF page 10

----- Table of Contents Introduction xvi How to Use This Book 2 Conventions Used in This Book 3 The Macintosh Toolbox and C 3 Additional Background Information 12 1 The Macintosh Toolbox and the User Interface 1 Characteristics of a Good Macintosh Application 2 The Macintosh User Interface 3 User Interface Conventions 4 Summing Up 16 2 Using the Event Manager 18 Types of Events 20 Event Records 24 Tl;te Event Queue 33 Priority of Events 34 Event Masks 35 Using the Event Manager Routines 36 A Sample Main Event Loop Program 40

Reading notes: Table of contents entries contain OCR-style artifacts such as 'Tl;te' and 'Table' fragments, which may be damaged characters. Page numbers and heading hierarchy are not fully clear from the supplied copy.

Languages
English
PDF page 11

xii 3 An Introduction to the Window Manager 42 Types of Windows 44 Components of a Window 46 Window Manager Data Types and Structures 48 Windows and GratPorts 49 Using the Window Manager 50 A Sample Program: Using Events and Windows 70 4 Using the Menu Manager 76 Anatomy of Menus 77 Menu Manager Types and Structures 78 Creating Menus 80 Choosing from Menus 90 A Sample Program for Windows and Menus 93 5 Drawing with QuickDraw 100 QuickDraw Basics-The Coordinate Plane, Points, and Rectangles 103 GratPorts-Drawing Environments for QuickDraw 112 The GratPort Data Structure and Routines 126 The QuickDraw Drawing Verbs 134 Drawing Rectangles 135 Drawing Ovals 136 Drawing Rounded-Comer Rectangles 137 Defining and Drawing Angles, Arcs, and Wedges 138 Defining and Drawing Polygons 140 Defining, Manipulating, and Drawing Regions 143 Defining and Drawing Pictures 148 Bit Transfer Operations 150 Cursors 151

Reading notes: Table of contents text contains OCR-like artifacts such as 'GratPorts' and 'Comer' that may be misspellings of 'GrafPorts' and 'Corner'.

Languages
English