Inheritance: Gtk.CellRenderer
Exemple #1
0
        public PropertyTree()
        {
            propertyRows = new Hashtable ();
            sensitives = new Hashtable ();
            invisibles = 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);
            col.PackStart (crt, true);
            col.SetCellDataFunc (crt, new TreeCellDataFunc (GroupData));
            col.Resizable = true;
            col.Expand = false;
            col.Sizing = TreeViewColumnSizing.Fixed;
            col.FixedWidth = 150;
            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.In;
            this.HscrollbarPolicy = Gtk.PolicyType.Never;

            Add (tree);
            ShowAll ();

            tree.Selection.Changed += OnSelectionChanged;
        }
        public PropertyTree()
        {
            propertyRows = new Hashtable();
            sensitives   = new Hashtable();
            invisibles   = new Hashtable();

            store = new TreeStore(typeof(string), typeof(PropertyDescriptor), typeof(bool), typeof(InstanceData));

            tree = new InternalTree(this, store);

            CellRendererText crt;

            TreeViewColumn col;

            col       = new TreeViewColumn();
            col.Title = Catalog.GetString("Property");
            crt       = new CellRendererPropertyGroup(tree);
            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, new TreeCellDataFunc(GroupData));
            col.Resizable  = true;
            col.Expand     = false;
            col.Sizing     = TreeViewColumnSizing.Fixed;
            col.FixedWidth = 150;
            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.In;
            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 = PropertyEditorCell.GetPropertyCell(prop);
                InstanceData       idata    = (InstanceData)model.GetValue(iter, 3);
                propCell.Initialize(tree, prop, idata.Instance);
                rc.SetData(idata.Instance, prop, propCell);
            }
        }