本文整理汇总了C#中TreeViewItem类的典型用法代码示例。如果您正苦于以下问题:C# TreeViewItem类的具体用法?C# TreeViewItem怎么用?C# TreeViewItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeViewItem类属于命名空间,在下文中一共展示了TreeViewItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TreeViewItemBuilderTests
public TreeViewItemBuilderTests()
{
var viewContext = TestHelper.CreateViewContext();
item = new TreeViewItem();
builder = new TreeViewItemBuilder(item, viewContext);
}
示例2: DrawIconAndLabel
protected override void DrawIconAndLabel(Rect rect, TreeViewItem item, string label, bool selected, bool focused, bool useBoldFont, bool isPinging)
{
if (!isPinging)
{
float contentIndent = this.GetContentIndent(item);
rect.x += contentIndent;
rect.width -= contentIndent;
}
AudioMixerItem audioMixerItem = item as AudioMixerItem;
if (audioMixerItem == null)
return;
GUIStyle guiStyle = !useBoldFont ? TreeViewGUI.s_Styles.lineStyle : TreeViewGUI.s_Styles.lineBoldStyle;
guiStyle.padding.left = (int) ((double) this.k_IconWidth + (double) this.iconTotalPadding + (double) this.k_SpaceBetweenIconAndText);
guiStyle.Draw(rect, label, false, false, selected, focused);
audioMixerItem.UpdateSuspendedString(false);
if ((double) audioMixerItem.labelWidth <= 0.0)
audioMixerItem.labelWidth = guiStyle.CalcSize(GUIContent.Temp(label)).x;
Rect position = rect;
position.x += audioMixerItem.labelWidth + 8f;
EditorGUI.BeginDisabledGroup(true);
guiStyle.Draw(position, audioMixerItem.infoText, false, false, false, false);
EditorGUI.EndDisabledGroup();
if (this.iconOverlayGUI == null)
return;
Rect rect1 = rect;
rect1.width = this.k_IconWidth + this.iconTotalPadding;
this.iconOverlayGUI(item, rect1);
}
示例3: StartDrag
public override void StartDrag(TreeViewItem draggedItem, List<int> draggedItemIDs)
{
if (!EditorApplication.isPlaying)
{
base.StartDrag(draggedItem, draggedItemIDs);
}
}
示例4: AudioMixerItem
public AudioMixerItem(int id, int depth, TreeViewItem parent, string displayName, AudioMixerController mixer, string infoText)
: base(id, depth, parent, displayName)
{
this.mixer = mixer;
this.infoText = infoText;
this.UpdateSuspendedString(true);
}
示例5: DrawIconAndLabel
protected override void DrawIconAndLabel(Rect rect, TreeViewItem itemRaw, string label, bool selected, bool focused, bool useBoldFont, bool isPinging)
{
FrameDebuggerTreeView.FDTreeViewItem fDTreeViewItem = (FrameDebuggerTreeView.FDTreeViewItem)itemRaw;
float contentIndent = this.GetContentIndent(fDTreeViewItem);
rect.x += contentIndent;
rect.width -= contentIndent;
string text;
GUIContent content;
GUIStyle gUIStyle;
if (fDTreeViewItem.m_ChildEventCount > 0)
{
Rect position = rect;
position.width -= 4f;
text = fDTreeViewItem.m_ChildEventCount.ToString(CultureInfo.InvariantCulture);
content = EditorGUIUtility.TempContent(text);
gUIStyle = FrameDebuggerWindow.styles.rowTextRight;
gUIStyle.Draw(position, content, false, false, false, false);
rect.width -= gUIStyle.CalcSize(content).x + 8f;
}
if (fDTreeViewItem.id <= 0)
{
text = fDTreeViewItem.displayName;
}
else
{
text = FrameDebuggerWindow.s_FrameEventTypeNames[(int)fDTreeViewItem.m_FrameEvent.type] + fDTreeViewItem.displayName;
}
if (string.IsNullOrEmpty(text))
{
text = "<unknown scope>";
}
content = EditorGUIUtility.TempContent(text);
gUIStyle = FrameDebuggerWindow.styles.rowText;
gUIStyle.Draw(rect, content, false, false, false, selected && focused);
}
示例6: TreeViewItemFactoryTests
public TreeViewItemFactoryTests()
{
ViewContext viewContext = TestHelper.CreateViewContext();
item = new TreeViewItem();
factory = new TreeViewItemFactory(item, viewContext);
}
示例7: AddVisibleChildrenRecursive
private void AddVisibleChildrenRecursive(BackendData.Foo source, TreeViewItem dest)
{
if (this.IsExpanded(source.id))
{
if (source.children == null || source.children.Count <= 0)
return;
dest.children = new List<TreeViewItem>(source.children.Count);
for (int index = 0; index < source.children.Count; ++index)
{
BackendData.Foo child = source.children[index];
dest.children.Add((TreeViewItem) new FooTreeViewItem(child.id, dest.depth + 1, dest, child.name, child));
++this.itemCounter;
this.AddVisibleChildrenRecursive(child, dest.children[index]);
}
}
else
{
if (!source.hasChildren)
return;
dest.children = new List<TreeViewItem>()
{
new TreeViewItem(-1, -1, (TreeViewItem) null, string.Empty)
};
}
}
示例8: AddBranchAndChildren
public void AddBranchAndChildren(TreeViewItem parent, ROMNode node)
{
string caption = node.GetROMObjectID();
TreeViewItem current = null;
if (parent != null)
{
current = new TreeViewItem();
current.Header = caption;
current.Tag = node;
current.Name = "_" + node.GetROMGUID().Replace('-', '_');
try
{
treeCtrl.UnregisterName(current.Name);
}
catch { }
treeCtrl.RegisterName(current.Name, current);
parent.Items.Add(current);
}
ROMNode[] children = node.GetAllChildren(false);
if (children != null) foreach (ROMNode child in children)
{
AddBranchAndChildren(current, child);
}
}
示例9: AddVisibleChildrenRecursive
private void AddVisibleChildrenRecursive(TreeViewTest.BackendData.Foo source, TreeViewItem dest)
{
if (this.IsExpanded(source.id))
{
if (source.children != null && source.children.Count > 0)
{
dest.children = new List<TreeViewItem>(source.children.Count);
for (int i = 0; i < source.children.Count; i++)
{
TreeViewTest.BackendData.Foo foo = source.children[i];
dest.children[i] = new TreeViewTest.FooTreeViewItem(foo.id, dest.depth + 1, dest, foo.name, foo);
this.itemCounter++;
this.AddVisibleChildrenRecursive(foo, dest.children[i]);
}
}
}
else
{
if (source.hasChildren)
{
dest.children = new List<TreeViewItem>
{
new TreeViewItem(-1, -1, null, string.Empty)
};
}
}
}
示例10: DrawIconAndLabel
protected override void DrawIconAndLabel(Rect rect, TreeViewItem item, string label, bool selected, bool focused, bool useBoldFont, bool isPinging)
{
if (!isPinging)
{
float contentIndent = this.GetContentIndent(item);
rect.x += contentIndent;
rect.width -= contentIndent;
}
AudioMixerItem item2 = item as AudioMixerItem;
if (item2 != null)
{
GUIStyle style = !useBoldFont ? TreeViewGUI.s_Styles.lineStyle : TreeViewGUI.s_Styles.lineBoldStyle;
style.padding.left = (int) ((base.k_IconWidth + base.iconTotalPadding) + base.k_SpaceBetweenIconAndText);
style.Draw(rect, label, false, false, selected, focused);
item2.UpdateSuspendedString(false);
if (item2.labelWidth <= 0f)
{
item2.labelWidth = style.CalcSize(GUIContent.Temp(label)).x;
}
Rect position = rect;
position.x += item2.labelWidth + 8f;
EditorGUI.BeginDisabledGroup(true);
style.Draw(position, item2.infoText, false, false, false, false);
EditorGUI.EndDisabledGroup();
if (base.iconOverlayGUI != null)
{
Rect rect3 = rect;
rect3.width = base.k_IconWidth + base.iconTotalPadding;
base.iconOverlayGUI(item, rect3);
}
}
}
示例11: StartDrag
public override void StartDrag(TreeViewItem draggedNode, List<int> draggedItemIDs)
{
DragAndDrop.PrepareStartDrag();
DragAndDrop.SetGenericData("FooDragging", (object) new TestDragging.FooDragData(this.GetItemsFromIDs((IEnumerable<int>) draggedItemIDs)));
DragAndDrop.objectReferences = new UnityEngine.Object[0];
DragAndDrop.StartDrag(draggedItemIDs.Count.ToString() + " Foo" + (draggedItemIDs.Count <= 1 ? (object) string.Empty : (object) "s"));
}
示例12: StartDrag
public override void StartDrag(TreeViewItem draggedItem, List<int> draggedItemIDs)
{
if (!SavedSearchFilters.IsSavedFilter(draggedItem.id) || (draggedItem.id != SavedSearchFilters.GetRootInstanceID()))
{
ProjectWindowUtil.StartDrag(draggedItem.id, draggedItemIDs);
}
}
示例13: AddAnimatableObjectToHierarchy
private TreeViewItem AddAnimatableObjectToHierarchy(GameObject root, EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path)
{
TreeViewItem item = new AddCurvesPopupObjectNode(parentNode, path, GetClassName(root, curveBindings[0])) {
icon = AssetPreview.GetMiniThumbnail(AnimationUtility.GetAnimatedObject(root, curveBindings[0]))
};
List<TreeViewItem> visibleItems = new List<TreeViewItem>();
List<EditorCurveBinding> list2 = new List<EditorCurveBinding>();
for (int i = 0; i < curveBindings.Length; i++)
{
EditorCurveBinding binding = curveBindings[i];
list2.Add(binding);
if ((i == (curveBindings.Length - 1)) || (AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(binding.propertyName)))
{
TreeViewItem item2 = this.CreateNode(list2.ToArray(), item);
if (item2 != null)
{
visibleItems.Add(item2);
}
list2.Clear();
}
}
visibleItems.Sort();
TreeViewUtility.SetChildParentReferences(visibleItems, item);
return item;
}
示例14: CreateTreeView
private void CreateTreeView()
{
if (processInfo == null)
return;
foreach (FrameInfo frame in processInfo.Frames)
{
TreeViewItem tviFrame = new TreeViewItem { Header = string.Format("Frame {0} ({1} - {2})", frame.FrameNumber, frame.BeginTime, frame.EndTime) };
foreach (ThreadInfo thread in frame.ThreadItems)
{
TreeViewItem tviThread = new TreeViewItem { Header = string.Format("Thread {0}", thread.Id) };
foreach (MicroThreadInfo mt in thread.MicroThreadItems)
{
TreeViewItem tviMicroThread = new TreeViewItem { Header = string.Format("MicroThread {0} ({1} - {2})", mt.Id, mt.BeginTime, mt.EndTime) };
tviThread.Items.Add(tviMicroThread);
}
tviFrame.Items.Add(tviThread);
}
treeView.Items.Add(tviFrame);
}
}
示例15: DragElement
public override bool DragElement(TreeViewItem targetItem, Rect targetItemRect, bool firstItem)
{
AudioMixerTreeViewDragging.DragData dragData = DragAndDrop.GetGenericData("AudioMixerDragging") as AudioMixerTreeViewDragging.DragData;
if (dragData == null)
{
DragAndDrop.visualMode = DragAndDropVisualMode.None;
return false;
}
bool flag = targetItem == null;
if (flag && this.m_TreeView.GetTotalRect().Contains(Event.current.mousePosition))
{
if (this.m_DropData != null)
{
this.m_DropData.dropTargetControlID = 0;
this.m_DropData.rowMarkerControlID = 0;
}
if (Event.current.type == EventType.DragPerform)
{
DragAndDrop.AcceptDrag();
if (this.m_MixersDroppedOnMixerCallback != null)
{
this.m_MixersDroppedOnMixerCallback(this.GetAudioMixersFromItems(dragData.m_DraggedItems), null);
}
}
DragAndDrop.visualMode = DragAndDropVisualMode.Move;
Event.current.Use();
return false;
}
return base.DragElement(targetItem, targetItemRect, firstItem);
}