void mTreeView_MouseDown(object sender, MouseEventArgs e) { //Control c = sender as Control; //TreeView v = c as TreeView; //TreeNode n = v.GetNodeAt(e.X, e.Y); //if (e.Button == MouseButtons.Right) //{ // ContextMenu m = CategoryTreeLogic.GetMainMenu(mTreeView, mSettings); // m.Show(c, new Point(0, 0)); //} if (e.Button == MouseButtons.Right) { CategoryTreeLogic.ShowMenu(mTreeView, mSettings, e); } if (e.Button == MouseButtons.Left) { //Category cat = null; //if (mTreeView.SelectedNode != null) //{ // cat = mTreeView.SelectedNode.Tag as Category; //} //if (cat != null && SelectedCategoryChanged != null) //{ // SelectedCategoryChanged.Invoke(this, null); //} } }
private void SetCategory(Category category) { autoTree1.Clear(); if (category == null) { } else { ICollection <string> content = CategoryTreeLogic.GetContent(mSettings, category); autoTree1.SetContent(content); } }
public void Setup(CategoryTreeNode settings)//ICollection<string> entries) { mSettings = settings; mTreeView.Tag = mSettings; mTreeView.Nodes.Clear(); mTreeView.Nodes.AddRange(CategoryTreeLogic.BuildTree(mSettings)); //mTreeView.Nodes.AddRange(CategoryTreeLogic.BuildTreeEditor(mSettings).Nodes); //load it up... }
static public void ShowMenu(TreeView tv, CategoryTreeNode settings, MouseEventArgs e) { TreeNode node = tv.GetNodeAt(e.X, e.Y); ContextMenu m = null; if (e.Button == MouseButtons.Right) { if (node != null) { m = CategoryTreeLogic.GetMenu(tv, node); } else { m = CategoryTreeLogic.GetMainMenu(tv, settings); } } if (m != null) { m.Show(tv, new Point(e.X, e.Y)); } }