Mercurial > dwindows
comparison mac/dw.m @ 1574:ae5e322584cd
Use [NSTableColumn width] method to get header width on Mac instead of frame size.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 22 Jan 2012 19:02:10 +0000 |
parents | d6e17c8f4de2 |
children | a51397ea24bf |
comparison
equal
deleted
inserted
replaced
1573:d6e17c8f4de2 | 1574:ae5e322584cd |
---|---|
1837 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:self]; | 1837 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:self]; |
1838 } | 1838 } |
1839 -(NSSize)getsize | 1839 -(NSSize)getsize |
1840 { | 1840 { |
1841 int cwidth = 0, cheight = 0; | 1841 int cwidth = 0, cheight = 0; |
1842 NSSize size = [self frame].size; | |
1843 | 1842 |
1844 if(tvcols) | 1843 if(tvcols) |
1845 { | 1844 { |
1846 int z; | 1845 int z; |
1847 int colcount = (int)[tvcols count]; | 1846 int colcount = (int)[tvcols count]; |
1848 int rowcount = (int)[self numberOfRowsInTableView:self]; | 1847 int rowcount = (int)[self numberOfRowsInTableView:self]; |
1849 | 1848 |
1850 for(z=0;z<colcount;z++) | 1849 for(z=0;z<colcount;z++) |
1851 { | 1850 { |
1852 NSTableColumn *column = [tvcols objectAtIndex:z]; | 1851 NSTableColumn *column = [tvcols objectAtIndex:z]; |
1853 NSCell *colcell = [column headerCell]; | 1852 int width = [column width]; |
1854 int width = [colcell cellSize].width; | |
1855 | 1853 |
1856 if(rowcount > 0) | 1854 if(rowcount > 0) |
1857 { | 1855 { |
1858 int x; | 1856 int x; |
1859 | 1857 |
1892 cwidth += width; | 1890 cwidth += width; |
1893 } | 1891 } |
1894 } | 1892 } |
1895 cwidth += 16; | 1893 cwidth += 16; |
1896 cheight += 16; | 1894 cheight += 16; |
1897 if(size.width > cwidth) | |
1898 cwidth = size.width; | |
1899 if(size.height > cheight) | |
1900 cheight = size.height; | |
1901 return NSMakeSize(cwidth, cheight); | 1895 return NSMakeSize(cwidth, cheight); |
1902 } | 1896 } |
1903 -(void)optimize | 1897 -(void)optimize |
1904 { | 1898 { |
1905 if(tvcols) | 1899 if(tvcols) |