int Foo(Frame frame, TreeViewItem parent, ref int nextIdx) { var infoItem = new SimpleTreeViewItem { id = nextIdx++, displayName = frame.Name }; if (frame.Children != null) { var bits = 0; foreach (var child in frame.Children) { bits += Foo(child, infoItem, ref nextIdx); } if (frame.Bits == 0) { frame.Bits = bits; } } infoItem.Bits = frame.Bits.ToString(); parent.AddChild(infoItem); return(frame.Bits); }
void CellGUI(Rect cellRect, SimpleTreeViewItem item, int column, ref RowGUIArgs args) { CenterRectUsingSingleLineHeight(ref cellRect); switch (column) { case 0: base.RowGUI(args); break; case 1: GUI.Label(cellRect, item.Bits); break; } }
protected override TreeViewItem BuildRoot() { var root = new TreeViewItem { id = 0, depth = -1, displayName = "root" }; var frames = Debugger.Frames; if (frames == null) { var serverItem = new SimpleTreeViewItem { id = 1, displayName = "No data" }; root.AddChild(serverItem); return(root); } int nextIdx = 1; for (int i = 0; i < MaxFrames; ++i) { var idx = Debugger.CurrentFrameIdx - i; if (idx < 0) { idx = MaxFrames - 1; } var currentFrame = frames[idx]; currentFrame.Name = "Frame N-" + i; Foo(currentFrame, root, ref nextIdx); } SetupDepthsFromParentsAndChildren(root); return(root); }