Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOTextFieldHistoryManager(Private) Category Reference

Instance Methods

(void) - checkInvariant
 
(void) - maintainInvariant
 
(void) - moveHistoryCursorTo:fieldEditor:
 
(void) - moveHistoryCursorBy:fieldEditor:
 

Detailed Description

Definition at line 35 of file OOTextFieldHistoryManager.m.

Method Documentation

◆ checkInvariant

- (void) checkInvariant

Extends class OOTextFieldHistoryManager.

Definition at line 1 of file OOTextFieldHistoryManager.m.

145{
146 NSAssert(_history != nil && // History buffer must exist
147 _historyCurrSize == [_history count] && // Size must be correct
148 ((_historyCurrSize <= _historyMaxSize) || (_historyMaxSize == 0)) && // Size must be in bounds
149 _historyCursor <= _historyCurrSize + 1, // Cursor must be in bounds
150 @"Invalid history buffer state in OOTextFieldHistoryManager.");
151}
unsigned count
return nil

◆ maintainInvariant

- (void) maintainInvariant

Extends class OOTextFieldHistoryManager.

Definition at line 1 of file OOTextFieldHistoryManager.m.

155{
156 _historyCurrSize = [_history count];
157
158 if (_historyMaxSize && (_historyMaxSize < _historyCurrSize))
159 {
160 [_history removeObjectsInRange:NSMakeRange(0, _historyCurrSize - _historyMaxSize)];
161 _historyCurrSize = _historyMaxSize;
162 }
163
164 [self checkInvariant];
165}

◆ moveHistoryCursorBy:fieldEditor:

- (void) moveHistoryCursorBy: (NSInteger) offset
fieldEditor: (NSTextView *) fieldEditor 

Extends class OOTextFieldHistoryManager.

Definition at line 1 of file OOTextFieldHistoryManager.m.

203 :(NSInteger)offset fieldEditor:(NSTextView *)fieldEditor
204{
205 // Range check
206 if (((offset < 0) && (_historyCursor < (NSUInteger)-offset)) // Destination < 0
207 || (_historyCurrSize < (offset + _historyCursor))) // Destination > _historyCurrSize
208 {
209 NSBeep();
210 return;
211 }
212 [self moveHistoryCursorTo:_historyCursor + offset fieldEditor:fieldEditor];
213}
voidpf uLong offset
Definition ioapi.h:140

◆ moveHistoryCursorTo:fieldEditor:

- (void) moveHistoryCursorTo: (NSUInteger) newCursor
fieldEditor: (NSTextView *) fieldEditor 

Extends class OOTextFieldHistoryManager.

Definition at line 1 of file OOTextFieldHistoryManager.m.

168 :(NSUInteger)newCursor fieldEditor:(NSTextView *)fieldEditor
169{
170 NSString *value = nil;
171 NSTextStorage *textStorage = nil;
172
173 if (_historyCurrSize < newCursor)
174 {
175 NSBeep();
176 return;
177 }
178
179 [self checkInvariant];
180 textStorage = [fieldEditor textStorage];
181
182 if (newCursor > 0)
183 {
184 NSUInteger index = _historyCurrSize - newCursor;
185 value = [_history objectAtIndex:index];
186 if (_historyCursor == 0) _latest = [[textStorage string] copy];
187 }
188 else
189 {
190 value = [_latest autorelease];
191 _latest = nil;
192 }
193
194 _historyCursor = newCursor;
195
196 [textStorage setString:value];
197 [textField selectText:self];
198
199 [self checkInvariant];
200}

The documentation for this category was generated from the following file: