mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Refactors CheckBox to use an enum instead of bool? for state. Cleans up naming to make more correct too (Toggle v. Toggled and State vs. Checked).
This commit is contained in:
@@ -484,7 +484,7 @@ public class TextAlignmentAndDirection : Scenario
|
||||
Enabled = false
|
||||
};
|
||||
|
||||
justifyCheckbox.Toggle += (s, e) => ToggleJustify (e.CurrentValue is { } && (bool)e.CurrentValue);
|
||||
justifyCheckbox.Toggle += (s, e) => ToggleJustify (e.NewValue == CheckState.Checked);
|
||||
|
||||
justifyOptions.SelectedItemChanged += (s, e) => { ToggleJustify (false, true); };
|
||||
|
||||
@@ -500,11 +500,11 @@ public class TextAlignmentAndDirection : Scenario
|
||||
Height = 1,
|
||||
Text = "Word Wrap"
|
||||
};
|
||||
wrapCheckbox.Checked = wrapCheckbox.TextFormatter.WordWrap;
|
||||
wrapCheckbox.State = wrapCheckbox.TextFormatter.WordWrap ? CheckState.Checked : CheckState.UnChecked;
|
||||
|
||||
wrapCheckbox.Toggle += (s, e) =>
|
||||
{
|
||||
if (e.CurrentValue == true)
|
||||
if (e.CurrentValue == CheckState.Checked)
|
||||
{
|
||||
foreach (Label t in multiLineLabels)
|
||||
{
|
||||
@@ -532,11 +532,11 @@ public class TextAlignmentAndDirection : Scenario
|
||||
Height = 1,
|
||||
Text = "AutoSize"
|
||||
};
|
||||
autoSizeCheckbox.Checked = autoSizeCheckbox.TextFormatter.AutoSize;
|
||||
autoSizeCheckbox.State = autoSizeCheckbox.TextFormatter.AutoSize ? CheckState.Checked : CheckState.UnChecked;
|
||||
|
||||
autoSizeCheckbox.Toggle += (s, e) =>
|
||||
{
|
||||
if (e.CurrentValue == true)
|
||||
if (e.CurrentValue == CheckState.Checked)
|
||||
{
|
||||
foreach (Label t in multiLineLabels)
|
||||
{
|
||||
@@ -570,7 +570,7 @@ public class TextAlignmentAndDirection : Scenario
|
||||
|
||||
directionOptions.SelectedItemChanged += (s, ev) =>
|
||||
{
|
||||
bool justChecked = justifyCheckbox.Checked is { } && (bool)justifyCheckbox.Checked;
|
||||
bool justChecked = justifyCheckbox.State == CheckState.Checked;
|
||||
|
||||
if (justChecked)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user