Mac Developer Library

Developer

AppKit Framework Reference NSPrintPanelAccessorizing Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSPrintPanelAccessorizing

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.5 and later.

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.

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

    Declaration

    Swift

    func localizedSummaryItems() -> [AnyObject]!

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

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

    Declaration

    Swift

    optional func keyPathsForValuesAffectingPreview() -> Set<NSObject>!

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

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

    Declaration

    Swift

    let NSPrintPanelAccessorySummaryItemNameKey: String let NSPrintPanelAccessorySummaryItemDescriptionKey: String

    Objective-C

    NSString *NSPrintPanelAccessorySummaryItemNameKey; NSString *NSPrintPanelAccessorySummaryItemDescriptionKey;

    Constants

    • NSPrintPanelAccessorySummaryItemNameKey

      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.

    • NSPrintPanelAccessorySummaryItemDescriptionKey

      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.