/usr/share/gtk-sharp2-examples/ManagedTreeViewDemo.cs is in gtk-sharp2-examples 2.12.40-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | // ManagedTreeViewDemo.cs - Another TreeView demo
//
// Author: Rachel Hestilow <hestilow@ximian.com>
//
// (c) 2003 Rachel Hestilow
namespace GtkSamples {
using System;
using System.Runtime.InteropServices;
using Gtk;
public class TreeViewDemo {
private static ListStore store = null;
private class Pair {
public string a, b;
public Pair (string a, string b) {
this.a = a;
this.b = b;
}
}
private static void PopulateStore ()
{
store = new ListStore (typeof (Pair));
string[] combs = {null, "foo", "bar", "baz"};
foreach (string a in combs) {
foreach (string b in combs) {
store.AppendValues (new Pair (a, b));
}
}
}
private static void CellDataA (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
Pair val = (Pair) store.GetValue (iter, 0);
((CellRendererText) cell).Text = val.a;
}
private static void CellDataB (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
Pair val = (Pair) store.GetValue (iter, 0);
((CellRendererText) cell).Text = val.b;
}
public static void Main (string[] args)
{
Application.Init ();
PopulateStore ();
Window win = new Window ("TreeView demo");
win.DeleteEvent += new DeleteEventHandler (DeleteCB);
win.DefaultWidth = 320;
win.DefaultHeight = 480;
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
TreeView tv = new TreeView (store);
tv.HeadersVisible = true;
tv.AppendColumn ("One", new CellRendererText (), new TreeCellDataFunc (CellDataA));
tv.AppendColumn ("Two", new CellRendererText (), new TreeCellDataFunc (CellDataB));
sw.Add (tv);
win.ShowAll ();
Application.Run ();
}
private static void DeleteCB (System.Object o, DeleteEventArgs args)
{
Application.Quit ();
}
}
}
|