33 @global _CPSmartPboardType
39 - (BOOL)textShouldBeginEditing:(
CPText)aTextObject;
40 - (BOOL)textShouldEndEditing:(
CPText)aTextObject;
58 @
typedef CPTextMovement
70 @
typedef CPWritingDirection
75 @
typedef CPTextAlignment
117 - (void)setSelectable:(BOOL)flag
119 [
self willChangeValueForKey:@"selectable"];
120 _isSelectable = flag;
121 [
self didChangeValueForKey:@"selectable"];
127 - (void)setEditable:(BOOL)flag
129 [
self willChangeValueForKey:@"editable"];
131 [
self didChangeValueForKey:@"editable"];
137 - (void)changeFont:(
id)sender
139 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
142 - (void)copy:(
id)sender
146 if (selectedRange.length < 1)
152 [pasteboard declareTypes:[CPStringPboardType] owner:nil];
153 [pasteboard setString:[[
self stringValue] substringWithRange:selectedRange] forType:CPStringPboardType];
156 - (id)_plainStringForPasting
161 - (id)_stringForPasting
164 dataForPasting = [pasteboard stringForType:CPRTFPboardType],
165 stringForPasting = [pasteboard stringForType:CPStringPboardType];
167 if (dataForPasting || [stringForPasting hasPrefix:
"{\\rtf1\\ansi"])
168 stringForPasting = [[_CPRTFParser new] parseRTF:dataForPasting ? dataForPasting : stringForPasting];
170 if (![
self isRichText] && [stringForPasting isKindOfClass:[
CPAttributedString class]])
171 stringForPasting = stringForPasting._string;
173 return stringForPasting;
176 - (BOOL)_shouldUseSmartPasting
178 return parseInt([[
CPPasteboard generalPasteboard] stringForType:_CPSmartPboardType], 10) > 0 || NO;
181 - (void)paste:(
id)sender
183 var stringForPasting = [
self _stringForPasting];
185 if (stringForPasting)
186 [
self insertText:stringForPasting];
189 - (void)copyFont:(
id)sender
191 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
194 - (void)delete:(
id)sender
196 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
201 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
206 - (BOOL)isHorizontallyResizable
208 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
213 - (BOOL)isRulerVisible
215 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
220 - (BOOL)isVerticallyResizable
222 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
229 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
231 return CGSizeMake(0,0);
236 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
237 return CGSizeMake(0,0);
240 - (void)pasteFont:(
id)sender
242 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
245 - (void)replaceCharactersInRange:(CPRange)aRange withString:(
CPString)aString
247 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
250 - (void)scrollRangeToVisible:(CPRange)aRange
252 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
255 - (void)selectedAll:(
id)sender
257 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
260 - (CPRange)selectedRange
262 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
269 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
272 - (void)setFont:(
CPFont)aFont range:(CPRange)aRange
274 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
277 - (void)setHorizontallyResizable:(BOOL)flag
279 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
282 - (void)setMaxSize:(CGSize)aSize
284 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
287 - (void)setMinSize:(CGSize)aSize
289 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
297 - (void)setUsesFontPanel:(BOOL)flag
299 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
302 - (void)setVerticallyResizable:(BOOL)flag
304 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
309 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
314 - (void)underline:(
id)sender
316 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
319 - (BOOL)usesFontPanel
321 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
340 [
self setSelectable:[aCoder decodeBoolForKey:CPTextViewIsSelectableKey]];
341 [
self setEditable:[aCoder decodeBoolForKey:CPTextViewIsEditableKey]];
342 [
self setRichText:[aCoder decodeBoolForKey:CPTextViewIsRichTextKey]];
351 [aCoder encodeBool:_isEditable forKey:CPTextViewIsEditableKey];
352 [aCoder encodeBool:_isSelectable forKey:CPTextViewIsSelectableKey];
353 [aCoder encodeBool:_isRichText forKey:CPTextViewIsRichTextKey];
371 - (void)setEditable:(BOOL)aValue
373 _isEditable = aValue;
381 return _isSelectable;
387 - (void)setSelectable:(BOOL)aValue
389 _isSelectable = aValue;
403 - (void)setRichText:(BOOL)aValue
405 _isRichText = aValue;
CPTextViewDidChangeSelectionNotification
id initWithCoder:(CPCoder aCoder)
var CPTextViewIsSelectableKey
CPWritingDirectionRightToLeft
CPString stringForType:(CPString aType)
CPForegroundColorAttributeName
A mutable character string with attributes.
CPAttachmentAttributeName
An immutable string (collection of characters).
CPBackgroundColorAttributeName
void encodeWithCoder:(CPCoder aCoder)
CPTextMovement CPIllegalTextMovement
CPTextDidEndEditingNotification
A notification that can be posted to a CPNotificationCenter.
CPTextViewDidChangeTypingAttributesNotification
void setSelectable:(BOOL flag)
CPTextDidChangeNotification
CPUnderlineStyleAttributeName
CPWritingDirectionLeftToRight
Defines methods for use when archiving & restoring (enc/decoding).
CPParagraphSeparatorCharacter
CPSuperscriptAttributeName
CPTextAlignment CPLeftTextAlignment
CPCarriageReturnCharacter
CPBaselineOffsetAttributeName
CPTextDidBeginEditingNotification
var CPTextViewIsEditableKey
void setEditable:(BOOL flag)
CPWritingDirection CPWritingDirectionNatural
CPRange function CPMakeRange(location, length)
void replaceCharactersInRange:withString:(CPRange aRange, [withString] CPString aString)
void setRichText:(BOOL aValue)
var CPTextViewIsRichTextKey