Important: The information in this document is obsolete and should not be used for new development.
Figures, Tables, and Listings
Chapter 1 Resource Manager 1-1Figure 1-1 The data fork and resource fork of a file 1-4
Figure 1-2 An application's and a document's data fork and resource fork 1-6
Figure 1-3 Resource attributes 1-8
Figure 1-4 A typical search order for a specific resource 1-11
Table 1-1 Typical locations of resources 1-12
Figure 1-5 The ResEdit window for the SurfWriter application 1-15
Figure 1-6 The menus of the SurfWriter application 1-16
Listing 1-1 A menu in Rez input format 1-17
Figure 1-7 Getting a handle to a resource 1-19
Figure 1-8 A handle to a purgeable resource after the resource has been purged 1-20
Listing 1-2 Safely changing a resource that is purgeable 1-21
Listing 1-3 Releasing a resource 1-22
Figure 1-9 Detaching a resource 1-23
Listing 1-4 Detaching a resource 1-24
Listing 1-5 Getting the file reference number for your application's resource fork 1-25
Listing 1-6 Creating an empty resource fork 1-26
Listing 1-7 Creating and opening a resource fork 1-27
Listing 1-8 Saving and restoring the current resource file 1-29
Listing 1-9 Getting a resource from a document file 1-32
Listing 1-10 Counting and indexing through resources 1-34
Listing 1-11 Saving a resource to a resource fork 1-38
Listing 1-12 Using partial resource routines 1-41
Table 1-2 Standard resource types 1-43
Table 1-3 Resource types reserved for use by system software 1-46
Figure 1-10 Resource ID of an owned resource 1-48
Figure 1-11 Format of a resource fork 1-121
Figure 1-12 Format of a resource header in a resource fork 1-122
Figure 1-13 Format of resource data for a single resource 1-122
Figure 1-14 Format of the resource map in a resource fork 1-123
Figure 1-15 Format of an item in a resource type list 1-123
Figure 1-16 Format of an entry in the reference list for a resource type 1-124
Figure 1-17 Format of an item in a resource name list 1-124
Figure 1-18 Offsets in a resource fork and an entry for a single resource in a reference list 1-125
Table 1-4 Document and application icons 1-130
Table 1-5 Folder icons 1-131
Table 1-6 System Folder icons 1-132
Table 1-7 Desktop icons 1-133
Table 1-8 Standard File Package icons 1-133
Figure 1-19 Structure of a compiled ROM override ('ROv#') resource 1-136
Figure 2-1 Copying and pasting data between two applications using the scrap 2-5
Table 2-1 Actions your application perfoms in response to editing commands 2-6
Figure 2-2 Writing both standard formats to the scrap 2-8
Figure 2-3 Using a private scrap 2-9
Figure 2-4 Intelligent cut and paste 2-11
Figure 2-5 Non-intelligent cut and paste 2-11
Figure 2-6 Location of the scrap in memory 2-13
Listing 2-1 Writing data to the scrap 2-16
Listing 2-2 Writing data to a private scrap 2-18
Listing 2-3 Copying data from the scrap in response to suspend events 2-19
Listing 2-4 Handling the Paste command using the scrap 2-21
Listing 2-5 Handling the Paste command using a private scrap 2-24
Listing 2-6 Handling resume events 2-25
Listing 2-7 Converting data between the scrap and a private scrap 2-27
Listing 2-8 Using TextEdit to handle the Cut command 2-29
Listing 2-9 Using TextEdit to handle the Paste command 2-30
Figure 3-1 The Help menu for the Finder 3-7
Figure 3-2 A help balloon drawn with the standard balloon definition function 3-8
Figure 3-3 The tip and hot rectangle for a help balloon 3-9
Figure 3-4 Standard balloon positions and their variation codes 3-10
Figure 3-5 Alternate positions of a help balloon 3-11
Figure 3-6 Default help balloons for the window frame 3-15
Figure 3-7 Default help balloons for the Apple and Help menus 3-16
Figure 3-8 Default help balloons for application and document icons 3-17
Figure 3-9 Help balloons for different states of the Cut command 3-29
Listing 3-1 Rez input for a partial 'hmnu' resource 3-31
Listing 3-2 Rez input for the missing-items component of an 'hmnu' resource 3-35
Figure 3-10 A help balloon for an enabled menu title 3-37
Figure 3-11 A help balloon for a dimmed menu title 3-37
Figure 3-12 A help balloon for a menu title dimmed by the Dialog Manager 3-38
Figure 3-13 A help balloon for menu items dimmed by the Dialog Manager 3-38
Figure 3-14 A help balloon for a menu item 3-39
Figure 3-15 A help balloon for a dimmed menu item 3-40
Listing 3-3 Rez input for corresponding 'hmnu' and 'STR#' resources 3-41
Listing 3-4 Rez input for an 'hmnu' resource that uses HMCompareItem for a changing menu item 3-44
Figure 3-16 Help balloons for a changing menu item 3-45
Listing 3-5 Rez input for specifying help messages with named resources 3-46
Listing 3-6 Specifying an alternate 'hmnu' resource for a menu that your application disables when it displays movable modal dialog boxes 3-49
Listing 3-7 Reassigning 'hmnu' resources before displaying a movable modal dialog box 3-50
Listing 3-8 Rez input for an item list resource and an 'hdlg' resource 3-59
Figure 3-17 A help balloon in a modal dialog box 3-61
Figure 3-18 Static and dynamic windows 3-64
Figure 3-19 A tool palette with a help balloon 3-70
Listing 3-9 Rez input for corresponding 'hwin' and 'hrct' resources 3-71
Figure 3-20 A help balloon for a dialog box with a title 3-72
Listing 3-10 Rez input for specifying help for titled and untitled windows 3-72
Listing 3-11 Using a string resource as the help message for HMShowBalloon 3-77
Listing 3-12 Using a picture resource as the help message for HMShowBalloon 3-77
Listing 3-13 Using a handle to a picture resource as the help message for HMShowBalloon 3-78
Listing 3-14 Using a string list resource as the help message for HMShowBalloon 3-79
Listing 3-15 Using styled text resources as the help message for HMShowBalloon 3-80
Listing 3-16 Using HMShowBalloon to display help balloons 3-82
Figure 3-21 Default and custom help balloons for an application icon 3-86
Listing 3-17 Rez input for creating an 'hfdr' resource for an application icon 3-86
Listing 3-18 Rez input for an 'hovr' resource 3-89
Figure 3-22 The Help menu with an appended menu item 3-90
Listing 3-19 Rez input for specifying help balloons for items in the Help menu 3-91
Listing 3-20 Responding to the user's choice in a menu command 3-92
Listing 3-21 Using the HMExtractHelpMsg function 3-124
Listing 3-22 Using a tip function 3-131
Figure 3-23 Structure of a compiled menu help ('hmnu') resource 3-133
Figure 3-24 Structure of an 'hmnu' component compiled with the HMStringItem identifier 3-135
Figure 3-25 Structure of an 'hmnu' component compiled with the HMStringResItem identifier 3-136
Figure 3-26 Structure of an 'hmnu' component compiled with the HMPictItem, HMTEResItem, or HMSTRResItem identifier 3-137
Figure 3-27 Structure of an 'hmnu' component compiled with the HMSkipItem identifier 3-138
Figure 3-28 Structure of a menu-item component compiled with the HMCompareItem identifier 3-139
Figure 3-29 Structure of a menu-item component compiled with the HMNamedResourceItem identifier 3-140
Figure 3-30 Structure of a compiled dialog-item help ('hdlg') resource 3-141
Figure 3-31 Structure of an 'hdlg' component compiled with the HMStringItem identifier 3-144
Figure 3-32 Structure of an 'hdlg' component compiled with the HMStringResItem identifier 3-145
Figure 3-33 Structure of an 'hdlg' component compiled with the HMPictItem, HMTEResItem, or HMSTRResItem identifier 3-146
Figure 3-34 Structure of an 'hdlg' component compiled with the HMSkipItem identifier 3-148
Figure 3-35 Structure of a compiled rectangle help ('hrct') resource 3-149
Figure 3-36 Structure of an 'hrct' component compiled with the HMStringItem identifier 3-150
Figure 3-37 Structure of an 'hrct' component compiled with the HMStringResItem identifier 3-151
Figure 3-38 Structure of an 'hrct' component compiled with the HMPictItem, HMTEResItem, or HMSTRResItem identifier 3-152
Figure 3-39 Structure of an 'hrct' component compiled with the HMSkipItem identifier 3-153
Figure 3-40 Structure of a compiled window help ('hwin') resource 3-155
Figure 3-41 Structure of a compiled Finder icon help ('hfdr') resource 3-157
Figure 3-42 Structure of an 'hfdr' component compiled with the HMStringItem identifier 3-158
Figure 3-43 Structure of an 'hfdr' component compiled with the HMStringResItem identifier 3-158
Figure 3-44 Structure of an 'hfdr' component compiled with the HMPictItem, HMTEResItem, or HMSTRResItem identifier 3-159
Figure 3-45 Structure of an 'hfdr' component compiled with the HMSkipItem identifier 3-160
Figure 3-46 Structure of a compiled default help override ('hovr') resource 3-161
Figure 3-47 Structure of an 'hovr' component compiled with the HMStringItem identifier 3-163
Figure 3-48 Structure of an 'hovr' component compiled with the HMStringResItem identifier 3-163
Figure 3-49 Structure of an 'hovr' component compiled with the HMPictItem, HMTEResItem, or HMSTRResItem identifier 3-164
Figure 3-50 Structure of an 'hovr' component compiled with the HMSkipItem identifier 3-165
Figure 4-1 A one-column, text-only list without a scroll bar 4-4
Figure 4-2 A one-column, text-only list with a vertical scroll bar 4-5
Figure 4-3 A list whose scroll bar has been disabled 4-6
Figure 4-4 A deactivated list 4-6
Figure 4-5 A list containing multiple columns and graphical elements 4-7
Figure 4-6 A list of items whose cells display more than one type of information 4-8
Figure 4-7 A list with an item selected 4-9
Figure 4-8 Selection of a range of items in a list 4-10
Figure 4-9 Effect of dragging after Shift-clicking 4-11
Figure 4-10 Selection of discontiguous items in a list 4-12
Figure 4-11 Effect of Shift-clicking in a list that contains discontiguous items 4-13
Figure 4-12 Notifying the user of nonstandard list behavior 4-14
Figure 4-13 Response to pressing the Command-Up Arrow keys 4-16
Figure 4-14 Response to user making a discontiguous selection, then pressing Shift-Right Arrow followed by Shift-Left Arrow using the extend algorithm 4-17
Figure 4-15 Response to Shift-Right Arrow using the anchor algorithm 4-19
Figure 4-16 An outlined list in a window with more than one list 4-21
Figure 4-17 Coordinates of cells 4-22
Listing 4-1 Creating a list with a vertical scroll bar 4-27
Listing 4-2 Installing a list in a dialog box 4-29
Listing 4-3 Drawing a border around a list 4-30
Listing 4-4 Adding items from a string list to a one-column, text-only list 4-31
Listing 4-5 Responding to a mouse-down event in a list 4-33
Listing 4-6 Responding to an update event in a list 4-33
Listing 4-7 Finding the first selected cell in a list 4-34
Listing 4-8 Finding the last selected cell in a list 4-35
Listing 4-9 Selecting a cell and deselecting other cells 4-36
Listing 4-10 Scrolling so that a particular cell is visible 4-37
Figure 4-18 Selection flags 4-38
Listing 4-11 Clearing all cell data 4-40
Listing 4-12 Getting a copy of the data of a cell 4-41
Listing 4-13 Directly accessing a cell's data 4-41
Listing 4-14 Adding an item to a one-column, alphabetical text list 4-42
Listing 4-15 A match function 4-43
Listing 4-16 Searching a list for a cell containing certain text or the next cell alphabetically 4-44
Listing 4-17 Resetting variables related to type selection 4-46
Listing 4-18 Selecting an item in response to a key-down event 4-47
Listing 4-19 Determining the location of a new cell in response to an arrow-key event 4-49
Listing 4-20 Moving the selection in response to an arrow-key event 4-50
Listing 4-21 Extending the selection in response to an arrow-key event 4-51
Listing 4-22 Processing an arrow-key event 4-52
Listing 4-23 Drawing an outline around a list 4-54
Listing 4-24 Adding a list to the ring 4-55
Listing 4-25 Updating the outline of all lists in a window 4-56
Listing 4-26 Moving the outline to the next list in a window 4-57
Listing 4-27 Moving the outline to the previous list in a window 4-57
Figure 4-19 The Chooser's use of a custom list definition procedure 4-58
Listing 4-28 Processing messages to a list definition procedure 4-59
Listing 4-29 Using the default initialization method 4-60
Listing 4-30 Responding to the lDrawMsg message 4-61
Listing 4-31 Responding to the lHiliteMsg message 4-62
Listing 4-32 Responding to the lCloseMsg message 4-63
Listing 4-33 Setting the cell size of a list 4-63
Listing 4- Adding an icon to a list of icons 4-64
Figure 5-1 The ResEdit view of an icon 5-4
Figure 5-2 An icon family 5-5
Listing 5-1 Drawing the icon from an icon family that is best suited to the user's display 5-10
Listing 5-2 Drawing the icon from an icon suite that is best suited to the display device 5-11
Listing 5-3 Drawing a specific icon from an icon family or icon suite 5-12
Listing 5-4 Manipulating icon data in memory 5-13
Listing 5-5 Drawing an icon of resource type 'ICON' 5-14
Listing 5-6 Drawing an icon of resource type 'ICON' with a specific alignment and transform 5-15
Listing 5-7 Drawing an icon of resource type 'cicn' 5-15
Listing 5-8 Drawing an icon of resource type 'cicn' with a specific alignment and transform 5-16
Listing 5-9 Drawing an icon of resource type 'SICN' with a specific alignment and transform 5-16
Chapter 6 Component Manager 6-1
Figure 6-1 The relationship between an application, the Component Manager, and components 6-5
Listing 6-1 Finding a component 6-9
Listing 6-2 Opening a specific component 6-10
Listing 6-3 Getting information about a component 6-10
Listing 6-4 Using a drawing component 6-11
Table 6-1 Request codes 6-14
Listing 6-5 A drawing component for ovals 6-16
Listing 6-6 Responding to an open request 6-20
Listing 6-7 Responding to a close request 6-21
Listing 6-8 Responding to the can do request 6-22
Listing 6-9 Responding to the setup request 6-26
Listing 6-10 Responding to the draw request 6-27
Listing 6-11 Responding to the erase request 6-27
Listing 6-12 Responding to the click request 6-27
Listing 6-13 Responding to the move to request 6-28
Listing 6-14 Registering a component 6-31
Listing 6-15 Rez input for a component resource 6-33
Figure 6-2 Supporting multiple component connections 6-34
Listing 6-16 Delegating a request to another component 6-36
Figure 6-3 Interaction between the componentFlags and componentFlagsMask fields 6-40
Figure 6-4 Format of a component file 6-84
Figure 6-5 Structure of a compiled component ('thng') resource 6-85
Chapter 7 Translation Manager 7-1
Figure 7-1 The Finder's application-unavailable alert box 7-5
Figure 7-2 The application-unavailable alert box for 'TEXT' and 'PICT' documents 7-5
Figure 7-3 The translation choices dialog box 7-6
Figure 7-4 A translation progress dialog box 7-7
Figure 7-5 The modified application-unavailable alert box 7-7
Figure 7-6 The enhanced file-opening dialog box 7-8
Figure 7-7 Document Converter configuration dialog box 7-9
Listing 7-1 Translation-specific selectors and response bit for Gestalt 7-12
Listing 7-2 A sample resource of type 'open' 7-13
Listing 7-3 A sample resource of type 'kind' 7-15
Listing 7-4 Sample resources for a translation extension 7-22
Listing 7-5 Handling Component Manager request codes 7-25
Figure 7-8 A translation group with multiple source and destination types 7-29
Figure 7-9 A translation group with a single destination type 7-29
Figure 7-10 Point-to-point translation 7-30
Listing 7- Creating a file translation list 7-30
Listing 7-7 Identifying file types 7-33
Listing 7-8 Translating a document 7-34
Figure 7-11 Structure of a compiled open ('open') resource 7-44
Figure 7-12 Structure of a compiled kind ('kind') resource 7-45
Figure 8-1 Two control panels, each with its own window 8-5
Figure 8-2 The General Controls control panel 8-6
Figure 8-3 Control panel icons in the Control Panels folder 8-9
Figure 8-4 The Monitors control panel 8-10
Figure 8-5 An Options dialog box for the SurfBoard video card 8-11
Figure 8-6 The River control panel interface 8-13
Figure 8-7 An icon for the River control panel file 8-14
Figure 8-8 The Color control panel 8-15
Figure 8-9 Coordinates defining the rectangles of the River control panel display area 8-16
Listing 8-1 Rez input for a rectangle positions list ('nrct') resource 8-16
Listing 8-2 Rez input for an item list ('DITL' ) resource 8-18
Listing 8-3 Rez input for a machine ('mach') resource 8-21
Listing 8-4 Rez input for a file reference ('FREF') resource 8-21
Table 8-1 Possible settings for the machine resource masks 8-21
Listing 8-5 Rez input for a signature resource 8-22
Listing 8-6 Rez input for a bundle ('BNDL') resource 8-22
Listing 8-7 A control panel's static text defined as user items 8-24
Listing 8-8 A control device function 8-27
Listing 8-9 Initializing a control panel: Allocating memory and setting controls 8-31
Figure 8-10 Example of an inactive control panel 8-34
Listing 8-10 Responding to an activate event 8-35
Listing 8-11 Responding to a keyboard event 8-38
Listing 8-12 Responding to the user's interaction with controls 8-41
Listing 8-13 Responding to update events 8-43
Listing 8-14 Drawing text defined as user items 8-44
Listing 8-15 Terminating a control device function when the user closes the control panel 8-45
Listing 8-16 Responding to Edit menu commands 8-46
Table 8-2 Error codes and their meaning 8-47
Figure 8-11 An Options dialog box with standard controls 8-49
Figure 8-12 An Options dialog box with superuser controls 8-50
Figure 8-13 The SurfBoard monitors extension icon 8-51
Listing 8-17 Rez input for a card ('card') resource 8-52
Figure 8-14 Display area defined by a rectangle resource 8-53
Listing 8-18 Rez input for a rectangle ('RECT') resource 8-53
Figure 8-15 The SurfBoard Options dialog box with superuser controls 8-54
Listing 8-19 Rez input for the SurfBoard monitors extension item list resource 8-55
Listing 8-20 Rez input for icon family resources for a monitors extension 8-57
Listing 8-21 Rez input for a version ('vers') resource 8-58
Listing 8-22 Rez input for the SurfBoard string list resource 8-59
Listing 8-23 Rez input for a file reference resource of a monitors extension 8-60
Listing 8-24 Rez input for a bundle resource of a monitors extension 8-60
Listing 8-25 A monitors extension function 8-64
Listing 8-26 Handling the startup message 8-66
Listing 8-27 Using a normal user rectangle or extending it to display superuser controls 8-68
Listing 8-28 Initializing a monitors extension 8-69
Listing 8-29 Drawing a line to separate superuser controls 8-70
Listing 8-30 Responding when a user clicks a control 8-72
Table 8-3 Messages from the Finder 8-77
Table 8-4 Messages from the Monitors control panel 8-81
Figure 8-16 Structure of a compiled machine ('mach') resource 8-85
Figure 8-17 Structure of a compiled rectangle positions ('nrct') resource 8-86
Table 8-5 Possible settings for the machine resource masks 8-86
Figure 8-18 Structure of a compiled font information ('finf') resource 8-87
Figure 8-19 Structure of a compiled card ('card') resource 8-88
Figure 8-20 Structure of a compiled rectangle ('RECT') resource 8-89