Class NumericalField<TValueType>
Numerical Field UI element.
Inheritance
Inherited Members
Namespace: UnityEngine.Dt.App.UI
Syntax
public abstract class NumericalField<TValueType> : ExVisualElement, IEventHandler, IStylePropertyAnimations, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IValidatableElement<TValueType>, INotifyValueChanged<TValueType>, ISizeableElement where TValueType : struct, IComparable, IComparable<TValueType>, IFormattable
Type Parameters
Name | Description |
---|---|
TValueType | The type of the value. |
Constructors
NumericalField()
Default constructor.
Declaration
protected NumericalField()
Fields
inputContainerUssClassName
The NumericalField input container styling class.
Declaration
public static readonly string inputContainerUssClassName
Field Value
Type | Description |
---|---|
String |
inputUssClassName
The NumericalField input styling class.
Declaration
public static readonly string inputUssClassName
Field Value
Type | Description |
---|---|
String |
m_InputContainer
The input container.
Declaration
protected readonly VisualElement m_InputContainer
Field Value
Type | Description |
---|---|
VisualElement |
m_InputElement
The input element.
Declaration
protected readonly TextField m_InputElement
Field Value
Type | Description |
---|---|
TextField |
m_Size
The size of the element.
Declaration
protected Size m_Size
Field Value
Type | Description |
---|---|
Size |
m_TrailingContainer
The trailing container.
Declaration
protected readonly VisualElement m_TrailingContainer
Field Value
Type | Description |
---|---|
VisualElement |
m_UnitElement
The unit element.
Declaration
protected readonly LocalizedTextElement m_UnitElement
Field Value
Type | Description |
---|---|
LocalizedTextElement |
m_Value
The value of the element.
Declaration
protected TValueType m_Value
Field Value
Type | Description |
---|---|
TValueType |
sizeUssClassName
The NumericalField size styling class.
Declaration
public static readonly string sizeUssClassName
Field Value
Type | Description |
---|---|
String |
trailingContainerUssClassName
The NumericalField trailing container styling class.
Declaration
public static readonly string trailingContainerUssClassName
Field Value
Type | Description |
---|---|
String |
unitUssClassName
The NumericalField unit styling class.
Declaration
public static readonly string unitUssClassName
Field Value
Type | Description |
---|---|
String |
ussClassName
The NumericalField main styling class.
Declaration
public const string ussClassName = "appui-numericalfield"
Field Value
Type | Description |
---|---|
String |
Properties
contentContainer
The content container of the element.
Declaration
public override VisualElement contentContainer { get; }
Property Value
Type | Description |
---|---|
VisualElement |
Overrides
formatString
The format string of the element.
Declaration
public string formatString { get; set; }
Property Value
Type | Description |
---|---|
String |
highValue
Maximum value.
Declaration
public TValueType? highValue { get; set; }
Property Value
Type | Description |
---|---|
Nullable<TValueType> |
invalid
The invalid state of the element.
Declaration
public bool invalid { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
lowValue
Minimum value.
Declaration
public TValueType? lowValue { get; set; }
Property Value
Type | Description |
---|---|
Nullable<TValueType> |
size
The size of the element.
Declaration
public Size size { get; set; }
Property Value
Type | Description |
---|---|
Size |
Implements
unit
The unit of the element.
Declaration
public string unit { get; set; }
Property Value
Type | Description |
---|---|
String |
validateValue
Method to validate the value.
Declaration
public Func<TValueType, bool> validateValue { get; set; }
Property Value
Type | Description |
---|---|
Func<TValueType, Boolean> |
Implements
value
The value of the element.
Declaration
public TValueType value { get; set; }
Property Value
Type | Description |
---|---|
TValueType |
Implements
Methods
AreEqual(TValueType, TValueType)
Check if two values of type TValueType
are equal.
Declaration
protected abstract bool AreEqual(TValueType a, TValueType b)
Parameters
Type | Name | Description |
---|---|---|
TValueType | a | The first value to test. |
TValueType | b | The second value to test. |
Returns
Type | Description |
---|---|
Boolean | True if both values are considered equals, false otherwise. |
GetIncrementFactor(TValueType)
Calculate the increment factor based on a base value.
Declaration
protected abstract float GetIncrementFactor(TValueType baseValue)
Parameters
Type | Name | Description |
---|---|---|
TValueType | baseValue | The base value. |
Returns
Type | Description |
---|---|
Single | The increment factor. |
Increment(TValueType, Single)
Increment a given value with a given delta.
Declaration
protected abstract TValueType Increment(TValueType originalValue, float delta)
Parameters
Type | Name | Description |
---|---|---|
TValueType | originalValue | The original value. |
Single | delta | The delta used for increment. |
Returns
Type | Description |
---|---|
TValueType | The incremented value. |
Max(TValueType, TValueType)
Return the biggest value between a and b.
Declaration
protected abstract TValueType Max(TValueType a, TValueType b)
Parameters
Type | Name | Description |
---|---|---|
TValueType | a | A value. |
TValueType | b | A value. |
Returns
Type | Description |
---|---|
TValueType | The biggest value between a and b. |
Min(TValueType, TValueType)
Return the smallest value between a and b.
Declaration
protected abstract TValueType Min(TValueType a, TValueType b)
Parameters
Type | Name | Description |
---|---|---|
TValueType | a | A value. |
TValueType | b | A value. |
Returns
Type | Description |
---|---|
TValueType | The smallest value between a and b. |
ParseStringToValue(String, out TValueType)
Define the conversion from the String value to a TValueType
value.
Declaration
protected abstract bool ParseStringToValue(string strValue, out TValueType val)
Parameters
Type | Name | Description |
---|---|---|
String | strValue | The String value to convert. |
TValueType | val | The |
Returns
Type | Description |
---|---|
Boolean | True if the conversion is possible, False otherwise. |
ParseValueToString(TValueType)
Define the conversion from a TValueType
value to a String value.
Declaration
protected abstract string ParseValueToString(TValueType val)
Parameters
Type | Name | Description |
---|---|---|
TValueType | val | The |
Returns
Type | Description |
---|---|
String | The converted value. |
SetValueWithoutNotify(TValueType)
Set the value of the element without notifying the change.
Declaration
public void SetValueWithoutNotify(TValueType newValue)
Parameters
Type | Name | Description |
---|---|---|
TValueType | newValue | The new value of the element. |