My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
Changes to /AppKit/NSTextView.subproj/NSTextView.h
e5277a40a7e8 vs. 2470bd80abf4 Compare: vs.  Format:
Revision 2470bd80abf4
Go to: 
Project members, sign in to write a code review
/AppKit/NSTextView.subproj/NSTextView.h   e5277a40a7e8 /AppKit/NSTextView.subproj/NSTextView.h   2470bd80abf4
1 /* Copyright (c) 2006 Christopher J. W. Lloyd 1 /* Copyright (c) 2006-2007 Christopher J. W. Lloyd
2 2
3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 4
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 6
7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
8 8
9 #import <AppKit/NSText.h> 9 #import <AppKit/NSText.h>
10 10
11 @class NSTextStorage, NSLayoutManager, NSTextContainer, NSUndoManager; 11 @class NSTextStorage, NSLayoutManager, NSTextContainer, NSUndoManager;
12 @class NSRulerView, NSRulerMarker; 12 @class NSRulerView, NSRulerMarker;
13 13
14 typedef enum { 14 typedef enum {
15 NSSelectByCharacter, 15 NSSelectByCharacter,
16 NSSelectByWord, 16 NSSelectByWord,
17 NSSelectByParagraph 17 NSSelectByParagraph
18 } NSSelectionGranularity; 18 } NSSelectionGranularity;
19 19
20 typedef enum { 20 typedef enum {
21 NSSelectionAffinityUpstream, 21 NSSelectionAffinityUpstream,
22 NSSelectionAffinityDownstream, 22 NSSelectionAffinityDownstream,
23 } NSSelectionAffinity; 23 } NSSelectionAffinity;
24 24
25 @interface NSTextView : NSText { 25 @interface NSTextView : NSText {
26 NSTextStorage *_textStorage; 26 NSTextStorage *_textStorage;
27 NSTextContainer *_textContainer; 27 NSTextContainer *_textContainer;
28 NSSize _textContainerInset; 28 NSSize _textContainerInset;
29 BOOL _ownsTextStorage; 29 BOOL _ownsTextStorage;
30 NSDictionary *_typingAttributes; 30 NSDictionary *_typingAttributes;
31 31
32 id _delegate; 32 id _delegate;
33 BOOL _isEditable; 33 BOOL _isEditable;
34 BOOL _isSelectable; 34 BOOL _isSelectable;
35 BOOL _isRichText; 35 BOOL _isRichText;
36 NSColor *_backgroundColor; 36 NSColor *_backgroundColor;
37 BOOL _drawsBackground; 37 BOOL _drawsBackground;
38 NSFont *_font; 38 NSFont *_font;
39 NSColor *_textColor; 39 NSColor *_textColor;
40 NSTextAlignment _textAlignment; 40 NSTextAlignment _textAlignment;
41 41
42 NSColor *_insertionPointColor; 42 NSColor *_insertionPointColor;
43 NSRect _insertionPointRect; 43 NSRect _insertionPointRect;
44 BOOL _insertionPointOn; 44 BOOL _insertionPointOn;
45 NSTimer *_insertionPointTimer; 45 NSTimer *_insertionPointTimer;
46 46
47 BOOL _isFieldEditor; 47 BOOL _isFieldEditor;
48 NSSize _maxSize; 48 NSSize _maxSize;
49 BOOL _isHorizontallyResizable; 49 BOOL _isHorizontallyResizable;
50 BOOL _isVerticallyResizable; 50 BOOL _isVerticallyResizable;
51 BOOL _usesRuler; 51 BOOL _usesRuler;
52 BOOL _rulerVisible; 52 BOOL _rulerVisible;
53 BOOL _allowsUndo; 53 BOOL _allowsUndo;
54 54
55 NSRange _selectedRange; 55 NSRange _selectedRange;
56 NSSelectionAffinity _selectionAffinity; 56 NSSelectionAffinity _selectionAffinity;
57 NSSelectionGranularity _selectionGranularity; 57 NSSelectionGranularity _selectionGranularity;
58 NSDictionary *_selectedTextAttributes; 58 NSDictionary *_selectedTextAttributes;
59 59
60 int _textMovement; 60 int _textMovement;
61 unsigned _selectionOrigin; // for keyboard selection sanity. 61 unsigned _selectionOrigin; // for keyboard selection sanity.
62 id _killBuffer; // NSString for Emacs-style, NSMutableString for additive 62 id _killBuffer; // NSString for Emacs-style, NSMutableString for additive
63 BOOL _killBufferIsAdditive; // .. additive == pine/pico style, but possible memory hog 63 BOOL _killBufferIsAdditive; // .. additive == pine/pico style, but possible memory hog
64 64
65 NSRange _rangeForUserCompletion; // range of original user completion text. 65 NSRange _rangeForUserCompletion; // range of original user completion text.
66 NSString *_userCompletionHint; // original "hint" text which started completion 66 NSString *_userCompletionHint; // original "hint" text which started completion
67 NSArray *_userCompletions; // current list of completions. shouldn't change while modal 67 NSArray *_userCompletions; // current list of completions. shouldn't change while modal
68 int _userCompletionSelectedItem; // index within completion array 68 int _userCompletionSelectedItem; // index within completion array
69 } 69 }
70 70
71 -initWithFrame:(NSRect)frame textContainer:(NSTextContainer *)container; 71 -initWithFrame:(NSRect)frame textContainer:(NSTextContainer *)container;
72 72
73 -initWithFrame:(NSRect)frame; 73 -initWithFrame:(NSRect)frame;
74 74
75 -(NSTextContainer *)textContainer; 75 -(NSTextContainer *)textContainer;
76 76
77 -(NSSize)textContainerInset; 77 -(NSSize)textContainerInset;
78 -(NSPoint)textContainerOrigin; 78 -(NSPoint)textContainerOrigin;
79 79
80 -(NSLayoutManager *)layoutManager; 80 -(NSLayoutManager *)layoutManager;
81 -(NSTextStorage *)textStorage; 81 -(NSTextStorage *)textStorage;
82 82
83 -(BOOL)usesRuler; 83 -(BOOL)usesRuler;
84 -(BOOL)isRulerVisible; 84 -(BOOL)isRulerVisible;
85 -(BOOL)allowsUndo; 85 -(BOOL)allowsUndo;
86 -(NSColor *)insertionPointColor; 86 -(NSColor *)insertionPointColor;
87 -(NSDictionary *)typingAttributes; 87 -(NSDictionary *)typingAttributes;
88 -(NSDictionary *)selectedTextAttributes; 88 -(NSDictionary *)selectedTextAttributes;
89 89
90 -(void)setTextContainer:(NSTextContainer *)container; 90 -(void)setTextContainer:(NSTextContainer *)container;
91 -(void)setTextContainerInset:(NSSize)size; 91 -(void)setTextContainerInset:(NSSize)size;
92 92
93 -(void)setUsesRuler:(BOOL)flag; 93 -(void)setUsesRuler:(BOOL)flag;
94 -(void)setRulerVisible:(BOOL)flag; 94 -(void)setRulerVisible:(BOOL)flag;
95 -(void)setAllowsUndo:(BOOL)flag; 95 -(void)setAllowsUndo:(BOOL)flag;
96 -(void)setInsertionPointColor:(NSColor *)color; 96 -(void)setInsertionPointColor:(NSColor *)color;
97 -(void)setTypingAttributes:(NSDictionary *)attributes; 97 -(void)setTypingAttributes:(NSDictionary *)attributes;
98 -(void)setSelectedTextAttributes:(NSDictionary *)attributes; 98 -(void)setSelectedTextAttributes:(NSDictionary *)attributes;
99 99
100 -(NSRange)selectionRangeForProposedRange:(NSRange)range granularity:(NSSelectionGranularity)granularity; 100 -(NSRange)selectionRangeForProposedRange:(NSRange)range granularity:(NSSelectionGranularity)granularity;
101 101
102 -(void)setSelectedRange:(NSRange)range affinity:(NSSelectionAffinity)affinity stillSelecting:(BOOL)stillSelecting; 102 -(void)setSelectedRange:(NSRange)range affinity:(NSSelectionAffinity)affinity stillSelecting:(BOOL)stillSelecting;
103 103
104 -(NSRange)rangeForUserCompletion; 104 -(NSRange)rangeForUserCompletion;
105 -(NSArray *)completionsForPartialWordRange:(NSRange)range indexOfSelectedItem:(int *)index; 105 -(NSArray *)completionsForPartialWordRange:(NSRange)range indexOfSelectedItem:(int *)index;
106 -(void)insertCompletion:(NSString *)string forPartialWordRange:(NSRange)range movement:(int)movement isFinal:(BOOL)isFinal; 106 -(void)insertCompletion:(NSString *)string forPartialWordRange:(NSRange)range movement:(int)movement isFinal:(BOOL)isFinal;
107 107
108 -(NSArray *)writablePasteboardTypes; 108 -(NSArray *)writablePasteboardTypes;
109 -(BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard type:(NSString *)type; 109 -(BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard type:(NSString *)type;
110 -(BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types; 110 -(BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types;
111 111
112 -(NSRange)rangeForUserTextChange; 112 -(NSRange)rangeForUserTextChange;
113 -(NSRange)rangeForUserCharacterAttributeChange; 113 -(NSRange)rangeForUserCharacterAttributeChange;
114 -(NSRange)rangeForUserParagraphAttributeChange; 114 -(NSRange)rangeForUserParagraphAttributeChange;
115 115
116 -(BOOL)shouldChangeTextInRange:(NSRange)changeInRange replacementString:(NSString *)replacementString; 116 -(BOOL)shouldChangeTextInRange:(NSRange)changeInRange replacementString:(NSString *)replacementString;
117 -(void)didChangeText; 117 -(void)didChangeText;
118 118
119 -(BOOL)shouldDrawInsertionPoint; 119 -(BOOL)shouldDrawInsertionPoint;
120 -(void)drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)turnedOn; 120 -(void)drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)turnedOn;
121 -(void)updateInsertionPointStateAndRestartTimer:(BOOL)restart; 121 -(void)updateInsertionPointStateAndRestartTimer:(BOOL)restart;
122 122
123 -(void)updateRuler; 123 -(void)updateRuler;
124 124
125 -(void)cut:sender; 125 -(void)cut:sender;
126 -(void)copy:sender; 126 -(void)copy:sender;
127 -(void)paste:sender; 127 -(void)paste:sender;
128 -(void)selectAll:sender; 128 -(void)selectAll:sender;
129 129
130 -(void)moveLeft:sender; 130 -(void)moveLeft:sender;
131 -(void)moveRight:sender; 131 -(void)moveRight:sender;
132 -(void)moveForward:sender; 132 -(void)moveForward:sender;
133 -(void)moveBackward:sender; 133 -(void)moveBackward:sender;
134 -(void)moveToBeginningOfLine:sender; 134 -(void)moveToBeginningOfLine:sender;
135 -(void)moveToEndOfLine:sender; 135 -(void)moveToEndOfLine:sender;
136 136
137 -(void)deleteForward:sender; 137 -(void)deleteForward:sender;
138 -(void)deleteBackward:sender; 138 -(void)deleteBackward:sender;
139 139
140 -(void)pageUp:sender; 140 -(void)pageUp:sender;
141 -(void)pageDown:sender; 141 -(void)pageDown:sender;
142 142
143 @end 143 @end
144 144
145 @interface NSObject(NSTextView_undoManager) 145 @interface NSObject(NSTextView_undoManager)
146 -(NSUndoManager *)undoManagerForTextView:(NSTextView *)textView; 146 -(NSUndoManager *)undoManagerForTextView:(NSTextView *)textView;
147 @end 147 @end
148 148
149 // introduced to override arrow keys for keyboard UI, dwy 149 // introduced to override arrow keys for keyboard UI, dwy
150 @interface NSObject(NSTextView_delegate) 150 @interface NSObject(NSTextView_delegate)
151 -(BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)selector; 151 -(BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)selector;
152 -(NSArray *)textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)range indexOfSelectedItem:(int *)index; 152 -(NSArray *)textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)range indexOfSelectedItem:(int *)index;
153 @end 153 @end
Powered by Google Project Hosting