comparison mac/dw.m @ 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
comparison
equal deleted inserted replaced
2181:fe54e67cec3b 2182:3bb5a74b4231
2807 2807
2808 for(x=0;x<rowcount;x++) 2808 for(x=0;x<rowcount;x++)
2809 { 2809 {
2810 #ifdef BUILDING_FOR_YOSEMITE 2810 #ifdef BUILDING_FOR_YOSEMITE
2811 NSTableCellView *cell = [self viewAtColumn:z row:x makeIfNecessary:YES]; 2811 NSTableCellView *cell = [self viewAtColumn:z row:x makeIfNecessary:YES];
2812 int thiswidth = NSWidth([cell frame]); 2812 int thiswidth = 4, thisheight = 0;
2813
2814 if([cell imageView])
2815 {
2816 thiswidth += [[cell imageView] image].size.width;
2817 thisheight = [[cell imageView] image].size.height;
2818 }
2819 if([cell textField])
2820 {
2821 int textheight = [[cell textField] intrinsicContentSize].width;
2822 thiswidth += [[cell textField] intrinsicContentSize].width;
2823 if(textheight > thisheight)
2824 thisheight = textheight;
2825 }
2813 2826
2814 /* If on the first column... add up the heights */ 2827 /* If on the first column... add up the heights */
2815 if(z == 0) 2828 if(z == 0)
2816 cheight += NSHeight([cell frame]); 2829 cheight += thisheight;
2817 #else 2830 #else
2818 NSCell *cell = [self preparedCellAtColumn:z row:x]; 2831 NSCell *cell = [self preparedCellAtColumn:z row:x];
2819 int thiswidth = [cell cellSize].width; 2832 int thiswidth = [cell cellSize].width;
2820 2833
2821 /* If on the first column... add up the heights */ 2834 /* If on the first column... add up the heights */
2874 2887
2875 for(x=0;x<rowcount;x++) 2888 for(x=0;x<rowcount;x++)
2876 { 2889 {
2877 #ifdef BUILDING_FOR_YOSEMITE 2890 #ifdef BUILDING_FOR_YOSEMITE
2878 NSTableCellView *cell = [self viewAtColumn:z row:x makeIfNecessary:YES]; 2891 NSTableCellView *cell = [self viewAtColumn:z row:x makeIfNecessary:YES];
2879 int thiswidth = NSWidth([cell frame]); 2892 int thiswidth = 4;
2893
2894 if([cell imageView])
2895 thiswidth += [[cell imageView] image].size.width;
2896 if([cell textField])
2897 thiswidth += [[cell textField] intrinsicContentSize].width;
2880 #else 2898 #else
2881 NSCell *cell = [self preparedCellAtColumn:z row:x]; 2899 NSCell *cell = [self preparedCellAtColumn:z row:x];
2882 int thiswidth = [cell cellSize].width; 2900 int thiswidth = [cell cellSize].width;
2883 2901
2884 /* Check the image inside the cell to get its width */ 2902 /* Check the image inside the cell to get its width */