protected internal ProjectNode(Base parent, string name) { Node = new TreeNode(parent) { Text = name, Dock = Gwen.Pos.Top }; }
void RecursiveBuildTree(DirectoryInfo dirRoot, Gwen.Control.TreeNode treeIter) { MeshPipeline.SetMeshContext <ushort, BasicVertexFormat> (); foreach (DirectoryInfo di in dirRoot.EnumerateDirectories()) { if (!di.Name.StartsWith(".")) { var iter = treeIter.AddNode(di.Name); foreach (FileInfo file in FilterFiles(di, SharpAsset.Pipeline.SupportedFileFormatsAttribute.importers.Keys)) { if (SupportedFileFormatsAttribute.importers.ContainsKey(file.Extension) && !file.Name.StartsWith(".")) { iter.AddNode(() => SupportedFileFormatsAttribute.importers[file.Extension].Import(file.FullName)); } } RecursiveBuildTree(di, iter); } } }
/// <summary> /// Adds a new child node. /// </summary> /// <param name="label">Node's label.</param> /// <returns>Newly created control.</returns> public TreeNode AddNode(string label) { TreeNode node = new TreeNode(this); node.Text = label; return node; }
public TreeNode AddNode(TreeNode node) { node.Parent = this; node.Dock = Pos.Top; node.IsRoot = this is TreeControl; node.TreeControl = m_TreeControl; if (m_TreeControl != null) { m_TreeControl.OnNodeAdded(node); } return node; }
/// <summary> /// Handler for node added event. /// </summary> /// <param name="node">Node added.</param> public virtual void OnNodeAdded(TreeNode node) { node.LabelPressed += OnNodeSelected; }
/// <summary> /// Adds a new child node. /// </summary> /// <param name="label">Node's label.</param> /// <returns>Newly created control.</returns> public TreeNode AddNode(string label) { TreeNode node = new TreeNode(this); node.Text = label; node.Dock = Pos.Top; node.IsRoot = this is TreeControl; node.TreeControl = m_TreeControl; if (m_TreeControl != null) { m_TreeControl.OnNodeAdded(node); } return node; }
public TreeControl(Base parent) : base(parent) { /* Simple Tree Control */ { Control.TreeControl ctrl = new Control.TreeControl(this); ctrl.AddNode("Node One"); Control.TreeNode node = ctrl.AddNode("Node Two"); { node.AddNode("Node Two Inside"); node.AddNode("Eyes"); { node.AddNode("Brown").AddNode("Node Two Inside").AddNode("Eyes").AddNode("Brown"); } Control.TreeNode imgnode = node.AddNode("Image"); imgnode.SetImage("test16.png"); imgnode = node.AddNode("Image_Kids"); imgnode.SetImage("test16.png"); { imgnode.AddNode("Kid1"); imgnode.AddNode("Kid2"); } node.AddNode("Nodes"); } ctrl.AddNode("Node Three"); node = ctrl.AddNode("Clickables"); { Control.TreeNode click = node.AddNode("Single Click"); click.Clicked += NodeClicked; click.RightClicked += NodeClicked; click = node.AddNode("Double Click"); click.DoubleClicked += NodeDoubleClicked; } ctrl.SetBounds(30, 30, 200, 200); ctrl.ExpandAll(); ctrl.Selected += NodeSelected; ctrl.Expanded += NodeExpanded; ctrl.Collapsed += NodeCollapsed; } /* Scrollable Tree Control */ { Control.TreeControl ctrl = new Control.TreeControl(this); ctrl.AllowMultiSelect = true; ctrl.AddNode("Node One"); Control.TreeNode node = ctrl.AddNode("Node Two"); node.AddNode("Node Two Inside"); node.AddNode("Eyes"); Control.TreeNode nodeTwo = node.AddNode("Brown").AddNode("Node Two Inside").AddNode("Eyes"); nodeTwo.AddNode("Brown"); nodeTwo.AddNode("Green"); nodeTwo.AddNode("Slime"); nodeTwo.AddNode("Grass"); nodeTwo.AddNode("Pipe"); node.AddNode("More"); node.AddNode("Nodes"); ctrl.AddNode("Node Three"); ctrl.SetBounds(240, 30, 200, 200); ctrl.ExpandAll(); ctrl.Selected += NodeSelected; ctrl.Expanded += NodeExpanded; ctrl.Collapsed += NodeCollapsed; } /* Normal Tree Control (without using the AddNode function */ { Control.TreeControl ctrl = new Control.TreeControl(this); ctrl.SetBounds(30, 240, 200, 200); Control.TreeNode node = new TreeNode(ctrl); node.Text = "First"; new TreeNode(node).Text = "2nd first"; node = new TreeNode(ctrl); node.Text = "Second"; node = new TreeNode(node); node.Text = "Other 2nd"; ctrl.ExpandAll(); } }