#nullable enable
using System;
namespace UVC.UIToolkit
{
///
/// 정수 범위 속성 데이터 클래스입니다.
/// UI는 UTKIntRangePropertyItemView에서 담당합니다.
///
public class UTKIntRangePropertyItem : UTKPropertyItemBase
{
#region Fields
private bool _useStepper;
private int _stepperMinValue = int.MinValue;
private int _stepperMaxValue = int.MaxValue;
private int _stepperStep = 1;
#endregion
#region Properties
/// 속성 타입
public override UTKPropertyType PropertyType => UTKPropertyType.IntRange;
/// 스테퍼(증감 버튼) 사용 여부
public bool UseStepper
{
get => _useStepper;
set
{
_useStepper = value;
}
}
/// 스테퍼 증감 단위 (기본값: 1)
public int StepperStep
{
get => _stepperStep;
set => _stepperStep = Math.Max(1, value);
}
/// 스테퍼 최소값
public int StepperMinValue
{
get => _stepperMinValue;
set => _stepperMinValue = value;
}
/// 스테퍼 최대값
public int StepperMaxValue
{
get => _stepperMaxValue;
set => _stepperMaxValue = value;
}
#endregion
#region Constructor
///
/// 정수 범위 속성을 생성합니다 (필드 모드).
///
/// 고유 ID
/// 표시 이름
/// 초기 범위 값
/// 읽기 전용 여부
/// 라벨 표시 여부
public UTKIntRangePropertyItem(string id, string name, UTKIntRange initialValue = default, bool isReadOnly = false, bool showLabel = true)
: base(id, name, initialValue)
{
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
///
/// 정수 범위 속성을 생성합니다.
///
/// 고유 ID
/// 표시 이름
/// 최소값
/// 최대값
/// 스테퍼 증감 단위
/// 스테퍼 최소값
/// 스테퍼 최대값
/// 스테퍼 사용 여부
/// 읽기 전용 여부
/// 라벨 표시 여부
public UTKIntRangePropertyItem(string id, string name, int min, int max, int stepperStep = 1, int stepperMinValue = int.MinValue, int stepperMaxValue = int.MaxValue, bool useStepper = false, bool isReadOnly = false, bool showLabel = true)
: base(id, name, new UTKIntRange(min, max))
{
_stepperMinValue = stepperMinValue;
_stepperMaxValue = stepperMaxValue;
_useStepper = useStepper;
_stepperStep = stepperStep;
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
///
/// 정수 범위 속성을 생성합니다 (슬라이더/스테퍼 모드).
///
/// 고유 ID
/// 표시 이름
/// 초기 범위 값
/// 스테퍼 증감 단위
/// 스테퍼 최소값
/// 스테퍼 최대값
/// 스테퍼 사용 여부
/// 읽기 전용 여부
/// 라벨 표시 여부
public UTKIntRangePropertyItem(string id, string name, UTKIntRange initialValue, int stepperStep = 1, int stepperMinValue = int.MinValue, int stepperMaxValue = int.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
}
}