NSPrintPanelAccessorizing Protocol Reference

Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.5 and later.
Declared in
NSPrintPanel.h
Related sample code

Overview

The NSPrintPanelAccessorizing protocol declares two methods that the NSPrintPanel class uses to get information from a printing accessory controller.

A printing accessory controller manages a custom print panel accessory view and used to coordinate print settings. If you are implementing a custom printing accessory view, your controller must support this protocol. Implementation of only one method in the protocol is actually required. The other method is considered optional and is used to support the print panel’s built-in preview facilities.

Tasks

Responding to Being Loaded from a Nib File

Instance Methods

keyPathsForValuesAffectingPreview

Returns a set of strings identifying the key paths for any properties that might affect the built-in print preview. (optional)

- (NSSet *)keyPathsForValuesAffectingPreview
Return Value

A set of NSString objects identifying one or more key paths. Only key paths for properties that might affect the contents of the print preview should be returned.

Discussion

If an accessory view modifies printing-related properties that are used by the print preview, you should implement this method to return the key paths for those properties. For example, if you write an accessory view that lets the user change the left and right document margins in the current NSPrintInfo object, you would return the following key paths: representedObject.leftMargin, representedObject.rightMargin. (The NSPrintInfo object is the represented object of the accessory controller.)

Implementation of this method is optional. You do not need to implement this method if you are not using the NSPrintPanel object’s built-in preview facilities. If you do use these facilities, however, you should implement this method.

Availability
  • Available in OS X v10.5 and later.
Related Sample Code
Declared In
NSPrintPanel.h

localizedSummaryItems

Returns an array of dictionaries containing the localized user setting summary strings. (required)

- (NSArray *)localizedSummaryItems
Return Value

An array of NSDictionary objects, each of which contains a NSPrintPanelAccessorySummaryItemNameKey and NSPrintPanelAccessorySummaryItemDescriptionKey key. The values for the keys are both strings. This method must not return nil.

Discussion

Accessory panels must implement this method to return information about the panel’s current settings. The returned array should contain a dictionary for each setting that is managed by the accessory panel and each dictionary should contain two key-value pairs identifying the name of the setting and its current value.

Your accessory view must be KVO-compliant for the localizedSummaryItems key path because NSPrintPanel object observes that key path and uses it to keep the contents of the summary view up to date. This means your view should manually send KVO notifications to observers for the localizedSummaryItems key path whenever the contents of the set of summary items changes. For more information on supporting key-value observing and manual notifications, see Key-Value Observing Programming Guide.

Availability
  • Available in OS X v10.5 and later.
Related Sample Code
Declared In
NSPrintPanel.h

Constants

Printing Summary Item Keys

These keys must be included in the dictionaries returned by the localizedSummaryItems method.

NSString *NSPrintPanelAccessorySummaryItemNameKey;
NSString *NSPrintPanelAccessorySummaryItemDescriptionKey;
Constants
NSPrintPanelAccessorySummaryItemNameKey

Used as a key to specify the name of the accessory panel setting. The corresponding value should be an NSString object.

Available in OS X v10.5 and later.

Declared in NSPrintPanel.h.

NSPrintPanelAccessorySummaryItemDescriptionKey

Used as a key to identify the current value of the accessory panel setting. The corresponding value should be an NSString object.

Available in OS X v10.5 and later.

Declared in NSPrintPanel.h.

Declared In
NSPrintPanel.h