private void TreeViewSelectionChanged(int[] ids) { if (ids == null || ids.Length == 0) { m_GraphView.currentGraph = null; return; } foreach (var id in ids) { var item = m_TreeView.FindItem(id) as GMCategoryItem; if (item != null && item.graph == m_GraphView.currentGraph) { return; } } var firstItem = m_TreeView.FindItem(ids[0]) as GMCategoryItem; if (firstItem == null) { m_GraphView.currentGraph = null; } else { m_GraphView.currentGraph = firstItem.graph; } }
private void RefreshBottomBarSelectedItem(int[] idList) { if (idList != null && idList.Length > 0) { var index = m_GridViewDataSource.GetItemIndexByItemId(idList[0]); if (index == -1) { var item = m_ConfigSource.GetValue <FolderGridItem>(BottomSelectedItem); var parentItem = m_TreeView.FindItem(item.ParentId) as FolderTreeViewItem; if (parentItem == null) { return; } if (parentItem.hasChildren) { foreach (var child in parentItem.children) { if (child.id == item.Id) { m_BottomBarSelectedItem = item; m_BottomBar.SelectedPathSplitted.Clear(); return; } } } if (parentItem.FileList != null) { foreach (var child in parentItem.FileList) { if (child.id == item.Id) { m_BottomBarSelectedItem = item; m_BottomBar.SelectedPathSplitted.Clear(); return; } } } return; } m_BottomBarSelectedItem = m_GridViewDataSource.GetItemByIndex(index) as FolderGridItem; m_ConfigSource.SetValue(BottomSelectedItem, m_BottomBarSelectedItem); m_BottomBar.SelectedPathSplitted.Clear(); } else { m_BottomBarSelectedItem = null; m_ConfigSource.SetValue <FolderGridItem>(BottomSelectedItem, null); m_BottomBar.SelectedPathSplitted.Clear(); } m_ConfigSource.SetConfigDirty(); }
public static void Show(int id, int childItemId, TreeView treeView, Rect activatorRect, BreadcrumbBar breadcrumbBar) { GenericMenu genericMenu = new GenericMenu(); var item = treeView.FindItem(id); var childItem = treeView.FindItem(childItemId); if (item != null && item.hasChildren) { foreach (var child in item.children) { genericMenu.AddItem(new GUIContent(child.displayName), childItem != null && childItem.displayName == child.displayName, new GenericMenu.MenuFunction(new BreadCrumbListMenu(child.id, breadcrumbBar).SelectSubFolder)); genericMenu.ShowAsContext(); } } else { genericMenu.AddDisabledItem(new GUIContent("No sub folders...")); } genericMenu.DropDown(activatorRect); }