#nullable enable
namespace UVC.UIToolkit
{
///
/// 실수 범위 속성 데이터 클래스입니다.
/// UI는 UTKFloatRangePropertyItemView에서 담당합니다.
///
public class UTKFloatRangePropertyItem : UTKPropertyItemBase
{
#region Fields
private bool _useStepper;
private float _stepperMinValue = float.MinValue;
private float _stepperMaxValue = float.MaxValue;
private float _stepperStep = 1.0f;
#endregion
#region Properties
/// 속성 타입
public override UTKPropertyType PropertyType => UTKPropertyType.FloatRange;
/// 스테퍼(증감 버튼) 사용 여부
public bool UseStepper
{
get => _useStepper;
set
{
_useStepper = value;
}
}
/// 스테퍼 증감 단위 (기본값: 1.0)
public float StepperStep
{
get => _stepperStep;
set => _stepperStep = value > 0 ? value : 1.0f;
}
/// 스테퍼 최소값
public float StepperMinValue
{
get => _stepperMinValue;
set => _stepperMinValue = value;
}
/// 스테퍼 최대값
public float StepperMaxValue
{
get => _stepperMaxValue;
set => _stepperMaxValue = value;
}
#endregion
#region Constructor
///
/// 실수 범위 속성을 생성합니다 (필드 모드).
///
/// 고유 ID
/// 표시 이름
/// 초기 범위 값
/// 읽기 전용 여부
/// 레이블 표시 여부
public UTKFloatRangePropertyItem(string id, string name, UTKFloatRange initialValue = default, bool isReadOnly = false, bool showLabel = true)
: base(id, name, initialValue)
{
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
///
/// 실수 범위 속성을 생성합니다.
///
/// 고유 ID
/// 표시 이름
/// 최소값
/// 최대값
/// 스테퍼 증감 단위
/// 스테퍼 최소값
/// 스테퍼 최대값
/// 스테퍼 사용 여부
/// 읽기 전용 여부
/// 레이블 표시 여부
public UTKFloatRangePropertyItem(string id, string name, float min, float max, float stepperStep = 1.0f, float stepperMinValue = float.MinValue, float stepperMaxValue = float.MaxValue, bool useStepper = false, bool isReadOnly = false, bool showLabel = true)
: base(id, name, new UTKFloatRange(min, max))
{
_stepperMinValue = stepperMinValue;
_stepperMaxValue = stepperMaxValue;
_useStepper = useStepper;
_stepperStep = stepperStep;
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
///
/// 실수 범위 속성을 생성합니다 (스테퍼 모드).
///
/// 고유 ID
/// 표시 이름
/// 초기 범위 값
/// 스테퍼 증감 단위
/// 스테퍼 최소값
/// 스테퍼 최대값
/// 스테퍼 사용 여부
/// 읽기 전용 여부
/// 레이블 표시 여부
public UTKFloatRangePropertyItem(string id, string name, UTKFloatRange initialValue, float stepperStep = 1.0f, float stepperMinValue = float.MinValue, float stepperMaxValue = float.MaxValue, bool useStepper = false, bool isReadOnly = false, bool showLabel = true)
: base(id, name, initialValue)
{
_stepperMinValue = stepperMinValue;
_stepperMaxValue = stepperMaxValue;
_useStepper = useStepper;
_stepperStep = stepperStep;
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
#endregion
}
}