ProjectManager 0.2
TextFinder.h
1#import <Foundation/NSObject.h>
2
3#define Forward YES
4#define Backward NO
5
6@interface TextFinder : NSObject {
7 NSString *findString;
8 id findTextField;
9 id replaceTextField;
10 id ignoreCaseButton;
11 id findNextButton;
12 id replaceAllScopeMatrix;
13 id statusField;
14 BOOL findStringChangedSinceLastPasteboardUpdate;
15 BOOL lastFindWasSuccessful; /* A bit of a kludge */
16}
17
18/* Common way to get a text finder. One instance of TextFinder per app is good enough. */
19+ (id)sharedInstance;
20
21/* Main method for external users; does a find in the first responder. Selects found range or beeps. */
22- (BOOL)find:(BOOL)direction;
23
24/* Loads UI lazily */
25- (NSPanel *)findPanel;
26
27/* Gets the first responder and returns it if it's an NSTextView */
28- (NSTextView *)textObjectToSearchIn;
29
30/* Get/set the current find string. Will update UI if UI is loaded */
31- (NSString *)findString;
32- (void)setFindString:(NSString *)string;
33
34/* Misc internal methods */
35- (void)appDidActivate:(NSNotification *)notification;
36- (void)addWillDeactivate:(NSNotification *)notification;
37- (void)loadFindStringFromPasteboard;
38- (void)loadFindStringToPasteboard;
39
40/* Methods sent from the find panel UI */
41- (void)findNext:(id)sender;
42- (void)findPrevious:(id)sender;
43- (void)findNextAndOrderFindPanelOut:(id)sender;
44- (void)replace:(id)sender;
45- (void)replaceAndFind:(id)sender;
46- (void)replaceAll:(id)sender;
47- (void)orderFrontFindPanel:(id)sender;
48
49@end
50
51
52@interface NSString (NSStringTextFinding)
53
54- (NSRange)findString:(NSString *)string selectedRange:(NSRange)selectedRange options:(unsigned)mask wrap:(BOOL)wrapFlag;
55
56@end
57
Definition TextFinder.h:6