private void SetChildren(TreeControl.Node parentNode) { if (m_treeView == null) { return; } if (parentNode.Expanded) { object obj = parentNode.Tag; if (obj != null) { TreeControl.Node node = null; foreach (object child in m_treeView.GetChildren(obj)) { node = parentNode.Add(child); m_itemToNodeMap.Add(child, node); UpdateNode(node); } if (node == null) // no children? { parentNode.IsLeaf = true; } } } else { foreach (TreeControl.Node child in parentNode.Children) { Unbind(child); } parentNode.Clear(); } }
public CookerPalette() : base(Style.CategorizedPalette) { AllowDrop = false; ShowRoot = false; // Actions { TreeControl.Node actions = Root.Add(null); actions.Label = "Actions"; actions.HoverText = "Activities that are performed on files or folders"; TreeControl.Node batch = actions.Add(typeof(CookBatch)); batch.Label = "Batch Cmd"; batch.HoverText = "Runs a .bat file"; TreeControl.Node process = actions.Add(typeof(CookProcess)); process.Label = "Run Exe"; process.HoverText = "Runs an executable with arbitrary parameters"; TreeControl.Node package = actions.Add(typeof(CookPackageBuilder)); package.Label = "Package"; package.HoverText = "Runs the Urho3D package compiler"; } // Targets { TreeControl.Node targets = Root.Add(null); targets.Label = "Targets"; TreeControl.Node cookItem = targets.Add(typeof(CookFileTarget)); cookItem.Label = "File"; cookItem.HoverText = "A single file target"; TreeControl.Node folderItem = targets.Add(typeof(CookFolderTarget)); folderItem.Label = "Folder"; folderItem.HoverText = "All files in the specified folder will be processed by cooking"; TreeControl.Node groupItem = targets.Add(typeof(CookGroupTarget)); groupItem.Label = "Group"; groupItem.HoverText = "Logically cluster cooking commands together"; } }
void Fill(string path, TreeControl.Node current) { try { foreach (string dir in System.IO.Directory.EnumerateDirectories(path)) { TreeControl.Node newNode = current.Add(dir); newNode.Label = System.IO.Path.GetFileName(dir); newNode.IsLeaf = System.IO.Directory.EnumerateDirectories(dir).Count() == 0; newNode.ImageIndex = 0; } } catch (Exception) { } }
void Fill(TreeControl.Node parentNode, object obj) { Translators.HierarchyTranslator trans = Translators.HierarchyTranslator.GetTranslator(obj.GetType()); if (trans != null) { TreeControl.Node nd = parentNode.Add(obj); UpdateNode(nd); // Attach a property changed notifier if (nd.Tag is INotifyPropertyChanged) { ((INotifyPropertyChanged)nd.Tag).PropertyChanged += (sender, args) => { // Only ever concerned about updating our label FontStyle fs = nd.FontStyle; nd.Label = trans.GetLabel(nd.Tag, out fs); nd.FontStyle = fs; }; } } }