CLASS:: TreeViewItem
summary:: An item in TreeView
categories:: GUI>Views

DESCRIPTION::

An instance of TreeViewItem represents an item in TreeView. There may be multiple instances representing the same item, e.g. after calling link::Classes/TreeView#-currentItem:: multiple times.

INSTANCEMETHODS::

PRIVATE:: prValidItem

METHOD:: index
	RETURNS:: An integer position of this item among its siblings.

METHOD:: parent
	RETURNS:: An new instance of TreeViewItem representing the parent item.

METHOD:: childAt
	RETURNS:: A new instance of TreeViewItem representing the child item at code::index::.

METHOD:: addChild
	Appends a new child to this item.

	ARGUMENT:: strings
		An array of Strings (or nil), each for the text of one data field.
	RETURNS::
		An instance of TreeViewItem representing the new item.

METHOD:: insertChild
	Inserts a new child to this item at code::index::.

	ARGUMENT:: index
		The position at which to insert the child.
	ARGUMENT:: strings
		An array of Strings (or nil), each for the text of one data field.
	RETURNS::
		An instance of TreeViewItem representing the new item.

METHOD:: strings
	The text in the data fields.

	ARGUMENT:: strings
		An array of Strings (or nil), each for the text of one data field.

METHOD:: setString
	Sets the text in the given data field.

	ARGUMENT:: column
		An integer index of a data field.
	ARGUMENT:: string
		A String or nil.

METHOD:: colors
	The background colors of the data fields.

	ARGUMENT:: colors
		An array of Colors, each for the color of one data field.

METHOD:: setColor
	Sets the background color of the given data field.

	ARGUMENT:: column
		An integer index of a data field.
	ARGUMENT:: color
		A Color.

METHOD:: textColors
	The text colors of the data fields.

	ARGUMENT:: textColors
		An array of Colors, each for the color of one data field.

METHOD:: setTextColor
	Sets the text color of the given data field.

	ARGUMENT:: column
		An integer index of a data field.
	ARGUMENT:: color
		A Color.

METHOD:: setView
	Places another view into the given data field. Only one view can be placed into a data field at once. If a view is already present, it will be removed and destroyed.

	If the number of data fields decreases due to a call to link::Classes/TreeView#-columns::, the views contained in removed data fields will also be removed and destroyed.

	ARGUMENT:: column
		An integer index of a data field.
	ARGUMENT:: view
		A View.

METHOD:: removeView
	Removes the view from the given data field, if any.

	ARGUMENT:: column
		An integer index of a data field.

METHOD:: view
	The view in the given data field.

	ARGUMENT:: column
		An integer index of a data field.

METHOD:: ==
	Implements equality comparison between two TreeViewItem instances. Two instances are equal if they represent the same item in TreeView.

	RETURNS:: A Boolean.

METHOD:: isNull
	Whether the item is invalid. After an item is removed, all related TreeViewItem instances become invalid.

	RETURNS:: A Boolean.


EXAMPLES::

CODE::

(
t = TreeView().front;
t.columns_(["one", "two", "three"]);
t.addItem(["Alice", "Anna", "Anders"]);
t.addItem(["Bob", "Beatrice", "Benny"]);
t.addItem(["Cleo", "Conrad", "Cecilia"]);
)

i = t.itemAt(1);  //get an item

i.setString(1, "Hans");
i.setColor(1, Color.red);
i.setTextColor(1, Color.white);

i.addChild(["Bengt", "Bodil", "Ben"]);
i.strings;
i.childAt(0).strings;
::
