4 using System.Collections.Generic;
6 using SiliconStudio.Core.Mathematics;
8 namespace SiliconStudio.
Paradox.UI
15 private float maximumSize;
16 private float minimumSize;
18 private float sizeValue;
23 public float ActualSize {
get;
internal set; }
41 SizeValue = sizeValue;
42 MaximumSize = float.PositiveInfinity;
51 public float MaximumSize
53 get {
return maximumSize; }
57 throw new ArgumentOutOfRangeException(
"value");
59 if(value < MinimumSize)
60 throw new InvalidOperationException(
"The provided maximum value is smaller than the current minimum value");
64 if (DefinitionChanged != null)
74 public float MinimumSize
76 get {
return minimumSize; }
79 if (value < 0 ||
float.IsPositiveInfinity(value))
80 throw new ArgumentOutOfRangeException(
"value");
82 if (value > MaximumSize)
83 throw new InvalidOperationException(
"The provided minimum value is bigger than the current maximum value");
87 if (DefinitionChanged != null)
105 var handler = DefinitionChanged;
116 public float SizeValue
118 get {
return sizeValue; }
121 if (value < 0 ||
float.IsPositiveInfinity(value))
122 throw new ArgumentOutOfRangeException(
"value");
126 var handler = DefinitionChanged;
139 return Math.Min(MaximumSize, Math.Max(MinimumSize, desiredSize));
142 internal float ValueRelativeMinimum()
147 return MinimumSize / SizeValue;
150 internal float ValueRelativeMaximum()
155 return MaximumSize / SizeValue;
158 internal class SortByIncreasingStarRelativeMinimumValues :
IComparer<StripDefinition>
160 public int Compare(StripDefinition def1, StripDefinition def2)
162 var val1 = def1.ValueRelativeMinimum();
163 var val2 = def2.ValueRelativeMinimum();
165 return val1.CompareTo(val2);
169 internal class SortByIncreasingStarRelativeMaximumValues :
IComparer<StripDefinition>
171 public int Compare(StripDefinition def1, StripDefinition def2)
173 var val1 = def1.ValueRelativeMaximum();
174 var val2 = def2.ValueRelativeMaximum();
176 return val1.CompareTo(val2);
180 internal event EventHandler<EventArgs> DefinitionChanged;
StripType
The different types of strip possible of a grid.
Represent the definition of a grid strip.
const float ZeroTolerance
The value for which all absolute numbers smaller than are considered equal to zero.
StripDefinition(StripType type, float sizeValue=1)
Creates a StripDefinition with the provided size and type.
StripDefinition()
Creates a 1-Star sized strip definition.
A strip that occupies the maximum available size, dispatched among the other stared-size columns...
float ClampSizeByMinimumMaximum(float desiredSize)
Clamp the provided size by the definition's minimum and maximum values.