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