Inheritance: Gtk.TreeView
Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
        protected override void Render(Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
        {
            int width, height;

            GetCellSize(widget, (int)(cell_area.Width - this.Xpad * 2), out width, out height);

            int x = (int)(cell_area.X + this.Xpad);
            int y = cell_area.Y + (cell_area.Height - height) / 2;

            StateType state;

            if (!sensitive)
            {
                state = StateType.Insensitive;
            }
            else if ((flags & CellRendererState.Selected) != 0)
            {
                state = StateType.Selected;
            }
            else
            {
                state = StateType.Normal;
            }

            if (IsGroup)
            {
                TreeGroup grp = new TreeGroup();
                grp.X     = x;
                grp.Y     = y;
                grp.Group = Text;
                grp.State = state;
                InternalTree tree = (InternalTree)widget;
                tree.Groups.Add(grp);
            }
            else
            {
                window.DrawLayout(widget.Style.TextGC(state), x, y, layout);
                int bx = background_area.X + background_area.Width - 1;
                using (Gdk.GC gc = new Gdk.GC(window)) {
                    gc.RgbFgColor = tree.Style.MidColors [(int)Gtk.StateType.Normal];
                    window.DrawLine(gc, bx, background_area.Y, bx, background_area.Y + background_area.Height);
                }
            }
        }