UTKAccordion 개발 완료. UTKComponentList 완료
This commit is contained in:
@@ -65,7 +65,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 메인/검색 리스트에서 항목이 선택될 때 발생합니다.
|
||||
/// </summary>
|
||||
public Action<List<UTKComponentListItemData>>? OnItemSelected
|
||||
public Action<List<UTKComponentListItemDataBase>>? OnItemSelected
|
||||
{
|
||||
get => _componentList?.OnItemSelected;
|
||||
set { if (_componentList != null) _componentList.OnItemSelected = value; }
|
||||
@@ -74,7 +74,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 메인/검색 리스트에서 항목이 선택 해제될 때 발생합니다.
|
||||
/// </summary>
|
||||
public Action<List<UTKComponentListItemData>>? OnItemDeselected
|
||||
public Action<List<UTKComponentListItemDataBase>>? OnItemDeselected
|
||||
{
|
||||
get => _componentList?.OnItemDeselected;
|
||||
set { if (_componentList != null) _componentList.OnItemDeselected = value; }
|
||||
@@ -83,7 +83,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 항목의 가시성(눈 아이콘)이 변경될 때 발생합니다.
|
||||
/// </summary>
|
||||
public event Action<UTKComponentListItemData, bool>? OnItemVisibilityChanged
|
||||
public event Action<UTKComponentListItemDataBase, bool>? OnItemVisibilityChanged
|
||||
{
|
||||
add { if (_componentList != null) _componentList.OnItemVisibilityChanged += value; }
|
||||
remove { if (_componentList != null) _componentList.OnItemVisibilityChanged -= value; }
|
||||
@@ -92,7 +92,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 메인/검색 리스트에서 항목이 삭제될 때 발생합니다 (Delete 키).
|
||||
/// </summary>
|
||||
public Action<UTKComponentListItemData>? OnItemDeleted
|
||||
public Action<UTKComponentListItemDataBase>? OnItemDeleted
|
||||
{
|
||||
get => _componentList?.OnItemDeleted;
|
||||
set { if (_componentList != null) _componentList.OnItemDeleted = value; }
|
||||
@@ -101,7 +101,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 메인/검색 리스트에서 항목이 더블클릭될 때 발생합니다.
|
||||
/// </summary>
|
||||
public Action<UTKComponentListItemData>? OnItemDoubleClicked
|
||||
public Action<UTKComponentListItemDataBase>? OnItemDoubleClicked
|
||||
{
|
||||
get => _componentList?.OnItemDoubleClicked;
|
||||
set { if (_componentList != null) _componentList.OnItemDoubleClicked = value; }
|
||||
@@ -110,7 +110,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 아이콘을 클릭할 때 발생합니다.
|
||||
/// </summary>
|
||||
public Action<string, UTKComponentListItemData>? OnItemIconClicked
|
||||
public Action<string, UTKComponentListItemDataBase>? OnItemIconClicked
|
||||
{
|
||||
get => _componentList?.OnItemIconClicked;
|
||||
set { if (_componentList != null) _componentList.OnItemIconClicked = value; }
|
||||
@@ -174,7 +174,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// 트리 데이터를 설정합니다.
|
||||
/// </summary>
|
||||
/// <param name="roots">루트 항목들의 리스트</param>
|
||||
public void SetData(List<UTKComponentListItemData> roots)
|
||||
public void SetData(List<UTKComponentListItemDataBase> roots)
|
||||
{
|
||||
_componentList?.SetData(roots);
|
||||
}
|
||||
@@ -202,17 +202,17 @@ namespace UVC.UIToolkit.Window
|
||||
/// 루트 레벨에 새 항목을 추가합니다.
|
||||
/// </summary>
|
||||
/// <param name="data">추가할 항목 데이터</param>
|
||||
public void AddItem(UTKComponentListItemData data)
|
||||
public void AddItem(UTKComponentListItemDataBase data)
|
||||
{
|
||||
_componentList?.AddItem(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 지정된 부모 항목의 자식으로 새 항목을 추가합니다.
|
||||
/// 지정된 부모 카테고리의 자식으로 새 항목을 추가합니다.
|
||||
/// </summary>
|
||||
/// <param name="parent">부모 항목</param>
|
||||
/// <param name="parent">부모 카테고리</param>
|
||||
/// <param name="data">추가할 항목 데이터</param>
|
||||
public void AddItem(UTKComponentListItemData? parent, UTKComponentListItemData data)
|
||||
public void AddItem(UTKComponentListCategoryData? parent, UTKComponentListItemDataBase data)
|
||||
{
|
||||
_componentList?.AddItem(parent, data);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// 트리에서 항목을 완전히 삭제합니다.
|
||||
/// </summary>
|
||||
/// <param name="data">삭제할 항목 데이터</param>
|
||||
public void DeleteItem(UTKComponentListItemData data)
|
||||
public void DeleteItem(UTKComponentListItemDataBase data)
|
||||
{
|
||||
_componentList?.DeleteItem(data);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// </summary>
|
||||
/// <param name="data">변경할 항목 데이터</param>
|
||||
/// <param name="newName">새 이름</param>
|
||||
public void SetItemName(UTKComponentListItemData data, string newName)
|
||||
public void SetItemName(UTKComponentListItemDataBase data, string newName)
|
||||
{
|
||||
_componentList?.SetItemName(data, newName);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace UVC.UIToolkit.Window
|
||||
|
||||
#region 탭 관련 데이터 (Tab Data)
|
||||
/// <summary>원본 전체 데이터</summary>
|
||||
private List<UTKComponentListItemData> _originalRoots = new();
|
||||
private List<UTKComponentListItemDataBase> _originalRoots = new();
|
||||
|
||||
/// <summary>현재 선택된 탭 인덱스 (-1: 전체)</summary>
|
||||
private int _selectedTabIndex = ALL_TAB_INDEX;
|
||||
@@ -87,7 +87,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 메인/검색 리스트에서 항목이 선택될 때 발생합니다.
|
||||
/// </summary>
|
||||
public Action<List<UTKComponentListItemData>>? OnItemSelected
|
||||
public Action<List<UTKComponentListItemDataBase>>? OnItemSelected
|
||||
{
|
||||
get => _componentList?.OnItemSelected;
|
||||
set { if (_componentList != null) _componentList.OnItemSelected = value; }
|
||||
@@ -96,7 +96,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 메인/검색 리스트에서 항목이 선택 해제될 때 발생합니다.
|
||||
/// </summary>
|
||||
public Action<List<UTKComponentListItemData>>? OnItemDeselected
|
||||
public Action<List<UTKComponentListItemDataBase>>? OnItemDeselected
|
||||
{
|
||||
get => _componentList?.OnItemDeselected;
|
||||
set { if (_componentList != null) _componentList.OnItemDeselected = value; }
|
||||
@@ -105,7 +105,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 항목의 가시성(눈 아이콘)이 변경될 때 발생합니다.
|
||||
/// </summary>
|
||||
public event Action<UTKComponentListItemData, bool>? OnItemVisibilityChanged
|
||||
public event Action<UTKComponentListItemDataBase, bool>? OnItemVisibilityChanged
|
||||
{
|
||||
add { if (_componentList != null) _componentList.OnItemVisibilityChanged += value; }
|
||||
remove { if (_componentList != null) _componentList.OnItemVisibilityChanged -= value; }
|
||||
@@ -114,7 +114,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 메인/검색 리스트에서 항목이 삭제될 때 발생합니다 (Delete 키).
|
||||
/// </summary>
|
||||
public Action<UTKComponentListItemData>? OnItemDeleted
|
||||
public Action<UTKComponentListItemDataBase>? OnItemDeleted
|
||||
{
|
||||
get => _componentList?.OnItemDeleted;
|
||||
set { if (_componentList != null) _componentList.OnItemDeleted = value; }
|
||||
@@ -123,7 +123,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 메인/검색 리스트에서 항목이 더블클릭될 때 발생합니다.
|
||||
/// </summary>
|
||||
public Action<UTKComponentListItemData>? OnItemDoubleClicked
|
||||
public Action<UTKComponentListItemDataBase>? OnItemDoubleClicked
|
||||
{
|
||||
get => _componentList?.OnItemDoubleClicked;
|
||||
set { if (_componentList != null) _componentList.OnItemDoubleClicked = value; }
|
||||
@@ -132,7 +132,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// <summary>
|
||||
/// 아이콘을 클릭할 때 발생합니다.
|
||||
/// </summary>
|
||||
public Action<string, UTKComponentListItemData>? OnItemIconClicked
|
||||
public Action<string, UTKComponentListItemDataBase>? OnItemIconClicked
|
||||
{
|
||||
get => _componentList?.OnItemIconClicked;
|
||||
set { if (_componentList != null) _componentList.OnItemIconClicked = value; }
|
||||
@@ -200,9 +200,9 @@ namespace UVC.UIToolkit.Window
|
||||
/// 데이터의 카테고리를 분석하여 탭을 자동 생성합니다.
|
||||
/// </summary>
|
||||
/// <param name="roots">루트 항목들의 리스트</param>
|
||||
public void SetData(List<UTKComponentListItemData> roots)
|
||||
public void SetData(List<UTKComponentListItemDataBase> roots)
|
||||
{
|
||||
_originalRoots = roots ?? new List<UTKComponentListItemData>();
|
||||
_originalRoots = roots ?? new List<UTKComponentListItemDataBase>();
|
||||
|
||||
// 탭 생성 (카테고리 기반)
|
||||
CreateTabs();
|
||||
@@ -277,7 +277,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// 루트 레벨에 새 항목을 추가합니다.
|
||||
/// </summary>
|
||||
/// <param name="data">추가할 항목 데이터</param>
|
||||
public void AddItem(UTKComponentListItemData data)
|
||||
public void AddItem(UTKComponentListItemDataBase data)
|
||||
{
|
||||
_originalRoots.Add(data);
|
||||
CreateTabs();
|
||||
@@ -285,11 +285,11 @@ namespace UVC.UIToolkit.Window
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 지정된 부모 항목의 자식으로 새 항목을 추가합니다.
|
||||
/// 지정된 부모 카테고리의 자식으로 새 항목을 추가합니다.
|
||||
/// </summary>
|
||||
/// <param name="parent">부모 항목</param>
|
||||
/// <param name="parent">부모 카테고리</param>
|
||||
/// <param name="data">추가할 항목 데이터</param>
|
||||
public void AddItem(UTKComponentListItemData? parent, UTKComponentListItemData data)
|
||||
public void AddItem(UTKComponentListCategoryData? parent, UTKComponentListItemDataBase data)
|
||||
{
|
||||
if (parent == null)
|
||||
{
|
||||
@@ -297,8 +297,7 @@ namespace UVC.UIToolkit.Window
|
||||
return;
|
||||
}
|
||||
|
||||
parent.children ??= new List<UTKComponentListItemData>();
|
||||
parent.children.Add(data);
|
||||
parent.Add(data);
|
||||
|
||||
// 탭 및 표시 갱신
|
||||
CreateTabs();
|
||||
@@ -309,7 +308,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// 트리에서 항목을 완전히 삭제합니다.
|
||||
/// </summary>
|
||||
/// <param name="data">삭제할 항목 데이터</param>
|
||||
public void DeleteItem(UTKComponentListItemData data)
|
||||
public void DeleteItem(UTKComponentListItemDataBase data)
|
||||
{
|
||||
if (RemoveItemFromRoots(data))
|
||||
{
|
||||
@@ -323,7 +322,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// </summary>
|
||||
/// <param name="data">변경할 항목 데이터</param>
|
||||
/// <param name="newName">새 이름</param>
|
||||
public void SetItemName(UTKComponentListItemData data, string newName)
|
||||
public void SetItemName(UTKComponentListItemDataBase data, string newName)
|
||||
{
|
||||
_componentList?.SetItemName(data, newName);
|
||||
}
|
||||
@@ -374,9 +373,9 @@ namespace UVC.UIToolkit.Window
|
||||
_tabContainer.Add(allTab);
|
||||
_tabButtons.Add(allTab);
|
||||
|
||||
// 카테고리별 탭 생성 (루트 항목들이 그룹이면 해당 이름으로 탭 생성)
|
||||
// 카테고리별 탭 생성 (카테고리 타입인 항목들만 탭으로 표시)
|
||||
var categories = _originalRoots
|
||||
.Where(r => r.children != null && r.children.Count > 0)
|
||||
.Where(r => r.IsCategory && r.children.Count > 0)
|
||||
.Select(r => r.name)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -433,7 +432,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// </summary>
|
||||
/// <param name="tabIndex">탭 인덱스 (-1: 전체)</param>
|
||||
/// <returns>필터링된 데이터</returns>
|
||||
private List<UTKComponentListItemData> FilterDataByTab(int tabIndex)
|
||||
private List<UTKComponentListItemDataBase> FilterDataByTab(int tabIndex)
|
||||
{
|
||||
// 전체 탭이면 모든 데이터 반환
|
||||
if (tabIndex == ALL_TAB_INDEX)
|
||||
@@ -443,12 +442,12 @@ namespace UVC.UIToolkit.Window
|
||||
|
||||
// 카테고리 탭이면 해당 카테고리의 자식들만 반환 (부모 없이 자식만 표시)
|
||||
var categories = _originalRoots
|
||||
.Where(r => r.children != null && r.children.Count > 0)
|
||||
.Where(r => r.IsCategory && r.children.Count > 0)
|
||||
.ToList();
|
||||
|
||||
if (tabIndex >= 0 && tabIndex < categories.Count)
|
||||
{
|
||||
return categories[tabIndex].children ?? new List<UTKComponentListItemData>();
|
||||
return categories[tabIndex].children ?? new List<UTKComponentListItemDataBase>();
|
||||
}
|
||||
|
||||
return _originalRoots;
|
||||
@@ -461,7 +460,7 @@ namespace UVC.UIToolkit.Window
|
||||
/// </summary>
|
||||
/// <param name="target">삭제할 항목</param>
|
||||
/// <returns>삭제 성공 여부</returns>
|
||||
private bool RemoveItemFromRoots(UTKComponentListItemData target)
|
||||
private bool RemoveItemFromRoots(UTKComponentListItemDataBase target)
|
||||
{
|
||||
if (_originalRoots.Remove(target))
|
||||
{
|
||||
@@ -485,13 +484,17 @@ namespace UVC.UIToolkit.Window
|
||||
/// <param name="parent">부모 노드</param>
|
||||
/// <param name="target">삭제할 대상 항목</param>
|
||||
/// <returns>삭제 성공 여부</returns>
|
||||
private bool RemoveFromChildren(UTKComponentListItemData parent, UTKComponentListItemData target)
|
||||
private bool RemoveFromChildren(UTKComponentListItemDataBase parent, UTKComponentListItemDataBase target)
|
||||
{
|
||||
if (parent.children == null || parent.children.Count == 0) return false;
|
||||
|
||||
if (parent.children.Remove(target))
|
||||
// 카테고리인 경우에만 자식에서 삭제 가능
|
||||
if (parent is UTKComponentListCategoryData category)
|
||||
{
|
||||
return true;
|
||||
if (category.Remove(target))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var child in parent.children)
|
||||
|
||||
Reference in New Issue
Block a user