* Source/GSCharacterPanel.m: Double click inserts character into

main window


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33474 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-07-07 07:14:49 +00:00
parent 1c87001866
commit 845ed11c17
2 changed files with 22 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2011-07-07 Eric Wasylishen <ewasylishen@gmail.com>
* Source/GSCharacterPanel.m: Double click inserts character into
main window
2011-07-07 Eric Wasylishen <ewasylishen@gmail.com>
* Source/GSCharacterPanel.m (-characterForRow:): Fix off-by-1 error

View file

@ -31,6 +31,7 @@
#import <Foundation/NSIndexSet.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSAutoreleasePool.h>
#import "AppKit/NSApplication.h"
#import "AppKit/NSStringDrawing.h"
#import "AppKit/NSPasteboard.h"
#import "AppKit/NSTableView.h"
@ -186,6 +187,8 @@ static NSIndexSet *CodepointsWithNameContainingSubstring(NSString *str)
[table setRowHeight: 32];
[table setDataSource: self];
[table setDelegate: self];
[table setTarget: self];
[table setDoubleAction: @selector(doubleClickRow:)];
// Allow dragging out of the application
[table setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO];
@ -273,6 +276,20 @@ static NSIndexSet *CodepointsWithNameContainingSubstring(NSString *str)
return @"";
}
- (void) doubleClickRow: (id)sender
{
NSWindow *mainWindow = [NSApp mainWindow];
NSResponder *firstResponder = [mainWindow firstResponder];
NSString *str = [self characterForRow: [table clickedRow]];
[firstResponder insertText: str];
}
- (BOOL) tableView: (NSTableView *)aTable shouldEditTableColumn: (NSTableColumn *)aColumn row: (NSInteger)row
{
return NO;
}
// NSTableViewDataSource protocol
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView