| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.4 and later. |
| Declared in | NSTextTable.h |
| Companion guides |
NSTextBlock objects represent a block of text laid out in a subregion of the text container. Text blocks appear as attributes on paragraphs, as part of the paragraph style.
The most important subclass is NSTextTableBlock, which represents a block of text that appears as a cell in a table. The table itself is represented by a separate class, NSTextTable, which is referenced by all of its NSTextTableBlock objects and which controls their sizing and positioning.
– setValue:type:forDimension:
– valueForDimension:
– valueTypeForDimension:
– setContentWidth:type:
– contentWidth
– contentWidthValueType
– setWidth:type:forLayer:edge:
– setWidth:type:forLayer:
– widthForLayer:edge:
– widthValueTypeForLayer:edge:
– setBackgroundColor:
– backgroundColor
– setBorderColor:forEdge:
– setBorderColor:
– borderColorForEdge:
– rectForLayoutAtPoint:inRect:textContainer:characterRange:
– boundsRectForContentRect:inRect:textContainer:characterRange:
Returns the background color of the text block.
- (NSColor *)backgroundColor
The background color of the text block.
NSTextTable.hReturns the border color of the specified text block edge.
- (NSColor *)borderColorForEdge:(NSRectEdge)edge
The edge of the text block in question.
The border color of the text block edge edge.
NSTextTable.hReturns the rectangle the text in the block actually occupies, including padding, borders, and margins.
- (NSRect)boundsRectForContentRect:(NSRect)contentRect inRect:(NSRect)rect textContainer:(NSTextContainer *)textContainer characterRange:(NSRange)charRange
The actual rectangle in which the text was laid out, as determined by rectForLayoutAtPoint:inRect:textContainer:characterRange:.
The initial rectangle in textContainer proposed by the typesetter.
The text container being used for the layout.
The range of the characters in the NSTextStorage object whose glyphs are to be drawn.
The rectangle the text in the block actually occupies, including padding, borders, and margins.
This methods is called by the typesetter after the text block is laid out to return the rectangle the text in the block actually occupies, including padding, borders, and margins.
NSTextTable.hReturns the width of the text block.
- (CGFloat)contentWidth
The width of the text block. This value must be interpreted according to the value type returned by contentWidthValueType.
This is a convenience method that invokes valueForDimension:NSTextBlockWidth.
NSTextTable.hReturns the type of value stored for the text block width.
- (NSTextBlockValueType)contentWidthValueType
The value type for the text block width. This determines how the width value should be interpreted.
NSTextTable.hCalled by the layout manager to draw any colors and other decorations before the text is drawn.
- (void)drawBackgroundWithFrame:(NSRect)frameRect inView:(NSView *)controlView characterRange:(NSRange)charRange layoutManager:(NSLayoutManager *)layoutManager
The bounds rectangle in view coordinates.
The view in which drawing occurs.
The range of the characters in the NSTextStorage object whose glyphs are to be drawn.
The layout manager controlling the typesetting.
NSTextTable.hInitializes and returns an empty text block object.
- (id)init
An initialized text block object.
This is the designated initializer for NSTextBlock.
NSTextTable.hReturns the rectangle within which glyphs should be laid out for the specified arguments.
- (NSRect)rectForLayoutAtPoint:(NSPoint)startingPoint inRect:(NSRect)rect textContainer:(NSTextContainer *)textContainer characterRange:(NSRange)charRange
The location, in container coordinates, where layout begins.
The rectangle in which the block is constrained to lie. For top-level blocks, this is the container rectangle of textContainer; for nested blocks, this is the layout rectangle of the enclosing block.
The text container being used for the layout.
The range of the characters in the NSTextStorage object whose glyphs are to be drawn.
The rectangle within which glyphs should be laid out.
This method is called by the typesetter before the text block is laid out to return the rectangle within which glyphs should be laid out.
NSTextTable.hSets the background color of the text block.
- (void)setBackgroundColor:(NSColor *)color
The new background color.
NSTextTable.hSets the color of all borders of the text block.
- (void)setBorderColor:(NSColor *)color
The new color.
This setting has no visible effect unless the border width is larger than the default, which is 0.
NSTextTable.hSets the border color of the specified edge of the text block.
- (void)setBorderColor:(NSColor *)color forEdge:(NSRectEdge)edge
The new color.
The edge whose color is to be set.
This setting has no visible effect unless the border width is larger than the default, which is 0.
NSTextTable.hSets the width of the text block.
- (void)setContentWidth:(CGFloat)val type:(NSTextBlockValueType)type
The new value for the width.
The type of value being provided. This controls how val is interpreted.
NSTextTable.hSets a dimension of the text block.
- (void)setValue:(CGFloat)val type:(NSTextBlockValueType)type forDimension:(NSTextBlockDimension)dimension
The new value for the dimension.
The type of value being provided. This controls how val is interpreted.
The dimension to set.
NSTextTable.hSets the vertical alignment of the text block.
- (void)setVerticalAlignment:(NSTextBlockVerticalAlignment)alignment
The new vertical alignment for the text block.
NSTextTable.hSets the width of all edges of a specified layer of the text block.
- (void)setWidth:(CGFloat)val type:(NSTextBlockValueType)type forLayer:(NSTextBlockLayer)layer
The new value for the specified edge width.
The type of value being provided. This controls how val is interpreted.
The layer of the text block to modify.
NSTextTable.hSets the width of a specified edge of a specified layer of the text block.
- (void)setWidth:(CGFloat)val type:(NSTextBlockValueType)type forLayer:(NSTextBlockLayer)layer edge:(NSRectEdge)edge
The new value for the specified edge width.
The type of value being provided. This controls how val is interpreted.
The layer of the text block to modify.
The edge of the layer to modify.
NSTextTable.hReturns the value of the specified text block dimension.
- (CGFloat)valueForDimension:(NSTextBlockDimension)dimension
The value for the specified dimension. This value should be interpreted according to the value type returned by valueTypeForDimension:.
NSTextTable.hReturns the value type of the specified text block dimension.
- (NSTextBlockValueType)valueTypeForDimension:(NSTextBlockDimension)dimension
The value type for the specified text block dimension. This result determines how the value for the dimension should be interpreted.
NSTextTable.hReturns the vertical alignment of the text block.
- (NSTextBlockVerticalAlignment)verticalAlignment
The vertical alignment of the text block.
NSTextTable.hReturns the width of an edge of a specified layer of the text block.
- (CGFloat)widthForLayer:(NSTextBlockLayer)layer edge:(NSRectEdge)edge
The layer to examine.
The edge of the layer to examine.
The width of the edge of layer. This value must be interpreted according to the value type returned by widthValueTypeForLayer:edge:.
NSTextTable.hReturns the value type of an edge of a specified layer of the text block.
- (NSTextBlockValueType)widthValueTypeForLayer:(NSTextBlockLayer)layer edge:(NSRectEdge)edge
The layer to examine.
The edge of the layer to examine.
The value type of the edge of layer. This determines how the value for this edge of layer should be interpreted.
NSTextTable.hThe following constants specify values used by the methods setValue:type:forDimension: and valueTypeForDimension:
enum {
NSTextBlockAbsoluteValueType = 0,
NSTextBlockPercentageValueType = 1
};
typedef NSUInteger NSTextBlockValueType;
NSTextBlockAbsoluteValueTypeAbsolute value in points
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockPercentageValueTypePercentage value (out of 100)
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
The following constants specify values used by the methods setValue:type:forDimension:, valueForDimension:, and valueTypeForDimension:.
enum {
NSTextBlockWidth = 0,
NSTextBlockMinimumWidth = 1,
NSTextBlockMaximumWidth = 2,
NSTextBlockHeight = 4,
NSTextBlockMinimumHeight = 5,
NSTextBlockMaximumHeight = 6
};
typedef NSUInteger NSTextBlockDimension;
NSTextBlockWidthWidth of the text block
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockMinimumWidthMinimum width of the text block
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockMaximumWidthMaximum width of the text block
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockHeightHeight of the text block
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockMinimumHeightMinimum height of the text block
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockMaximumHeightMaximum height of the text block
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
The following constants specify values used by the methods setContentWidth:type:, contentWidthValueType, setWidth:type:forLayer:edge:, setWidth:type:forLayer:, widthForLayer:edge:, and widthValueTypeForLayer:edge:.
enum {
NSTextBlockPadding = -1,
NSTextBlockBorder = 0,
NSTextBlockMargin = 1
};
typedef NSInteger NSTextBlockLayer;
NSTextBlockPaddingPadding of the text block: space surrounding the content area extending to the border
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockBorderBorder of the text block: space between padding and margin, typically colored to present a visible boundary
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockMarginMargin of the text block: space surrounding the border
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
The following constants specify values used by the methods setVerticalAlignment: and verticalAlignment.
enum {
NSTextBlockTopAlignment = 0,
NSTextBlockMiddleAlignment = 1,
NSTextBlockBottomAlignment = 2,
NSTextBlockBaselineAlignment = 3
};
typedef NSUInteger NSTextBlockVerticalAlignment;
NSTextBlockTopAlignmentAligns adjacent blocks at their top
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockMiddleAlignmentAligns adjacent blocks at their middle
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockBottomAlignmentAligns adjacent blocks at their bottom
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
NSTextBlockBaselineAlignmentAligns adjacent blocks at the baseline of the first line of text in the block
Available in Mac OS X v10.4 and later.
Declared in NSTextTable.h.
Last updated: 2009-06-02