blob: 8c125ec3ea090b619c72a3b1eba4adc8e6144ddc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
using System.Windows.Forms;
namespace grapher.Models.Options
{
/// <summary>
/// This is an option type that is just a checkbox.
/// </summary>
public class CheckBoxOption : OptionBase
{
public CheckBoxOption(
CheckBox checkBox,
ActiveValueLabel activeValueLabel)
{
CheckBox = checkBox;
ActiveValueLabel = activeValueLabel;
Show(string.Empty);
}
public CheckBox CheckBox { get; }
public ActiveValueLabel ActiveValueLabel { get; }
public override bool Visible
{
get
{
return CheckBox.Visible || ShouldShow;
}
}
public override int Left
{
get
{
return CheckBox.Left;
}
set
{
CheckBox.Left = value;
}
}
public override int Height
{
get
{
return CheckBox.Height;
}
}
public override int Top
{
get
{
return CheckBox.Top;
}
set
{
CheckBox.Top = value;
ActiveValueLabel.Top = value;
}
}
public override int Width
{
get
{
return CheckBox.Width;
}
set
{
CheckBox.Width = value;
}
}
/// <summary>
/// For some reason, setting CheckBox.Show() does not result in visible not being true on GUI startup.
/// This is inconsistent with the other options, which do.
/// Keep this bool for allowing Visible to still be the signal for option snapping.
/// </summary>
private bool ShouldShow { get; set; }
public override void AlignActiveValues()
{
ActiveValueLabel.Align();
}
public override void Hide()
{
CheckBox.Hide();
ShouldShow = false;
CheckBox.Enabled = false;
ActiveValueLabel.Hide();
}
public override void Show(string Name)
{
CheckBox.Show();
ShouldShow = true;
CheckBox.Enabled = true;
CheckBox.Name = Name;
ActiveValueLabel.Show();
}
public void SetActiveValue(bool gain)
{
CheckBox.Checked = gain;
var activeValueString = gain ? "Gain" : "Legacy";
ActiveValueLabel.SetValue(activeValueString);
}
}
}
|