Mercurial > dwindows
changeset 2182:3bb5a74b4231
Mac: First attempt to get optimize and auto-box-sizing working with NSView
based Containers.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 13 Oct 2020 07:51:24 +0000 |
parents | fe54e67cec3b |
children | c7713d96e5a9 |
files | mac/dw.m |
diffstat | 1 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Tue Oct 13 07:24:07 2020 +0000 +++ b/mac/dw.m Tue Oct 13 07:51:24 2020 +0000 @@ -2809,11 +2809,24 @@ { #ifdef BUILDING_FOR_YOSEMITE NSTableCellView *cell = [self viewAtColumn:z row:x makeIfNecessary:YES]; - int thiswidth = NSWidth([cell frame]); + int thiswidth = 4, thisheight = 0; + + if([cell imageView]) + { + thiswidth += [[cell imageView] image].size.width; + thisheight = [[cell imageView] image].size.height; + } + if([cell textField]) + { + int textheight = [[cell textField] intrinsicContentSize].width; + thiswidth += [[cell textField] intrinsicContentSize].width; + if(textheight > thisheight) + thisheight = textheight; + } /* If on the first column... add up the heights */ if(z == 0) - cheight += NSHeight([cell frame]); + cheight += thisheight; #else NSCell *cell = [self preparedCellAtColumn:z row:x]; int thiswidth = [cell cellSize].width; @@ -2876,7 +2889,12 @@ { #ifdef BUILDING_FOR_YOSEMITE NSTableCellView *cell = [self viewAtColumn:z row:x makeIfNecessary:YES]; - int thiswidth = NSWidth([cell frame]); + int thiswidth = 4; + + if([cell imageView]) + thiswidth += [[cell imageView] image].size.width; + if([cell textField]) + thiswidth += [[cell textField] intrinsicContentSize].width; #else NSCell *cell = [self preparedCellAtColumn:z row:x]; int thiswidth = [cell cellSize].width;