# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1617563183 0 # Node ID 6220f058008836402646c67aafefee10ea972c2c # Parent 60a459df758d9a7e8153fb59241e36a26e345bdd iOS: DWContainer attempt to get touch and selection handlers working. Also implement the size calculations for a single column and foreground color. diff -r 60a459df758d -r 6220f0580088 ios/dw.m --- a/ios/dw.m Sun Apr 04 18:22:27 2021 +0000 +++ b/ios/dw.m Sun Apr 04 19:06:23 2021 +0000 @@ -1812,8 +1812,6 @@ -(void)setup; -(CGSize)getsize; -(void)setForegroundColor:(UIColor *)input; --(void)doubleClicked:(id)sender; --(void)selectionChanged:(id)sender; -(DWMenu *)menuForEvent:(UIEvent *)event; @end @@ -2050,101 +2048,82 @@ { int cwidth = 0, cheight = 0; -#if 0 /* TODO: Figure out how to calculate the table size */ if(tvcols) { - int z; int colcount = (int)[tvcols count]; int rowcount = (int)[self numberOfRowsInSection:0]; - - for(z=0;z 0) + int width = 0; + + if(rowcount > 0) + { + int x; + + for(x=0;x thisheight) - thisheight = textheight; - } - - /* If on the first column... add up the heights */ - if(z == 0) - cheight += thisheight; - - if(thiswidth > width) - { - width = thiswidth; - } + thiswidth += [[cell imageView] image].size.width; + thisheight = [[cell imageView] image].size.height; } - /* If the image is missing default the optimized width to 16. */ - if(!width && [[types objectAtIndex:z] intValue] & DW_CFA_BITMAPORICON) + if([cell textLabel]) { - width = 16; + int textheight = [[cell textLabel] intrinsicContentSize].width; + thiswidth += [[cell textLabel] intrinsicContentSize].width; + if(textheight > thisheight) + thisheight = textheight; + } + + cheight += thisheight; + + if(thiswidth > width) + { + width = thiswidth; } } - if(width) - cwidth += width; - } - } -#endif + /* If the image is missing default the optimized width to 16. */ + if(!width && [[types objectAtIndex:0] intValue] & DW_CFA_BITMAPORICON) + { + width = 16; + } + } + if(width) + cwidth += width; + } cwidth += 16; cheight += 16; return CGSizeMake(cwidth, cheight); } -(void)setForegroundColor:(UIColor *)input { -#if 0 /* TODO: Fix this without columns */ - int z, count = (int)[tvcols count]; + UIColor *oldfgcolor = fgcolor; fgcolor = input; [fgcolor retain]; - - for(z=0;z