Files
tbd-station-14/Content.Client/UserInterface/Controls/SplitBar.xaml.cs
Pieter-Jan Briers 68ce53ae17 Random spontaneous cleanup PR (#25131)
* Use new Subs.CVar helper

Removes manual config OnValueChanged calls, removes need to remember to manually unsubscribe.

This both reduces boilerplate and fixes many issues where subscriptions weren't removed on entity system shutdown.

* Fix a bunch of warnings

* More warning fixes

* Use new DateTime serializer to get rid of ISerializationHooks in changelog code.

* Get rid of some more ISerializationHooks for enums

* And a little more

* Apply suggestions from code review

Co-authored-by: 0x6273 <0x40@keemail.me>

---------

Co-authored-by: 0x6273 <0x40@keemail.me>
2024-02-13 16:48:39 -05: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()
{
DisposeAllChildren();
}
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
});
}
}
}