Skip to content

Commit

Permalink
Add visual disabled state to ternary buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Oct 24, 2024
1 parent ddbeb56 commit 77bd0e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ protected override void LoadComplete()

private void onAction()
{
if (!Button.Enabled.Value)
return;

Button.Toggle();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class TernaryButton
{
public readonly Bindable<TernaryState> Bindable;

public readonly Bindable<bool> Enabled = new Bindable<bool>();

public readonly string Description;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,22 @@ public static Drawable GetIconForSample(string sampleName)

private void updateAutoBankTernaryButtonTooltip()
{
bool enabled = SelectionHandler.AutoSelectionBankEnabled.Value;

var autoBankButton = SampleBankTernaryStates.Single(t => t.Bindable == SelectionHandler.SelectionBankStates[EditorSelectionHandler.HIT_BANK_AUTO]);
autoBankButton.Tooltip = !SelectionHandler.AutoSelectionBankEnabled.Value ? "Auto normal bank can only be used during hit object placement" : string.Empty;
autoBankButton.Enabled.Value = enabled;
autoBankButton.Tooltip = !enabled ? "Auto normal bank can only be used during hit object placement" : string.Empty;
}

private void updateAdditionBankTernaryButtonTooltips()
{
bool enabled = SelectionHandler.SelectionAdditionBanksEnabled.Value;

foreach (var ternaryButton in SampleAdditionBankTernaryStates)
ternaryButton.Tooltip = !SelectionHandler.SelectionAdditionBanksEnabled.Value ? "Add an addition sample first to be able to set a bank" : string.Empty;
{
ternaryButton.Enabled.Value = enabled;
ternaryButton.Tooltip = !enabled ? "Add an addition sample first to be able to set a bank" : string.Empty;
}
}

#region Placement
Expand Down

0 comments on commit 77bd0e8

Please sign in to comment.