Important: The information in this document is obsolete and should not be used for new development.
Inherits from | |
Package | com.apple.cocoa.application |
Companion guides |
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.
Returns a newly created NSPrintPanel object.
public static NSPrintPanel printPanel
()
Returns the receiver’s accessory view (used to customize the receiver).
public NSView accessoryView
()
Presents a print sheet for printInfo, document-modal relative to docWindow.
public void beginSheetWithPrintInfo
(NSPrintInfo printInfo, NSWindow docWindow, Object modalDelegate, NSSelector didEndSelector, Object contextInfo)
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.
Writes the values of the receiver’s printing attributes to the NSPrintInfo object belonging to the current NSPrintOperation.
public void finalWritePrintInfo
()
Do not invoke this method directly—it is invoked automatically when the Print panel is dismissed by the user clicking the OK button.
updateFromPrintInfo
currentOperation
(NSPrintOperation)Returns the type of content that the Print panel is representing.
public String jobStyleHint
()
Returns null
if no job style hint has been set.
public void pickedAllPages
(Object sender)
Deprecated.
public void pickedButton
(Object sender)
Deprecated.
public void pickedLayoutList
(Object sender)
Deprecated.
Displays the receiver and begins the modal loop.
public int runModal
()
Returns NSPanel.CancelButton
if the user clicks the Cancel button; otherwise returns NSPanel.OKButton
.
Adds an NSView to the receiver.
public void setAccessoryView
(NSView aView)
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.
public void setJobStyleHint
(String hint)
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.
Reads the receiver’s values from the NSPrintInfo object belonging to the current NSPrintOperation and updates the receiver accordingly.
public void updateFromPrintInfo
()
Do not invoke this method directly—it is invoked automatically before the Print panel is displayed.
finalWritePrintInfo
currentOperation
(NSPrintOperation)The following constant can be passed to setJobStyleHint
to activate the simplified Print panel interface and identify which presets to present.
© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)