comparison mac/dw.m @ 1573:d6e17c8f4de2

Fixed container and listbox not accounting for contents on Mac.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 22 Jan 2012 18:46:20 +0000
parents 035bc006afbe
children ae5e322584cd
comparison
equal deleted inserted replaced
1572:e6a2e6405d30 1573:d6e17c8f4de2
1620 -(int)lastQueryPoint; 1620 -(int)lastQueryPoint;
1621 -(void)setLastQueryPoint:(int)input; 1621 -(void)setLastQueryPoint:(int)input;
1622 -(void)clear; 1622 -(void)clear;
1623 -(void)setup; 1623 -(void)setup;
1624 -(void)optimize; 1624 -(void)optimize;
1625 -(NSSize)getsize;
1625 -(void)setForegroundColor:(NSColor *)input; 1626 -(void)setForegroundColor:(NSColor *)input;
1626 -(void)doubleClicked:(id)sender; 1627 -(void)doubleClicked:(id)sender;
1627 -(void)keyUp:(NSEvent *)theEvent; 1628 -(void)keyUp:(NSEvent *)theEvent;
1628 -(void)tableView:(NSTableView *)tableView didClickTableColumn:(NSTableColumn *)tableColumn; 1629 -(void)tableView:(NSTableView *)tableView didClickTableColumn:(NSTableColumn *)tableColumn;
1629 -(void)selectionChanged:(id)sender; 1630 -(void)selectionChanged:(id)sender;
1832 tvcols = [[[NSMutableArray alloc] init] retain]; 1833 tvcols = [[[NSMutableArray alloc] init] retain];
1833 data = [[[NSMutableArray alloc] init] retain]; 1834 data = [[[NSMutableArray alloc] init] retain];
1834 types = [[[NSMutableArray alloc] init] retain]; 1835 types = [[[NSMutableArray alloc] init] retain];
1835 titles = [[NSPointerArray pointerArrayWithWeakObjects] retain]; 1836 titles = [[NSPointerArray pointerArrayWithWeakObjects] retain];
1836 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:self]; 1837 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:self];
1838 }
1839 -(NSSize)getsize
1840 {
1841 int cwidth = 0, cheight = 0;
1842 NSSize size = [self frame].size;
1843
1844 if(tvcols)
1845 {
1846 int z;
1847 int colcount = (int)[tvcols count];
1848 int rowcount = (int)[self numberOfRowsInTableView:self];
1849
1850 for(z=0;z<colcount;z++)
1851 {
1852 NSTableColumn *column = [tvcols objectAtIndex:z];
1853 NSCell *colcell = [column headerCell];
1854 int width = [colcell cellSize].width;
1855
1856 if(rowcount > 0)
1857 {
1858 int x;
1859
1860 for(x=0;x<rowcount;x++)
1861 {
1862 NSCell *cell = [self preparedCellAtColumn:z row:x];
1863 int thiswidth = [cell cellSize].width;
1864
1865 /* If on the first column... add up the heights */
1866 if(z == 0)
1867 cheight += [cell cellSize].height;
1868
1869 /* Check the image inside the cell to get its width */
1870 if([cell isMemberOfClass:[NSImageCell class]])
1871 {
1872 int index = (int)(x * [tvcols count]) + z;
1873 NSImage *image = [data objectAtIndex:index];
1874 if([image isMemberOfClass:[NSImage class]])
1875 {
1876 thiswidth = [image size].width;
1877 }
1878 }
1879
1880 if(thiswidth > width)
1881 {
1882 width = thiswidth;
1883 }
1884 }
1885 /* If the image is missing default the optimized width to 16. */
1886 if(!width && [[types objectAtIndex:z] intValue] & DW_CFA_BITMAPORICON)
1887 {
1888 width = 16;
1889 }
1890 }
1891 if(width)
1892 cwidth += width;
1893 }
1894 }
1895 cwidth += 16;
1896 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);
1837 } 1902 }
1838 -(void)optimize 1903 -(void)optimize
1839 { 1904 {
1840 if(tvcols) 1905 if(tvcols)
1841 { 1906 {
3616 /* Take into account the horizontal scrollbar */ 3681 /* Take into account the horizontal scrollbar */
3617 if(hscroll && size.width > _DW_SCROLLED_MAX_WIDTH) 3682 if(hscroll && size.width > _DW_SCROLLED_MAX_WIDTH)
3618 size.height += 16.0; 3683 size.height += 16.0;
3619 } 3684 }
3620 else 3685 else
3621 size = [object frame].size; 3686 size = [object getsize];
3622 3687
3623 thiswidth = size.width; 3688 thiswidth = size.width;
3624 thisheight = size.height; 3689 thisheight = size.height;
3625 3690
3626 if(thiswidth < _DW_SCROLLED_MIN_WIDTH) 3691 if(thiswidth < _DW_SCROLLED_MIN_WIDTH)