Consolidate tree processing
- Only build treeview once, destroy/create child content on change - Single recursive AddTree(IObject3D) method handles all nodes - BuildTree caller assigns node.TreeView instance on root node - MatterHackers/MCCentral#3483 Differing construction implementations results in inconsistent TreeNodes
This commit is contained in:
parent
9e69b4a915
commit
5244025ae3
5 changed files with 48 additions and 70 deletions
|
|
@ -36,33 +36,22 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.CustomWidgets.TreeView
|
||||
{
|
||||
public class TopNode : TreeNode
|
||||
{
|
||||
internal TreeView treeView;
|
||||
public override TreeView TreeView => treeView;
|
||||
}
|
||||
|
||||
public class TreeView : ScrollableWidget
|
||||
{
|
||||
private ThemeConfig theme;
|
||||
|
||||
public TreeView(TopNode topNode, ThemeConfig theme)
|
||||
: this(topNode, 0, 0, theme)
|
||||
public TreeView(ThemeConfig theme)
|
||||
: this(0, 0, theme)
|
||||
{
|
||||
}
|
||||
|
||||
public TreeView(TopNode topNode, int width, int height, ThemeConfig theme)
|
||||
public TreeView(int width, int height, ThemeConfig theme)
|
||||
: base(width, height)
|
||||
{
|
||||
this.theme = theme;
|
||||
this.AutoScroll = true;
|
||||
this.HAnchor = HAnchor.Stretch;
|
||||
this.VAnchor = VAnchor.Stretch;
|
||||
this.TopNode = topNode;
|
||||
|
||||
topNode.treeView = this;
|
||||
|
||||
this.AddChild(TopNode);
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
|
@ -230,7 +219,6 @@ namespace MatterHackers.MatterControl.CustomWidgets.TreeView
|
|||
public bool ShowPlusMinus { get; set; }
|
||||
public bool ShowRootLines { get; set; }
|
||||
public bool Sorted { get; set; }
|
||||
public TreeNode TopNode { get; }
|
||||
|
||||
public IComparer TreeViewNodeSorter { get; set; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue