Mercurial > dwindows
comparison mac/dw.m @ 888:cd6ff038e38b
Implemented dw_mle_search on Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 07 Apr 2011 19:17:52 +0000 |
parents | 29d8ae25a78c |
children | 5a96cc2695b9 |
comparison
equal
deleted
inserted
replaced
887:29d8ae25a78c | 888:cd6ff038e38b |
---|---|
4139 * point: Start point of search. | 4139 * point: Start point of search. |
4140 * flags: Search specific flags. | 4140 * flags: Search specific flags. |
4141 */ | 4141 */ |
4142 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags) | 4142 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags) |
4143 { | 4143 { |
4144 NSLog(@"dw_mle_search() unimplemented\n"); | 4144 NSScrollView *sv = handle; |
4145 return 0; | 4145 DWMLE *mle = [sv documentView]; |
4146 NSTextStorage *ts = [mle textStorage]; | |
4147 NSMutableString *ms = [ts mutableString]; | |
4148 NSString *searchForMe = [NSString stringWithUTF8String:text]; | |
4149 NSRange searchRange = NSMakeRange(point, [ms length] - point); | |
4150 NSRange range = NSMakeRange(NSNotFound, 0); | |
4151 NSUInteger options = flags ? flags : NSCaseInsensitiveSearch; | |
4152 | |
4153 if(ms) | |
4154 { | |
4155 range = [ms rangeOfString:searchForMe options:options range:searchRange]; | |
4156 } | |
4157 | |
4158 if(range.location != NSNotFound) | |
4159 { | |
4160 return -1; | |
4161 } | |
4162 return (int)range.location; | |
4146 } | 4163 } |
4147 | 4164 |
4148 /* | 4165 /* |
4149 * Stops redrawing of an MLE box. | 4166 * Stops redrawing of an MLE box. |
4150 * Parameters: | 4167 * Parameters: |