<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <linklocation="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<summary>The tree interface used by <seecref="T:Gtk.TreeView"/></summary>
<remarks>
<para>
The <seecref="T:Gtk.TreeModel"/> interface defines a generic tree interface for use by the <seecref="T:Gtk.TreeView"/> widget. It is an abstract interface, and is designed to be usable with any appropriate data structure. The programmer just has to implement this interface on their own data type for it to be viewable by a <seecref="T:Gtk.TreeView"/> widget.
</para>
<para>
The model is represented as a hierarchical tree of strongly-typed, columned data. In other words, the model can be seen as a tree where every node has different values depending on which column is being queried. The types are homogeneous per column across all nodes. It is important to note that this interface only provides a way of examining a model and observing changes. The implementation of each individual model decides how and if changes are made.
</para>
<para>
In order to make life simpler for programmers who do not need to write their own specialized model, two generic models are provided - the <seecref="T:Gtk.TreeStore"/> and the <seecref="T:Gtk.ListStore"/>. To use these, the developer simply pushes data into these models as necessary. These models provide the data structure as well as all appropriate tree interfaces. As a result, implementing drag and drop, sorting, and storing data is trivial. For the vast majority of trees and lists, these two models are sufficient.
</para>
<para>
Models are accessed on a node/column level of granularity. One can query for the value of a model at a certain node and a certain column on that node. There are two structures used to reference a particular node in a model. They are the <seecref="T:Gtk.TreePath"/> and the <seecref="T:Gtk.TreeIter"/>. Most of the interface consists of operations on a <seecref="T:Gtk.TreeIter"/>.
</para>
<para>
A path is essentially a potential node. It is a location on a model that may or may not actually correspond to a node on a specific model. The <seecref="T:Gtk.TreePath"/> struct can be converted into either an array of unsigned integers or a string. The string form is a list of numbers separated by a colon. Each number refers to the offset at that level. Thus, the path "0" refers to the root node and the path "2:4" refers to the fifth child of the third node.
</para>
<para>
By contrast, a <seecref="T:Gtk.TreeIter"/> is a reference to a specific node on a specific model. It is a generic struct with an integer and three generic pointers. These are filled in by the model in a model-specific way. One can convert a path to an iterator by calling <seecref="M:Gtk.TreeModel.GetIter(Gtk.TreeIter,Gtk.TreePath)"/>. These iterators are the primary way of accessing a model and are similar to the iterators used by <seecref="T:Gtk.TextBuffer"/>. The model interface defines a set of operations using them for navigating the model.
</para>
<para>
It is expected that models fill in the iterator with private data. For example, the <seecref="T:Gtk.ListStore"/> model, which is internally a simple linked list, stores a list node in one of the pointers. The <seecref="T:Gtk.TreeModelSort"/> stores an array and an offset in two of the pointers. Additionally, there is an integer field. This field is generally filled with a unique stamp per model. This stamp is for catching errors resulting from using invalid iterators with a model.
</para>
<para>
The lifecycle of an iterator can be a little confusing at first. Iterators are expected to always be valid for as long as the model is unchanged (and does not emit a signal). Additionally, some models guarantee that an iterator is valid for as long as the node it refers to is valid (most notably the <seecref="T:Gtk.TreeStore"/> and <seecref="T:Gtk.ListStore"/>). Although generally uninteresting, as one always has to allow for the case where iterators do not persist beyond a signal, some very important performance enhancements were made in the sort model. As a result, the <seecref="F:Gtk.TreeModelFlags.ItersPersist"/> flag was added to indicate this behavior.
<paramname="iter">an object of type <seecref="T:Gtk.TreeIter"/></param>
<remarks>
<para>This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons.</para>
<para>This function is primarily meant as a way for views to let caching model know when nodes are being displayed (and hence, whether or not to cache that node.) For example, a file-system based model would not want to keep the entire file-hierarchy in memory, just the sections that are currently being displayed by every current view.</para>
<para>A model should be expected to be able to get an iter independent of its referenced state.</para>
<summary>Emits the <seecref="E:Gtk.TreeModel.RowDeleted"/> event.</summary>
<paramname="path">an object of type <seecref="T:Gtk.TreePath"/></param>
<remarks>This should be called by models after a row has been removed. The location pointed to by <paramrefname="path"/> should be the location that the row previously was at. It may not be a valid location anymore.</remarks>
<paramname="iter">an object of type <seecref="T:Gtk.TreeIter"/></param>
<remarks>This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons. For more information on what this means, see <seecref="M:Gtk.TreeModel.RefNode()"/>. Please note that nodes that are deleted are not unreferenced.</remarks>
<summary>Returns a set of flags supported by this interface.</summary>
<returns>an object of type <seecref="T:Gtk.TreeModelFlags"/></returns>
<remarks>The flags are a bitwise combination of <seecref="T:Gtk.TreeModelFlags"/>. The flags supported should not change during the lifecycle of the <seecref="T:Gtk.TreeModel"/>.</remarks>
<summary>Sets <paramrefname="iter"/> to be the child of <paramrefname="parent"/>, using the given index.</summary>
<paramname="iter">an object of type <seecref="T:Gtk.TreeIter"/></param>
<paramname="parent">an object of type <seecref="T:Gtk.TreeIter"/></param>
<paramname="n">an object of type <seecref="T:System.Int32"/></param>
<returns>an object of type <seecref="T:System.Boolean"/></returns>
<remarks>The first index is 0. If <paramrefname="n"/> is too big, or <paramrefname="parent"/> has no children, <paramrefname="iter"/> is set to an invalid iterator and <seelangword="false"/> is returned. <paramrefname="parent"/> will remain a valid node after this function has been called.</remarks>
<summary>Sets <paramrefname="iter"/> to point to the first child of <paramrefname="parent"/>.</summary>
<paramname="iter">an object of type <seecref="T:Gtk.TreeIter"/></param>
<paramname="parent">an object of type <seecref="T:Gtk.TreeIter"/></param>
<returns>an object of type <seecref="T:System.Boolean"/></returns>
<remarks>If <paramrefname="parent"/> has no children, <seelangword="false"/> is returned and <paramrefname="iter"/> is set to be invalid. <paramrefname="parent"/> will remain a valid node after this function has been called.</remarks>
<summary>Sets <paramrefname="iter"/> to be the parent of <paramrefname="child"/>.</summary>
<paramname="iter">an object of type <seecref="T:Gtk.TreeIter"/></param>
<paramname="child">an object of type <seecref="T:Gtk.TreeIter"/></param>
<returns>an object of type <seecref="T:System.Boolean"/></returns>
<remarks>If <paramrefname="child"/> is at the toplevel, and does not have a parent, then <paramrefname="iter"/> is set to an invalid iterator and <seelangword="false"/> is returned. <paramrefname="child"/> will remain a valid node after this function has been called.</remarks>