Add option to collapse and expand any tree node type
This commit is contained in:
parent
25c2abfd9b
commit
7d4ef5adde
@ -674,12 +674,13 @@ namespace Bfres.Structs
|
||||
public ToolStripItem[] GetContextMenuItems()
|
||||
{
|
||||
List<ToolStripItem> Items = new List<ToolStripItem>();
|
||||
Items.Add(new ToolStripMenuItem("Rename", null, RenameAction, Keys.Control | Keys.I));
|
||||
Items.Add(new ToolStripMenuItem("New Child Bone", null, NewAction, Keys.Control | Keys.I));
|
||||
Items.Add(new ToolStripMenuItem("Rename", null, RenameAction, Keys.Control | Keys.R));
|
||||
Items.Add(new ToolStripSeparator());
|
||||
Items.Add(new ToolStripMenuItem("New Child Bone", null, NewAction, Keys.Control | Keys.N));
|
||||
Items.Add(new ToolStripMenuItem("Import Child Bone", null, ImportAction, Keys.Control | Keys.I));
|
||||
Items.Add(new ToolStripSeparator());
|
||||
Items.Add(new ToolStripMenuItem("Export Bone", null, ExportAction, Keys.Control | Keys.I));
|
||||
Items.Add(new ToolStripMenuItem("Replace Bone", null, ReplaceAction, Keys.Control | Keys.I));
|
||||
Items.Add(new ToolStripMenuItem("Export Bone", null, ExportAction, Keys.Control | Keys.E));
|
||||
Items.Add(new ToolStripMenuItem("Replace Bone", null, ReplaceAction, Keys.Control | Keys.R));
|
||||
return Items.ToArray();
|
||||
}
|
||||
|
||||
|
@ -343,6 +343,23 @@ namespace Toolbox.Library.Forms
|
||||
{
|
||||
treeNodeContextMenu.Items.AddRange(((IContextMenuNode)e.Node).GetContextMenuItems());
|
||||
}
|
||||
|
||||
bool HasCollpase = false;
|
||||
bool HasExpand = false;
|
||||
foreach (var item in ((IContextMenuNode)e.Node).GetContextMenuItems())
|
||||
{
|
||||
if (item.Text == "Collapse All")
|
||||
HasCollpase = true;
|
||||
if (item.Text == "Expand All")
|
||||
HasExpand = true;
|
||||
}
|
||||
|
||||
if (!HasCollpase)
|
||||
treeNodeContextMenu.Items.Add(new ToolStripMenuItem("Collapse All", null, CollapseAllAction, Keys.Control | Keys.Q));
|
||||
|
||||
if (!HasExpand)
|
||||
treeNodeContextMenu.Items.Add(new ToolStripMenuItem("Expand All", null, ExpandAllAction, Keys.Control | Keys.P));
|
||||
|
||||
treeNodeContextMenu.Show(Cursor.Position);
|
||||
|
||||
//Select the node without the evemt
|
||||
@ -358,6 +375,20 @@ namespace Toolbox.Library.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void ExpandAllAction(object sender, EventArgs args)
|
||||
{
|
||||
var node = treeViewCustom1.SelectedNode;
|
||||
if (node != null)
|
||||
node.ExpandAll();
|
||||
}
|
||||
|
||||
private void CollapseAllAction(object sender, EventArgs args)
|
||||
{
|
||||
var node = treeViewCustom1.SelectedNode;
|
||||
if (node != null)
|
||||
node.Collapse();
|
||||
}
|
||||
|
||||
private void DeleteAction(object sender, EventArgs args)
|
||||
{
|
||||
var node = treeViewCustom1.SelectedNode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user