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; }
void PropertyData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { CellRendererProperty rc = (CellRendererProperty)cell; bool group = (bool)model.GetValue(iter, 2); if (group) { rc.SetData(null, null, null); } else { PropertyDescriptor prop = (PropertyDescriptor)model.GetValue(iter, 1); PropertyEditorCell propCell = editorManager.GetEditor(prop); InstanceData idata = (InstanceData)model.GetValue(iter, 3); propCell.Initialize(tree, editorManager, prop, idata.Instance); rc.SetData(idata.Instance, prop, propCell); } }
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; }