GtkSharp/doc/en/Gtk/NodeStore.xml

209 lines
7.4 KiB
XML
Raw Normal View History

<Type Name="NodeStore" FullName="Gtk.NodeStore">
<TypeSignature Language="C#" Maintainer="Mike Kestner" Value="public class NodeStore : GLib.Object, System.Collections.IEnumerable" />
<AssemblyInfo>
<AssemblyName>gtk-sharp</AssemblyName>
<AssemblyPublicKey>
</AssemblyPublicKey>
<AssemblyVersion>2.8.0.0</AssemblyVersion>
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>A store for <see cref="T:Gtk.TreeView" /> that provides data from an arbitrary class. It is simpler to use than the <see cref="T:Gtk.ListStore" />.</summary>
<remarks>
<para>
This class provides a simple mechanism of implementing the Model required by the <see cref="T:Gtk.TreeView" />.
</para>
<example>
<code lang="C#">
[TreeNode (ColumnCount=2)]
class DemoNode {
string name;
string email;
public DemoNode (string name, string email)
{
this.name = name;
this.email = email;
}
[TreeNodeValue (Column=0)]
public string Name {
get { return name; }
}
[TreeNodeValue (Column=1)]
public string EMail {
get { return email; }
}
}
class Demo {
NodeStore store;
void PopulateStore ()
{
NodeStore store = new NodeStore (typeof (MyRow));
DemoNode my_node = new DemoNode ("Miguel de Icaza", "miguel@ximian.com");
store.AddNode (my_node);
}
</code>
</example>
<para>
Iteration: In new versions of Gtk# (2.0 and up) this class implements the <see cref="T:System.Collections.IEnumerable" /> interface, so code can be written like this:
</para>
<para>
<example>
<code lang="C#">
void DumpColumnValues (NodeStore store, int col)
{
foreach (object[] row in store)
Console.WriteLine ("Value of column {0} is {2}", col, row [col]);
}
</code>
</example>
</para>
</remarks>
</Docs>
<Base>
<BaseTypeName>GLib.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Collections.IEnumerable</InterfaceName>
</Interface>
</Interfaces>
<Members>
<Member MemberName="AddNode">
<MemberSignature Language="C#" Value="public void AddNode (Gtk.ITreeNode node);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="node" Type="Gtk.ITreeNode" />
</Parameters>
<Docs>
<summary>Appends the node to the root level of the tree</summary>
<param name="node">a <see cref="T:Gtk.ITreeNode" /></param>
<remarks>
Adds <paramref name="node" /> to the end of the list of root level nodes.
</remarks>
</Docs>
</Member>
<Member MemberName="AddNode">
<MemberSignature Language="C#" Value="public void AddNode (Gtk.ITreeNode node, int position);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="node" Type="Gtk.ITreeNode" />
<Parameter Name="position" Type="System.Int32" />
</Parameters>
<Docs>
<summary>Inserts the node into the root level of the tree</summary>
<param name="node">a <see cref="T:Gtk.ITreeNode" /></param>
<param name="position">the position to insert it at</param>
<remarks>
Adds <paramref name="node" /> to the list of root level nodes before the node
currently at <paramref name="position" />.
</remarks>
<since version="Gtk# 2.4" />
</Docs>
</Member>
<Member MemberName="GetNode">
<MemberSignature Language="C#" Value="public Gtk.ITreeNode GetNode (Gtk.TreePath path);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>Gtk.ITreeNode</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="path" Type="Gtk.TreePath" />
</Parameters>
<Docs>
<summary>Returns a node given a <see cref="T:Gtk.TreePath" />.</summary>
<param name="path">The path to look up.</param>
<remarks>
Looks up the node corresponding to <paramref name="path" /> and returns it,
or null if the node cannot be found.
</remarks>
<returns>To be added.</returns>
</Docs>
</Member>
<Member MemberName="RemoveNode">
<MemberSignature Language="C#" Value="public void RemoveNode (Gtk.ITreeNode node);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="node" Type="Gtk.ITreeNode" />
</Parameters>
<Docs>
<summary>Removes a node from the store.</summary>
<param name="node">a <see cref="T:Gtk.ITreeNode" /></param>
<remarks>
Removes <paramref name="node" /> from the list of root level nodes.
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public NodeStore (Type node_type);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="node_type" Type="System.Type" />
</Parameters>
<Docs>
<summary>NodeStore constructor</summary>
<param name="node_type">a <see cref="T:System.Type" /></param>
<remarks>
Creates a <see cref="T:Gtk.NodeStore" /> for nodes of the specified <paramref name="node_type" />.
The type provided in <paramref name="node_type" /> must implement <see cref="T:Gtk.ITreeNode" />.
</remarks>
</Docs>
</Member>
<Member MemberName="GType">
<MemberSignature Language="C#" Value="public static GLib.GType GType { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>GLib.GType</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Native type value.</summary>
<value>a <see cref="T:GLib.GType" /></value>
<remarks>
</remarks>
</Docs>
</Member>
<Member MemberName="GetEnumerator">
<MemberSignature Language="C#" Value="public System.Collections.IEnumerator GetEnumerator ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Collections.IEnumerator</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Gets an enumerator for the root nodes.</summary>
<returns>a <see cref="T:System.Collections.IEnumerator" /></returns>
<remarks>Children of root nodes are not enumerated. You must traverse them independently.</remarks>
<since version="Gtk# 2.4" />
</Docs>
</Member>
<Member MemberName="Clear">
<MemberSignature Language="C#" Value="public void Clear ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Removes all nodes from the store.</summary>
<remarks>
</remarks>
</Docs>
</Member>
</Members>
</Type>