From 6ee812cfe5a6e8201e1ac6647dfd22f4731c87c4 Mon Sep 17 00:00:00 2001 From: Absotively Date: Thu, 22 Jan 2026 10:31:56 -0700 Subject: [PATCH] SwitchButton (#39161) * Initial toggle switch styling * tweak toggle switch textures * Simplify toggle SVG images a bit * Better name for switch button * Update CheckButtons that were already just regular buttons * Match checkbox/text field outline colour instead of slider outline colour * Use switch button for APC power * Update switch button styling; add separate style for power buttons * Use new switch button in midi channels menu * Add spacer * adjust switch button icon proportions, position * Add disabled toggle switch styles, use improved pressed style setup, make APC breaker state visible to all * Use Janet Blackquill's icon design; remove StyleClassPowerSwitchButton. Co-authored-by: Janet Blackquill * Style switch children directly instead of with propagated styles * Add attributions file * Turns out source is a required field * Move SwitchButton out of engine * Move styles to sheetlet * Make workaround for child controls not updating work in content * Icon layers * Set up ISwitchButtonConfig * Fix disabled switch label font color * Don't redefine base pseudostyles * Use pseudoclass helpers for better readability * Use margin instead of padding element * Remove unused using statements * Remove extra image file * Update attributions for changed files --- .../Instruments/UI/ChannelsMenu.xaml | 7 +- .../Instruments/UI/ChannelsMenu.xaml.cs | 1 - Content.Client/Power/APC/UI/ApcMenu.xaml | 5 +- Content.Client/Power/APC/UI/ApcMenu.xaml.cs | 5 +- .../Stylesheets/CommonStylesheet.cs | 9 +- .../SheetletConfigs/ISwitchButtonConfig.cs | 14 + .../Sheetlets/SwitchButtonSheetlet.cs | 125 +++++++ .../UserInterface/Controls/SwitchButton.cs | 317 ++++++++++++++++++ Resources/Locale/en-US/ui/controls.ftl | 4 + Resources/Locale/en-US/ui/power-apc.ftl | 1 - .../Textures/Interface/Nano/attributions.yml | 9 + .../Nano/switchbutton_symbol_off.svg | 61 ++++ .../switchbutton_symbol_off.svg.96dpi.png | Bin 0 -> 387 bytes .../Interface/Nano/switchbutton_symbol_on.svg | 60 ++++ .../Nano/switchbutton_symbol_on.svg.96dpi.png | Bin 0 -> 192 bytes .../Nano/switchbutton_thumb_fill.svg | 60 ++++ .../switchbutton_thumb_fill.svg.96dpi.png | Bin 0 -> 256 bytes .../Nano/switchbutton_thumb_outline.svg | 61 ++++ .../switchbutton_thumb_outline.svg.96dpi.png | Bin 0 -> 269 bytes .../Nano/switchbutton_track_fill.svg | 61 ++++ .../switchbutton_track_fill.svg.96dpi.png | Bin 0 -> 283 bytes .../Nano/switchbutton_track_outline.svg | 61 ++++ .../switchbutton_track_outline.svg.96dpi.png | Bin 0 -> 331 bytes 23 files changed, 847 insertions(+), 14 deletions(-) create mode 100644 Content.Client/Stylesheets/SheetletConfigs/ISwitchButtonConfig.cs create mode 100644 Content.Client/Stylesheets/Sheetlets/SwitchButtonSheetlet.cs create mode 100644 Content.Client/UserInterface/Controls/SwitchButton.cs create mode 100644 Resources/Textures/Interface/Nano/attributions.yml create mode 100644 Resources/Textures/Interface/Nano/switchbutton_symbol_off.svg create mode 100644 Resources/Textures/Interface/Nano/switchbutton_symbol_off.svg.96dpi.png create mode 100644 Resources/Textures/Interface/Nano/switchbutton_symbol_on.svg create mode 100644 Resources/Textures/Interface/Nano/switchbutton_symbol_on.svg.96dpi.png create mode 100644 Resources/Textures/Interface/Nano/switchbutton_thumb_fill.svg create mode 100644 Resources/Textures/Interface/Nano/switchbutton_thumb_fill.svg.96dpi.png create mode 100644 Resources/Textures/Interface/Nano/switchbutton_thumb_outline.svg create mode 100644 Resources/Textures/Interface/Nano/switchbutton_thumb_outline.svg.96dpi.png create mode 100644 Resources/Textures/Interface/Nano/switchbutton_track_fill.svg create mode 100644 Resources/Textures/Interface/Nano/switchbutton_track_fill.svg.96dpi.png create mode 100644 Resources/Textures/Interface/Nano/switchbutton_track_outline.svg create mode 100644 Resources/Textures/Interface/Nano/switchbutton_track_outline.svg.96dpi.png diff --git a/Content.Client/Instruments/UI/ChannelsMenu.xaml b/Content.Client/Instruments/UI/ChannelsMenu.xaml index e98b03e6b3..f902cad4d0 100644 --- a/Content.Client/Instruments/UI/ChannelsMenu.xaml +++ b/Content.Client/Instruments/UI/ChannelsMenu.xaml @@ -1,5 +1,5 @@ + xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls">