Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: AppKit/NSPageLayout.h
On Mach platforms, NSPageLayout inherits from NSPanel.
NSPageLayout is a panel that queries the user for information such as paper type and orientation. This information is stored in an NSPrintInfo object, and is later used when printing. The NSPageLayout panel is created, displayed, and run (in a modal loop) when a runPageLayout: message is sent to the NSApplication object. By default, this message is sent up the responder chain when the user chooses the Page Setup menu item (on Mach platforms the menu item is called Page Layout).
Typically, you access an NSPageLayout panel by invoking the pageLayout method. When the class receives a pageLayout message, it returns an existing panel rather than create a new one. If a panel is reused, its attributes are reset to the default values so that the effect is the same as receiving a new panel. Because the NSPageLayout object returned by pageLayout may be reused, you should only modify it using methods explicitly declared by NSPageLayout. If you must modify an NSPageLayout object in other ways, don't modify the object returned by pageLayout; instead, create and manage your own instance using the alloc... and init... methods.
In most cases it is unnecessary to subclass NSPageLayout-you
can customize an NSPageLayout by specifying your own accessory view.
You can add your own controls to an NSPageLayout through the setAccessoryView: method.
The panel is automatically resized to accommodate the NSView that
you've added. Note that NSPageLayout does not have accessor methods
to obtain the state of its controls. If controls you add through
an accessory view need to know the values of existing controls (or
vice versa) use the viewWithTag: method.
You obtain a specific control object by sending viewWithTag: to
the NSPageLayout object passing one of the following tags (enumerated
in AppKit/NSPageLayout.h
):
The value can then be obtained by sending an appropriate accessor message to the returned control object.
- Creating an NSPageLayout
- + pageLayout
- Running an NSPageLayout
- - runModal
- - runModalWithPrintInfo:
- Customizing an NSPageLayout
- - accessoryView
- - setAccessoryView:
- Accessing the NSPrintInfo
- - printInfo
- - readPrintInfo
- - writePrintInfo
- Updating the display
- - convertOldFactor:newFactor:
- - pickedButton:
- - pickedOrientation:
- - pickedPaperSize:
- - pickedUnits:
+ (NSPageLayout *)pageLayout
- (NSView *)accessoryView
See Also: - setAccessoryView:
- (void)convertOldFactor:(float *)old
newFactor:(float *)new
The pickedUnits: method is invoked when the user selects a new unit of measurement from the NSPageLayout panel. Subclasses should override pickedUnits: to update any controls, located on the accessory view, that display dimensional values. Use this method to get the old and new ratios. See pickedUnits: for details.
- (void)pickedButton:(id)sender
See Also: - pickedOrientation:, - pickedPaperSize:, - pickedUnits:
- (void)pickedOrientation:(id)sender
See Also: - pickedButton:, - pickedPaperSize:, - pickedUnits:
- (void)pickedPaperSize:(id)sender
See Also: - pickedButton:, - pickedOrientation:, - pickedUnits:
- (void)pickedUnits:(id)sender
Subclasses should override this method to update controls in the accessory view that contain unit values. The ratios returned by the convertOldFactor:newFactor: method should be used to calculate the new values as shown below, where myField is an NSTextField located on the accessory view that needs to be updated:
- (void)pickedUnits:(id)sender { float old, new; /* At this point the units have been selected but not set. */ [self convertOldFactor:&old newFactor:&new]; /* Update myField based on the conversion factors. */ [myField setFloatValue:([myField floatValue]*new/old)]; /* Set the selected units. */ return [super pickedUnits:sender]; }
See Also: - pickedButton:, - pickedOrientation:, - pickedPaperSize:
- (NSPrintInfo *)printInfo
See Also: - readPrintInfo, - writePrintInfo
- (void)readPrintInfo
See Also: - printInfo, - writePrintInfo, - runModal, - runModalWithPrintInfo:
- (int)runModal
See Also: - pickedButton:, - runModalWithPrintInfo:
- (int)runModalWithPrintInfo:(NSPrintInfo *)printInfo
See Also: - pickedButton:, - runModal
- (void)setAccessoryView:(NSView *)aView
nil
,
then the receiver's current accessory view, if any, is removed.See Also: - accessoryView
- (void)writePrintInfo
See Also: - printInfo, - readPrintInfo, - runModal, - runModalWithPrintInfo: