# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1298573941 0 # Node ID 756015085da732f22d2fea2c223eca5ab647d6dc # Parent 0502e5b6743bf31056d5df45fd9a08d7f920fd89 Fixes for container signal handling. diff -r 0502e5b6743b -r 756015085da7 mac/dw.m --- a/mac/dw.m Thu Feb 24 14:29:23 2011 +0000 +++ b/mac/dw.m Thu Feb 24 18:59:01 2011 +0000 @@ -84,7 +84,7 @@ int _event_handler(id object, NSEvent *event, int message) { SignalHandler *handler = _get_handler(object, message); - NSLog(@"Event handler\n"); + NSLog(@"Event handler - type %d\n", message); if(handler) { @@ -153,6 +153,25 @@ NSLog(@"Clicked\n"); return clickfunc(object, handler->data); } + case 10: + { + int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))handler->signalfunction; + char *text = (char *)event; + void *user = NULL; + LONG x,y; + + dw_pointer_query_pos(&x, &y); + + return containercontextfunc(handler->window, text, x, y, handler->data, user); + } + case 12: + { + int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))handler->signalfunction; + char *text = (char *)event; + void *user = NULL; + + return treeselectfunc(handler->window, NULL, text, handler->data, user); + } } } return -1; @@ -455,6 +474,7 @@ -(float)range; -(float)visible; -(void)setRange:(float)input1 andVisible:(float)input2; +-(void)changed:(id)sender; @end @implementation DWScrollbar @@ -463,6 +483,7 @@ -(float)range { return range; } -(float)visible { return visible; } -(void)setRange:(float)input1 andVisible:(float)input2 { range = input1; visible = input2; } +-(void)changed:(id)sender { /*NSNumber *num = [NSNumber numberWithDouble:[scroller floatValue]]; NSLog([num stringValue]);*/ } @end /* Subclass for a render area type */ @@ -504,7 +525,7 @@ NSMutableArray *tvcols; NSMutableArray *data; NSMutableArray *types; - NSMutableArray *titles; + NSPointerArray *titles; int lastAddPoint; } -(NSInteger)numberOfRowsInTableView:(NSTableView *)aTable; @@ -517,9 +538,13 @@ -(int)addRows:(int)number; -(void)editCell:(id)input at:(int)row and:(int)col; -(int)cellType:(int)col; +-(void)setRow:(int)row title:(void *)input; +-(void *)getRowTitle:(int)row; -(int)lastAddPoint; -(void)clear; -(void)setup; +-(void)selectionChanged:(id)sender; +-(NSMenu *)menuForEvent:(NSEvent *)event; @end @implementation DWContainer @@ -553,7 +578,8 @@ if(col != -1) { int index = (aRow * count) + col; - return [data objectAtIndex:index]; + id this = [data objectAtIndex:index]; + return ([this isKindOfClass:[NSNull class]]) ? nil : this; } } return nil; @@ -583,7 +609,7 @@ -(void *)userdata { return userdata; } -(void)setUserdata:(void *)input { userdata = input; } -(void)addColumn:(NSTableColumn *)input andType:(int)type { if(tvcols) { [tvcols addObject:input]; [types addObject:[NSNumber numberWithInt:type]]; } } --(int)addRow:(NSArray *)input { if(data) { [data addObjectsFromArray:input]; [titles addObject:[NSNull null]]; return [titles count]; } return 0; } +-(int)addRow:(NSArray *)input { if(data) { [data addObjectsFromArray:input]; [titles addPointer:NULL]; return [titles count]; } return 0; } -(int)addRows:(int)number { if(tvcols) @@ -599,7 +625,7 @@ } for(z=0;z