Files
tbd-station-14/Content.Client/UserInterface/Controls/SplitBar.xaml.cs
LordCarve a3ddba6f42 Cleanup - Use RemoveAllChildren() over DisposeAllChildren() (#39848)
* Content - change the (should-be-obsolete) DisposeAllChildren into the more robust RemoveAllChildren.

* Remove duplicate calls.

---------

Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
2025-09-23 15:40:48 +12:00

44 lines
1.1 KiB
C#

using System.Numerics;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.UserInterface.Controls
{
[GenerateTypedNameReferences]
[Virtual]
public partial class SplitBar : BoxContainer
{
public Vector2 MinBarSize = new(24, 0);
public SplitBar()
{
RobustXamlLoader.Load(this);
}
public void Clear()
{
RemoveAllChildren();
}
public void AddEntry(float amount, Color color, string? tooltip = null)
{
AddChild(new PanelContainer
{
ToolTip = tooltip,
HorizontalExpand = true,
SizeFlagsStretchRatio = amount,
MouseFilter = MouseFilterMode.Stop,
PanelOverride = new StyleBoxFlat
{
BackgroundColor = color,
PaddingLeft = 2f,
PaddingRight = 2f,
},
MinSize = MinBarSize
});
}
}
}