Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights Reserved.


Inherits From: NSPanel : NSWindow : NSResponder : NSObject

Conforms To: NSCoding (NSResponder) NSObject (NSObject)

Declared In: AppKit/NSPrintPanel.h

Class Description

NSPrintPanel creates a Print panel. The Print panel queries the user for information about a print job, such as which pages to print and how many copies.

When a print: message is sent to an NSView or NSWindow, an NSPrintOperation object is created to control the print operation, which includes deciding whether or not to use an NSPrintPanel. The NSPrintPanel will be used unless the setShowPanels:NO message is sent to the NSPrintOperation. If you're subclassing NSPrintPanel, send the setPrintPanel message to the NSPrintOperation object to ensure that an instance of your subclass is the unique NSPrintPanel for that operation.

Short of subclassing NSPrintPanel, you can augment its display by adding a custom NSView through the setAccessoryView: method. The panel is automatically resized to accommodate the NSView that you add. Note, however, that you don't have to create controls for special printer features. If a printer includes features in the OpenUI field of its PostScript Printer Description (PPD) table, these features will be displayed in a separate panel that's brought up when the user clicks the Print panel's Options button. For more information on a printer's PPD table, see the NSPrinter class description.

Typically, you access an NSPrintPanel by invoking the printPanel method. When the class receives a printPanel message, it tries to reuse an existing panel rather than create a new one. When a panel is reused, its attributes are reset to the default values so that the effect is the same as receiving a new panel. Because a Print panel may be reused, you shouldn't modify the instance returned by printPanel, except through the methods listed below. For example, you can set the accessory view, but not the arrangement of the buttons within the panel. If you must modify the Print panel substantially, create and manage your own instance using the alloc... and init... methods rather than the printPanel method.

An application stores printing information in an NSPrintInfo object. NSPrintPanel's updateFromPrintInfo reads the NSPrintInfo object's information into the Print panel. finalWritePrintInfo updates the NSPrintInfo object if the user changes the information on the Print panel. When the NSPrintOperation object is created, an NSPrintInfo object is also selected for the operation. The NSPrintOperation creates a copy of the NSPrintInfo. finalWritePrintInfo actually writes to that copy.

Creating an NSPrintPanel

Customizing the Panel

Running the Panel

Updating the Panel's Display

Communicating with the NSPrintInfo Object