Figures, Tables, and Listings
Chapter 1 Introduction 1Listing 1-1 A simple Macintosh application 3
Figure 1-1 The window created by the simple application 4
Table 1-1 Parameters passed to NewWindow in Listing 1-1 4
Figure 1-2 Overview of the system software 7
Figure 1-3 Parts of the Macintosh Toolbox 8
Table 1-2 The Macintosh Toolbox 10
Table 1-3 The Macintosh Operating System 11
Figure 1-4 A multiscript line of text drawn by QuickDraw 13
Figure 1-5 Input and conversion of Japanese text using the Text Services Manager 14
Figure 1-6 Sharing dynamic data with other applications 15
Figure 1-7 Sending and responding to Apple events 16
Figure 1-8 Playing a QuickTime movie 18
Figure 1-9 A typical Venn diagram window 22
Figure 1-10 The parts of a Venn diagram window 22
Figure 1-11 A correctly constructed Venn diagram 23
Figure 1-12 The Venn menu 24
Figure 2-1 Memory organization in the cooperative multitasking environment 30
Figure 2-2 Organization of an application partition 32
Figure 2-3 The application stack 34
Figure 2-4 A fragmented heap 35
Figure 2-5 A compacted heap 36
Figure 2-6 Organization of an application's A5 world 37
Figure 2-7 A pointer to a nonrelocatable block 39
Figure 2-8 A handle to a relocatable block 41
Figure 2-9 Purging and reallocating a relocatable block 44
Table 3-1 Typical locations of resources 53
Figure 3-1 Searching for a resource 54
Table 3-2 Some standard resource types 55
Listing 3-1 Rez input for the Preferences dialog box 57
Figure 3-2 The ResEdit version of the Preferences dialog box 58
Figure 3-3 A resource diagram 59
Figure 3-4 The Preferences dialog box 61
Listing 3-2 The structure of a resource containing Venn diagram preferences 61
Listing 3-3 Reading a user's preferences 62
Listing 3-4 Creating a preferences file 64
Listing 3-5 Copying a resource from one resource file to another 65
Listing 3-6 Saving current preferences settings 66
Figure 4-1 Sources of events sent to your application 73
Listing 4-1 Initializing your application 74
Listing 4-2 Initializing the main Toolbox Managers 75
Listing 4-3 Handling disk-inserted events 77
Listing 4-4 An event loop 77
Listing 4-5 Tracking mouse events in the close box 79
Listing 4-6 Tracking the cursor in an arbitrary rectangle 80
Figure 5-1 Samples of QuickDraw's abilities 85
Figure 5-2 The coordinate plane 86
Figure 5-3 A rectangle 87
Figure 5-4 Pixels and rectangles 88
Figure 5-5 Two regions 90
Figure 5-6 A bitmap 92
Listing 5-1 Saving and restoring the current graphics port 93
Listing 5-2 The structure of a record describing a document window's geometry 94
Listing 5-3 Initializing the geometry record 95
Listing 5-4 Defining circular regions 96
Listing 5-5 Defining noncircular regions 96
Figure 5-7 Calculating the overlap regions of a Venn diagram 98
Figure 5-8 Bit images in a document window 99
Listing 5-6 Reading 'ICON' resources into memory 100
Listing 5-7 Drawing the tools area of a document window 100
Listing 5-8 Drawing a portion of an icon 101
Listing 5-9 Retrieving a status message from a resource 102
Listing 5-10 Informing the user of an argument's validity or invalidity 103
Listing 5-11 Displaying a status message 103
Figure 6-1 A Venn diagram window 111
Listing 6-1 The WindowRecord data structure 112
Listing 6-2 Determining if a window is a document window 114
Listing 6-3 Determining if a window is a dialog box 114
Listing 6-4 Determining if a window is a desk accessory window 115
Listing 6-5 The structure of a document record for the Venn Diagrammer application 115
Listing 6-6 Creating a new Venn diagram window 117
Listing 6-7 Handling mouse-down events 120
Listing 6-8 Dragging a window 121
Listing 6-9 Handling clicks in a window's content region 121
Listing 6-10 Handling a click in a figure icon 123
Listing 6-11 Handling update events 124
Listing 6-12 Handling window activations and deactivations 126
Figure 6-2 An inactive window containing controls 127
Listing 6-13 Handling clicks in the close box 128
Listing 6-14 Closing a window 129
Listing 6-15 Closing a Venn diagram window 129
Figure 7-1 An About box 133
Figure 7-2 An alert box 134
Figure 7-3 A Preferences dialog box 134
Listing 7-1 Dialog item numbers 135
Listing 7-2 Creating a modeless dialog box 138
Listing 7-3 Setting up application-defined dialog items 139
Listing 7-4 Drawing application-defined dialog items 140
Listing 7-5 Handling events in a modeless dialog box 141
Listing 7-6 Setting the state of radio buttons and checkboxes 142
Listing 7-7 Displaying a modal dialog box 145
Listing 7-8 Outlining the default button of a modal dialog box 146
Listing 7-9 A modal dialog filter function 147
Figure 8-1 A typical pull-down menu 151
Figure 8-2 Defining a 'MENU' resource 153
Figure 8-3 Editing a menu command 153
Figure 8-4 An 'MBAR' resource in ResEdit 154
Listing 8-1 Setting up the menu bar and menus 155
Listing 8-2 Defining menu numbers and menu item numbers 156
Listing 8-3 Handling menu selections 157
Listing 8-4 Handling Apple menu selections 159
Listing 8-5 Handling Command-key equivalents 160
Table 8-1 Reserved keyboard equivalents 161
Listing 8-6 Adjusting menus 161
Figure 9-1 The desktop with several applications open 166
Listing 9-1 The Rez input for a sample 'SIZE' resource 169
Listing 9-2 Handling operating-system events 171
Table 9-1 The bits in the message field of an operating-system event record 172
Listing 9-3 Handling null events 173
Figure 9-2 A Venn diagram before automatic adjusting 174
Figure 9-3 A Venn diagram after automatic adjusting 175
Listing 9-4 Quitting your application 175
Listing 9-5 Handling serious errors 178
Listing 9-6 Checking that FindFolder is present 179
Listing 9-7 Determining whether a trap is available 180
Listing 9-8 Checking for the availability of the WaitNextEvent function 181
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help