Esempio n. 1
0
 protected internal ProjectNode(Base parent, string name)
 {
     Node = new TreeNode(parent)
     {
         Text = name,
         Dock = Gwen.Pos.Top
     };
 }
Esempio n. 2
0
 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);
         }
     }
 }
Esempio n. 3
0
        /// <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;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
 /// <summary>
 /// Handler for node added event.
 /// </summary>
 /// <param name="node">Node added.</param>
 public virtual void OnNodeAdded(TreeNode node)
 {
     node.LabelPressed += OnNodeSelected;
 }
Esempio n. 6
0
        /// <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;
        }
Esempio n. 7
0
        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();
			}
		}