using Content.Client.ContextMenu.UI; using Content.Client.Resources; using Content.Client.Stylesheets.Fonts; using Content.Client.Stylesheets.Palette; using Content.Client.Stylesheets.SheetletConfigs; using Content.Client.Stylesheets.Stylesheets; using Content.Client.Verbs.UI; using Content.Shared.Verbs; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using static Content.Client.Stylesheets.StylesheetHelpers; namespace Content.Client.Stylesheets.Sheetlets.Hud; [CommonSheetlet] public sealed class ContextMenuSheetlet : Sheetlet where T : PalettedStylesheet, IWindowConfig, IButtonConfig, IIconConfig { // TODO: make this not hardcoded (I am too scared to change the context menu colors) private static readonly ColorPalette ContextButtonPalette = ColorPalette.FromHexBase("#000000") with { HoveredElement = Color.DarkSlateGray, Element = Color.FromHex("#1119"), PressedElement = Color.LightSlateGray, }; public override StyleRule[] GetRules(T sheet, object config) { IWindowConfig windowCfg = sheet; var borderedWindowBackground = new StyleBoxTexture { Texture = sheet.GetTextureOr(windowCfg.WindowBackgroundBorderedPath, NanotrasenStylesheet.TextureRoot), }; borderedWindowBackground.SetPatchMargin(StyleBox.Margin.All, ContextMenuElement.ElementMargin); var buttonContext = new StyleBoxTexture { Texture = Texture.White }; var contextMenuExpansionTexture = ResCache.GetTexture("/Textures/Interface/VerbIcons/group.svg.192dpi.png"); var verbMenuConfirmationTexture = ResCache.GetTexture("/Textures/Interface/VerbIcons/group.svg.192dpi.png"); var rules = new List { // Context Menu window E() .Class(ContextMenuPopup.StyleClassContextMenuPopup) .Panel(borderedWindowBackground), // Context menu buttons E() .Class(ContextMenuElement.StyleClassContextMenuButton) .Prop(ContainerButton.StylePropertyStyleBox, buttonContext), // Context Menu Labels E() .Class(InteractionVerb.DefaultTextStyleClass) .Font(sheet.BaseFont.GetFont(12, FontKind.BoldItalic)), E() .Class(ActivationVerb.DefaultTextStyleClass) .Font(sheet.BaseFont.GetFont(12, FontKind.Bold)), E() .Class(AlternativeVerb.DefaultTextStyleClass) .Font(sheet.BaseFont.GetFont(12, FontKind.Italic)), E() .Class(Verb.DefaultTextStyleClass) .Font(sheet.BaseFont.GetFont(12)), E() .Class(ContextMenuElement.StyleClassContextMenuExpansionTexture) .Prop(TextureRect.StylePropertyTexture, contextMenuExpansionTexture), E() .Class(VerbMenuElement.StyleClassVerbMenuConfirmationTexture) .Prop(TextureRect.StylePropertyTexture, verbMenuConfirmationTexture), // Context menu confirm buttons E() .Class(ConfirmationMenuElement.StyleClassConfirmationContextMenuButton) .Prop(ContainerButton.StylePropertyStyleBox, buttonContext), }; ButtonSheetlet.MakeButtonRules(rules, ContextButtonPalette, ContextMenuElement.StyleClassContextMenuButton); ButtonSheetlet.MakeButtonRules(rules, sheet.NegativePalette, ConfirmationMenuElement.StyleClassConfirmationContextMenuButton); return rules.ToArray(); } }