OpenStep Development Tools
  Suchtext Nur in diesem Buch
Dieses Buch im PDF-Format herunterladen

............................Contents


1. Introduction
1-1
..Putting Together an OpenStep Application 1-2
....Designing Your Application 1-2
....Creating a Project 1-2
....Writing Code for Your Application 1-3
....Connecting Objects with Interface Builder 1-3
....Adding Other Resource Files 1-4
....Choosing Document Extensions for Your Application 1-4
....Compiling Your Program 1-4
....Debugging Your Program 1-5
....Adding Help to Your Application 1-5
....Translate Your User Interface 1-5
....Making Your Application Available to Users 1-6

2. Using Project Builder
2-1
..Creating and Maintaining Projects in Project Builder 2-3
....Creating a New Project 2-3
....Opening an Existing Project 2-5
....Opening and Converting Older Project Types 2-6
....Creating a New Subproject 2-7
....Setting Project Attributes 2-8
........Application Attributes 2-9
........Subproject Attributes 2-11
........Bundle Attributes 2-11
........Tool Attributes 2-12
........Palette Attributes 2-13
........Library Attributes 2-14
....Managing Project Files 2-14
........Adding Files to a Project 2-17
........File Display Shortcuts 2-17
....Building the Project 2-18
........Build Targets 2-23
........The Preamble and Postamble Files 2-24
........Defining User-configurable Macros for a Project
........with IDL Interfaces 2-27
....Setting Preferences 2-29
........Build Defaults Controls 2-29
........Tools Controls 2-29
........Sounds Controls 2-31
........Build Service Controls 2-31
........Save Options Controls 2-31
..Running and Debugging an Application 2-32
....Running 2-32
....Debugging 2-32
..Project Builder Command Reference 2-33
....Commands in the Project Menu 2-33
....Commands in the Files Menu 2-34

3. Working with Interface Builder
3-1
..An Orientation 3-3
..Building an Application with Interface Builder 3-4
....Specifying Object Attributes 3-4
....Interconnecting Objects 3-5
....Adding Code to Your Application 3-5
..Composing the Interface 3-6
....Opening a Nib File 3-6
.... When Interface Builder Starts 3-8
........The Palette Window 3-9
........The Interface Window 3-9
........The Nib File Window 3-10
........The Inspector Panel 3-21
....Creating a Nib File 3-22
....Saving the Nib File 3-23
....What Is in a Nib File 3-24
........Archived Objects 3-24
........Sounds and Images 3-25
........Class References 3-25
........Connection Information 3-26
....When You Load a Nib File 3-27
....Using the Palettes 3-27
........The Menus Palette 3-28
........The Views Palette 3-28
........The TextViews Palette 3-30
........The Windows Palette 3-30
........Adding an Object from a Palette to Your Interface 3-31
....Placing Interface Objects 3-33
....Selecting Multiple Objects 3-34
....Where Palette Objects Go 3-34
....Sizing Windows and Panels 3-36
....Initializing Text 3-38
....Sizing Interface Objects 3-39
....Positioning and Sizing Precisely 3-40
....Duplicating Objects 3-42
....Moving Objects to Other Windows 3-43
....Copying Objects to Other Interfaces 3-44
....Arranging Objects 3-45
........Using the Alignment Panel 3-45
........Making Columns and Rows of Objects 3-48
....Removing Objects 3-49
....The Coordinate System in Interface Builder 3-49
....OpenStep's Basic UI Design Philosophy 3-51
........Make It Consistent 3-51
........Make it Feel Natural 3-51
........Put the User in Charge 3-51
........Focus on the Mouse 3-52
....Making Interface Objects the Same Size 3-52
....Shrinking Objects to their Minimum Size 3-54
....Grouping Objects 3-55
....Layering Objects 3-57
....Creating Matrices of Objects 3-58
....Creating Menus 3-60
........Deleting a Menu Cell 3-61
........Changing Titles of Menu Cells 3-61
........Resequencing Menu Cells and Assigning
........Command Key Equivalents 3-61
........Custom Menus 3-62
..Setting Object Attributes 3-63
....Examining an Object's Attributes 3-65
....Customizing Windows and Panels 3-67
........Window Backing 3-68
........Changing Class and Custom Windows 3-69
........Window Controls 3-69
........Window Options 3-70
....What is the Difference Between a Window and a Panel? 3-70
....Setting Button Attributes 3-71
........The Anatomy of a Button 3-72
........Titles and Icons 3-73
........Key Equivalent 3-73
........Button Type 3-74
........Button Options 3-74
....Associating Sounds and Images with Buttons 3-75
....Managing Sounds and Images 3-78
....Customizing Titles, Text Fields, and Scroll Views 3-81
....Setting Textual Attributes 3-84
....Setting Box (Group) Attributes 3-85
....Customizing Browsers 3-87
....Setting Attributes of Menu Cells and Pop-up Buttons 3-89
........Pop-Up Lists and Pull-Down Lists 3-90
....Compound Objects 3-91
........NSControl and NSActionCell 3-91
........Matrices 3-92
........Special Compound Objects 3-93
....Setting Matrix Attributes 3-95
........Matrix Selection Mode 3-95
........Cell Prototype 3-96
....Automatically Resizing Objects 3-98
........When There Are Conflicts 3-101
....Some Effects of Automatic Resizing 3-102
....Automatic Resizing: An Example 3-104
....Using Tags 3-107
..Making and Managing Connections 3-109
....Communicating With Other Objects: Outlets and Actions. 3-109
........Outlets 3-109
........Delegates 3-110
........Targets 3-111
........Actions 3-111
....Connecting Objects 3-113
........Outlet Connections 3-114
........Action Connections 3-116
....Connections Within the Interface 3-118
....Making Connections in Outline Mode 3-120
....Examining Connections 3-122
....Identifying Objects in Outline Mode 3-127
....Enabling Inter-Field Tabbing 3-128
....Disconnecting Objects 3-130
..Attaching Help to Objects 3-132
..Reviewing Help Attachments 3-135
..Testing the Interface 3-136
..Creating a Class 3-137
....Naming a New Class 3-141
....A Perspective on Class Hierarchy 3-142
....Specifying Outlets and Actions 3-143
........Adding Outlets 3-144
....Adding Actions 3-145
....Creating an Instance of Your Class 3-147
....Connecting Your Class's Outlets 3-149
....Connecting Your Class's Actions 3-151
....Generating Source Code Files 3-153
....Implementing a Subclass of NSObject 3-155
....Making Your Class a Delegate 3-156
....Implementing an NSView Subclass 3-158
....Adding Existing Classes to Your Nib File 3-162
....Updating a Class Definition 3-163
....Adding IDL Template Objects to Your Interface 3-164
........Connecting IDL Template Objects 3-165
........Outlet Autotyping 3-166
..Setting Preferences 3-167
....General Preferences 3-167
....Palettes Preferences 3-168
..Adding Custom Palettes, Inspectors, and Editors 3-169
..Interface Builder Command Reference 3-171
....Commands in the Document Menu 3-171
........Commands in the New Module Submenu 3-172
....Commands in the Edit Menu 3-173
....Commands in the Format Menu 3-173
........Commands in the Group Submenu 3-175
........Commands in the Align Submenu 3-175
....Commands in the Size Submenu 3-177
....Commands in the Tools Menu 3-177
........Commands on the Palettes Submenu 3-178

4. Using Edit in Developer Mode
4-1
..Starting Edit 4-1
..Setting Preferences 4-3
....User Options 4-4
........Start-up Options 4-4
........New Document Format Options 4-5
........Default Font for RTF Files 4-5
........Default Font for ASCII Files 4-5
....Global Options 4-6
........Save Options 4-6
........Default Window Size Options 4-7
........Emacs Key Bindings 4-7
....Temporary Settings 4-7
........Line Wrap Options 4-8
........Rich Text Display Options 4-8
....Text Options 4-8
........Automatic Indenting Options 4-9
........Structure Level of Blank Lines 4-9
........Alignment Options 4-9
........Open at Structure Level Options 4-10
........Editing Modes 4-10
....C Options 4-11
........Structure for Top Level 4-11
........Structure Level of Blank Lines 4-11
........Tags Path 4-12
........Include Path 4-12
..Performing Basic Operations 4-13
..Opening Edit Files 4-13
..Using File Windows and Folder Windows 4-14
..Contracting and Expanding Text in a File Window 4-15
..Adding Help Links 4-17
..Using Templates 4-18
..Using Keyboard Editing Commands 4-21
..Interacting with UNIX 4-21
....Piping UNIX Output to a File 4-22
....Using a Tags File 4-23
..Edit Command Reference 4-24
....Commands in the Main Menu 4-24
....Commands in the File Menu 4-25
....Commands in the Edit Menu 4-26
........Commands in the Link Submenu 4-26
........Commands in the Find Submenu 4-27
....Commands in the Format Menu 4-28
........Commands in the Font Submenu 4-28
........Commands in the Text Submenu 4-29
........Commands in the Help Submenu 4-30
........Commands in the Sructure Submenu 4-31
....Commands in the Utilities Menu 4-31
........Commands in the Expert Submenu 4-34

5. Using Icon Builder to Create Application Icons
5-1
..Creating, Opening, and Saving Documents 5-1
....Creating a New Document 5-2
....Opening an Existing Document 5-3
....Saving a Document 5-3
..Editing Icon Documents 5-3
....Using Icon Builder Tools 5-4
........The Brush Tool 5-5
........The Line Tool 5-5
........The PaintBucket Tool 5-6
........The Pencil Tool 5-6
........The Rectangle Tool 5-6
........The Selection Tool 5-7
........The Text Tool 5-7
....Using the Tools Inspector 5-8
........The Brush Inspector 5-8
........The Line Inspector 5-9
........The Oval Inspector 5-9
........The Pencil Inspector 5-10
........The Rectangle Inspector 5-11
........The Selection Inspector 5-12
........The TextTool Inspector 5-14
....Zooming In on a Document 5-15
....Changing the Attributes of a Document 5-17
....Working with Multiple-Icon Documents 5-17
..Icon Builder Command Reference 5-18
....Commands in the Main Menu 5-18
....Commands in the Document Menu 5-18
....Commands in the Format Menu 5-19
....Commands in the Tools Menu 5-20

6. Navigating the OpenStep API with Header Viewer
6-1
..Header Viewer and Header Files 6-2
....Precompiled Headers 6-2
....Language Elements 6-3
..Header Viewer and OpenStep Documentation 6-4
..Using Header Viewer 6-5
....The Browser View 6-5
....The Finder View 6-10
....Adding Header Files 6-12
....The Find Panel 6-13
....Header Viewer and the File Viewer 6-13
....Header Viewer and Edit 6-13
..Setting Preferences 6-14
....Header Files Preferences 6-14
....Documentation Preferences 6-15
....Other Options Preferences 6-15
..Header Viewer Command Reference 6-16
....Commands in the Find Menu 6-16
....Commands in the Utilities Menu 6-18

7. The NSObject Class
7-1
..Class Description 7-1
....Initializing an Object to Its Class 7-2
....Instance and Class Methods 7-2
....Initializing the Class 7-3
....Creating and Destroying Instances 7-4
....Identifying Classes 7-5
....Testing Class Functionality 7-5
....Testing Protocol Conformance 7-6
....Obtaining Method Information 7-6
....Describing Objects 7-7
....Posing 7-7
....Error Handling 7-7
....Sending Deferred Messages 7-8
....Forwarding Messages 7-8
....Archiving 7-9

8. The Objective C Language
8-1
..Objects 8-2
....The id Data Type 8-3
....Dynamic Typing 8-4
..Messages 8-5
....Polymorphism 8-6
....Dynamic Binding 8-7
..Classes 8-8
....Inheritance 8-9
........The NSObject Class 8-10
........Inheriting Instance Variables 8-11
........Inheriting Methods 8-11
........Overriding One Method with Another 8-11
........Abstract Classes 8-12
....Class Types 8-13
........Static Typing 8-13
........Type Introspection 8-14
....Class Objects 8-14
........Creating Instances 8-16
........Customization with Class Objects 8-16
........Variables and Class Objects 8-18
........Initializing a Class Object 8-19
........Methods of the Root Class 8-19
....Class Names in Source Code 8-20
..Defining a Class 8-21
....The Interface 8-21
........Importing the Interface 8-23
........Referring to Other Classes 8-24
........The Role of the Interface 8-24
....The Implementation 8-25
........Referring to Instance Variables 8-26
........The Scope of Instance Variables 8-28
..How Messaging Works 8-31
....Selectors 8-34
........Methods and Selectors 8-35
........Method Return and Argument Types 8-35
........Varying the Message at Run Time 8-36
........The Target-Action Paradigm 8-36
........Avoiding Messaging Errors 8-37
....Hidden Arguments 8-38
....Messages to self and super 8-39
........An Example 8-40
........Using super 8-42
........Redefining self 8-43

9. The Objective C Extensions
9¬1
..Categories 9¬1
....Adding to a Class 9¬2
....How Categories are Used 9¬3
....Categories of the Root Class 9¬4
..Protocols 9¬5
....How Protocols are Used 9¬5
........Methods for Others to Implement 9¬6
........Anonymous Objects 9¬7
........Nonhierarchical Similarities 9¬9
....Informal Protocols 9¬9
....Formal Protocols 9¬10
........Protocol Objects 9¬12
........Conforming to a Protocol 9¬12
........Type Checking 9¬13
........Protocols within Protocols 9¬14
..Remote Messaging 9¬15
....Distributed Objects 9¬16
....Language Support 9¬18
........Synchronous and Asynchronous Messages 9¬18
........Pointer Arguments 9¬19
........Proxies and Copies 9¬21
..Static Options 9¬22
....Static Typing 9¬23
....Type Checking 9¬24
........Return and Argument Types 9¬25
........Static Typing to an Inherited Class 9¬25
....Getting a Method Address 9¬27
.....Getting an Object Data Structure 9¬28
.....Type *Encoding 9¬29

A. Debugging an OpenStep Application
A-1
..Debugger Objective C Support A-1
.....Dynamic Types A-2
.....Finding Methods and Using Method Names in
.......Non-expression Commands A-2
.....Setting Breakpoints A-2
.....Calling Objective C Methods A-3
.....Recovering from a Run-time System Crash A-3
..Sample .dbxrc File A-3
.....Helpful User Default Variables to Set with dwrite A-13
..Tracing Objective C Objects A-13
..... Invoking messageSendDebug Using
.......dwrite Commands A-14
.........Adding Individual Message Filters A-14
.........Controlling Call Level Indentation A-15
..... Invoking messageSendDebug from a Program or
.......the Debugger A-15
.........Enabling messageSendDebug A-15
.........Adding Filters A-16
.........Controlling Call Level Indentation A-17
.........Removing Filters A-17
.........Disabling Filters A-17
.........Setting a Breakpoint on a Filter Match A-17
..... Examples A-18
.........Example 1: A-18
.........Example 2: A-18
.........Example 3: A-19
.....Implementing Your Own Filtering Mechanism A-19
..Debugging Applications Using Optimized Libraries A-20

B. Interface Builder Application Programming Interface
B-1
..Interface Builder's Design B-2
..The Object Hierarchy B-3
..Class References B-3
..Connection Information B-4
..Interface Builder's Programming Interface B-5
.....Classes B-5
.....Protocols B-6
.....Other Programming Interfaces B-6

C. Interface Builder API Classes
C-1
..IBInspector C-1
.....Class Description C-1
.....Instance Variables C-2
.....Method Types C-3
.....Instance Methods C-3
.........object C-3
.........ok: C-3
.........okButton: C-4
.........revert: C-4
.........revertButton: C-5
.........textDidBeginEditing: C-5
.........touch: C-5
.........wantsButtons C-5
.........window C-5
..IBPalette C-6
.....Class Description C-6
.....Instance Variables C-7
.....Method Types C-8
.....Instance Methods C-8
.........associateObject:ofType:withView: C-8
.........imageNamed: C-8
.........finishInstantiate C-9
.........originalWindow C-9
.........paletteDocument C-9
..NSApplication Additions C-9
.....Category Description C-9
.....Instance Methods C-10
.........connectDestination C-10
.........connectSource C-10
.........displayConnectionBetween:and: C-10
.........isConnecting C-10
.........stopConnecting C-11
..NSObject Additions C-11
.....Category Description C-11
.....Instance Methods C-12
.........awakeFromDocument: C-12
.........canSubstituteFor Class: C-12
.........connectInspectorClassName C-12
.........editorClassName C-12
.........helpInspectorClassName C-13
.........imageForViewer: C-13
.........inspectorClassName C-13
.........sizeInspectorClassName C-13
..NSCellAdditions C-14
.....Category Description C-14
.....Instance Methods C-14
.........cellWillAltDragWithSize: C-14
.........maximumSizeForCellSize: C-14
.........minimumSizeForCellSize: C-15
..NSView Additions C-15
.....Category Description C-15
.....Instance Methods C-16
.........allowsAltDragging: C-16
.........maximumSizeFromKnobPosition: C-16
.........minimumSizeFromKnobPosition: C-16
.........placeView: C-17

D. Interface Builder API Protocols
D-1
..IB D-1
.....Protocol Description D-1
.....Method Types D-2
.....Instance Methods D-2
.........activeDocument D-2
.........isTestingInterface D-2
.........selectionOwner D-2
..IBConnectors D-3
.....Protocol Description D-3
.....Method Types D-4
.....Instance Methods D-4
.........destination D-4
.........establishConnection D-4
.........label D-4
.........nibInstantiate D-5
.........replaceObject:withObject: D-6
.........source D-6
..IBDocuments D-6
.....Protocol Description D-6
.....Method Types D-7
.....Instance Methods D-8
.........addConnector: D-8
.........attachObject:toParent: D-8
.........attachObjects:toParent: D-9
.........connectorsForDestination: D-9
.........connectorsForDestination:ofClass: D-9
.........connectorsForSource: D-10
.........connectorsForSource:ofClass: D-10
.........containsObject: D-10
.........containsObjectWithName:forParent D-11
.........copyObject:type:toPasteboard: D-11
.........copyObjects:type:toPasteboard: D-11
.........detachObject: D-12
.........detachObjects: D-12
.........documentPath D-12
.........drawObject: D-13
.........editor:didCloseForObject: D-13
.........editorForObject:create: D-13
.........nameForObject: D-13
.........objects: D-13
.........openEditorForObject: D-14
.........parentOfObject: D-14
.........pasteType:fromPasteboard:parent: D-14
.........removeConnector: D-14
.........replaceObject:withObject: D-15
.........resignSelectionForEditor: D-15
.........setName:forObject: D-15
.........setSelectionFromEditor: D-15
.........touch D-16
..IBEditors D-16
.....Protocol Description D-16
.....Method Types D-17
.....Instance Methods D-18
.........acceptsTypeFromArray: D-18
.........activate D-18
.........close D-19
.........closeSubeditors D-19
.........copySelection D-19
.........deleteSelection D-20
.........document D-20
.........editedObject D-20
.........initWithObject:inDocument: D-20
.........makeSelectionVisible: D-21
.........openSubeditorForObject: D-21
.........orderFront D-21
.........pasteInSelection D-21
.........resetObject: D-22
.........selectObjects: D-22
.........validateEditing D-22
.........wantsSelection D-22
.........window D-22
..IBSelectionOwners D-23
.....Protocol Description D-23
.....Instance Methods D-23
.........drawSelection D-23
.........selection: D-23
.........selectionCount D-24

E. Interface Builder API Types and Constants
E-1
..Symbolic Constants E-1
.....Control Point Constants E-1
.........Synopsis E-1
.........Description E-1
..Global Variables E-2
.....Notification Types E-2
.........Synopsis E-2
.........Description E-2
.........Synopsis E-3
.........Description E-3
.....Pasteboard Types E-3
.........Synopsis E-3
.........Description E-3