changeset 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 2accf180bcfe
children efaa9ceeb253
files mac/dw.m
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Tue Jun 14 13:38:55 2011 +0000
+++ b/mac/dw.m	Fri Jun 24 02:10:45 2011 +0000
@@ -1763,7 +1763,8 @@
     {
         NSMutableArray *this = (NSMutableArray *)item;
         NSImage *img = [this objectAtIndex:0];
-        [(NSBrowserCell*)cell setImage:img];
+        if([img isKindOfClass:[NSImage class]])
+            [(NSBrowserCell*)cell setImage:img];
     }
 }
 -(BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item { return NO; }
@@ -5028,7 +5029,10 @@
     DWTree *tree = handle;
     NSString *nstr = [[NSString stringWithUTF8String:title] retain];
     NSMutableArray *treenode = [[[NSMutableArray alloc] init] retain];
-    [treenode addObject:icon];
+    if(icon)
+        [treenode addObject:icon];
+    else
+        [treenode addObject:[NSNull null]];
     [treenode addObject:nstr];
     [treenode addObject:[NSValue valueWithPointer:itemdata]];
     [treenode addObject:[NSNull null]];