Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSPrintPanel

Inherits from
Package
com.apple.cocoa.application
Companion guides

Overview

NSPrintPanel creates a Print panel used to query the user for information about a print job, such as which pages to print and how many copies, and to executes the Print command.

Print panels can display a simplified interface when printing certain types of data. The interface presents a list of presets for commonly used sets of print settings based on the type of data being printed. The user can select a preset instead of individually selecting the appropriate settings in each pane of the Print panel. The setJobStyleHint method activates the simplified interface and identifies which presets to present. Pass null to this method to deactivate the simplified interface.

Tasks

Constructors

Creating an NSPrintPanel

Customizing the Panel

Running the Panel

Communicating with the NSPrintInfo Object

Deprecated Methods

Constructors

NSPrintPanel

Creates an empty NSPrintPanel.

public NSPrintPanel()

Static Methods

printPanel

Returns a newly created NSPrintPanel object.

public static NSPrintPanel printPanel()

Instance Methods

accessoryView

Returns the receiver’s accessory view (used to customize the receiver).

public NSView accessoryView()

See Also

beginSheetWithPrintInfo

Presents a print sheet for printInfo, document-modal relative to docWindow.

public void beginSheetWithPrintInfo(NSPrintInfo printInfo, NSWindow docWindow, Object modalDelegate, NSSelector didEndSelector, Object contextInfo)

Discussion

When the modal session ends, if neither modalDelegate nor didEndSelector is null, didEndSelector is invoked on modalDelegate, passing contextInfo, among others, as an argument. modalDelegate is not the same as a delegate assigned to the panel. Modal delegates in sheets are temporary and the relationship only lasts until the sheet is dismissed.

The didEndSelector argument must have the following signature:

public void printPanelDidEnd (NSPrintPanel printPanel, int returnCode,  void contextInfo)

The value passed as returnCode is either NSPanel.CancelButton or NSPanel.OKButton. NSPanel.OKButton is returned even if the user clicked the Preview button.

finalWritePrintInfo

Writes the values of the receiver’s printing attributes to the NSPrintInfo object belonging to the current NSPrintOperation.

public void finalWritePrintInfo()

Discussion

Do not invoke this method directly—it is invoked automatically when the Print panel is dismissed by the user clicking the OK button.

See Also

jobStyleHint

Returns the type of content that the Print panel is representing.

public String jobStyleHint()

Discussion

Returns null if no job style hint has been set.

Availability
See Also

pickedAllPages

public void pickedAllPages(Object sender)

Discussion

Deprecated.

pickedButton

public void pickedButton(Object sender)

Discussion

Deprecated.

pickedLayoutList

public void pickedLayoutList(Object sender)

Discussion

Deprecated.

runModal

Displays the receiver and begins the modal loop.

public int runModal()

Discussion

Returns NSPanel.CancelButton if the user clicks the Cancel button; otherwise returns NSPanel.OKButton.

setAccessoryView

Adds an NSView to the receiver.

public void setAccessoryView(NSView aView)

Discussion

Invoke this method to add a custom view containing your controls. If you invoke this method prior to displaying the receiver, an item whose title is the same as your application’s name is added to the pane-selection pull-down menu on the Print panel. When the user selects this item, your accessory view is shown. This method can be invoked repeatedly to change the accessory view depending on the situation. If aView is null, the receiver’s current accessory view is removed.

See Also

setJobStyleHint

public void setJobStyleHint(String hint)

Discussion

Sets the type of content that the Print panel is representing. This controls the set of items that appear in the Presets menu of the simplified Print panel interface. The supported job style hints are described in “Constants.” If hint is null, the standard interface is used.

Availability
See Also

updateFromPrintInfo

Reads the receiver’s values from the NSPrintInfo object belonging to the current NSPrintOperation and updates the receiver accordingly.

public void updateFromPrintInfo()

Discussion

Do not invoke this method directly—it is invoked automatically before the Print panel is displayed.

See Also

Constants

The following constant can be passed to setJobStyleHint to activate the simplified Print panel interface and identify which presets to present.

Constant

Description

PrintPhotoJobStyleHint

Output is of photographic data.



Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.