# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1298557763 0 # Node ID 0502e5b6743bf31056d5df45fd9a08d7f920fd89 # Parent f31a47b055f8c492396c097dd1d1890318de1966 Haven't finished but the basics of the container/listbox are now working. diff -r f31a47b055f8 -r 0502e5b6743b mac/dw.m --- a/mac/dw.m Thu Feb 24 07:30:41 2011 +0000 +++ b/mac/dw.m Thu Feb 24 14:29:23 2011 +0000 @@ -184,7 +184,7 @@ */ /* Subclass for a box type */ -@interface DWBox : NSView +@interface DWBox : NSView { Box box; void *userdata; @@ -338,7 +338,7 @@ @end /* Subclass for a Notebook control type */ -@interface DWNotebook : NSTabView +@interface DWNotebook : NSTabView { void *userdata; int pageid; @@ -498,30 +498,44 @@ @end /* Subclass for a Container/List type */ -@interface DWContainer : NSTableView +@interface DWContainer : NSTableView { void *userdata; NSMutableArray *tvcols; NSMutableArray *data; NSMutableArray *types; -} + NSMutableArray *titles; + int lastAddPoint; +} +-(NSInteger)numberOfRowsInTableView:(NSTableView *)aTable; +-(id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow; +-(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex; -(void *)userdata; -(void)setUserdata:(void *)input; --(id)tableView:(NSTableView *)aTable objectValueForColumn:(NSTableColumn *)aCol row:(int)aRow; --(int)numberOfRowsInTableView:(NSTableView *)aTable; -(void)addColumn:(NSTableColumn *)input andType:(int)type; --(void)addRow:(NSArray *)input; --(void)addRows:(int)number; +-(int)addRow:(NSArray *)input; +-(int)addRows:(int)number; -(void)editCell:(id)input at:(int)row and:(int)col; -(int)cellType:(int)col; +-(int)lastAddPoint; -(void)clear; -(void)setup; @end @implementation DWContainer --(void *)userdata { return userdata; } --(void)setUserdata:(void *)input { userdata = input; } --(id)tableView:(NSTableView *)aTable objectValueForColumn:(NSTableColumn *)aCol row:(int)aRow +-(NSInteger)numberOfRowsInTableView:(NSTableView *)aTable +{ + if(tvcols && data) + { + int cols = [tvcols count]; + if(cols) + { + return [data count] / cols; + } + } + return 0; +} +-(id)tableView:(NSTableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow { if(tvcols) { @@ -544,32 +558,52 @@ } return nil; } --(int)numberOfRowsInTableView:(NSTableView *)aTable -{ - if(tvcols && data) +-(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex +{ + if(tvcols) { - int cols = [tvcols count]; - if(cols) + int z, col = -1; + int count = [tvcols count]; + + for(z=0;z