comparison mac/dw.m @ 1067:6ca1132a240e

Allow tree nodes without icons using the new NSMutableArray tree code on Mac.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 24 Jun 2011 02:10:45 +0000
parents 25e0317335fc
children efaa9ceeb253
comparison
equal deleted inserted replaced
1066:2accf180bcfe 1067:6ca1132a240e
1761 { 1761 {
1762 if([cell isMemberOfClass:[NSBrowserCell class]]) 1762 if([cell isMemberOfClass:[NSBrowserCell class]])
1763 { 1763 {
1764 NSMutableArray *this = (NSMutableArray *)item; 1764 NSMutableArray *this = (NSMutableArray *)item;
1765 NSImage *img = [this objectAtIndex:0]; 1765 NSImage *img = [this objectAtIndex:0];
1766 [(NSBrowserCell*)cell setImage:img]; 1766 if([img isKindOfClass:[NSImage class]])
1767 [(NSBrowserCell*)cell setImage:img];
1767 } 1768 }
1768 } 1769 }
1769 -(BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item { return NO; } 1770 -(BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item { return NO; }
1770 -(void)addTree:(NSMutableArray *)item and:(NSMutableArray *)parent after:(NSMutableArray *)after 1771 -(void)addTree:(NSMutableArray *)item and:(NSMutableArray *)parent after:(NSMutableArray *)after
1771 { 1772 {
5026 int _locked_by_me = FALSE; 5027 int _locked_by_me = FALSE;
5027 DW_MUTEX_LOCK; 5028 DW_MUTEX_LOCK;
5028 DWTree *tree = handle; 5029 DWTree *tree = handle;
5029 NSString *nstr = [[NSString stringWithUTF8String:title] retain]; 5030 NSString *nstr = [[NSString stringWithUTF8String:title] retain];
5030 NSMutableArray *treenode = [[[NSMutableArray alloc] init] retain]; 5031 NSMutableArray *treenode = [[[NSMutableArray alloc] init] retain];
5031 [treenode addObject:icon]; 5032 if(icon)
5033 [treenode addObject:icon];
5034 else
5035 [treenode addObject:[NSNull null]];
5032 [treenode addObject:nstr]; 5036 [treenode addObject:nstr];
5033 [treenode addObject:[NSValue valueWithPointer:itemdata]]; 5037 [treenode addObject:[NSValue valueWithPointer:itemdata]];
5034 [treenode addObject:[NSNull null]]; 5038 [treenode addObject:[NSNull null]];
5035 [tree addTree:treenode and:parent after:item]; 5039 [tree addTree:treenode and:parent after:item];
5036 if(parent) 5040 if(parent)