-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWNTextView.m
39 lines (30 loc) · 1.7 KB
/
WNTextView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//---------------------------------------------------------------------------------------
// WNTextView.m created by erik on Sat 19-Sep-1998
// This code is part of the WordNet frontend by Erik Doernenburg. For copyright details
// see GNU public license version 2 or above. No warranties implied. Use at own risk.
// More information can be found at http://www.mulle-kybernetik.com/software/WordNet/.
//---------------------------------------------------------------------------------------
#import <AppKit/AppKit.h>
#import "WNTextView.h"
//=======================================================================================
@implementation WNTextView
//=======================================================================================
NSString *WNTextViewDoubleClickNotification = @"WNTextViewDoubleClickNotification";
//---------------------------------------------------------------------------------------
// MOUSE DOWN OVERRIDE
//---------------------------------------------------------------------------------------
- (void)mouseDown:(NSEvent *)theEvent
{
NSRange selRange;
NSString *selection;
[super mouseDown:theEvent];
if([theEvent clickCount] == 2)
{
selRange = [self selectedRange];
selection = [[[self textStorage] attributedSubstringFromRange:selRange] string];
[[NSNotificationCenter defaultCenter] postNotificationName:WNTextViewDoubleClickNotification object:self userInfo:[NSDictionary dictionaryWithObject:selection forKey:@"selection"]];
}
}
//=======================================================================================
@end
//=======================================================================================