-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMyTableView.m
37 lines (31 loc) · 942 Bytes
/
MyTableView.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
//
// MyTableView.m
// Notification Watcher
//
// Created by Kevin Ballard on Tue Mar 16 2004.
// Copyright (c) 2004 TildeSoft. All rights reserved.
//
#import "MyTableView.h"
@implementation MyTableView
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
if (isLocal) {
return NSDragOperationMove;
} else {
return NSDragOperationCopy;
}
}
- (IBAction)copy:(id __unused)sender
{
NSPasteboard *pb = [NSPasteboard generalPasteboard];
[[self dataSource] tableView:self writeRowsWithIndexes:[self selectedRowIndexes] toPasteboard:pb];
}
- (BOOL)becomeFirstResponder
{
NSNotification *pseudoNotification = [NSNotification
notificationWithName:NSTableViewSelectionDidChangeNotification
object:self];
[[NSNotificationCenter defaultCenter] postNotification:pseudoNotification];
return [super becomeFirstResponder];
}
@end