gtk-sharp 0.0.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. A widget for displaying both trees and lists. Widget that displays any object that implements the interface. To create a tree or list in GTK#, you need to use the interface, in conjunction with the widget. This widget is designed around a Model/View/Controller design and consists of four major parts: , the tree view widget , the view column. The cell renderers ( and others). , the model interface. The View is composed of the first three, while the last is the Model. One of the prime benefits of the MVC design is that multiple views can be created of a single model. For example, a model mapping the file system could be created for a file manager. Many views could be created to display various parts of the file system, but only one copy need be kept in memory. The purpose of the cell renderers is to provide extensibility to the widget and to allow multiple ways of rendering the same type of data. For example, consider how to render a boolean variable. Should you render it as a string of "True" or "False", "On" or "Off", or should you render it as a checkbox? A simple list: using System; using Gtk; using GtkSharp; public class TreeViewSample { public static void Main (string [] args) { Application.Init (); TreeStore store = new TreeStore (typeof (string), typeof (string)); for (int i=0; i < 5; i++) { TreeIter iter = store.AppendValues ("Demo " + i, "Data " + i); } Window win = new Window ("TreeView List Demo"); win.DeleteEvent += new DeleteEventHandler (delete_cb); win.SetDefaultSize (400,250); ScrolledWindow sw = new ScrolledWindow (); win.Add (sw); TreeView tv = new TreeView (); tv.Model = store; tv.HeadersVisible = true; tv.AppendColumn ("Demo", new CellRendererText (), "text", 0); tv.AppendColumn ("Data", new CellRendererText (), "text", 1); sw.Add (tv); sw.Show (); win.ShowAll (); Application.Run (); } private static void delete_cb (System.Object o, DeleteEventArgs args) { Application.Quit (); args.RetVal = true; } } A more advanced example: using System; using System.Reflection; using Gtk; using GtkSharp; public class TreeViewDemo { private static TreeStore store = null; private static Dialog dialog = null; private static Label dialog_label = null; public TreeViewDemo () { Application.Init (); PopulateStore (); Window win = new Window ("TreeView demo"); win.DeleteEvent += new DeleteEventHandler (DeleteCB); win.SetDefaultSize (640,480); ScrolledWindow sw = new ScrolledWindow (); win.Add (sw); TreeView tv = new TreeView (store); tv.HeadersVisible = true; tv.AppendColumn ("Name", new CellRendererText (), "text", 0); tv.AppendColumn ("Type", new CellRendererText (), "text", 1); sw.Add (tv); dialog.Destroy (); dialog = null; win.ShowAll (); Application.Run (); } private static void ProcessType (TreeIter parent, System.Type t) { foreach (MemberInfo mi in t.GetMembers ()) { store.AppendValues (parent, mi.Name, mi.ToString ()); } } private static void ProcessAssembly (TreeIter parent, Assembly asm) { string asm_name = asm.GetName ().Name; foreach (System.Type t in asm.GetTypes ()) { UpdateDialog ("Loading from {0}:\n{1}", asm_name, t.ToString ()); TreeIter iter = store.AppendValues (parent, t.Name, t.ToString ()); ProcessType (iter, t); } } private static void PopulateStore () { if (store != null) return; store = new TreeStore (typeof (string), typeof (string)); foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) { UpdateDialog ("Loading {0}", asm.GetName ().Name); TreeIter iter = store.AppendValues (asm.GetName ().Name, "Assembly"); ProcessAssembly (iter, asm); } } public static void Main (string[] args) { new TreeViewDemo (); } private static void DeleteCB (System.Object o, DeleteEventArgs args) { Application.Quit (); } private static void UpdateDialog (string format, params object[] args) { string text = String.Format (format, args); if (dialog == null) { dialog = new Dialog (); dialog.Title = "Loading data from assemblies..."; dialog.AddButton (Stock.Cancel, 1); dialog.Response += new ResponseHandler (ResponseCB); dialog.SetDefaultSize (480, 100); VBox vbox = dialog.VBox; HBox hbox = new HBox (false, 4); vbox.PackStart (hbox, true, true, 0); Gtk.Image icon = new Gtk.Image (Stock.DialogInfo, IconSize.Dialog); hbox.PackStart (icon, false, false, 0); dialog_label = new Label (text); hbox.PackStart (dialog_label, false, false, 0); dialog.ShowAll (); } else { dialog_label.Text = text; while (Application.EventsPending ()) Application.RunIteration (); } } private static void ResponseCB (object obj, ResponseArgs args) { Application.Quit (); System.Environment.Exit (0); } } Gtk.Container Atk.Implementor GLib.IWrapper GLib.IWrapper System.IDisposable Method System.UInt32 To be added an object of type To be added Method System.Int32 To be added an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type To be added Method Gdk.Pixmap To be added an object of type an object of type To be added Method System.Void To be added To be added Method System.Void To be added an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type To be added Method System.Void To be added an object of type To be added Method System.Int32 To be added an object of type an object of type an object of type To be added Method System.Void To be added an object of type an object of type To be added Method System.Boolean To be added an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type To be added Method System.Void To be added To be added Method System.Int32 To be added an object of type an object of type To be added Method System.Void To be added an object of type an object of type To be added Method System.Void To be added To be added Method System.Void To be added an object of type an object of type an object of type an object of type To be added Method System.Boolean To be added an object of type an object of type To be added Method System.Boolean To be added an object of type an object of type an object of type an object of type an object of type To be added Method System.Void To be added To be added Method System.Void To be added an object of type an object of type To be added Method System.Void To be added an object of type To be added Method System.Void To be added an object of type an object of type To be added Method Gtk.TreeViewColumn To be added an object of type an object of type To be added Method System.Boolean To be added an object of type an object of type an object of type To be added Method System.Void To be added To be added Method System.Void To be added an object of type an object of type an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type To be added Method System.Void To be added an object of type an object of type To be added Method System.Void Disposes the resources associated with the object. Constructor Internal constructor Pointer to the C object. An instance of TreeView, wrapping the C object. This is an internal constructor, and should not be used by user code. Constructor To be added an object of type To be added Constructor To be added an object of type an object of type To be added Property System.UInt32 The for The for the class. Property Gtk.TreeModel To be added an object of type an object of type To be added Property Gtk.TreeSelection To be added an object of type To be added Property Gdk.Window To be added an object of type To be added Property GLib.List To be added an object of type To be added Property System.Boolean Whether to display alternating, shaded rows in the . an object of type an object of type Setting to enables alternating, shaded rows in the . Property System.Boolean To be added an object of type an object of type To be added Property System.Boolean To be added an object of type an object of type To be added Property Gtk.TreeViewColumn To be added an object of type an object of type To be added Property System.Boolean To be added an object of type an object of type To be added Property Gtk.Adjustment To be added an object of type an object of type To be added Property System.Boolean To be added an object of type an object of type To be added Property Gtk.Adjustment To be added an object of type an object of type To be added Property System.Int32 To be added an object of type an object of type To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Constructor Internal constructor GLib type for the type Creates a new instance of TreeView, using the GLib-provided type This is a constructor used by derivative types of that would have their own GLib type assigned to it. This is not typically used by C# code. Method System.Boolean To be added an object of type an object of type an object of type an object of type an object of type To be added Method System.Boolean To be added an object of type an object of type an object of type an object of type To be added Method System.Boolean To be added an object of type an object of type an object of type an object of type an object of type an object of type an object of type To be added Method System.Void To be added an object of type an object of type an object of type an object of type To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Event To be added To be added Method Gtk.TreeViewColumn To be added a a a a To be added Method Gtk.TreeViewColumn To be added a a a a To be added Method System.Void To be added a a a a To be added Method System.Void To be added a To be added