2003-02-12 02:00:12 +00:00
<Type Name= "TreeIterCompareFunc" FullName= "Gtk.TreeIterCompareFunc" >
2007-01-16 16:18:05 +00:00
<TypeSignature Language= "C#" Maintainer= "auto" Value= "public delegate int TreeIterCompareFunc(TreeModel model, TreeIter a, TreeIter b);" />
2011-11-09 16:01:51 +00:00
<TypeSignature Language= "ILAsm" Value= ".class public auto ansi sealed TreeIterCompareFunc extends System.MulticastDelegate" />
2003-02-12 02:00:12 +00:00
<AssemblyInfo >
<AssemblyName > gtk-sharp</AssemblyName>
</AssemblyInfo>
2003-02-23 07:26:30 +00:00
<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>
2011-11-09 16:01:51 +00:00
<Base >
<BaseTypeName > System.Delegate</BaseTypeName>
</Base>
<Parameters >
<Parameter Name= "model" Type= "Gtk.TreeModel" />
<Parameter Name= "a" Type= "Gtk.TreeIter" />
<Parameter Name= "b" Type= "Gtk.TreeIter" />
</Parameters>
<ReturnValue >
<ReturnType > System.Int32</ReturnType>
</ReturnValue>
2003-02-12 02:00:12 +00:00
<Docs >
2005-05-23 20:41:51 +00:00
<param name= "model" > To be added.</param>
<param name= "a" > To be added.</param>
<param name= "b" > To be added.</param>
2004-08-13 16:36:59 +00:00
<summary > Delegate function to specify the shape of comparison functions for tree iterators.</summary>
2011-11-09 16:01:51 +00:00
<returns > To be added.</returns>
2005-04-16 19:09:48 +00:00
<remarks > Functions with this call syntax are usually used for comparison between two tree iterators as part of a sort.
2007-01-16 16:18:05 +00:00
<example > <code lang= "C#" >
2005-04-16 19:09:48 +00:00
using System;
using Gtk;
public class SortableTreeView : TreeView {
TreeStore ts;
TreeIter iter;
TreeViewColumn col0;
TreeViewColumn col1;
public SortableTreeView () {
Type[] col_types = {typeof(string), typeof(string)};
ts = new TreeStore (col_types);
ts.SetSortFunc (0, col0_compare, IntPtr.Zero, null); // use col0_compare to sort
iter = new TreeIter ();
AddRow ("1,1", "1,2");
AddRow ("2,1", "2,2");
this.Model = ts;
this.HeadersClickable = true;
this.HeadersVisible = true;
col0 = new TreeViewColumn ();
col0.Clickable = true;
col0.Title = "Column 1";
CellRendererText col0_renderer = new CellRendererText ();
col0.PackStart (col0_renderer, true);
col0.AddAttribute (col0_renderer, "text", 0);
col0.Clicked += new EventHandler (col0_clicked);
this.AppendColumn (col0);
col1 = new TreeViewColumn ();
col1.Title = "Column 2";
CellRendererText col1_renderer = new CellRendererText ();
col1.PackStart (col1_renderer, true);
col1.AddAttribute (col1_renderer, "text", 1);
this.AppendColumn (col1);
}
public void AddRow (string val1, string val2) {
ts.Append (out iter);
ts.SetValue (iter, 0, val1);
ts.SetValue (iter, 1, val2);
}
public int col0_compare (TreeModel model, TreeIter tia, TreeIter tib) {
return String.Compare ((string) model.GetValue (tia, 0),
(string) model.GetValue (tib, 0));
}
private void col0_clicked (object o, EventArgs args) {
col0.SortOrder = SetSortOrder (col0); // set order asc or desc
col0.SortIndicator = true; // turn on sort indicator
ts.SetSortColumnId (0, col0.SortOrder);
}
public SortType SetSortOrder (TreeViewColumn col) {
if (col.SortIndicator) {
if (col.SortOrder == SortType.Ascending)
return SortType.Descending;
else return SortType.Ascending;
}
else return SortType.Ascending;
}
public static void Main () {
Application.Init ();
Window win = new Window ("TreeIterCompareFunc Example");
win.DeleteEvent += new DeleteEventHandler (delete_event);
win.SetDefaultSize (400, 250);
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
SortableTreeView stv = new SortableTreeView ();
sw.Add (stv);
win.ShowAll ();
Application.Run ();
}
private static void delete_event (object o, DeleteEventArgs args) {
Application.Quit ();
}
}
2007-01-16 16:18:05 +00:00
</code> </example> </remarks>
2003-02-12 02:00:12 +00:00
</Docs>
<Members />
2005-05-23 20:41:51 +00:00
</Type>