diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem2.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem2.java | 777 |
1 files changed, 0 insertions, 777 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem2.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem2.java deleted file mode 100644 index b95f828e12..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem2.java +++ /dev/null @@ -1,777 +0,0 @@ -package org.eclipse.swt.widgets; - -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.carbon.*; -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; - -/** - * Instances of this class represent a selectable user interface object - * that represents a hierarchy of tree items in a tree widget. - * - * <dl> - * <dt><b>Styles:</b></dt> - * <dd>(none)</dd> - * <dt><b>Events:</b></dt> - * <dd>(none)</dd> - * </dl> - * <p> - * IMPORTANT: This class is <em>not</em> intended to be subclassed. - * </p> - */ - -public class TreeItem2 extends Item { - Tree2 parent; - int background, foreground; - - // AW - private TreeItem2 fParentItem; - ArrayList fChildren; - boolean fIsOpen; - // AW - -/** - * Constructs a new instance of this class given its parent - * (which must be a <code>Tree2</code> or a <code>TreeItem2</code>) - * and a style value describing its behavior and appearance. - * The item is added to the end of the items maintained by its parent. - * <p> - * The style value is either one of the style constants defined in - * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together - * (that is, using the <code>int</code> "|" operator) two or more - * of those <code>SWT</code> style constants. The class description - * lists the style constants that are applicable to the class. - * Style bits are also inherited from superclasses. - * </p> - * - * @param parent a composite control which will be the parent of the new instance (cannot be null) - * @param style the style of control to construct - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> - * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> - * </ul> - * - * @see SWT - * @see Widget#checkSubclass - * @see Widget#getStyle - */ -public TreeItem2 (Tree2 parent, int style) { - /* AW - super (parent, style); - this.parent = parent; - fParentItem = parent.fRoot; - parent.createItem (this, 0, 99999); - */ - this(parent.fRoot, style); -} - -/** - * Constructs a new instance of this class given its parent - * (which must be a <code>Tree2</code> or a <code>TreeItem2</code>), - * a style value describing its behavior and appearance, and the index - * at which to place it in the items maintained by its parent. - * <p> - * The style value is either one of the style constants defined in - * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together - * (that is, using the <code>int</code> "|" operator) two or more - * of those <code>SWT</code> style constants. The class description - * lists the style constants that are applicable to the class. - * Style bits are also inherited from superclasses. - * </p> - * - * @param parent a composite control which will be the parent of the new instance (cannot be null) - * @param style the style of control to construct - * @param index the index to store the receiver in its parent - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> - * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> - * </ul> - * - * @see SWT - * @see Widget#checkSubclass - * @see Widget#getStyle - */ -public TreeItem2 (Tree2 parent, int style, int index) { - /* AW - super (parent, style); - if (index < 0) error (SWT.ERROR_INVALID_RANGE); - this.parent = parent; - fParentItem = parent.fRoot; - int hItem = 0; // OS.TVI_FIRST; - if (index != 0) { - int count = 1, hwnd = parent.handle; - hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); - while (hItem != 0 && count < index) { - hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem); - count++; - } - if (hItem == 0) error (SWT.ERROR_INVALID_RANGE); - }; - parent.createItem (this, 0, hItem); - */ - this(parent.fRoot, style, index); -} - -/** - * Constructs a new instance of this class given its parent - * (which must be a <code>Tree2</code> or a <code>TreeItem2</code>) - * and a style value describing its behavior and appearance. - * The item is added to the end of the items maintained by its parent. - * <p> - * The style value is either one of the style constants defined in - * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together - * (that is, using the <code>int</code> "|" operator) two or more - * of those <code>SWT</code> style constants. The class description - * lists the style constants that are applicable to the class. - * Style bits are also inherited from superclasses. - * </p> - * - * @param parentItem a composite control which will be the parent of the new instance (cannot be null) - * @param style the style of control to construct - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> - * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> - * </ul> - * - * @see SWT - * @see Widget#checkSubclass - * @see Widget#getStyle - */ -public TreeItem2 (TreeItem2 parentItem, int style) { - super (checkNull (parentItem).parent, style); - fParentItem = parentItem; - parent = parentItem.parent; - parent.createItem (this, parentItem, 99999); -} - -/** - * Constructs a new instance of this class given its parent - * (which must be a <code>Tree2</code> or a <code>TreeItem2</code>), - * a style value describing its behavior and appearance, and the index - * at which to place it in the items maintained by its parent. - * <p> - * The style value is either one of the style constants defined in - * class <code>SWT</code> which is applicable to instances of this - * class, or must be built by <em>bitwise OR</em>'ing together - * (that is, using the <code>int</code> "|" operator) two or more - * of those <code>SWT</code> style constants. The class description - * lists the style constants that are applicable to the class. - * Style bits are also inherited from superclasses. - * </p> - * - * @param parentItem a composite control which will be the parent of the new instance (cannot be null) - * @param style the style of control to construct - * @param index the index to store the receiver in its parent - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> - * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> - * </ul> - * - * @see SWT - * @see Widget#checkSubclass - * @see Widget#getStyle - */ -public TreeItem2 (TreeItem2 parentItem, int style, int index) { - super (checkNull (parentItem).parent, style); - if (index < 0) error (SWT.ERROR_INVALID_RANGE); - parent = parentItem.parent; - fParentItem = parentItem; - int hItem = 0; // OS.TVI_FIRST; - if (index != 0) { - int count = 1, hwnd = parent.handle; - /* AW - hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent); - while (hItem != 0 && count < index) { - hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem); - count++; - } - */ - if (hItem == 0) error (SWT.ERROR_INVALID_RANGE); - } - parent.createItem (this, parentItem, hItem); -} - -static TreeItem2 checkNull (TreeItem2 item) { - if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - return item; -} - -protected void checkSubclass () { - if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); -} - -/** - * Returns the receiver's background color. - * - * @return the background color - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * - * @since 2.0 - * - */ -public Color getBackground () { - checkWidget (); - int pixel = (background == -1) ? parent.getBackgroundPixel() : background; - return Color.carbon_new(getDisplay (), pixel, false); -} - -/** - * Returns a rectangle describing the receiver's size and location - * relative to its parent. - * - * @return the receiver's bounding rectangle - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public Rectangle getBounds () { - checkWidget (); - MacRect bounds= new MacRect(); - OS.GetDataBrowserItemPartBounds(parent.handle, handle, Tree2.COL_ID, - OS.kDataBrowserPropertyEnclosingPart, bounds.getData()); - return bounds.toRectangle(); -} - -/** - * Returns <code>true</code> if the receiver is checked, - * and false otherwise. When the parent does not have - * the <code>CHECK style, return false. - * <p> - * - * @return the checked state - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean getChecked () { - checkWidget (); - if ((parent.style & SWT.CHECK) == 0) return false; - /* AW - int hwnd = parent.handle; - TVITEM tvItem = new TVITEM (); - tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE; - tvItem.stateMask = OS.TVIS_STATEIMAGEMASK; - tvItem.hItem = handle; - int result = OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem); - return (result != 0) && (((tvItem.state >> 12) & 1) == 0); - */ - return false; -} - -public Display getDisplay () { - Tree2 parent = this.parent; - if (parent == null) - error (SWT.ERROR_WIDGET_DISPOSED); - return parent.getDisplay (); -} - -/** - * Returns <code>true</code> if the receiver is expanded, - * and false otherwise. - * <p> - * - * @return the expanded state - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean getExpanded () { - checkWidget (); - return fIsOpen; -} - -/** - * Returns the foreground color that the receiver will use to draw. - * - * @return the receiver's foreground color - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * - * @since 2.0 - * - */ -public Color getForeground () { - checkWidget (); - int pixel = (foreground == -1) ? parent.getForegroundPixel() : foreground; - return Color.carbon_new (getDisplay (), pixel, false); -} - -/** - * Returns <code>true</code> if the receiver is grayed, - * and false otherwise. When the parent does not have - * the <code>CHECK style, return false. - * <p> - * - * @return the grayed state - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public boolean getGrayed () { - checkWidget (); - if ((parent.style & SWT.CHECK) == 0) return false; - int hwnd = parent.handle; - /* AW - TVITEM tvItem = new TVITEM (); - tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE; - tvItem.stateMask = OS.TVIS_STATEIMAGEMASK; - tvItem.hItem = handle; - int result = OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem); - return (result != 0) && ((tvItem.state >> 12) > 2); - */ - return false; -} - -/** - * Returns the number of items contained in the receiver - * that are direct item children of the receiver. - * - * @return the number of items - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public int getItemCount () { - checkWidget (); - if (fChildren != null) - return fChildren.size(); - return 0; -} - -/** - * Returns an array of <code>TreeItem2</code>s which are the - * direct item children of the receiver. - * <p> - * Note: This is not the actual structure used by the receiver - * to maintain its list of items, so modifying the array will - * not affect the receiver. - * </p> - * - * @return the receiver's items - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public TreeItem2 [] getItems () { - checkWidget (); - if (fChildren != null) - return (TreeItem2[]) fChildren.toArray(new TreeItem2[fChildren.size()]); - return new TreeItem2[0]; -} - -/** - * Returns the receiver's parent, which must be a <code>Tree2</code>. - * - * @return the receiver's parent - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public Tree2 getParent () { - checkWidget (); - return parent; -} - -/** - * Returns the receiver's parent item, which must be a - * <code>TreeItem2</code> or null when the receiver is a - * root. - * - * @return the receiver's parent item - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public TreeItem2 getParentItem () { - checkWidget (); - if (fParentItem == parent.fRoot) - return null; - return fParentItem; -} - -void redraw () { - /* AW - if (parent.drawCount > 0) return; - int hwnd = parent.handle; - if (!OS.IsWindowVisible (hwnd)) return; - RECT rect = new RECT (); - rect.left = handle; - if (OS.SendMessage (hwnd, OS.TVM_GETITEMRECT, 1, rect) != 0) { - OS.InvalidateRect (hwnd, rect, true); - } - */ - update(OS.kDataBrowserItemNoProperty); -} - -void releaseChild () { - super.releaseChild (); - parent.destroyItem (this); -} - -void releaseHandle () { - super.releaseHandle (); - handle = 0; -} - -// AW -void releaseResources() { -} -// AW - -void releaseWidget () { - super.releaseWidget (); - parent = null; -} - -/** - * Sets the receiver's background color to the color specified - * by the argument, or to the default system color for the item - * if the argument is null. - * - * @param color the new color (or null) - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * - * @since 2.0 - * - */ -public void setBackground (Color color) { - checkWidget (); - if (color != null && color.isDisposed ()) { - SWT.error (SWT.ERROR_INVALID_ARGUMENT); - } - int pixel = -1; - if (color != null) { - /* AW - parent.customDraw = true; - */ - pixel = color.handle; - } - background = pixel; - redraw (); -} - -/** - * Sets the checked state of the receiver. - * <p> - * - * @param checked the new checked state - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setChecked (boolean checked) { - checkWidget (); - if ((parent.style & SWT.CHECK) == 0) return; - /* AW - int hwnd = parent.handle; - TVITEM tvItem = new TVITEM (); - tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE; - tvItem.stateMask = OS.TVIS_STATEIMAGEMASK; - tvItem.hItem = handle; - OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem); - int state = tvItem.state >> 12; - if (checked) { - if ((state & 0x1) != 0) state++; - } else { - if ((state & 0x1) == 0) --state; - } - tvItem.state = state << 12; - OS.SendMessage (hwnd, OS.TVM_SETITEM, 0, tvItem); - */ -} - -/** - * Sets the expanded state of the receiver. - * <p> - * - * @param expanded the new expanded state - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setExpanded (boolean expanded) { - checkWidget (); - int hwnd = parent.handle; - /* - * Feature in Windows. When the user collapses the root - * of a subtree that has the focus item, Windows moves - * the selection to the root of the subtree and issues - * a TVN_SELCHANGED to inform the programmer that the - * seletion has changed. When the programmer collapses - * the same subtree using TVM_EXPAND, Windows does not - * send the selection changed notification. This is not - * stricly wrong but is inconsistent. The fix is to notice - * that the selection has changed and issue the event. - */ - /* AW - int hOldItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); - parent.ignoreExpand = true; - OS.SendMessage (hwnd, OS.TVM_EXPAND, expanded ? OS.TVE_EXPAND : OS.TVE_COLLAPSE, handle); - parent.ignoreExpand = false; - int hNewItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); - if (hNewItem != hOldItem) { - Event event = new Event (); - if (hNewItem != 0) { - TVITEM tvItem = new TVITEM (); - tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM; - tvItem.hItem = hNewItem; - if (OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem) != 0) { - event.item = parent.items [tvItem.lParam]; - } - } - parent.sendEvent (SWT.Selection, event); - } - */ - if (expanded) - OS.OpenDataBrowserContainer(parent.handle, handle); - else - OS.CloseDataBrowserContainer(parent.handle, handle); -} - -/** - * Sets the receiver's foreground color to the color specified - * by the argument, or to the default system color for the item - * if the argument is null. - * - * @param color the new color (or null) - * - * @since 2.0 - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * - * @since 2.0 - * - */ -public void setForeground (Color color) { - checkWidget (); - if (color != null && color.isDisposed ()) { - SWT.error (SWT.ERROR_INVALID_ARGUMENT); - } - int pixel = -1; - if (color != null) { - /* AW - parent.customDraw = true; - */ - pixel = color.handle; - } - foreground = pixel; - redraw (); -} - -/** - * Sets the grayed state of the receiver. - * <p> - * - * @param checked the new grayed state - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - */ -public void setGrayed (boolean grayed) { - checkWidget (); - if ((parent.style & SWT.CHECK) == 0) return; - int hwnd = parent.handle; - /* AW - TVITEM tvItem = new TVITEM (); - tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE; - tvItem.stateMask = OS.TVIS_STATEIMAGEMASK; - tvItem.hItem = handle; - OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem); - int state = tvItem.state >> 12; - if (grayed) { - if (state <= 2) state +=2; - } else { - if (state > 2) state -=2; - } - tvItem.state = state << 12; - OS.SendMessage (hwnd, OS.TVM_SETITEM, 0, tvItem); - */ -} - -public void setImage (Image image) { - checkWidget (); - super.setImage (image); - update(OS.kDataBrowserItemNoProperty); -} - -/** - * This label will be displayed to the right of the bitmap, - * or, if the receiver doesn't have a bitmap to the right of - * the horizontal hierarchy connector line. - */ -public void setText (String string) { - checkWidget (); - if (string == null) error (SWT.ERROR_NULL_ARGUMENT); - super.setText (string); - update(OS.kDataBrowserItemNoProperty); -} - -///////////////////////////////////////////////////////////// -// Mac stuff -///////////////////////////////////////////////////////////// - -/** - * Only used for creating the root item - */ -TreeItem2 (Tree2 parent) { - super (parent, SWT.NONE); - this.parent = parent; - parent.createItem (this, null, 99999); -} - -void addChild(TreeItem2 child) { - if (fChildren == null) - fChildren= new ArrayList(); - fChildren.add(child); - if (fIsOpen) { - if (OS.AddDataBrowserItems(parent.handle, getContainerID(), 1, new int[] { child.handle }, 0) != OS.kNoErr) { - System.out.println("SWT.ERROR_ITEM_NOT_ADDED"); - //error (SWT.ERROR_ITEM_NOT_ADDED); - } - } else { - update(OS.kDataBrowserItemIsContainerProperty); - } -} - -void removeChild(TreeItem2 child) { - if (fChildren != null) - fChildren.remove(child); - if (fIsOpen) { - if (OS.RemoveDataBrowserItems(parent.handle, getContainerID(), 1, new int[] { child.handle }, 0) != OS.kNoErr) { - System.out.println("SWT.ERROR_ITEM_NOT_REMOVED"); - //error (SWT.ERROR_ITEM_NOT_REMOVED); - } - } else { - update(OS.kDataBrowserItemIsContainerProperty); - } -} - -int getContainerID() { - if (this == parent.fRoot) - return 0; - return handle; -} - -void open() { - fIsOpen= true; - if (fChildren != null) { - int n= fChildren.size(); - int[] ids= new int[n]; - Iterator iter= fChildren.iterator(); - for (int i= 0; iter.hasNext(); i++) { - TreeItem2 e= (TreeItem2) iter.next(); - ids[i]= e.handle; - } - if (OS.AddDataBrowserItems(parent.handle, getContainerID(), ids.length, ids, 0) != OS.kNoErr) { - System.out.println("SWT.ERROR_ITEM_NOT_ADDED"); - //error (SWT.ERROR_ITEM_NOT_ADDED); - } - } -} - -void close() { - fIsOpen= false; -} - -void updateContent(int itemData) { - String text= getText(); - if (text != null) { - int sHandle= 0; - try { - sHandle= OS.CFStringCreateWithCharacters(text); - OS.SetDataBrowserItemDataText(itemData, sHandle); - } finally { - if (sHandle != 0) - OS.CFRelease(sHandle); - } - } - /* - if (fIcon != 0) { - OS.SetDataBrowserItemDataIcon(itemData, fIcon); - } - */ -} - -void update(int property) { - int containerID= 0; - if (fParentItem != null) - containerID= fParentItem.handle; - OS.UpdateDataBrowserItems(parent.handle, containerID, 1, new int[] { handle }, property, OS.kDataBrowserNoItem); -} - -boolean isContainerProperty() { - return fChildren != null; -} - -} |