//
//  GSTextStorage.h
//  FunTextField
//
//  Created by Yung-Luen Lan on 6/24/08.
//  Copyright 2008 yllan.org. All rights reserved.
//

static NSString *const GSFontAttrib = @"GSFontAttrib";
static NSString *const GSLayerIdAttrib = @"GSLayerIdAttrib";
static NSString *const GSShowBackgroundAttrib = @"GSShowBackgroundAttrib";

@interface GSTextStorage : NSObject

+ (GSTextStorage *)textStorage;

/// ----------------------------------------------------------------------------
/// @name Managing Text
/// ----------------------------------------------------------------------------

// TODO: Make the receiver a subclass of NSMutableAttributedString, just like NSTextStorage?
@property (strong, nonatomic) NSMutableAttributedString *text;

/// ----------------------------------------------------------------------------
/// @name Replacing Text
/// ----------------------------------------------------------------------------

/**
 @note It is preferable to send this message to GSGlyphEditView instead as it now handles the selection.
 */
- (void)replaceCharactersInRange:(NSRange)aRange withString:(id)aString;

- (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement;

/// ----------------------------------------------------------------------------
/// @name Managing Composed Character Sequences
/// ----------------------------------------------------------------------------

- (NSRange)rangeOfComposedCharacterSequencesForRange:(NSRange)range;

- (NSRange)rangeOfComposedCharacterSequenceAtIndex:(NSUInteger)idx;

@end
