/// <summary> /// Initializes a new instance of the <see cref="TreeNode"/> class. /// </summary> /// <param name="parent">Parent control.</param> public TreeNode(ControlBase parent) : base(parent) { // Make sure that the tree control has only one root node. if (m_TreeControl == null && parent is TreeControl) { m_TreeControl = parent as TreeControl; m_Root = true; } else { m_ToggleButton = new TreeToggleButton(this); m_ToggleButton.Toggled += OnToggleButtonPress; m_Title = new TreeNodeLabel(this); m_Title.DoubleClicked += OnDoubleClickName; m_Title.Clicked += OnClickName; } m_InnerPanel = new Layout.VerticalLayout(this); m_InnerPanel.Collapse(!m_Root, false); // Root node is always expanded m_Selected = false; m_Selectable = true; }
public override void Initialize () { Console.WriteLine (Environment.CurrentDirectory); base.Initialize (); tree = new Gwen.Control.TreeControl (panel); tree.SetSize (panel.Width, panel.Height); tree.ShouldDrawBackground = false; var type = typeof(Pipeline); var subclasses = type.Assembly.GetTypes ().Where (t => t.IsSubclassOf (type)); foreach (var subclass in subclasses) { subclass.GetCustomAttributes (false); } MeshPipeline.SetMeshContext<ushort,BasicVertexFormat> (); RecursiveBuildTree (root, tree); foreach (FileInfo file in FilterFiles(root,SupportedFileFormatsAttribute.importers.Keys)) { if (!file.Name.StartsWith (".") && SupportedFileFormatsAttribute.importers.ContainsKey(file.Extension)) tree.AddNode (SupportedFileFormatsAttribute.importers [file.Extension].Import (file.FullName)); } tree.Show (); tree.Selected += OnSelected; }
public override void Initialize () { base.Initialize (); if(tree==null) tree = new Gwen.Control.TreeControl (panel); tree.SetSize (panel.Width, panel.Height); tree.ShouldDrawBackground = false; tree.SelectionChanged += (sender, args) => Selection.Asset = (sender as TreeNode).Content; SceneView.OnAddedEntity += ReconstructTree; SceneView.OnRemovedEntity += ReconstructTree; ReconstructTree (); }
internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent) { TreeControl element = new TreeControl(parent); parser.ParseAttributes(element); if (parser.MoveToContent()) { foreach (string elementName in parser.NextElement()) { if (elementName == "TreeNode") { parser.ParseElement <TreeNode>(element); } } } return(element); }
public void InitControl(Base parent) { Tree = new TreeControl(parent) { Dock = Gwen.Pos.Left, Width = 150 }; CreateProjectNode("test"); }