@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Client.Resources;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -196,13 +197,38 @@ public sealed partial class FancyTree : Control
|
||||
if (depth == 0)
|
||||
return;
|
||||
depth--;
|
||||
|
||||
|
||||
foreach (var child in item.Body.Children)
|
||||
{
|
||||
RecursiveSetExpanded((TreeItem) child, value, depth);
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetIndexFromMetadata(object metadata, [NotNullWhen(true)] out int? index)
|
||||
{
|
||||
index = null;
|
||||
foreach (var item in Items)
|
||||
{
|
||||
if (item.Metadata?.Equals(metadata) ?? false)
|
||||
{
|
||||
index = item.Index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index != null;
|
||||
}
|
||||
|
||||
public void ExpandParentEntries(int index)
|
||||
{
|
||||
Control? current = Items[index];
|
||||
while (current != null)
|
||||
{
|
||||
if (current is TreeItem item)
|
||||
item.SetExpanded(true);
|
||||
current = current.Parent;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
foreach (var item in Items)
|
||||
|
||||
Reference in New Issue
Block a user