FoundationExtension
FoundationExtension is common Foundation/UIKit/Cocoa shortcuts and snippets collection.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
NSAttributedString+Cocoa.h
Go to the documentation of this file.
1 //
2 // NSAttributedString+Cocoa.h
3 // FoundationExtension
4 //
5 // Created by Jeong YunWon on 12. 10. 31..
6 // Copyright (c) 2012 youknowone.org. All rights reserved.
7 //
8 
18 #import <Cocoa/Cocoa.h>
20 
26 enum {
28  NSLigatureStandard = 1, // default
30 };
36 typedef NSUInteger NSLigatureType;
37 
38 #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101100
39 typedef NSInteger NSUnderlineStyle; // Only type is required
40 
41 #define NSTextAlignmentLeft NSLeftTextAlignment
42 #define NSTextAlignmentRight NSRightTextAlignment
43 #define NSTextAlignmentCenter NSCenterTextAlignment
44 #define NSTextAlignmentJustified NSJustifiedTextAlignment
45 #define NSTextAlignmentNatural NSNaturalTextAlignment
46 
47 typedef NSInteger NSWritingDirectionFormatType;
48 #define NSWritingDirectionEmbedding kCTWritingDirectionEmbedding
49 #define NSWritingDirectionOverride kCTWritingDirectionOverride
50 
51 #endif
52 
59 enum {
60  NSWritingDirectionAttributeLRE = 1 << (NSWritingDirectionLeftToRight | NSWritingDirectionEmbedding),
61  NSWritingDirectionAttributeRLE = 1 << (NSWritingDirectionRightToLeft | NSWritingDirectionEmbedding),
62  NSWritingDirectionAttributeLRO = 1 << (NSWritingDirectionLeftToRight | NSWritingDirectionOverride),
63  NSWritingDirectionAttributeRLO = 1 << (NSWritingDirectionRightToLeft | NSWritingDirectionOverride),
64 };
70 typedef NSUInteger NSWritingDirectionAttributes;
71 
77 enum {
80 };
86 typedef NSUInteger NSVerticalGlyphForm;
87 
88 
93 
97 - (void)addAttributeWritingDirectionArray:(NSArray *)writingDirectionArray range:(NSRange)range NS_AVAILABLE_MAC(10_6);
98 
99 
104 - (void)addAttributeFont:(NSFont *)font range:(NSRange)range;
109 - (void)removeAttributeFontFromRange:(NSRange)range;
110 
115 - (void)addAttributeParagraphStyle:(NSParagraphStyle *)paragraphStyle range:(NSRange)range;
120 - (void)removeAttributeParagraphStyleFromRange:(NSRange)range;
121 
126 - (void)addAttributeForegroundColor:(NSColor *)foregroundColor range:(NSRange)range;
131 - (void)removeAttributeForegroundColorFromRange:(NSRange)range;
132 
137 - (void)addAttributeUnderlineStyle:(NSUnderlineStyle)underlineStyle range:(NSRange)range;
142 - (void)removeAttributeUnderlineStyleFromRange:(NSRange)range;
143 
148 - (void)addAttributeSuperscript:(BOOL)superscript range:(NSRange)range;
153 - (void)removeAttributeSuperscriptFromRange:(NSRange)range;
154 
159 - (void)addAttributeBackgroundColor:(NSColor *)backgroundColor range:(NSRange)range;
164 - (void)removeAttributeBackgroundColorFromRange:(NSRange)range;
165 
170 - (void)addAttributeAttachment:(NSTextAttachment *)attachment range:(NSRange)range;
175 - (void)removeAttributeAttachmentFromRange:(NSRange)range;
176 
181 - (void)addAttributeLigature:(NSLigatureType)ligature range:(NSRange)range;
186 - (void)removeAttributeLigatureFromRange:(NSRange)range;
187 
192 - (void)addAttributeBaselineOffset:(float)baselineOffset range:(NSRange)range;
197 - (void)removeAttributeBaselineOffsetFromRange:(NSRange)range;
198 
203 - (void)addAttributeKern:(float)kern range:(NSRange)range;
208 - (void)removeAttributeKernFromRange:(NSRange)range;
209 
214 - (void)addAttributeLink:(NSURL *)link range:(NSRange)range;
219 - (void)removeAttributeLinkFromRange:(NSRange)range;
220 
225 - (void)addAttributeStrokeWidth:(float)strokeWidth range:(NSRange)range;
230 - (void)removeAttributeStrokeWidthFromRange:(NSRange)range;
231 
236 - (void)addAttributeStrokeColor:(NSColor *)strokeColor range:(NSRange)range;
241 - (void)removeAttributeStrokeColorFromRange:(NSRange)range;
242 
247 - (void)addAttributeUnderlineColor:(NSColor *)underlineColor range:(NSRange)range;
252 - (void)removeAttributeUnderlineColorFromRange:(NSRange)range;
253 
258 - (void)addAttributeStrikethroughStyle:(NSUnderlineStyle)strikethroughStyle range:(NSRange)range;
263 - (void)removeAttributeStrikethroughStyleFromRange:(NSRange)range;
264 
269 - (void)addAttributeStrikethroughColor:(NSColor *)strikethroughColor range:(NSRange)range;
274 - (void)removeAttributeStrikethroughColorFromRange:(NSRange)range;
275 
280 - (void)addAttributeShadow:(NSShadow *)shadow range:(NSRange)range;
285 - (void)removeAttributeShadowFromRange:(NSRange)range;
286 
291 - (void)addAttributeObliqueness:(float)obliqueness range:(NSRange)range;
296 - (void)removeAttributeObliquenessFromRange:(NSRange)range;
297 
302 - (void)addAttributeExpansion:(float)expansion range:(NSRange)range;
307 - (void)removeAttributeExpansionFromRange:(NSRange)range;
308 
313 - (void)addAttributeCursor:(NSCursor *)cursor range:(NSRange)range;
318 - (void)removeAttributeCursorFromRange:(NSRange)range;
319 
324 - (void)addAttributeToolTip:(NSString *)toolTip range:(NSRange)range;
329 - (void)removeAttributeToolTipFromRange:(NSRange)range;
330 
331 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
332 
336 - (void)addAttributeMarkedClauseSegment:(NSInteger)markedClauseSegment range:(NSRange)range NS_AVAILABLE_MAC(10_5);
341 - (void)removeAttributeMarkedClauseSegmentFromRange:(NSRange)range NS_AVAILABLE_MAC(10_5);
342 #endif
343 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
344 
348 - (void)addAttributeWritingDirection:(NSWritingDirectionAttributes)writingDirection range:(NSRange)range NS_AVAILABLE_MAC(10_6);
353 - (void)removeAttributeWritingDirectionFromRange:(NSRange)range NS_AVAILABLE_MAC(10_6);
354 #endif
355 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
356 
360 - (void)addAttributeVerticalGlyphForm:(NSVerticalGlyphForm)verticalGlyphForm range:(NSRange)range NS_AVAILABLE_MAC(10_7);
365 - (void)removeAttributeVerticalGlyphFormFromRange:(NSRange)range NS_AVAILABLE_MAC(10_7);
366 #endif
367 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
368 
372 - (void)addAttributeTextAlternatives:(NSTextAlternatives *)textAlternatives range:(NSRange)range NS_AVAILABLE_MAC(10_8);
377 - (void)removeAttributeTextAlternativesFromRange:(NSRange)range NS_AVAILABLE_MAC(10_8);
378 #endif
379 
380 @end
381 
382 
391 
396 @property(strong) NSFont *font;
401 @property(strong) NSParagraphStyle *paragraphStyle;
406 @property(strong) NSColor *foregroundColor;
411 @property(strong) NSNumber *underlineStyleNumber;
416 @property(assign) NSUnderlineStyle underlineStyle;
421 @property(strong) NSNumber *superscriptNumber;
426 @property(assign) BOOL superscript;
431 @property(strong) NSColor *backgroundColor;
436 @property(strong) NSTextAttachment *attachment;
441 @property(strong) NSNumber *ligatureNumber;
446 @property(assign) NSLigatureType ligature;
451 @property(strong) NSNumber *baselineOffsetNumber;
456 @property(assign) float baselineOffset;
461 @property(strong) NSNumber *kernNumber;
466 @property(assign) float kern;
471 @property(strong) NSURL *link;
476 @property(strong) NSNumber *strokeWidthNumber;
481 @property(assign) float strokeWidth;
486 @property(strong) NSColor *strokeColor;
491 @property(strong) NSColor *underlineColor;
496 @property(strong) NSNumber *strikethroughStyleNumber;
501 @property(assign) NSUnderlineStyle strikethroughStyle;
506 @property(strong) NSColor *strikethroughColor;
511 @property(strong) NSShadow *shadow;
516 @property(strong) NSNumber *obliquenessNumber;
521 @property(assign) float obliqueness;
526 @property(strong) NSNumber *expansionNumber;
531 @property(assign) float expansion;
536 @property(strong) NSCursor *cursor;
541 @property(strong) NSString *toolTip;
542 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
543 
547 @property(strong) NSNumber *markedClauseSegmentNumber NS_AVAILABLE_MAC(10_5);
548 #endif
549 
550 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
551 
555 @property(assign) NSInteger markedClauseSegment NS_AVAILABLE_MAC(10_5);
556 #endif
557 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
558 
562 @property(strong) NSArray *writingDirectionArray NS_AVAILABLE_MAC(10_6);
563 #endif
564 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
565 
569 @property(assign) NSWritingDirectionAttributes writingDirection NS_AVAILABLE_MAC(10_6);
570 #endif
571 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
572 
576 @property(strong) NSNumber *verticalGlyphFormNumber NS_AVAILABLE_MAC(10_7);
577 #endif
578 
579 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
580 
584 @property(assign) NSVerticalGlyphForm verticalGlyphForm NS_AVAILABLE_MAC(10_7);
585 #endif
586 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
587 
591 @property(strong) NSTextAlternatives *textAlternatives NS_AVAILABLE_MAC(10_8);
592 #endif
593 @end
594 
NSInteger NSWritingDirectionFormatType
Definition: NSAttributedString+Cocoa.h:47
NSMutableDictionary subclass-available implementation.
Definition: NSADictionary.h:32
NSUInteger NSVerticalGlyphForm
Type for vertical glyph form.
Definition: NSAttributedString+Cocoa.h:86
Definition: NSAttributedString+Cocoa.h:78
Dictionary with easy attribute interface.
Definition: NSAttributedString+Cocoa.h:92
Definition: NSAttributedString+Cocoa.h:29
See CoreFoundation-Subclass for concept of these objects.
Definition: NSAttributedString+Cocoa.h:28
Definition: NSAttributedString+Cocoa.h:63
Definition: NSAttributedString+Cocoa.h:60
NSMutableAttributedString attributes dictionary.
Definition: NSAttributedString+Cocoa.h:390
Definition: NSAttributedString+Cocoa.h:79
NSUInteger NSWritingDirectionAttributes
Type for writing direction.
Definition: NSAttributedString+Cocoa.h:70
NSInteger NSUnderlineStyle
Definition: NSAttributedString+Cocoa.h:39
NSUInteger NSLigatureType
Type for ligature style.
Definition: NSAttributedString+Cocoa.h:36
#define NSWritingDirectionOverride
Definition: NSAttributedString+Cocoa.h:49
Definition: NSAttributedString+Cocoa.h:61
Definition: NSAttributedString+Cocoa.h:62
#define NSWritingDirectionEmbedding
Definition: NSAttributedString+Cocoa.h:48
Definition: NSAttributedString+Cocoa.h:27