About Ruler Markers
NSRulerMarker object displays a symbol on an
NSRulerView object, indicating a location for whatever graphic element it represents in the client of the ruler view (for example, a margin or tab setting, or the edges of a graphic on the page). A ruler marker comprises three primary attributes: the image it displays on the ruler view, the location of that image, and the object it represents. The
setRepresentedObject: methods set each of these attributes, respectively. In addition, a ruler marker records an offset for the image, allowing it to be placed relative to the marker location much in the way a cursor’s hot spot relates a cursor image to the mouse location; the
setImageOrigin: method establishes this offset.
Most of these attributes are set upon initialization by the
initWithRulerView:markerLocation:image:imageOrigin: method. New ruler markers don’t have represented objects; the client typically establishes the represented object in its
rulerView:didAddMarker: method. A new ruler marker can be moved around in its ruler view, but not removed from it. The
setRemovable: methods alter these default settings.
Represented objects allow the ruler view's client to distinguish among different attributes of the selection. In the ruler view client methods, the client can retrieve the marker’s represented object to determine what attribute to alter. Generic attributes can be represented by string or other value objects, such as the edge names “Left”, “Right”, “Top”, and “Bottom”. Attributes already implemented as objects can be represented by those objects. For example, the text system records tab stops as
NSTextTab objects, which include the tab location and its alignment. When an
NSTextView object is the client view of a ruler, it simply makes the
NSTextTab objects the represented objects of the ruler markers.