gtk-sharp2.4.0.0Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.The tree interface used by
The interface defines a generic tree interface for use by the 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 widget.
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.
In order to make life simpler for programmers who do not need to write their own specialized model, two generic models are provided - the and the . 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.
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 and the . Most of the interface consists of operations on a .
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 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.
By contrast, a 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 . These iterators are the primary way of accessing a model and are similar to the iterators used by . The model interface defines a set of operations using them for navigating the model.
It is expected that models fill in the iterator with private data. For example, the model, which is internally a simple linked list, stores a list node in one of the pointers. The 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.
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 and ). 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 flag was added to indicate this behavior.
GLib.IWrapperMethodSystem.Int32Returns the number of children that the has.an object of type As a special case, if iter is , then the number of toplevel nodes is returned.MethodSystem.BooleanSets the TreeIter object pointed to by to point to the first child of this tree.
an object of type an object of type , true if the iter has been set to the first child.MethodSystem.VoidEmits the signal.
an object of type
an object of type MethodSystem.VoidCalls on each node in model in a depth-first fashion.
an object of type If func returns , then the tree ceases to be walked, and this method returns.MethodSystem.BooleanGets the first iterator in the tree (the one at the path "0") and returns .
an object of type an object of type Returns if the tree is empty.MethodSystem.VoidEmits the event.
an object of type
an object of type This should be called by models after the child state of a node changes.MethodGtk.TreePathGets the of .
an object of type an object of type MethodSystem.BooleanReturns if has children, otherwise.
an object of type an object of type MethodSystem.VoidLets the tree ref the node.
an object of type 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.This function is primarily meant as a way for views to let caching models 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.A model should be expected to be able to get an iter independent of its referenced state.MethodSystem.Int32Returns the number of children that has.
an object of type an object of type As a special case, if is , then the number of toplevel nodes is returned.MethodSystem.VoidEmits the event.
an object of type , path of the inserted row.
an object of type , points to the inserted row.
MethodSystem.VoidEmits the event.
an object of type This should be called by models after a row has been removed. The location pointed to by should be the location that the row previously was at. It may not be a valid location anymore.MethodSystem.VoidGets the values of child properties for the row pointed to by .
an object of type
a , pointer to the va_list data structure of arguments (FIXME: clarify what va_lists look like)
MethodSystem.VoidLets the tree unref the node.
an object of type 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 . Please note that nodes that are deleted are not unreferenced.PropertySystem.Int32Returns the number of columns supported by the .an object of type PropertyGtk.TreeModelFlagsReturns a set of flags supported by this interface.an object of type The flags are a bitwise combination of . The flags supported should not change during the lifecycle of the .EventGtk.RowHasChildToggledHandlerEmitted when a child of a row is toggled.EventGtk.RowInsertedHandlerEmitted when a row has been inserted into the model.EventGtk.RowDeletedHandlerEmitted when a row is deleted.EventGtk.RowChangedHandlerEmitted when a row has changed.EventGtk.RowsReorderedHandlerEmitted when a row is re-orderedMethodSystem.BooleanSets to be the child of the root node, using the given index.
an object of type
an object of type an object of type In this case, the nth root node is set.MethodSystem.BooleanSets to be the child of , using the given index.
an object of type
an object of type
an object of type an object of type The first index is 0. If is too big, or has no children, is set to an invalid iterator and is returned. will remain a valid node after this function has been called.MethodSystem.BooleanGets the at .
an object of type
an object of type an object of type Otherwise, is left invalid and is returned.MethodSystem.BooleanSets to point to the first child of .
an object of type
an object of type an object of type If has no children, is returned and is set to be invalid. will remain a valid node after this function has been called.MethodSystem.BooleanSets to a valid iterator pointing to .
an object of type
an object of type an object of type MethodSystem.BooleanSets to be the parent of .
an object of type
an object of type an object of type If is at the toplevel, and does not have a parent, then is set to an invalid iterator and is returned. will remain a valid node after this function has been called.MethodSystem.StringGenerates a string representation of the path of .
a a This string is a ':' separated list of numbers. For example, "4:10:0:3" would be an acceptable return value for this string.MethodSystem.VoidSets the value of column in the row pointed to by to if the value is a boolean.
a
a
a MethodSystem.VoidSets the value of column in the row pointed to by to if the value is a .
a
a
a MethodSystem.VoidSets the value of column in the row pointed to by to if the value is an .
a
a
a MethodSystem.VoidSets the value of column in the row pointed to by to if the value is an .
a
a
a MethodSystem.VoidSets the value of column in the row pointed to by to if the value is an .
a
a
a MethodSystem.VoidSets the value of column in the row pointed to by to if the value is an .
a
a
a To be added.MethodSystem.VoidSets the value of column in the row pointed to by to if the value is an .
a
a
a MethodSystem.ObjectGets the value stored in column of the row pointed to by .
a
a a MethodGLib.GTypeReturns the type of the column at the given index.
a , the column number.
a MethodSystem.Int32Sends out a event.
a that points to the row whose children have been reordered.
a that points to the row whose children have been reordered.
a , pointer to an array of integers with the new indices of the children.MethodSystem.VoidGets the value stored in column of the row pointed to by and stores it in
a
a
a MethodSystem.BooleanSets to point to the node following it at the current level.
an object of type an object of type If there is no next iter, is returned and iter is set to be invalid.