#nullable enable
using System;
using UnityEngine;
namespace UVC.UIToolkit
{
///
/// 버튼 속성 Item 클래스입니다.
/// UTKButton 설정을 포함하며, 클릭 시 Action 이름을 전달합니다.
///
public class UTKButtonItem : UTKPropertyItemBase
{
#region Properties
public override UTKPropertyType PropertyType => UTKPropertyType.Button;
/// 버튼 텍스트
public string Text { get; set; }
/// 버튼 아이콘
public string Icon { get; set; }
/// 아이콘 크기
public int IconSize { get; set; }
/// 버튼 스타일 변형
public UTKButton.ButtonVariant Variant { get; set; }
/// 버튼 크기
public UTKButton.ButtonSize Size { get; set; }
/// 커스텀 배경 색상
public Color? BackgroundColor { get; set; }
/// 외곽선 굵기
public int BorderWidth { get; set; }
/// 아이콘만 표시 모드
public bool IconOnly { get; set; }
/// 라벨 표시 여부 (false면 버튼이 전체 너비 사용)
public bool ShowLabel { get; set; }
/// 액션 이름 (버튼 클릭 시 전달되는 고유 이름)
public string ActionName { get; }
#endregion
#region Constructor
///
/// 기본 버튼 아이템을 생성합니다.
///
/// 고유 ID
/// 액션 이름 (클릭 시 전달)
/// 버튼 텍스트
/// 버튼 아이콘
/// 버튼 스타일
/// 버튼 크기
public UTKButtonItem(
string id,
string actionName,
string text = "",
string icon = "",
UTKButton.ButtonVariant variant = UTKButton.ButtonVariant.Normal,
UTKButton.ButtonSize size = UTKButton.ButtonSize.Medium)
: base(id, actionName, actionName)
{
ActionName = actionName;
Text = text;
Icon = icon;
IconSize = 12;
Variant = variant;
Size = size;
BackgroundColor = null;
BorderWidth = -1;
IconOnly = false;
ShowLabel = true; // 기본적으로 라벨 표시
}
///
/// 전체 설정을 포함한 버튼 아이템을 생성합니다.
///
/// 고유 ID
/// 액션 이름
/// 버튼 텍스트
/// 버튼 아이콘
/// 아이콘 크기
/// 버튼 스타일
/// 버튼 크기
/// 배경 색상
/// 외곽선 굵기
/// 아이콘만 표시
/// 라벨 표시 여부
public UTKButtonItem(
string id,
string actionName,
string text,
string icon,
int iconSize,
UTKButton.ButtonVariant variant,
UTKButton.ButtonSize size,
Color? backgroundColor,
int borderWidth,
bool iconOnly,
bool showLabel = true)
: base(id, actionName, actionName)
{
ActionName = actionName;
Text = text;
Icon = icon;
IconSize = iconSize;
Variant = variant;
Size = size;
BackgroundColor = backgroundColor;
BorderWidth = borderWidth;
IconOnly = iconOnly;
ShowLabel = showLabel;
}
#endregion
}
}