Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSPrintPanel 

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 

+ (NSPrintPanel *)printPanel	Returns a default NSPrintPanel object.

Customizing the Panel 

- (void)setAccessoryView:(NSView *)aView	Adds an NSView to the panel.

- (NSView *)accessoryView	Returns the accessory NSView.

Running the Panel 

- (int)runModal	Displays the Print panel and begins its event loop. If it is necessary to resize the panel in order to accommodate the list of printers, this method posts the notification NSWindowDidResizeNotification with the receiving object to the default notification center.

- (void)pickedButton:(id)sender	Stops the event loop.

Updating the Panel's Display 

- (void)pickedAllPages:(id)sender	Updates the panel when the user chooses all pages.

- (void)pickedLayoutList:(id)sender	Updates the panel when the user chooses a new layout.

Communicating with the NSPrintInfo Object 

- (void)updateFromPrintInfo	Reads NSPrintPanel's values from the NSPrintInfo object.

- (void)finalWritePrintInfo	Writes NSPrintPanel's values to the NSPrintInfo object.