NSPrintPanelAccessorizing

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.

Declaration

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.

Declaration

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.