Remove the remaining CheckButtons (#41073)

remove CheckButtons
This commit is contained in:
Errant
2025-10-30 21:59:16 +01:00
committed by GitHub
parent 036fef8054
commit 3f5067693f
4 changed files with 8 additions and 8 deletions

View File

@@ -294,19 +294,19 @@ public sealed partial class BanPanel : DefaultWindow
} }
/// <summary> /// <summary>
/// Adds a check button specifically for one "role" in a "group" /// Adds a toggle button specifically for one "role" in a "group"
/// E.g. it would add the Chief Medical Officer "role" into the "Medical" group. /// E.g. it would add the Chief Medical Officer "role" into the "Medical" group.
/// </summary> /// </summary>
private void AddRoleCheckbox(string group, string role, GridContainer roleGroupInnerContainer, Button roleGroupCheckbox) private void AddRoleCheckbox(string group, string role, GridContainer roleGroupInnerContainer, Button roleGroupCheckbox)
{ {
var roleCheckboxContainer = new BoxContainer(); var roleCheckboxContainer = new BoxContainer();
var roleCheckButton = new Button var roleToggleButton = new Button
{ {
Name = role, Name = role,
Text = role, Text = role,
ToggleMode = true, ToggleMode = true,
}; };
roleCheckButton.OnToggled += args => roleToggleButton.OnToggled += args =>
{ {
// Checks the role group checkbox if all the children are pressed // Checks the role group checkbox if all the children are pressed
if (args.Pressed && _roleCheckboxes[group].All(e => e.Item1.Pressed)) if (args.Pressed && _roleCheckboxes[group].All(e => e.Item1.Pressed))
@@ -343,12 +343,12 @@ public sealed partial class BanPanel : DefaultWindow
roleCheckboxContainer.AddChild(jobIconTexture); roleCheckboxContainer.AddChild(jobIconTexture);
} }
roleCheckboxContainer.AddChild(roleCheckButton); roleCheckboxContainer.AddChild(roleToggleButton);
roleGroupInnerContainer.AddChild(roleCheckboxContainer); roleGroupInnerContainer.AddChild(roleCheckboxContainer);
_roleCheckboxes.TryAdd(group, []); _roleCheckboxes.TryAdd(group, []);
_roleCheckboxes[group].Add((roleCheckButton, rolePrototype)); _roleCheckboxes[group].Add((roleToggleButton, rolePrototype));
} }
public void UpdateBanFlag(bool newFlag) public void UpdateBanFlag(bool newFlag)

View File

@@ -47,7 +47,7 @@
Access="Public" Access="Public"
Text="{Loc 'ui-disposal-unit-button-eject'}" Text="{Loc 'ui-disposal-unit-button-eject'}"
StyleClasses="OpenBoth" /> StyleClasses="OpenBoth" />
<CheckButton Name="Power" <Button Name="Power"
Access="Public" Access="Public"
Text="{Loc 'ui-disposal-unit-button-power'}" Text="{Loc 'ui-disposal-unit-button-power'}"
StyleClasses="OpenLeft" /> StyleClasses="OpenLeft" />

View File

@@ -34,7 +34,7 @@
Access="Public" Access="Public"
Text="{Loc 'ui-disposal-unit-button-eject'}" Text="{Loc 'ui-disposal-unit-button-eject'}"
StyleClasses="OpenBoth" /> StyleClasses="OpenBoth" />
<CheckButton Name="Power" <Button Name="Power"
Access="Public" Access="Public"
Text="{Loc 'ui-disposal-unit-button-power'}" Text="{Loc 'ui-disposal-unit-button-power'}"
StyleClasses="OpenLeft" /> StyleClasses="OpenLeft" />

View File

@@ -7,7 +7,7 @@
<Button Name="AllButton" Text="{Loc 'instruments-component-channels-all-button'}" HorizontalExpand="true" VerticalExpand="true" SizeFlagsStretchRatio="1"/> <Button Name="AllButton" Text="{Loc 'instruments-component-channels-all-button'}" HorizontalExpand="true" VerticalExpand="true" SizeFlagsStretchRatio="1"/>
<Button Name="ClearButton" Text="{Loc 'instruments-component-channels-clear-button'}" HorizontalExpand="true" VerticalExpand="true" SizeFlagsStretchRatio="1"/> <Button Name="ClearButton" Text="{Loc 'instruments-component-channels-clear-button'}" HorizontalExpand="true" VerticalExpand="true" SizeFlagsStretchRatio="1"/>
</BoxContainer> </BoxContainer>
<CheckButton Name="DisplayTrackNames" <Button Name="DisplayTrackNames"
Text="{Loc 'instruments-component-channels-track-names-toggle'}" /> Text="{Loc 'instruments-component-channels-track-names-toggle'}" />
</BoxContainer> </BoxContainer>
</DefaultWindow> </DefaultWindow>