*** empty log message ***
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
index e3a36bb..f8fac10 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
@@ -53,9 +53,42 @@
 }
 
 public Point computeSize (int wHint, int hHint, boolean changed) {
-	checkWidget ();
-	//NOT DONE
-	return new Point (100, 100);
+	checkWidget();
+	int width = 0;
+	if (wHint == SWT.DEFAULT) {
+		GC gc = new GC (this);
+		for (int i=0; i<itemCount; i++) {
+			//NOT DONE - take into account the icon
+//			Rectangle rect = items [i].getBounds ();
+//			width = Math.max (width, rect.width);
+			Point extent = gc.stringExtent (items [i].text);
+			width = Math.max (width, extent.x);
+		}
+		gc.dispose ();
+	} else {
+		width = wHint;
+	}
+	if (width <= 0) width = DEFAULT_WIDTH;
+	int height = 0;
+	if (hHint == SWT.DEFAULT) {
+		height = itemCount * getItemHeight ();
+	} else {
+		height = hHint;
+	}
+	if (height <= 0) height = DEFAULT_HEIGHT;
+	Rectangle rect = computeTrim (0, 0, width, height);
+	return new Point (rect.width, rect.height);
+}
+
+public Rectangle computeTrim (int x, int y, int width, int height) {
+	checkWidget();
+	Rect rect = new Rect ();
+	OS.GetDataBrowserScrollBarInset (handle, rect);
+	x -= rect.left;
+	y -= rect.top;
+	width += (rect.left + rect.right) * 3;
+	height += rect.top + rect.bottom;
+	return new Rectangle (x, y, width, height);
 }
 
 void createHandle () {
@@ -184,14 +217,17 @@
 
 public void deselect (int index) {
 	checkWidget();
-	ignoreSelect = true;
-	int [] id = new int [] {index + 1};
-	OS.SetDataBrowserSelectedItems (handle, id.length, id, OS.kDataBrowserItemsRemove);
-	ignoreSelect = false;
+	if (0 <= index && index < itemCount) {
+		ignoreSelect = true;
+		int [] id = new int [] {index + 1};
+		OS.SetDataBrowserSelectedItems (handle, id.length, id, OS.kDataBrowserItemsRemove);
+		ignoreSelect = false;
+	}
 }
 
 public void deselect (int start, int end) {
 	checkWidget();
+	//NOT DONE - check range
 	int length = end - start + 1;
 	if (length <= 0) return;
 	int [] ids = new int [length];
@@ -204,6 +240,7 @@
 public void deselect (int [] indices) {
 	checkWidget();
 	if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+	//NOT DONE - check range
 	int length = indices.length;
 	int [] ids = new int [length];
 	for (int i=0; i<length; i++) ids [i] = indices [length - i - 1] + 1;
@@ -237,7 +274,9 @@
 			item.setImage (columnCount - 1, null);
 		}
 	}
-	if (columnCount > 1) {
+	if (columnCount == 1) {
+		//NOT DONE - reassign COLUMN_ID when last column deleted
+	} else {
 		if (OS.RemoveDataBrowserTableViewColumn (handle, column.id) != OS.noErr) {
 			error (SWT.ERROR_ITEM_NOT_REMOVED);
 		}
@@ -261,6 +300,14 @@
 	OS.UpdateDataBrowserItems (handle, 0, 0, null, OS.kDataBrowserItemNoProperty, OS.kDataBrowserNoItem);
 }
 
+public Rectangle getClientArea () {
+	checkWidget();
+	Rect rect = new Rect (), inset = new Rect ();
+	OS.GetControlBounds (handle, rect);
+	OS.GetDataBrowserScrollBarInset (handle, inset);
+	return new Rectangle (inset.left, inset.top, rect.right - rect.left + inset.right, rect.bottom - rect.top + inset.bottom);
+}
+
 public TableColumn getColumn (int index) {
 	checkWidget ();
 	if (!(0 <=index && index < columnCount)) error (SWT.ERROR_INVALID_RANGE);
@@ -553,6 +600,62 @@
 	return result;
 }
 
+int kEventRawKeyDown (int nextHandler, int theEvent, int userData) {
+	int result = super.kEventRawKeyDown (nextHandler, theEvent, userData);
+	if (result == OS.noErr) return result;
+	/*
+	* Feature in the Macintosh.  For some reason, when the user hits an
+	* up or down arrow to traverse the items in a Data Browser, the item
+	* scrolls to the left such that the white space that is normally
+	* visible to the right of the every item is scrolled out of view.
+	* The fix is to do the arrow traversal in Java and not call the
+	* default handler.
+	*/
+	int [] keyCode = new int [1];
+	OS.GetEventParameter (theEvent, OS.kEventParamKeyCode, OS.typeUInt32, null, keyCode.length * 4, null, keyCode);
+	switch (keyCode [0]) {
+		case 125: { /* Down */
+			int index = getSelectionIndex ();
+			setSelection (Math.min (itemCount - 1, index + 1));
+			return OS.noErr;
+		}
+		case 126: { /* Up*/
+			int index = getSelectionIndex ();
+			setSelection (Math.max (0, index - 1));
+			return OS.noErr;
+		}
+	}
+	return OS.eventNotHandledErr;
+}
+
+int kEventRawKeyRepeat (int nextHandler, int theEvent, int userData) {
+	int result = super.kEventRawKeyRepeat (nextHandler, theEvent, userData);
+	if (result == OS.noErr) return result;
+	/*
+	* Feature in the Macintosh.  For some reason, when the user hits an
+	* up or down arrow to traverse the items in a Data Browser, the item
+	* scrolls to the left such that the white space that is normally
+	* visible to the right of the every item is scrolled out of view.
+	* The fix is to do the arrow traversal in Java and not call the
+	* default handler.
+	*/
+	int [] keyCode = new int [1];
+	OS.GetEventParameter (theEvent, OS.kEventParamKeyCode, OS.typeUInt32, null, keyCode.length * 4, null, keyCode);
+	switch (keyCode [0]) {
+		case 125: { /* Down */
+			int index = getSelectionIndex ();
+			setSelection (Math.min (itemCount - 1, index + 1));
+			return OS.noErr;
+		}
+		case 126: { /* Up*/
+			int index = getSelectionIndex ();
+			setSelection (Math.max (0, index - 1));
+			return OS.noErr;
+		}
+	}
+	return OS.eventNotHandledErr;
+}
+
 void releaseWidget () {
 	for (int i=0; i<columnCount; i++) {
 		TableColumn column = columns [i];
@@ -624,15 +727,18 @@
 
 public void select (int index) {
 	checkWidget();
-	int [] id = new int [] {index + 1};
-	ignoreSelect = true;
-	int operation = (style & SWT.SINGLE) != 0 ? OS.kDataBrowserItemsAssign: OS.kDataBrowserItemsAdd;
-	OS.SetDataBrowserSelectedItems (handle, id.length, id, operation);
-	ignoreSelect = false;
+	if (0 <- index && index < itemCount) {
+		int [] id = new int [] {index + 1};
+		ignoreSelect = true;
+		int operation = (style & SWT.SINGLE) != 0 ? OS.kDataBrowserItemsAssign: OS.kDataBrowserItemsAdd;
+		OS.SetDataBrowserSelectedItems (handle, id.length, id, operation);
+		ignoreSelect = false;
+	}
 }
 
 public void select (int start, int end) {
 	checkWidget();
+	//NOT DONE - check range
 	int length = end - start + 1;
 	if (length <= 0) return;
 	int [] ids = new int [length];
@@ -646,6 +752,7 @@
 public void select (int [] indices) {
 	checkWidget();
 	if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+	//NOT DONE - check range
 	int length = indices.length;
 	int [] ids = new int [length];
 	for (int i=0; i<length; i++) ids [i] = indices [length - i - 1] + 1;
@@ -675,11 +782,13 @@
 
 public void setSelection (int index) {
 	checkWidget();
-	int [] id = new int [] {index + 1};
-	ignoreSelect = true;
-	OS.SetDataBrowserSelectedItems (handle, id.length, id, OS.kDataBrowserItemsAssign);
-	ignoreSelect = false;
-	showIndex (id [0] - 1);
+	if (0 < index && index < itemCount) {
+		int [] id = new int [] {index + 1};
+		ignoreSelect = true;
+		OS.SetDataBrowserSelectedItems (handle, id.length, id, OS.kDataBrowserItemsAssign);
+		ignoreSelect = false;
+		showIndex (id [0] - 1);
+	}
 }
 
 public void setSelection (int start, int end) {
@@ -740,10 +849,18 @@
 }
 
 void showIndex (int index) {
-	OS.RevealDataBrowserItem (handle, index + 1, COLUMN_ID, (byte) OS.kDataBrowserRevealWithoutSelecting);
-    int [] top = new int [1], left = new int [1];
-    OS.GetDataBrowserScrollPosition (handle, top, left);
-    OS.SetDataBrowserScrollPosition (handle, top [0], 0);
+	if (0 <= index && index < itemCount) {
+		//NOT DONE - doesn't work for SWT.CHECK
+		int id = columnCount == 0 ? COLUMN_ID : columns [0].id;
+		short [] width = new short [1];
+		OS.GetDataBrowserTableViewNamedColumnWidth (handle, id, width);
+		Rect rect = new Rect (), inset = new Rect ();
+		OS.GetControlBounds (handle, rect);
+		OS.GetDataBrowserScrollBarInset (handle, inset);
+		OS.SetDataBrowserTableViewNamedColumnWidth (handle, id, (short)(rect.right - rect.left - inset.left - inset.right));
+		OS.RevealDataBrowserItem (handle, index + 1, COLUMN_ID, (byte) OS.kDataBrowserRevealWithoutSelecting);
+		OS.SetDataBrowserTableViewNamedColumnWidth (handle, id, (short)width [0]);
+	}
 }
 
 public void showItem (TableItem item) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableColumn.java
index d2ff613..e7a7684 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableColumn.java
@@ -41,6 +41,7 @@
 	addListener (SWT.Resize,typedListener);
 	addListener (SWT.Move,typedListener);
 }
+
 public void addSelectionListener (SelectionListener listener) {
 	checkWidget ();
 	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
@@ -166,7 +167,7 @@
 	if (str == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
 	DataBrowserListViewHeaderDesc desc = new DataBrowserListViewHeaderDesc ();
 	desc.version = OS.kDataBrowserListViewLatestHeaderDesc;
-	//NOT DONE - GP's
+	//NOT DONE - for some reason this call GP's
 //	OS.GetDataBrowserListViewHeaderDesc (parent.handle, id, desc);
 	desc.maximumWidth = 0x7FFF;
 	desc.titleString = str;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
index a6abd4a..bda8ef9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
@@ -9,8 +9,10 @@
  
 import org.eclipse.swt.internal.carbon.OS;
 import org.eclipse.swt.internal.carbon.DataBrowserCallbacks;
-import org.eclipse.swt.internal.carbon.Rect;
+import org.eclipse.swt.internal.carbon.DataBrowserCustomCallbacks;
 import org.eclipse.swt.internal.carbon.DataBrowserListViewColumnDesc;
+import org.eclipse.swt.internal.carbon.RGBColor;
+import org.eclipse.swt.internal.carbon.Rect;
 
 import org.eclipse.swt.*;
 import org.eclipse.swt.events.*;
@@ -18,6 +20,7 @@
 
 public class Tree extends Composite {
 	TreeItem [] items;
+	GC paintGC;
 	int anchorFirst, anchorLast;
 	boolean ignoreSelect, ignoreExpand;
 	static final int CHECK_COLUMN_ID = 1024;
@@ -59,8 +62,40 @@
 
 public Point computeSize (int wHint, int hHint, boolean changed) {
 	checkWidget ();
-	//NOT DONE
-	return new Point (200, 200);
+	int width = 0;
+	if (wHint == SWT.DEFAULT) {
+		TreeItem [] items = getItems ();
+		GC gc = new GC (this);
+		for (int i=0; i<items.length; i++) {
+			Rectangle rect = items [i].getBounds ();
+			width = Math.max (width, rect.width);
+		}
+		gc.dispose ();
+		width = width * 2;
+	} else {
+		width = wHint;
+	}
+	if (width <= 0) width = DEFAULT_WIDTH;
+	int height = 0;
+	if (hHint == SWT.DEFAULT) {
+		height = getItemCount () * getItemHeight ();
+	} else {
+		height = hHint;
+	}
+	if (height <= 0) height = DEFAULT_HEIGHT;
+	Rectangle rect = computeTrim (0, 0, width, height);
+	return new Point (rect.width, rect.height);
+}
+
+public Rectangle computeTrim (int x, int y, int width, int height) {
+	checkWidget();
+	Rect rect = new Rect ();
+	OS.GetDataBrowserScrollBarInset (handle, rect);
+	x -= rect.left;
+	y -= rect.top;
+	width += (rect.left + rect.right) * 3;
+	height += rect.top + rect.bottom;
+	return new Rectangle (x, y, width, height);
 }
 
 void createHandle () {
@@ -91,7 +126,8 @@
 	DataBrowserListViewColumnDesc column = new DataBrowserListViewColumnDesc ();
 	column.headerBtnDesc_version = OS.kDataBrowserListViewLatestHeaderDesc;
 	column.propertyDesc_propertyID = COLUMN_ID;
-	column.propertyDesc_propertyType = OS.kDataBrowserTextType; // OS.kDataBrowserIconAndTextType
+//	column.propertyDesc_propertyType = OS.kDataBrowserTextType; // OS.kDataBrowserIconAndTextType
+	column.propertyDesc_propertyType = OS.kDataBrowserCustomType;
 	column.propertyDesc_propertyFlags = OS.kDataBrowserListViewSelectionColumn | OS.kDataBrowserDefaultPropertyFlags;
 	//NOT DONE
 	column.headerBtnDesc_maximumWidth = 0x7FFF;
@@ -105,6 +141,10 @@
 	* the widget has a minimum size.  The fix is to force the scroll
 	* bars to be created by temporarily giving the widget a size and
 	* then restoring it to zero.
+	* 
+	* NOTE: The widget must be visible and SizeControl() must be used
+	* to resize the widget to a minimim size or the widget will not
+	* create the scroll bars.  This work around currently flashes.
 	*/
 	OS.SizeControl (handle, (short) 0xFF, (short) 0xFF);
 	OS.SizeControl (handle, (short) 0, (short) 0);
@@ -196,13 +236,105 @@
 	item.index = -1;
 }
 
+int drawItemProc (int browser, int id, int property, int itemState, int theRect, int gdDepth, int colorDevice) {
+	int index = id - 1;
+	if (!(0 <= index && index < items.length)) return OS.noErr;
+	TreeItem item = items [index];
+
+//	if (false) {
+//		int [] port = new int [1], gdh = new int [1];
+//		OS.GetGWorld (port, gdh);
+//		byte [] buffer = item.text.getBytes();
+//		Rect rect = new Rect ();
+//		OS.memcpy (rect, theRect, Rect.sizeof);
+//		Display display = getDisplay ();
+//		Color foreground = null, background = null;
+//		if ((itemState & OS.kDataBrowserItemIsSelected) != 0)  {
+//			foreground = display.getSystemColor (SWT.COLOR_LIST_SELECTION_TEXT);
+//			background = display.getSystemColor (SWT.COLOR_LIST_SELECTION);
+//		} else {
+//			foreground = display.getSystemColor (SWT.COLOR_LIST_FOREGROUND);
+//			background = display.getSystemColor (SWT.COLOR_LIST_BACKGROUND);
+//		}
+//		int red = (short) (background.handle [0] * 255);
+//		int green = (short) (background.handle [1] * 255);
+//		int blue = (short) (background.handle [2] * 255);
+//		RGBColor color = new RGBColor ();
+//		color.red = (short) (red << 8 | red);
+//		color.green = (short) (green << 8 | green);
+//		color.blue = (short) (blue << 8 | blue);
+//		OS.RGBForeColor (color);
+//		OS.PaintRect (rect);
+//		red = (short) (foreground.handle [0] * 255);
+//		green = (short) (foreground.handle [1] * 255);
+//		blue = (short) (foreground.handle [2] * 255);
+//		color.red = (short) (red << 8 | red);
+//		color.green = (short) (green << 8 | green);
+//		color.blue = (short) (blue << 8 | blue);
+//		OS.RGBForeColor (color);
+//		OS.MoveTo (rect.left, (short)(rect.top + 13));
+//		OS.DrawText (buffer, (short) 0, (short) buffer.length);
+//		OS.SetGWorld (port [0], gdh [0]);
+////		System.out.println("x=" + rect.left + " y=" + rect.top + " width=" + (rect.right - rect.left) + " height=" + (rect.bottom - rect.top));
+//		return OS.noErr;
+//	} 
+
+	Rect rect = new Rect ();
+	OS.memcpy (rect, theRect, Rect.sizeof);
+//	System.out.println("x=" + rect.left + " y=" + rect.top + " width=" + (rect.right - rect.left) + " height=" + (rect.bottom - rect.top));
+	int x = rect.left;
+	int y = rect.top;
+	int width = rect.right - rect.left;
+	int height = rect.bottom - rect.top;
+	Rect controlRect = new Rect ();
+	OS.GetControlBounds (handle, controlRect);
+	x -= controlRect.left;
+	y -= controlRect.top;
+	GC gc = paintGC == null ? new GC (this) :  paintGC;
+	int clip = OS.NewRgn ();
+	OS.GetClip (clip);
+	OS.OffsetRgn (clip, (short)-controlRect.left, (short)-controlRect.top);
+	gc.setClipping (Region.carbon_new (clip));
+	OS.DisposeRgn (clip);
+	Display display = getDisplay ();
+	Color foreground = item.foreground != null ? item.foreground : display.getSystemColor (SWT.COLOR_LIST_FOREGROUND);
+	Color background = item.background != null ? item.background : display.getSystemColor (SWT.COLOR_LIST_BACKGROUND);
+	gc.setForeground (foreground);
+	gc.setBackground (background);
+	gc.fillRectangle (x, y, width, height);
+	Image image = item.image;
+	if (image != null) {
+		Rectangle bounds = image.getBounds ();
+		gc.drawImage (image, 0, 0, bounds.width, bounds.height, x, y, bounds.width, height);
+		x += bounds.width + 2;
+	}
+	Point extent = gc.stringExtent (item.text);
+	if ((itemState & OS.kDataBrowserItemIsSelected) != 0) {
+		gc.setForeground (display.getSystemColor (SWT.COLOR_LIST_SELECTION_TEXT));
+		gc.setBackground (display.getSystemColor (SWT.COLOR_LIST_SELECTION));
+		gc.fillRectangle (x, y, extent.x, height);
+	}
+	gc.drawString (item.text, x, y + (Math.max (0, (height - extent.y) / 2)));
+	if (paintGC == null) gc.dispose ();
+	return OS.noErr;
+}
+
+public Rectangle getClientArea () {
+	checkWidget();
+	Rect rect = new Rect (), inset = new Rect ();
+	OS.GetControlBounds (handle, rect);
+	OS.GetDataBrowserScrollBarInset (handle, inset);
+	return new Rectangle (inset.left, inset.top, rect.right - rect.left + inset.right, rect.bottom - rect.top + inset.bottom);
+}
+
 public TreeItem getItem (Point point) {
 	checkWidget ();
 	if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
-	//OPTIMIZE
-	org.eclipse.swt.internal.carbon.Point pt = new org.eclipse.swt.internal.carbon.Point ();
-	OS.SetPt (pt, (short) point.x, (short) point.y);
 	Rect rect = new Rect ();
+	OS.GetControlBounds (handle, rect);
+	org.eclipse.swt.internal.carbon.Point pt = new org.eclipse.swt.internal.carbon.Point ();
+	OS.SetPt (pt, (short) (point.x + rect.left), (short) (point.y + rect.top));
+	//OPTIMIZE
 	for (int i=0; i<items.length; i++) {
 		TreeItem item = items [i];
 		if (item != null) {
@@ -290,6 +422,13 @@
 	return count [0];
 }
 
+int hitTestProc (int browser, int id, int property, int theRect, int mouseRect) {
+//	int index = id - 1;
+//	if (!(0 <= index && index < items.length)) return 0;
+//	TreeItem item = items [index];
+	return 1;
+}
+
 void hookEvents () {
 	super.hookEvents ();
 	Display display= getDisplay();
@@ -299,6 +438,13 @@
 	callbacks.v1_itemDataCallback = display.itemDataProc;
 	callbacks.v1_itemNotificationCallback = display.itemNotificationProc;
 	OS.SetDataBrowserCallbacks (handle, callbacks);
+	DataBrowserCustomCallbacks custom = new DataBrowserCustomCallbacks ();
+	custom.version = OS.kDataBrowserLatestCustomCallbacks;
+	OS.InitDataBrowserCustomCallbacks (custom);
+	custom.v1_drawItemCallback = display.drawItemProc;
+	custom.v1_hitTestCallback = display.hitTestProc;
+	custom.v1_trackingCallback = display.trackingProc;
+	OS.SetDataBrowserCustomCallbacks (handle, custom);
 }
 
 int itemDataProc (int browser, int id, int property, int itemData, int setValue) {
@@ -321,16 +467,16 @@
 			}
 			break;
 		}
-		case COLUMN_ID: {
-			String text = item.text;
-			char [] buffer = new char [text.length ()];
-			text.getChars (0, buffer.length, buffer, 0);
-			int ptr = OS.CFStringCreateWithCharacters (OS.kCFAllocatorDefault, buffer, buffer.length);
-			if (ptr == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
-			OS.SetDataBrowserItemDataText (itemData, ptr);
-			OS.CFRelease (ptr);
-			break;
-		}
+//		case COLUMN_ID: {
+//			String text = item.text;
+//			char [] buffer = new char [text.length ()];
+//			text.getChars (0, buffer.length, buffer, 0);
+//			int ptr = OS.CFStringCreateWithCharacters (OS.kCFAllocatorDefault, buffer, buffer.length);
+//			if (ptr == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
+//			OS.SetDataBrowserItemDataText (itemData, ptr);
+//			OS.CFRelease (ptr);
+//			break;
+//		}
 		case OS.kDataBrowserItemIsContainerProperty: {
 			for (int i=0; i<items.length; i++) {
 				if (items [i] != null && items [i].parentItem == item) {
@@ -411,14 +557,45 @@
 				}
 			}
 			OS.AddDataBrowserItems (handle, id, ids.length, ids, 0);
-			//BUG - items that are added in the expand callback should draw checked but don't
-//			OS.UpdateDataBrowserItems (handle, id, ids.length, ids, OS.kDataBrowserItemNoProperty, OS.kDataBrowserNoItem);
 			break;
 		}
 	}
 	return OS.noErr;
 }
 
+int kEventControlDraw (int nextHandler, int theEvent, int userData) {
+	GC currentGC = paintGC;
+	if (currentGC == null) paintGC = new GC (this);
+	int result = super.kEventControlDraw (nextHandler, theEvent, userData);
+	if (currentGC == null) {
+		paintGC.dispose ();
+		paintGC = null;
+	}
+	return result;
+}
+
+int kEventMouseDown (int nextHandler, int theEvent, int userData) {
+	int result = super.kEventMouseDown (nextHandler, theEvent, userData);
+	if (result == OS.noErr) return result;
+	/*
+	* Feature in the Macintosh.  For some reason, when the user
+	* clicks on the data browser, focus is assigned, then lost
+	* and then reassigned causing kEvenControlSetFocusPart events.
+	* The fix is to ignore kEvenControlSetFocusPart when the user
+	* clicks and send the focus events from kEventMouseDown.
+	*/
+	Display display = getDisplay ();
+	Control oldFocus = display.getFocusControl ();
+	display.ignoreFocus = true;
+	result = OS.CallNextEventHandler (nextHandler, theEvent);
+	display.ignoreFocus = false;
+	if (oldFocus != this) {
+		if (oldFocus != null) oldFocus.sendFocusEvent (false);
+		if (isEnabled ()) sendFocusEvent (true);
+	}
+	return result;
+}
+
 void releaseWidget () {
 	for (int i=0; i<items.length; i++) {
 		TreeItem item = items [i];
@@ -485,6 +662,7 @@
 	ignoreSelect = true;
 	OS.SetDataBrowserSelectedItems (handle, ids.length, ids, OS.kDataBrowserItemsAssign);
 	ignoreSelect = false;
+	if (items.length > 0) showItem (items [0], true);
 }
 
 public void showItem (TreeItem item) {
@@ -511,9 +689,29 @@
 	for (int i=path.length-1; i>=0; --i) {
 		path [i].setExpanded (true);
 	}
-	int options = OS.kDataBrowserRevealWithoutSelecting;
-	if (scroll)  options |= OS.kDataBrowserRevealAndCenterInView;
-	OS.RevealDataBrowserItem (handle, item.id, COLUMN_ID, (byte)options);
+//	if (scroll) {
+//		short [] width = new short [1];
+//		OS.GetDataBrowserTableViewNamedColumnWidth (handle, COLUMN_ID, width);
+//		Rect rect = new Rect (), inset = new Rect ();
+//		OS.GetControlBounds (handle, rect);
+//		OS.GetDataBrowserScrollBarInset (handle, inset);
+//		OS.SetDataBrowserTableViewNamedColumnWidth (handle, COLUMN_ID, (short)(rect.right - rect.left - inset.left - inset.right));
+//		OS.RevealDataBrowserItem (handle, item.id, COLUMN_ID, (byte) OS.kDataBrowserRevealWithoutSelecting);
+//		OS.SetDataBrowserTableViewNamedColumnWidth (handle, COLUMN_ID, (short)width [0]);
+//	}
+	if (scroll) {
+		Rectangle treeRect = getClientArea ();
+		Rectangle itemRect = item.getBounds ();
+		if (treeRect.contains (itemRect.x, itemRect.y)) return;
+		OS.RevealDataBrowserItem (handle, item.id, COLUMN_ID, (byte) OS.kDataBrowserRevealWithoutSelecting);
+		int [] top = new int [1], left = new int [1];
+		OS.GetDataBrowserScrollPosition (handle, top, left);
+		OS.SetDataBrowserScrollPosition (handle, top [0], 0);
+		itemRect = item.getBounds ();
+		if (!treeRect.contains (itemRect.x, itemRect.y)) {
+			OS.RevealDataBrowserItem (handle, item.id, COLUMN_ID, (byte) OS.kDataBrowserRevealWithoutSelecting);
+		}
+	}
 }
 
 public void showSelection () {
@@ -523,4 +721,11 @@
 	if (selection.length > 0) showItem (selection [0], true);
 }
 
+int trackingProc (int browser, int id, int property, int theRect, int startPt, int modifiers) {
+//	int index = id - 1;
+//	if (!(0 <= index && index < items.length)) return 0;
+//	TreeItem item = items [index];
+	return 1;
+}
+
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java
index 2084d8f..e89cb91 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java
@@ -7,7 +7,8 @@
  * http://www.eclipse.org/legal/cpl-v10.html
  */
 
-import org.eclipse.swt.internal.carbon.*;
+import org.eclipse.swt.internal.carbon.OS;
+import org.eclipse.swt.internal.carbon.Rect;
 
 import org.eclipse.swt.*;
 import org.eclipse.swt.graphics.*;
@@ -17,6 +18,7 @@
 	TreeItem parentItem;
 	int id, index = -1;
 	boolean checked;
+	Color foreground, background;
 
 public TreeItem (Tree parent, int style) {
 	super (parent, style);
@@ -57,8 +59,7 @@
 
 public Color getBackground () {
 	checkWidget ();
-	//NOT DONE
-	return getDisplay ().getSystemColor (SWT.COLOR_WHITE);
+	return background != null ? background : getDisplay ().getSystemColor (SWT.COLOR_LIST_BACKGROUND);
 }
 
 public Rectangle getBounds () {
@@ -66,7 +67,15 @@
 	Rect rect = new Rect();
 	OS.GetDataBrowserItemPartBounds (parent.handle, id, Tree.COLUMN_ID, OS.kDataBrowserPropertyEnclosingPart, rect);
 	int x = rect.left, y = rect.top;
-	int width = rect.right - rect.left;
+	int width = 0;
+	if (image != null) {
+		Rectangle bounds = image.getBounds ();
+		width += bounds.width + 2;
+	}
+	GC gc = new GC (parent);
+	Point extent = gc.stringExtent (text);
+	gc.dispose ();
+	width += extent.x;
 	int height = rect.bottom - rect.top;
 	OS.GetControlBounds (parent.handle, rect);
 	x -= rect.left;
@@ -95,8 +104,7 @@
 
 public Color getForeground () {
 	checkWidget ();
-	//NOT DONE
-	return getDisplay ().getSystemColor (SWT.COLOR_BLACK);
+	return foreground != null ? foreground : getDisplay ().getSystemColor (SWT.COLOR_LIST_FOREGROUND);
 }
 
 public boolean getGrayed () {
@@ -144,15 +152,15 @@
 	if (color != null && color.isDisposed ()) {
 		SWT.error (SWT.ERROR_INVALID_ARGUMENT);
 	}
-	//NOT DONE
+	background = color;
+	redraw ();
 }
 
 public void setChecked (boolean checked) {
 	checkWidget ();
 	if ((parent.style & SWT.CHECK) == 0) return;
 	this.checked = checked;
-	int parentID = parentItem == null ? OS.kDataBrowserNoItem : parentItem.id;
-	OS.UpdateDataBrowserItems (parent.handle, parentID, 1, new int[] {id}, OS.kDataBrowserItemNoProperty, OS.kDataBrowserNoItem);
+	redraw ();
 }
 
 public void setExpanded (boolean expanded) {
@@ -171,7 +179,8 @@
 	if (color != null && color.isDisposed ()) {
 		SWT.error (SWT.ERROR_INVALID_ARGUMENT);
 	}
-	//NOT DONE
+	foreground = color;
+	redraw ();
 }
 
 public void setGrayed (boolean grayed) {
@@ -183,16 +192,20 @@
 public void setImage (Image image) {
 	checkWidget ();
 	super.setImage (image);
-	int parentID = parentItem == null ? OS.kDataBrowserNoItem : parentItem.id;
-	OS.UpdateDataBrowserItems (parent.handle, parentID, 1, new int[] {id}, OS.kDataBrowserItemNoProperty, OS.kDataBrowserNoItem);
+	redraw ();
 }
 
 public void setText (String string) {
 	checkWidget ();
 	if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
 	super.setText (string);
+	redraw ();
+}
+
+void redraw () {
 	int parentID = parentItem == null ? OS.kDataBrowserNoItem : parentItem.id;
 	OS.UpdateDataBrowserItems (parent.handle, parentID, 1, new int[] {id}, OS.kDataBrowserItemNoProperty, OS.kDataBrowserNoItem);
+
 }
 
 }