public PropertyGridTree(EditorManager editorManager, PropertyGrid parentGrid) { this.editorManager = editorManager; this.parentGrid = parentGrid; propertyRows = new Hashtable(); store = new TreeStore(typeof(string), typeof(object), typeof(bool), typeof(object)); tree = new InternalTree(this, store); CellRendererText crt; TreeViewColumn col; col = new TreeViewColumn(); col.Title = "Property"; crt = new CellRendererPropertyGroup(tree); crt.Xpad = 0; col.PackStart(crt, true); col.SetCellDataFunc(crt, new TreeCellDataFunc(GroupData)); col.Resizable = true; col.Expand = false; col.Sizing = TreeViewColumnSizing.Fixed; col.FixedWidth = 180; tree.AppendColumn(col); editorColumn = new TreeViewColumn(); editorColumn.Title = "Value"; CellRendererProperty crp = new CellRendererProperty(tree); editorColumn.PackStart(crp, true); editorColumn.SetCellDataFunc(crp, new TreeCellDataFunc(PropertyData)); editorColumn.Sizing = TreeViewColumnSizing.Fixed; editorColumn.Resizable = false; editorColumn.Expand = true; tree.AppendColumn(editorColumn); tree.HeadersVisible = false; this.ShadowType = Gtk.ShadowType.None; this.HscrollbarPolicy = Gtk.PolicyType.Never; Add(tree); ShowAll(); tree.Selection.Changed += OnSelectionChanged; }
public PropertyGridTree(EditorManager editorManager, PropertyGrid parentGrid) { this.editorManager = editorManager; this.parentGrid = parentGrid; propertyRows = new Hashtable (); store = new TreeStore (typeof (string), typeof(object), typeof(bool), typeof(object)); tree = new InternalTree (this, store); CellRendererText crt; TreeViewColumn col; col = new TreeViewColumn (); col.Title = Catalog.GetString("Property"); crt = new CellRendererPropertyGroup (tree); crt.Xpad = 0; col.PackStart (crt, true); col.SetCellDataFunc (crt, new TreeCellDataFunc (GroupData)); col.Resizable = true; col.Expand = false; col.Sizing = TreeViewColumnSizing.Fixed; col.FixedWidth = 180; tree.AppendColumn (col); editorColumn = new TreeViewColumn (); editorColumn.Title = Catalog.GetString("Value"); CellRendererProperty crp = new CellRendererProperty (tree); editorColumn.PackStart (crp, true); editorColumn.SetCellDataFunc (crp, new TreeCellDataFunc (PropertyData)); editorColumn.Sizing = TreeViewColumnSizing.Fixed; editorColumn.Resizable = false; editorColumn.Expand = true; tree.AppendColumn (editorColumn); tree.HeadersVisible = false; this.ShadowType = Gtk.ShadowType.None; this.HscrollbarPolicy = Gtk.PolicyType.Never; Add (tree); ShowAll (); tree.Selection.Changed += OnSelectionChanged; }
void GroupData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { CellRendererPropertyGroup rc = (CellRendererPropertyGroup)cell; rc.IsGroup = (bool)model.GetValue(iter, 2); rc.Text = (string)model.GetValue(iter, 0); PropertyDescriptor prop = (PropertyDescriptor)model.GetValue(iter, 1); if (prop != null) { rc.SensitiveProperty = !prop.IsReadOnly; } else { rc.SensitiveProperty = true; } }