### Eclipse Workspace Patch 1.0 #P org.eclipse.swt Index: Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java,v retrieving revision 1.188 diff -u -r1.188 Tree.java --- Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java 31 May 2007 22:03:46 -0000 1.188 +++ Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java 14 Jun 2007 18:14:38 -0000 @@ -455,8 +455,8 @@ width = wHint; } else { if (columns.length == 0) { - for (int i = 0; i < items.length; i++) { - Rectangle itemBounds = items [i].getBounds (false); + for (int i = 0; i < availableItemsCount; i++) { + Rectangle itemBounds = availableItems [i].getBounds (false); width = Math.max (width, itemBounds.x + itemBounds.width); } } else { @@ -468,7 +468,7 @@ if (hHint != SWT.DEFAULT) { height = hHint; } else { - height = getHeaderHeight () + items.length * itemHeight; + height = getHeaderHeight () + availableItemsCount * itemHeight; } Rectangle result = computeTrim (0, 0, width, height); return new Point (result.width, result.height); Index: Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java,v retrieving revision 1.163 diff -u -r1.163 Tree.java --- Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java 31 May 2007 22:03:57 -0000 1.163 +++ Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java 14 Jun 2007 18:14:38 -0000 @@ -94,6 +94,7 @@ static final int CELL_CONTENT_INSET = 12; static final int BORDER_INSET = 1; static final int DISCLOSURE_COLUMN_EDGE_INSET = 8; + static final int DISCLOSURE_COLUMN_LEVEL_INDENT = 24; static final int DISCLOSURE_TRIANGLE_AND_CONTENT_GAP = 8; /** @@ -315,15 +316,17 @@ addListener (SWT.Collapse, typedListener); } -int calculateWidth (int [] ids, GC gc, boolean recurse) { +int calculateWidth (int [] ids, GC gc, boolean recurse, int level, int levelIndent) { if (ids == null) return 0; int width = 0; for (int i=0; i= 0x1040) { + float [] metric = new float [1]; + OS.DataBrowserGetMetric (handle, OS.kDataBrowserMetricDisclosureColumnPerDepthGap, null, metric); + levelIndent = (int) metric [0]; } + GC gc = new GC (this); + width = calculateWidth (childIds, gc, true, 0, levelIndent); gc.dispose (); - width += columnWidth + getInsetWidth (column_id, true); + width += getInsetWidth (column_id, true); } if ((style & SWT.CHECK) != 0) width += getCheckColumnWidth (); } else { @@ -507,7 +510,7 @@ if (width <= 0) width = DEFAULT_WIDTH; int height = 0; if (hHint == SWT.DEFAULT) { - height = getItemCount () * getItemHeight () + getHeaderHeight(); + height = visibleCount * getItemHeight () + getHeaderHeight(); } else { height = hHint; } @@ -2927,7 +2930,7 @@ if (ignoreRedraw || drawCount != 0) return false; if (columnCount != 0 || childIds == null) return false; GC gc = new GC (this); - int newWidth = calculateWidth (childIds, gc, recurse); + int newWidth = calculateWidth (childIds, gc, recurse, 0, 0); gc.dispose (); newWidth += getInsetWidth (column_id, false); if (!set) {