Mac Developer Library

Developer

AppKit Framework Reference NSRulerMarkerClientViewDelegation Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSRulerMarkerClientViewDelegation

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

NSRulerMarkerClientViewDelegation defines the interface for a ruler to allow a delegate to influence its behavior.

  • Requests permission for aRulerView to move aMarker.

    Declaration

    Swift

    func rulerView(_ ruler: NSRulerView, shouldMoveMarker marker: NSRulerMarker) -> Bool

    Objective-C

    - (BOOL)rulerView:(NSRulerView *)ruler shouldMoveMarker:(NSRulerMarker *)marker

    Discussion

    If the client returns YEStrue the ruler view allows the user to move the marker; if the client returns NOfalse the marker doesn’t move.

    The user’s ability to move a marker is typically set on the marker itself, using NSRulerMarker’s setMovable: method. You should use this client view method only when the marker’s movability can vary depending on a variable condition (for example, if graphic items can be locked down to prevent them from being inadvertently moved).

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the client that aRulerView will move aMarker, an NSRulerMarker already on the ruler view.

    Declaration

    Swift

    func rulerView(_ ruler: NSRulerView, willMoveMarker marker: NSRulerMarker, toLocation location: CGFloat) -> CGFloat

    Objective-C

    - (CGFloat)rulerView:(NSRulerView *)ruler willMoveMarker:(NSRulerMarker *)marker toLocation:(CGFloat)location

    Discussion

    location is the marker’s tentative new location, expressed in the client view’s coordinate system. The value returned by the client view is actually used; the client can simply return location unchanged or adjust it as needed. For example, it may snap the location to a grid. This message is sent repeatedly to the client as the user drags the marker.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the client that aRulerView allowed the user to move aMarker.

    Declaration

    Swift

    func rulerView(_ ruler: NSRulerView, didMoveMarker marker: NSRulerMarker)

    Objective-C

    - (void)rulerView:(NSRulerView *)ruler didMoveMarker:(NSRulerMarker *)marker

    Discussion

    The client can take whatever action it needs based on this message, such as updating the location of a tab stop in the selected paragraph, moving a layout guideline, or resizing a graphics element.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – representedObject (NSRulerMarker)
    – markerLocation (NSRulerMarker)

  • Requests permission for aRulerView to remove aMarker.

    Declaration

    Swift

    func rulerView(_ ruler: NSRulerView, shouldRemoveMarker marker: NSRulerMarker) -> Bool

    Objective-C

    - (BOOL)rulerView:(NSRulerView *)ruler shouldRemoveMarker:(NSRulerMarker *)marker

    Discussion

    If the client returns YEStrue the ruler view allows the user to remove the marker; if the client returns NOfalse the marker is kept pinned to the ruler’s baseline. This message is sent as many times as needed while the user drags the marker.

    The user’s ability to remove a marker is typically set on the marker itself, using NSRulerMarker’s setRemovable: method. You should use this client view method only when the marker’s removability can vary while the user drags it (for example, if the user must press the Shift key to remove a marker).

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the client that aRulerView allowed the user to remove aMarker.

    Declaration

    Swift

    func rulerView(_ ruler: NSRulerView, didRemoveMarker marker: NSRulerMarker)

    Objective-C

    - (void)rulerView:(NSRulerView *)ruler didRemoveMarker:(NSRulerMarker *)marker

    Discussion

    The client can take whatever action it needs based on this message, such as deleting a tab stop from the paragraph style or removing a layout guideline.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – representedObject (NSRulerMarker)

  • Informs the client that the user has pressed the mouse button while the cursor is in the ruler area of aRulerView.

    Declaration

    Swift

    func rulerView(_ ruler: NSRulerView, handleMouseDown event: NSEvent)

    Objective-C

    - (void)rulerView:(NSRulerView *)ruler handleMouseDown:(NSEvent *)event

    Discussion

    theEvent is the mouse-down event that triggered the message. The client view can implement this method to perform an action such as adding a new marker using trackMarker:withMouseEvent: or adding layout guidelines.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the client view that aRulerView is about to be appropriated by newClient.

    Declaration

    Swift

    func rulerView(_ ruler: NSRulerView, willSetClientView newClient: NSView)

    Objective-C

    - (void)rulerView:(NSRulerView *)ruler willSetClientView:(NSView *)newClient

    Discussion

    The client view can use this opportunity to clear any cached information related to the ruler.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.