INDSequentialTextSelectionManager.h 1.53 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
//
//  INDSequentialTextSelectionManager.h
//  INDSequentialTextSelectionManager
//
//  Created by Indragie Karunaratne on 2014-03-02.
//  Copyright (c) 2014 Indragie Karunaratne. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>

typedef NSAttributedString * (^INDAttributedTextTransformationBlock)(NSAttributedString *);

/**
 *  Coordinates sequential text selection among an arbitrary set of `NSTextView`s
 */
@interface INDSequentialTextSelectionManager : NSResponder

/**
 *  Registers a text view to participate in sequential selection.
 *
 *  @param textView   The `NSTextView` instance to register.
 *  @param identifier The unique identifier to associate with the text view instance.
 */
- (void)registerTextView:(NSTextView *)textView withUniqueIdentifier:(NSString *)identifier;

/**
 *  Registers a text view to participate in sequential selection.
 *
 *  @param textView   The `NSTextView` instance to register.
 *  @param identifier The unique identifier to associate with the text view instance.
 *  @param block      A transformation block to apply to the contents of the text view
 *  before copying the text.
 */
- (void)registerTextView:(NSTextView *)textView withUniqueIdentifier:(NSString *)identifier transformationBlock:(INDAttributedTextTransformationBlock)block;

/**
 *  Unregisters a text view for sequential text selection.
 *
 *  @param textView The text view to unregister.
 */
- (void)unregisterTextView:(NSTextView *)textView;

/**
 *  Unregisters all text views.
 */
- (void)unregisterAllTextViews;

@end