private void DrawRefreshStatus()
        {
            bool compiling        = EditorApplication.isCompiling;
            bool assembliesLocked = !EditorApplication.CanReloadAssemblies();

            if (compiling || showProgress)
            {
                if (assembliesLocked)
                {
                    GUILayout.Button(Styles.assemblyLock, Styles.statusIcon);
                }
                else
                {
                    int frame = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10, 11.99f);
                    GUILayout.Button(Styles.statusWheel[frame], Styles.statusIcon);
                }
            }
            else
            {
                var canHide = ProgressWindow.canHideDetails;
                if (GUILayout.Button(canHide ? Styles.progressHideIcon : Styles.progressIcon, Styles.statusIcon))
                {
                    if (canHide)
                    {
                        ProgressWindow.HideDetails();
                    }
                    else
                    {
                        Progress.ShowDetails();
                    }
                }

                var buttonRect = GUILayoutUtility.GetLastRect();
                EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
            }
        }
 public static void ShowDetails(bool shouldReposition = true)
 {
     ProgressWindow.ShowDetails(shouldReposition);
 }
 public void ProgressWindowShowDetails(bool shouldReposition) => ProgressWindow.ShowDetails(shouldReposition);
 public void ProgressWindowHideDetails() => ProgressWindow.HideDetails();
        void OnEnable()
        {
            s_Window     = this;
            titleContent = EditorGUIUtility.TrTextContent("Background Tasks");

            rootVisualElement.AddStyleSheetPath(ussPath);
            if (EditorGUIUtility.isProSkin)
            {
                rootVisualElement.AddStyleSheetPath(ussPathDark);
            }
            else
            {
                rootVisualElement.AddStyleSheetPath(ussPathLight);
            }

            var toolbar = new UIElements.Toolbar();

            m_DismissAllBtn = new ToolbarButton(ClearInactive)
            {
                name = "DismissAllBtn",
                text = L10n.Tr("Clear inactive"),
            };
            toolbar.Add(m_DismissAllBtn);

            // This is our friend the spacer
            toolbar.Add(new VisualElement()
            {
                style =
                {
                    flexGrow = 1
                }
            });

            rootVisualElement.Add(toolbar);
            s_VisualProgressItemTask = EditorGUIUtility.Load(k_UxmlProgressItemPath) as VisualTreeAsset;

            m_TreeView                 = new TreeView();
            m_TreeView.makeItem        = MakeTreeViewItem;
            m_TreeView.bindItem        = BindTreeViewItem;
            m_TreeView.unbindItem      = UnbindTreeViewItem;
            m_TreeView.destroyItem     = DestroyTreeViewItem;
            m_TreeView.fixedItemHeight = 50;
            m_TreeView.SetRootItems(new TreeViewItemData <Progress.Item>[] {});

            var scrollView = m_TreeView.Q <ScrollView>();

            if (scrollView != null)
            {
                scrollView.horizontalScrollerVisibility = ScrollerVisibility.Hidden;
            }

            rootVisualElement.Add(m_TreeView);
            m_TreeView.Rebuild();

            // Update the treeview with the existing items
            m_MissingParents        = new Dictionary <int, List <int> >();
            m_ContainedItems        = new HashSet <int>();
            m_ItemsNeedingExpansion = new HashSet <int>();
            OperationsAdded(Progress.EnumerateItems().ToArray());

            Progress.added   += OperationsAdded;
            Progress.removed += OperationsRemoved;
            Progress.updated += OperationsUpdated;
            UpdateDismissAllButton();
        }