private void DrawThreadPopup(HierarchyFrameDataView frameDataView)
        {
            if (!(frameDataView != null && frameDataView.valid))
            {
                var disabledValues = new string[] { m_ThreadName };
                EditorGUILayout.AdvancedPopup(0, disabledValues, BaseStyles.threadSelectionToolbarDropDown, GUILayout.MinWidth(BaseStyles.detailedViewTypeToolbarDropDown.fixedWidth));
                return;
            }

            var newThreadIndex = 0;

            if (threadIndex == 0)
            {
                newThreadIndex = EditorGUILayout.AdvancedLazyPopup(m_ThreadName, threadIndex,
                                                                   (() => GetThreadNamesLazy(frameDataView)),
                                                                   BaseStyles.threadSelectionToolbarDropDown, GUILayout.MinWidth(BaseStyles.detailedViewTypeToolbarDropDown.fixedWidth));
            }
            else
            {
                float minWidth, maxWidth;
                var   content = new GUIContent(m_ThreadName);
                BaseStyles.threadSelectionToolbarDropDown.CalcMinMaxWidth(content, out minWidth, out maxWidth);
                UpdateThreadNamesAndThreadIndex(frameDataView);
                newThreadIndex = EditorGUILayout.AdvancedPopup(threadIndex, m_ThreadNames, BaseStyles.threadSelectionToolbarDropDown, GUILayout.MinWidth(Math.Max(BaseStyles.detailedViewTypeToolbarDropDown.fixedWidth, minWidth)));
            }

            if (newThreadIndex != threadIndex)
            {
                threadIndex  = newThreadIndex;
                m_ThreadName = m_ThreadNames[threadIndex];
                cpuModule.Repaint();
                EditorGUIUtility.ExitGUI();
            }
        }
Esempio n. 2
0
        private void DrawThreadPopup(HierarchyFrameDataView frameDataView)
        {
            if (!frameDataView.valid)
            {
                var disabledValues = new string[] { m_ThreadName };
                EditorGUILayout.AdvancedPopup(0, disabledValues, BaseStyles.detailedViewTypeToolbarDropDown, GUILayout.Width(BaseStyles.detailedViewTypeToolbarDropDown.fixedWidth));
                return;
            }

            var newThreadIndex = 0;

            if (m_ThreadIndex == 0)
            {
                newThreadIndex = EditorGUILayout.AdvancedLazyPopup(m_ThreadName, m_ThreadIndex,
                                                                   (() => GetThreadNamesLazy(frameDataView)),
                                                                   BaseStyles.detailedViewTypeToolbarDropDown, GUILayout.Width(BaseStyles.detailedViewTypeToolbarDropDown.fixedWidth));
            }
            else
            {
                UpdateThreadNamesAndThreadIndex(frameDataView);
                newThreadIndex = EditorGUILayout.AdvancedPopup(m_ThreadIndex, m_ThreadNames, BaseStyles.detailedViewTypeToolbarDropDown, GUILayout.Width(BaseStyles.detailedViewTypeToolbarDropDown.fixedWidth));
            }

            if (newThreadIndex != m_ThreadIndex)
            {
                m_ThreadIndex = newThreadIndex;
                m_ThreadName  = m_ThreadNames[m_ThreadIndex];
            }
        }