# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1327257980 0 # Node ID d6e17c8f4de296e51e110cd623d5b451d24f40d2 # Parent e6a2e6405d309179045823856b103991f4e67acc Fixed container and listbox not accounting for contents on Mac. diff -r e6a2e6405d30 -r d6e17c8f4de2 mac/dw.m --- a/mac/dw.m Sun Jan 22 12:30:20 2012 +0000 +++ b/mac/dw.m Sun Jan 22 18:46:20 2012 +0000 @@ -1622,6 +1622,7 @@ -(void)clear; -(void)setup; -(void)optimize; +-(NSSize)getsize; -(void)setForegroundColor:(NSColor *)input; -(void)doubleClicked:(id)sender; -(void)keyUp:(NSEvent *)theEvent; @@ -1835,6 +1836,70 @@ titles = [[NSPointerArray pointerArrayWithWeakObjects] retain]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:self]; } +-(NSSize)getsize +{ + int cwidth = 0, cheight = 0; + NSSize size = [self frame].size; + + if(tvcols) + { + int z; + int colcount = (int)[tvcols count]; + int rowcount = (int)[self numberOfRowsInTableView:self]; + + for(z=0;z 0) + { + int x; + + for(x=0;x width) + { + width = thiswidth; + } + } + /* If the image is missing default the optimized width to 16. */ + if(!width && [[types objectAtIndex:z] intValue] & DW_CFA_BITMAPORICON) + { + width = 16; + } + } + if(width) + cwidth += width; + } + } + cwidth += 16; + cheight += 16; + if(size.width > cwidth) + cwidth = size.width; + if(size.height > cheight) + cheight = size.height; + return NSMakeSize(cwidth, cheight); +} -(void)optimize { if(tvcols) @@ -3618,7 +3683,7 @@ size.height += 16.0; } else - size = [object frame].size; + size = [object getsize]; thiswidth = size.width; thisheight = size.height;