PdaProgramItem.xaml.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Robust.Client.AutoGenerated;
  2. using Robust.Client.Graphics;
  3. using Robust.Client.UserInterface.Controls;
  4. using Robust.Client.UserInterface.XAML;
  5. namespace Content.Client.PDA;
  6. [GenerateTypedNameReferences]
  7. public sealed partial class PdaProgramItem : ContainerButton
  8. {
  9. public const string StylePropertyBgColor = "backgroundColor";
  10. public const string NormalBgColor = "#313138";
  11. public const string HoverColor = "#3E6C45";
  12. private readonly StyleBoxFlat _styleBox = new()
  13. {
  14. BackgroundColor = Color.FromHex("#25252a"),
  15. };
  16. public Color BackgroundColor
  17. {
  18. get => _styleBox.BackgroundColor;
  19. set => _styleBox.BackgroundColor = value;
  20. }
  21. public PdaProgramItem()
  22. {
  23. RobustXamlLoader.Load(this);
  24. Panel.PanelOverride = _styleBox;
  25. }
  26. protected override void Draw(DrawingHandleScreen handle)
  27. {
  28. base.Draw(handle);
  29. if (TryGetStyleProperty<Color>(StylePropertyBgColor, out var bgColor))
  30. BackgroundColor = bgColor;
  31. }
  32. }