Instance Method

rulerView:willAddMarker:atLocation:

Returns a potentially modified location to which the marker should be added.

Declaration

- (CGFloat)rulerView:(NSRulerView *)ruler willAddMarker:(NSRulerMarker *)marker atLocation:(CGFloat)location;

Parameters

aRulerView

The ruler view sending the message.

aMarker

The marker to be added.

location

The new location for the marker, in the ruler view’s coordinates.

Return Value

The modified location to which the marker should be added.

Discussion

This method ensures that the proposed location of aMarker lies within the appropriate bounds for the receiver’s text container, returning the modified location. Appropriate bounds are those of the text container minus its line fragment padding.

Typically, the ruler view's width matches that of its text view.

See Also

NSRulerView Client Methods

- rulerView:didMoveMarker:

Modifies the paragraph style of the paragraphs containing the selection to record the new location of the marker.

- rulerView:willMoveMarker:toLocation:

Returns a potentially modified location to which the marker should be moved.

- rulerView:shouldMoveMarker:

Returns whether the marker should be moved.

- rulerView:didRemoveMarker:

Modifies the paragraph style of the paragraphs containing the selection—if possible—by removing the specified marker.

- rulerView:shouldRemoveMarker:

Returns whether the marker should be removed.

- rulerView:didAddMarker:

Modifies the paragraph style of the paragraphs containing the selection to accommodate a new marker.

- rulerView:shouldAddMarker:

Returns whether a new marker can be added.

- rulerView:handleMouseDown:

Adds a left tab marker to the ruler at the location clicked.