summaryrefslogtreecommitdiff
path: root/grapher/Models/Options/Option.cs
diff options
context:
space:
mode:
Diffstat (limited to 'grapher/Models/Options/Option.cs')
-rw-r--r--grapher/Models/Options/Option.cs77
1 files changed, 74 insertions, 3 deletions
diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs
index b0ef374..22b78d4 100644
--- a/grapher/Models/Options/Option.cs
+++ b/grapher/Models/Options/Option.cs
@@ -10,14 +10,22 @@ namespace grapher
{
public class Option
{
+ #region Constructors
+
public Option(
Field field,
Label label,
- ActiveValueLabel activeValueLabel)
+ ActiveValueLabel activeValueLabel,
+ int left)
{
Field = field;
Label = label;
ActiveValueLabel = activeValueLabel;
+ Left = left;
+
+ label.AutoSize = false;
+ label.Width = Field.Left - left - Constants.OptionLabelBoxSeperation;
+ label.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
}
public Option(
@@ -25,11 +33,13 @@ namespace grapher
Form containingForm,
double defaultData,
Label label,
+ int left,
ActiveValueLabel activeValueLabel)
: this(
new Field(box, containingForm, defaultData),
label,
- activeValueLabel)
+ activeValueLabel,
+ left)
{
}
@@ -38,6 +48,7 @@ namespace grapher
Form containingForm,
double defaultData,
Label label,
+ int left,
ActiveValueLabel activeValueLabel,
string startingName)
: this(
@@ -45,22 +56,70 @@ namespace grapher
containingForm,
defaultData,
label,
+ left,
activeValueLabel)
{
SetName(startingName);
}
+ #endregion Constructors
+
+ #region Properties
+
public Field Field { get; }
public Label Label { get; }
public ActiveValueLabel ActiveValueLabel { get; }
+ public int Top
+ {
+ get
+ {
+ return Field.Top;
+ }
+ set
+ {
+ Field.Top = value;
+ Label.Top = value;
+ }
+ }
+
+ public int Height
+ {
+ get
+ {
+ return Field.Height;
+ }
+ }
+
+ public int Left
+ {
+ get
+ {
+ return Label.Left;
+ }
+ private set
+ {
+ Label.Left = value;
+ }
+ }
+ public int Width
+ {
+ get
+ {
+ return Field.Left + Field.Width - Label.Left;
+ }
+ }
+
+ #endregion Properties
+
+ #region Methods
+
public void SetName(string name)
{
Label.Text = name;
//Label.Left = Convert.ToInt32((Field.Box.Left / 2.0) - (Label.Width / 2.0)); //Centered
- Label.Left = Convert.ToInt32(Field.Box.Left - Label.Width - 10); //Right-aligned
}
public void SetActiveValue(double value)
@@ -93,5 +152,17 @@ namespace grapher
Show();
}
+
+ public void SnapTo(Option option)
+ {
+ Top = option.Top + option.Height + Constants.OptionVerticalSeperation;
+ }
+
+ public void SnapTo(CapOptions option)
+ {
+ Top = option.Top + option.Height + Constants.OptionVerticalSeperation;
+ }
+
+ #endregion Methods
}
}