From c0f2aa4a41de22936a5ed177c3b83792cc8231a8 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Mon, 13 Sep 2021 00:40:57 -0700 Subject: Most of Cap Type options in GUI --- grapher/Models/Options/ComboBoxOptionsBase.cs | 129 ++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 grapher/Models/Options/ComboBoxOptionsBase.cs (limited to 'grapher/Models/Options/ComboBoxOptionsBase.cs') diff --git a/grapher/Models/Options/ComboBoxOptionsBase.cs b/grapher/Models/Options/ComboBoxOptionsBase.cs new file mode 100644 index 0000000..64e0092 --- /dev/null +++ b/grapher/Models/Options/ComboBoxOptionsBase.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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 Label.Height; + } + } + + public override int Top + { + get + { + return Label.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 + } +} -- cgit v1.2.3 From 8878091a2cab77b0433daea7a47033e1c35e42c1 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Wed, 15 Sep 2021 23:16:43 -0700 Subject: Cap type options now fully working --- grapher/Models/Options/ComboBoxOptionsBase.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'grapher/Models/Options/ComboBoxOptionsBase.cs') diff --git a/grapher/Models/Options/ComboBoxOptionsBase.cs b/grapher/Models/Options/ComboBoxOptionsBase.cs index 64e0092..6999e99 100644 --- a/grapher/Models/Options/ComboBoxOptionsBase.cs +++ b/grapher/Models/Options/ComboBoxOptionsBase.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; +using System.Windows.Forms; namespace grapher.Models.Options { @@ -61,7 +56,7 @@ namespace grapher.Models.Options { get { - return Label.Height; + return OptionsDropdown.Height; } } @@ -69,7 +64,7 @@ namespace grapher.Models.Options { get { - return Label.Top; + return OptionsDropdown.Top; } set { -- cgit v1.2.3