UTKFloatStepper 추가. UTKFloatPropertyItem, UTKFloatPropertyItemView에 추가

This commit is contained in:
logonkhi
2026-02-09 20:28:09 +09:00
parent a38efd756e
commit 97bbb789ed
65 changed files with 2785 additions and 131 deletions

View File

@@ -64,6 +64,9 @@ namespace UVC.UIToolkit
/// <summary>속성 클릭 이벤트</summary>
public event Action<IUTKPropertyItem>? OnPropertyClicked;
/// <summary>버튼 클릭 이벤트 (액션 이름 전달)</summary>
public event Action<string, string>? OnPropertyButtonClicked;
#endregion
#region Constructor
@@ -576,6 +579,12 @@ namespace UVC.UIToolkit
{
view.Unbind();
}
// IDisposable 구현체인 경우 Dispose 호출
if (child is IDisposable disposable)
{
disposable.Dispose();
}
}
element.Clear();
@@ -601,11 +610,21 @@ namespace UVC.UIToolkit
groupElement.Add(title);
groupElement.Add(count);
groupElement.RegisterCallback<ClickEvent>(_ =>
// 그룹 클릭 이벤트 - DetachFromPanelEvent에서 자동 정리됨
EventCallback<ClickEvent> clickCallback = null!;
clickCallback = _ =>
{
ToggleGroupExpanded(group.GroupId);
expandIcon.SetMaterialIcon(group.IsExpanded ? UTKMaterialIcons.ExpandMore : UTKMaterialIcons.ChevronRight, 16);
OnGroupExpandedChanged?.Invoke(group, group.IsExpanded);
};
groupElement.RegisterCallback(clickCallback);
// DetachFromPanelEvent에서 이벤트 해제
groupElement.RegisterCallback<DetachFromPanelEvent>(evt =>
{
groupElement.UnregisterCallback(clickCallback);
});
container.Add(groupElement);
@@ -616,7 +635,47 @@ namespace UVC.UIToolkit
// View Factory를 사용하여 View 생성 및 바인딩
var itemView = UTKPropertyItemViewFactory.CreateView(item);
itemView.RegisterCallback<ClickEvent>(_ => OnPropertyClicked?.Invoke(item));
// 클릭 이벤트 등록 - DetachFromPanelEvent에서 자동 정리됨
EventCallback<ClickEvent> clickCallback = _ => OnPropertyClicked?.Invoke(item);
itemView.RegisterCallback(clickCallback);
// 버튼 아이템인 경우 버튼 클릭 이벤트 구독
Action<string>? buttonClickHandler = null;
if (itemView is UTKButtonItemView buttonView)
{
buttonClickHandler = (actionName) =>
{
OnPropertyButtonClicked?.Invoke(item.Id, actionName);
};
buttonView.OnButtonClicked += buttonClickHandler;
}
// String 아이템에 ActionButton이 있는 경우 이벤트 구독
Action<string>? actionButtonClickHandler = null;
if (itemView is UTKStringPropertyItemView stringView)
{
actionButtonClickHandler = (actionName) =>
{
OnPropertyButtonClicked?.Invoke(item.Id, actionName);
};
stringView.OnActionButtonClicked += actionButtonClickHandler;
}
// DetachFromPanelEvent에서 이벤트 해제
itemView.RegisterCallback<DetachFromPanelEvent>(evt =>
{
itemView.UnregisterCallback(clickCallback);
if (itemView is UTKButtonItemView btnView && buttonClickHandler != null)
{
btnView.OnButtonClicked -= buttonClickHandler;
}
if (itemView is UTKStringPropertyItemView strView && actionButtonClickHandler != null)
{
strView.OnActionButtonClicked -= actionButtonClickHandler;
}
});
container.Add(itemView);
}
@@ -720,6 +779,7 @@ namespace UVC.UIToolkit
OnPropertyValueChanged = null;
OnGroupExpandedChanged = null;
OnPropertyClicked = null;
OnPropertyButtonClicked = null;
// UI 참조 정리
_treeView = null;