forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathITreeViewDataSource.cs
More file actions
78 lines (60 loc) · 2.67 KB
/
Copy pathITreeViewDataSource.cs
File metadata and controls
78 lines (60 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System.Collections.Generic;
using UnityEngine;
// The TreeView requires implementations from the following three interfaces:
// ITreeViewDataSource: Should handle data fetching, build the tree/data structure and hold expanded state
// ITreeViewGUI: Should handle visual representation of TreeView and input handling
// ITreeViewDragging Should handle dragging, temp expansion of items, allow/disallow dropping
// The TreeView handles: Navigation, Item selection and initiates dragging
namespace UnityEditor.IMGUI.Controls
{
// Represents a complete data tree
internal interface ITreeViewDataSource
{
void OnInitialize();
// Return root of tree
TreeViewItem root { get; }
// For data sources where GetRows() might be an expensive operation
int rowCount { get; }
// Reload data
void ReloadData();
void InitIfNeeded();
// Find Item by id
TreeViewItem FindItem(int id);
// Get current row of an item (using the current expanded state in TreeViewState)
// Returns -1 if not found
int GetRow(int id);
// Check rowCount before requesting
TreeViewItem GetItem(int row);
// Get the flattened tree of visible items. If possible use GetItem(int row) instead
IList<TreeViewItem> GetRows();
bool IsRevealed(int id);
void RevealItem(int id);
void RevealItems(int[] ids);
// Expand / collapse interface
// The DataSource has the interface for this because it should be able to rebuild
// tree when expanding
void SetExpandedWithChildren(TreeViewItem item, bool expand);
void SetExpanded(TreeViewItem item, bool expand);
bool IsExpanded(TreeViewItem item);
bool IsExpandable(TreeViewItem item);
void SetExpandedWithChildren(int id, bool expand);
int[] GetExpandedIDs();
void SetExpandedIDs(int[] ids);
bool SetExpanded(int id, bool expand);
bool IsExpanded(int id);
// Selection
bool CanBeMultiSelected(TreeViewItem item);
bool CanBeParent(TreeViewItem item);
List<int> GetNewSelection(TreeViewItem clickedItem, TreeViewSelectState selectState);
// Renaming
bool IsRenamingItemAllowed(TreeViewItem item);
void InsertFakeItem(int id, int parentID, string name, Texture2D icon);
void RemoveFakeItem();
bool HasFakeItem();
// Search
void OnSearchChanged();
}
} // namespace UnityEditor