1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-24 01:09:23 +01:00

Improve f166c3d256 by allowing buttons to be selectable even when disabled

This commit is contained in:
Ell 2022-04-05 14:20:38 +02:00
parent df0ad68837
commit 30b4d5fc43
2 changed files with 12 additions and 2 deletions

View file

@ -63,9 +63,14 @@ namespace MLEM.Ui.Elements {
this.Text.TruncateIfLong = value;
}
}
/// <summary>
/// Whether this button should be able to be selected even if it <see cref="IsDisabled"/>.
/// If this is true, <see cref="CanBeSelected"/> will be able to return true even if <see cref="IsDisabled"/> is true.
/// </summary>
public bool CanSelectDisabled;
/// <inheritdoc />
public override bool CanBeSelected => base.CanBeSelected && !this.IsDisabled;
public override bool CanBeSelected => base.CanBeSelected && (this.CanSelectDisabled || !this.IsDisabled);
/// <inheritdoc />
public override bool CanBePressed => base.CanBePressed && !this.IsDisabled;

View file

@ -67,9 +67,14 @@ namespace MLEM.Ui.Elements {
/// An event that is invoked when this checkbox's <see cref="Checked"/> property changes
/// </summary>
public CheckStateChange OnCheckStateChange;
/// <summary>
/// Whether this checkbox should be able to be selected even if it <see cref="IsDisabled"/>.
/// If this is true, <see cref="CanBeSelected"/> will be able to return true even if <see cref="IsDisabled"/> is true.
/// </summary>
public bool CanSelectDisabled;
/// <inheritdoc />
public override bool CanBeSelected => base.CanBeSelected && !this.IsDisabled;
public override bool CanBeSelected => base.CanBeSelected && (this.CanSelectDisabled || !this.IsDisabled);
/// <inheritdoc />
public override bool CanBePressed => base.CanBePressed && !this.IsDisabled;