summaryrefslogtreecommitdiff
path: root/grapher/Models/Options/ComboBoxOptionsBase.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-09-24 02:04:43 -0400
committerGitHub <[email protected]>2021-09-24 02:04:43 -0400
commit2896b8a09ce42e965705c58593b8738adc454f7f (patch)
tree71e4d0cff60b5a1ad11427d78e1f8c7b775e5690 /grapher/Models/Options/ComboBoxOptionsBase.cs
parentMerge pull request #107 from a1xd/1.5.0-fix (diff)
parentmake note clearer (diff)
downloadrawaccel-1.6.0.tar.xz
rawaccel-1.6.0.zip
Merge pull request #108 from a1xd/1.6r2HEADv1.6.0master
v1.6
Diffstat (limited to 'grapher/Models/Options/ComboBoxOptionsBase.cs')
-rw-r--r--grapher/Models/Options/ComboBoxOptionsBase.cs124
1 files changed, 124 insertions, 0 deletions
diff --git a/grapher/Models/Options/ComboBoxOptionsBase.cs b/grapher/Models/Options/ComboBoxOptionsBase.cs
new file mode 100644
index 0000000..6999e99
--- /dev/null
+++ b/grapher/Models/Options/ComboBoxOptionsBase.cs
@@ -0,0 +1,124 @@
+using System.Windows.Forms;
+
+namespace grapher.Models.Options
+{
+ public abstract class ComboBoxOptionsBase : OptionBase
+ {
+ #region Constructors
+
+ public ComboBoxOptionsBase(
+ Label label,
+ ComboBox dropdown,
+ ActiveValueLabel activeValueLabel)
+ {
+ OptionsDropdown = dropdown;
+ OptionsDropdown.Items.Clear();
+
+ Label = label;
+ Label.AutoSize = false;
+ Label.Width = 50;
+
+ ActiveValueLabel = activeValueLabel;
+ }
+
+ #endregion Constructors
+
+ #region Properties
+
+ public Label Label { get; }
+
+ public ActiveValueLabel ActiveValueLabel { get; }
+
+ public ComboBox OptionsDropdown { get; }
+
+ public override bool Visible
+ {
+ get
+ {
+ return Label.Visible || ShouldShow;
+ }
+ }
+
+ public override int Left
+ {
+ get
+ {
+ return Label.Left;
+ }
+ set
+ {
+ Label.Left = value;
+ OptionsDropdown.Left = Label.Left + Label.Width + Constants.OptionVerticalSeperation;
+ }
+ }
+
+ public override int Height
+ {
+ get
+ {
+ return OptionsDropdown.Height;
+ }
+ }
+
+ public override int Top
+ {
+ get
+ {
+ return OptionsDropdown.Top;
+ }
+ set
+ {
+ OptionsDropdown.Top = value;
+ Label.Top = (OptionsDropdown.Height - Label.Height) / 2 + OptionsDropdown.Top;
+ ActiveValueLabel.Top = value;
+ }
+ }
+
+ public override int Width
+ {
+ get
+ {
+ return Label.Width;
+ }
+ set
+ {
+ OptionsDropdown.Width = value - Label.Width - Constants.OptionLabelBoxSeperation;
+ }
+ }
+
+ protected bool ShouldShow { get; set; }
+
+ #endregion Properties
+
+ #region Methods
+
+ public override void Hide()
+ {
+ Label.Hide();
+ OptionsDropdown.Hide();
+ ActiveValueLabel.Hide();
+ ShouldShow = false;
+ }
+
+ public override void Show(string labelText)
+ {
+ Label.Show();
+
+ if (!string.IsNullOrWhiteSpace(labelText))
+ {
+ Label.Text = labelText;
+ }
+
+ OptionsDropdown.Show();
+ ActiveValueLabel.Show();
+ ShouldShow = true;
+ }
+
+ public override void AlignActiveValues()
+ {
+ ActiveValueLabel.Align();
+ }
+
+ #endregion Methods
+ }
+}