2001-10-19 19:41:13 +00:00
|
|
|
#import "OutlineViewDelegate.h"
|
2002-02-07 03:45:43 +00:00
|
|
|
#import "ResourceNameCell.h"
|
2002-02-12 04:01:47 +00:00
|
|
|
#import "Resource.h"
|
2002-04-27 18:17:47 +00:00
|
|
|
#import "ApplicationDelegate.h"
|
2001-10-19 19:41:13 +00:00
|
|
|
|
|
|
|
@implementation OutlineViewDelegate
|
|
|
|
|
2002-03-31 12:00:02 +00:00
|
|
|
- (void)tableView:(NSTableView*)tableView didClickTableColumn:(NSTableColumn *)tableColumn
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2001-10-19 19:41:13 +00:00
|
|
|
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
|
|
|
{
|
2002-04-27 18:17:47 +00:00
|
|
|
int row = [outlineView rowForItem:item];
|
2002-02-23 03:40:24 +00:00
|
|
|
NSString *identifier = [tableColumn identifier];
|
|
|
|
if( [identifier isEqualToString:@"name"] ) [cell setFormatter:nameFormatter];
|
|
|
|
else if( [identifier isEqualToString:@"size"] ) [cell setFormatter:sizeFormatter];
|
|
|
|
else if( [identifier isEqualToString:@"attributes"] ) [cell setFormatter:attributesFormatter];
|
2002-02-07 03:45:43 +00:00
|
|
|
|
|
|
|
// set resource icon
|
2002-02-23 03:40:24 +00:00
|
|
|
if( [identifier isEqualToString:@"name"] )
|
2002-02-07 03:45:43 +00:00
|
|
|
{
|
2002-02-23 03:40:24 +00:00
|
|
|
// [(ResourceNameCell *)cell setImage:[NSImage imageNamed:@"Resource file"]];
|
2002-04-27 18:17:47 +00:00
|
|
|
// [(ResourceNameCell *)cell setImage:[[NSWorkspace sharedWorkspace] iconForFileType:[(Resource *)item type]]];
|
|
|
|
[(ResourceNameCell *)cell setImage:[[(ApplicationDelegate *)[NSApp delegate] icons] valueForKey:[(Resource *)item type]]];
|
2002-02-07 03:45:43 +00:00
|
|
|
}
|
2002-04-27 18:17:47 +00:00
|
|
|
|
|
|
|
if( row % 2 == 0 ) [cell setBackgroundColor:[NSColor whiteColor]];
|
|
|
|
else [cell setBackgroundColor:[NSColor colorWithCalibratedRed:0.93 green:0.95 blue:1.0 alpha:1.0]];
|
2001-10-19 19:41:13 +00:00
|
|
|
}
|
|
|
|
|
2002-02-23 03:40:24 +00:00
|
|
|
@end
|