NSPageLayout Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.0 and later.
Companion guide
Declared in
NSPageLayout.h
Related sample code

Overview

NSPageLayout is a panel that queries the user for information such as paper type and orientation. It is normally displayed in response to the user selecting the Page Setup menu item. You obtain an instance with the pageLayout class method. The pane can then be run as a sheet using beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo: or modally using runModal or runModalWithPrintInfo:.

Tasks

Creating an NSPageLayout Instance

Running a Page Setup Dialog

Customizing the Page Setup Dialog

Accessing the NSPrintInfo Object

Deprecated Methods

Class Methods

pageLayout

Returns a newly created NSPageLayout object.

+ (NSPageLayout *)pageLayout
Availability
  • Available in OS X v10.0 and later.
Declared In
NSPageLayout.h

Instance Methods

accessoryControllers

Returns an array of accessory view controllers belonging to the receiver.

- (NSArray *)accessoryControllers
Return Value

The NSViewController instances representing the accessory view controllers belonging to the receiver.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSPageLayout.h

addAccessoryController:

Adds the given controller of an accessory view to be presented in the page setup panel.

- (void)addAccessoryController:(NSViewController *)accessoryController
Parameters
accessoryController

The controller to add.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSPageLayout.h

beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:

Presents a page setup sheet for the given NSPrintInfo object, document-modal relative to the given window.

- (void)beginSheetWithPrintInfo:(NSPrintInfo *)printInfo modalForWindow:(NSWindow *)docWindow delegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo
Parameters
printInfo

The NSPrintInfo object to use.

docWindow

The window to which the sheet is attached.

delegate

The delegate to which didEndSelector is sent. Can be nil.

didEndSelector

The selector sent to the delegate. Can be nil.

contextInfo

Context information object passed with didEndSelector.

Discussion

The didEndSelector argument must have the same signature as:

- (void)pageLayoutDidEnd:(NSPageLayout *)pageLayout returnCode:(int)returnCode  contextInfo: (void *)contextInfo;

The value passed as returnCode is either NSCancelButton or NSOKButton.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSPageLayout.h

printInfo

Returns the NSPrintInfo object used when the receiver is run.

- (NSPrintInfo *)printInfo
Discussion

The NSPrintInfo object is set using the beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo: or runModalWithPrintInfo: method. The shared NSPrintInfo object is used if the receiver is run using runModal.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSPageLayout.h

removeAccessoryController:

Removes the given controller of an accessory view.

- (void)removeAccessoryController:(NSViewController *)accessoryController
Parameters
accessoryController

The controller to remove.

Availability
  • Available in OS X v10.5 and later.
Declared In
NSPageLayout.h

runModal

Displays the receiver and begins the modal loop using the shared NSPrintInfo object.

- (NSInteger)runModal
Return Value

NSCancelButton if the user clicks the Cancel button; otherwise, NSOKButton.

Discussion

The receiver’s values are recorded in the shared NSPrintInfo object.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSPageLayout.h

runModalWithPrintInfo:

Displays the receiver and begins the modal loop using the given NSPrintInfo object.

- (NSInteger)runModalWithPrintInfo:(NSPrintInfo *)printInfo
Parameters
printInfo

The NSPrintInfo object to use.

Return Value

NSCancelButton if the user clicks the Cancel button; otherwise, NSOKButton.

Discussion

The receiver’s values are recorded in printInfo.

Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSPageLayout.h