DoPreviewColumn() private static method

private static DoPreviewColumn ( object selectedObject, ObjectColumnFunction previewColumnFunction ) : void
selectedObject object
previewColumnFunction ObjectColumnFunction
return void
Ejemplo n.º 1
0
        public void OnGUI(List <ColumnViewElement> elements, ColumnView.ObjectColumnFunction previewColumnFunction, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            ColumnView.InitStyles();
            this.m_ScrollPosition = GUILayout.BeginScrollView(this.m_ScrollPosition, new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            List <ColumnViewElement> list = elements;
            int    i = 0;
            object obj;

            do
            {
                if (this.m_ListViewStates.Count == i)
                {
                    this.m_ListViewStates.Add(new ListViewState());
                }
                if (this.m_CachedSelectedIndices.Count == i)
                {
                    this.m_CachedSelectedIndices.Add(-1);
                }
                ListViewState listViewState = this.m_ListViewStates[i];
                listViewState.totalRows = list.Count;
                if (i == 0)
                {
                    GUILayout.BeginVertical(new GUILayoutOption[]
                    {
                        GUILayout.MaxWidth(this.columnWidth)
                    });
                }
                int num = this.m_CachedSelectedIndices[i];
                num = this.DoListColumn(listViewState, list, i, num, (i != 0) ? null : selectedSearchItemFunction, selectedRegularItemFunction, getDataForDraggingFunction);
                if (Event.current.type == EventType.Layout && this.m_ColumnToFocusKeyboard == i)
                {
                    this.m_ColumnToFocusKeyboard = -1;
                    GUIUtility.keyboardControl   = listViewState.ID;
                    if (listViewState.row == -1 && list.Count != 0)
                    {
                        num = (listViewState.row = 0);
                    }
                }
                if (i == 0)
                {
                    if (this.isSearching)
                    {
                        KeyCode keyCode = ColumnView.StealImportantListviewKeys();
                        if (keyCode != KeyCode.None)
                        {
                            ListViewShared.SendKey(this.m_ListViewStates[0], keyCode);
                        }
                    }
                    this.m_SearchText = EditorGUILayout.ToolbarSearchField(this.m_SearchText, new GUILayoutOption[0]);
                    GUILayout.EndVertical();
                }
                if (num >= list.Count)
                {
                    num = -1;
                }
                if (Event.current.type == EventType.Layout && this.m_CachedSelectedIndices[i] != num && this.m_ListViewStates.Count > i + 1)
                {
                    int index = i + 1;
                    int count = this.m_ListViewStates.Count - (i + 1);
                    this.m_ListViewStates.RemoveRange(index, count);
                    this.m_CachedSelectedIndices.RemoveRange(index, count);
                }
                this.m_CachedSelectedIndices[i] = num;
                obj  = ((num <= -1) ? null : list[num].value);
                list = (obj as List <ColumnViewElement>);
                i++;
            }while (list != null);
            while (i < this.minimumNumberOfColumns)
            {
                this.DoDummyColumn();
                i++;
            }
            ColumnView.DoPreviewColumn(obj, previewColumnFunction);
            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();
        }
Ejemplo n.º 2
0
        public void OnGUI(List <ColumnViewElement> elements, ColumnView.ObjectColumnFunction previewColumnFunction, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            ColumnView.InitStyles();
            this.m_ScrollPosition = GUILayout.BeginScrollView(this.m_ScrollPosition);
            GUILayout.BeginHorizontal();
            List <ColumnViewElement> columnViewElements = elements;
            int    columnIndex = 0;
            object selectedObject;

            do
            {
                if (this.m_ListViewStates.Count == columnIndex)
                {
                    this.m_ListViewStates.Add(new ListViewState());
                }
                if (this.m_CachedSelectedIndices.Count == columnIndex)
                {
                    this.m_CachedSelectedIndices.Add(-1);
                }
                ListViewState listViewState = this.m_ListViewStates[columnIndex];
                listViewState.totalRows = columnViewElements.Count;
                if (columnIndex == 0)
                {
                    GUILayout.BeginVertical(GUILayout.MaxWidth(this.columnWidth));
                }
                int cachedSelectedIndex = this.m_CachedSelectedIndices[columnIndex];
                int index1 = this.DoListColumn(listViewState, columnViewElements, columnIndex, cachedSelectedIndex, columnIndex != 0 ? (ColumnView.ObjectColumnFunction)null : selectedSearchItemFunction, selectedRegularItemFunction, getDataForDraggingFunction);
                if (Event.current.type == EventType.Layout && this.m_ColumnToFocusKeyboard == columnIndex)
                {
                    this.m_ColumnToFocusKeyboard = -1;
                    GUIUtility.keyboardControl   = listViewState.ID;
                    if (listViewState.row == -1 && columnViewElements.Count != 0)
                    {
                        index1 = listViewState.row = 0;
                    }
                }
                if (columnIndex == 0)
                {
                    if (this.isSearching)
                    {
                        KeyCode keyCode = ColumnView.StealImportantListviewKeys();
                        if (keyCode != KeyCode.None)
                        {
                            ListViewShared.SendKey(this.m_ListViewStates[0], keyCode);
                        }
                    }
                    this.m_SearchText = EditorGUILayout.ToolbarSearchField(this.m_SearchText);
                    GUILayout.EndVertical();
                }
                if (index1 >= columnViewElements.Count)
                {
                    index1 = -1;
                }
                if (Event.current.type == EventType.Layout && this.m_CachedSelectedIndices[columnIndex] != index1 && this.m_ListViewStates.Count > columnIndex + 1)
                {
                    int index2 = columnIndex + 1;
                    int count  = this.m_ListViewStates.Count - (columnIndex + 1);
                    this.m_ListViewStates.RemoveRange(index2, count);
                    this.m_CachedSelectedIndices.RemoveRange(index2, count);
                }
                this.m_CachedSelectedIndices[columnIndex] = index1;
                selectedObject     = index1 <= -1 ? (object)null : columnViewElements[index1].value;
                columnViewElements = selectedObject as List <ColumnViewElement>;
                ++columnIndex;
            }while (columnViewElements != null);
            for (; columnIndex < this.minimumNumberOfColumns; ++columnIndex)
            {
                this.DoDummyColumn();
            }
            ColumnView.DoPreviewColumn(selectedObject, previewColumnFunction);
            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();
        }