changeset 813:7fa26d8cc8d0

Fix for column click handler not working.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 25 Mar 2011 21:23:43 +0000
parents f8bfb19090f9
children f5972669d7e9
files mac/dw.m
diffstat 1 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Fri Mar 25 13:25:37 2011 +0000
+++ b/mac/dw.m	Fri Mar 25 21:23:43 2011 +0000
@@ -999,7 +999,7 @@
 /* Subclass for a Container/List type */
 @interface DWContainer : NSTableView
 #ifdef BUILDING_FOR_SNOW_LEOPARD
-<NSTableViewDataSource>
+<NSTableViewDataSource,NSTableViewDelegate>
 #endif
 {
     void *userdata;
@@ -1010,12 +1010,14 @@
     NSColor *fgcolor;
     int lastAddPoint, lastQueryPoint;
     id scrollview;
+    int filesystem;
 }
 -(NSInteger)numberOfRowsInTableView:(NSTableView *)aTable;
 -(id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow;
 -(BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;
 -(void *)userdata;
 -(void)setUserdata:(void *)input;
+-(void)setFilesystem:(int)input;
 -(id)scrollview;
 -(void)setScrollview:(id)input;
 -(void)addColumn:(NSTableColumn *)input andType:(int)type;
@@ -1080,6 +1082,7 @@
 -(BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { return NO; }
 -(void *)userdata { return userdata; }
 -(void)setUserdata:(void *)input { userdata = input; }
+-(void)setFilesystem:(int)input { filesystem = input; }
 -(id)scrollview { return scrollview; }
 -(void)setScrollview:(id)input { scrollview = input; }
 -(void)addColumn:(NSTableColumn *)input andType:(int)type { if(tvcols) { [tvcols addObject:input]; [types addObject:[NSNumber numberWithInt:type]]; } }
@@ -1197,10 +1200,16 @@
     /* Handler for container class */
     _event_handler(self, (NSEvent *)[self getRowTitle:(int)[self selectedRow]], 9);
 }
--(void)tableView:(NSTableView*)tableView mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn
-{
+-(void)tableView:(NSTableView *)tableView mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn;
+{
+    NSUInteger index = [tvcols indexOfObject:tableColumn];
+    
+    if(filesystem && index > 0)
+    {
+        index--;
+    }
     /* Handler for column click class */
-    _event_handler(self, (NSEvent *)[tvcols indexOfObject:tableColumn], 17);
+    _event_handler(self, (NSEvent *)index, 17);
 }
 -(void)selectionChanged:(id)sender
 {
@@ -1255,7 +1264,7 @@
 /* Subclass for a Tree type */
 @interface DWTree : NSOutlineView
 #ifdef BUILDING_FOR_SNOW_LEOPARD
-<NSOutlineViewDataSource>
+<NSOutlineViewDataSource,NSOutlineViewDelegate>
 #endif
 {
     void *userdata;
@@ -3201,6 +3210,7 @@
         [cont setAllowsMultipleSelection:NO];
     }
     [cont setDataSource:cont];
+    [cont setDelegate:cont];
     [scrollview setDocumentView:cont];
     [cont setTag:cid];
     [scrollview release];
@@ -4567,6 +4577,7 @@
 {
     char **newtitles = malloc(sizeof(char *) * (count + 2));
     unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
+    DWContainer *cont = handle;
 
     newtitles[0] = "Icon";
     newtitles[1] = "Filename";
@@ -4578,6 +4589,7 @@
     memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
 
     dw_container_setup(handle, newflags, newtitles, count + 2, 0);
+    [cont setFilesystem:YES];
 
     free(newtitles);
     free(newflags);