HLine.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Content.Client.Stylesheets;
  2. using Robust.Client.Graphics;
  3. using Robust.Client.UserInterface;
  4. using Robust.Client.UserInterface.Controls;
  5. using Robust.Shared.Maths;
  6. namespace Content.Client.UserInterface.Controls;
  7. public sealed class HLine : Container
  8. {
  9. public Color? Color
  10. {
  11. get
  12. {
  13. if (_line.PanelOverride is StyleBoxFlat styleBox) return styleBox.BackgroundColor;
  14. return null;
  15. }
  16. set
  17. {
  18. if (_line.PanelOverride is StyleBoxFlat styleBox) styleBox.BackgroundColor = value!.Value;
  19. }
  20. }
  21. public float? Thickness {
  22. get
  23. {
  24. if (_line.PanelOverride is StyleBoxFlat styleBox) return styleBox.ContentMarginTopOverride;
  25. return null;
  26. }
  27. set
  28. {
  29. if (_line.PanelOverride is StyleBoxFlat styleBox) styleBox.ContentMarginTopOverride = value!.Value;
  30. }
  31. }
  32. private readonly PanelContainer _line;
  33. public HLine()
  34. {
  35. _line = new PanelContainer();
  36. _line.PanelOverride = new StyleBoxFlat();
  37. _line.PanelOverride.ContentMarginTopOverride = Thickness;
  38. AddChild(_line);
  39. }
  40. }