public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, int[] colWidths, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
 {
     GUILayout.BeginHorizontal(style, new GUILayoutOption[0]);
     state.scrollPos = EditorGUILayout.BeginScrollView(state.scrollPos, options);
     ListViewGUI.ilvState.beganHorizontal = true;
     state.draggedFrom = -1;
     state.draggedTo   = -1;
     state.fileNames   = null;
     if ((lvOptions & ListViewOptions.wantsReordering) != (ListViewOptions)0)
     {
         ListViewGUI.ilvState.wantsReordering = true;
     }
     if ((lvOptions & ListViewOptions.wantsExternalFiles) != (ListViewOptions)0)
     {
         ListViewGUI.ilvState.wantsExternalFiles = true;
     }
     if ((lvOptions & ListViewOptions.wantsToStartCustomDrag) != (ListViewOptions)0)
     {
         ListViewGUI.ilvState.wantsToStartCustomDrag = true;
     }
     if ((lvOptions & ListViewOptions.wantsToAcceptCustomDrag) != (ListViewOptions)0)
     {
         ListViewGUI.ilvState.wantsToAcceptCustomDrag = true;
     }
     return(ListViewGUI.DoListView(GUILayoutUtility.GetRect(1f, (float)(state.totalRows * state.rowHeight + 3)), state, colWidths, string.Empty));
 }
        public static ListViewShared.ListViewElementsEnumerator DoListView(Rect pos, ListViewState state, int[] colWidths, string dragTitle)
        {
            int controlID = GUIUtility.GetControlID(ListViewGUI.listViewHash, FocusType.Passive);

            state.ID = controlID;
            state.selectionChanged = false;
            Rect rect;

            if (GUIClipHelper.visibleRect.x < 0f || GUIClipHelper.visibleRect.y < 0f)
            {
                rect = pos;
            }
            else
            {
                rect = ((pos.y >= 0f) ? new Rect(0f, state.scrollPos.y, GUIClipHelper.visibleRect.width, GUIClipHelper.visibleRect.height) : new Rect(0f, 0f, GUIClipHelper.visibleRect.width, GUIClipHelper.visibleRect.height));
            }
            if (rect.width <= 0f)
            {
                rect.width = 1f;
            }
            if (rect.height <= 0f)
            {
                rect.height = 1f;
            }
            ListViewGUI.ilvState.rect = rect;
            int num  = (int)((-pos.y + rect.yMin) / (float)state.rowHeight);
            int num2 = num + (int)Math.Ceiling((double)(((rect.yMin - pos.y) % (float)state.rowHeight + rect.height) / (float)state.rowHeight)) - 1;

            if (colWidths == null)
            {
                ListViewGUI.dummyWidths[0] = (int)rect.width;
                colWidths = ListViewGUI.dummyWidths;
            }
            ListViewGUI.ilvState.invisibleRows = num;
            ListViewGUI.ilvState.endRow        = num2;
            ListViewGUI.ilvState.rectHeight    = (int)rect.height;
            ListViewGUI.ilvState.state         = state;
            if (num < 0)
            {
                num = 0;
            }
            if (num2 >= state.totalRows)
            {
                num2 = state.totalRows - 1;
            }
            return(new ListViewShared.ListViewElementsEnumerator(ListViewGUI.ilvState, colWidths, num, num2, dragTitle, new Rect(0f, (float)(num * state.rowHeight), pos.width, (float)state.rowHeight)));
        }
 public bool MoveNext()
 {
     if (this.xPos > -1)
     {
         if (ListViewShared.HasMouseDown(this.ilvState, this.rect))
         {
             this.ilvState.state.selectionChanged = true;
             this.ilvState.state.row       = this.yPos;
             this.ilvState.state.column    = this.xPos;
             this.ilvState.state.scrollPos = ListViewShared.ListViewScrollToRow(this.ilvState, this.yPos);
             if ((this.ilvState.wantsReordering || this.ilvState.wantsToStartCustomDrag) && GUIUtility.hotControl == this.ilvState.state.ID)
             {
                 DragAndDropDelay dragAndDropDelay = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), this.ilvState.state.ID);
                 dragAndDropDelay.mouseDownPosition = Event.current.mousePosition;
                 this.ilvState.dragItem             = this.yPos;
                 ListViewShared.dragControlID       = this.ilvState.state.ID;
             }
         }
         if ((this.ilvState.wantsReordering || this.ilvState.wantsToStartCustomDrag) && GUIUtility.hotControl == this.ilvState.state.ID && Event.current.type == EventType.MouseDrag && GUIClipHelper.visibleRect.Contains(Event.current.mousePosition))
         {
             DragAndDropDelay dragAndDropDelay2 = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), this.ilvState.state.ID);
             if (dragAndDropDelay2.CanStartDrag())
             {
                 DragAndDrop.PrepareStartDrag();
                 DragAndDrop.objectReferences = new UnityEngine.Object[0];
                 DragAndDrop.paths            = null;
                 if (this.ilvState.wantsReordering)
                 {
                     this.ilvState.state.dropHereRect = new Rect(this.ilvState.rect.x, 0f, this.ilvState.rect.width, (float)(this.ilvState.state.rowHeight * 2));
                     DragAndDrop.StartDrag(this.dragTitle);
                 }
                 else
                 {
                     if (this.ilvState.wantsToStartCustomDrag)
                     {
                         DragAndDrop.SetGenericData("CustomDragID", this.ilvState.state.ID);
                         DragAndDrop.StartDrag(this.dragTitle);
                     }
                 }
             }
             Event.current.Use();
         }
     }
     this.xPos++;
     if (this.xPos > this.xTo)
     {
         this.xPos = 0;
         this.yPos++;
         this.rect.x     = this.firstRect.x;
         this.rect.width = (float)this.colWidths[0];
         if (this.yPos > this.yTo)
         {
             this.quiting = true;
         }
         else
         {
             this.rect.y = this.rect.y + this.rect.height;
         }
     }
     else
     {
         if (this.xPos >= 1)
         {
             this.rect.x = this.rect.x + (float)this.colWidths[this.xPos - 1];
         }
         this.rect.width = (float)this.colWidths[this.xPos];
     }
     this.element.row      = this.yPos;
     this.element.column   = this.xPos;
     this.element.position = this.rect;
     if (this.element.row >= this.ilvState.state.totalRows)
     {
         this.quiting = true;
     }
     if (this.isLayouted && Event.current.type == EventType.Layout && this.yFrom + 1 == this.yPos)
     {
         this.quiting = true;
     }
     if (this.isLayouted && this.yPos != this.yFrom)
     {
         GUILayout.EndHorizontal();
     }
     if (this.quiting)
     {
         if (this.ilvState.state.drawDropHere && Event.current.GetTypeForControl(this.ilvState.state.ID) == EventType.Repaint)
         {
             GUIStyle gUIStyle = ListViewShared.Constants.insertion;
             gUIStyle.Draw(gUIStyle.margin.Remove(this.ilvState.state.dropHereRect), false, false, false, false);
         }
         if (ListViewShared.ListViewKeyboard(this.ilvState, this.colWidths.Length))
         {
             this.ilvState.state.selectionChanged = true;
         }
         if (Event.current.GetTypeForControl(this.ilvState.state.ID) == EventType.MouseUp)
         {
             GUIUtility.hotControl = 0;
         }
         if (this.ilvState.wantsReordering && GUIUtility.hotControl == this.ilvState.state.ID)
         {
             ListViewState state = this.ilvState.state;
             EventType     type  = Event.current.type;
             if (type != EventType.DragUpdated)
             {
                 if (type != EventType.DragPerform)
                 {
                     if (type == EventType.DragExited)
                     {
                         this.ilvState.wantsReordering    = false;
                         this.ilvState.state.drawDropHere = false;
                         GUIUtility.hotControl            = 0;
                     }
                 }
                 else
                 {
                     if (GUIClipHelper.visibleRect.Contains(Event.current.mousePosition))
                     {
                         this.ilvState.state.draggedFrom = this.ilvState.dragItem;
                         this.ilvState.state.draggedTo   = Mathf.RoundToInt(Event.current.mousePosition.y / (float)state.rowHeight);
                         if (this.ilvState.state.draggedTo > this.ilvState.state.totalRows)
                         {
                             this.ilvState.state.draggedTo = this.ilvState.state.totalRows;
                         }
                         if (this.ilvState.state.draggedTo > this.ilvState.state.draggedFrom)
                         {
                             this.ilvState.state.row = this.ilvState.state.draggedTo - 1;
                         }
                         else
                         {
                             this.ilvState.state.row = this.ilvState.state.draggedTo;
                         }
                         this.ilvState.state.selectionChanged = true;
                         DragAndDrop.AcceptDrag();
                         Event.current.Use();
                         this.ilvState.wantsReordering    = false;
                         this.ilvState.state.drawDropHere = false;
                     }
                     GUIUtility.hotControl = 0;
                 }
             }
             else
             {
                 DragAndDrop.visualMode = ((!this.ilvState.rect.Contains(Event.current.mousePosition)) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Move);
                 Event.current.Use();
                 if (DragAndDrop.visualMode != DragAndDropVisualMode.None)
                 {
                     state.dropHereRect.y = (float)((Mathf.RoundToInt(Event.current.mousePosition.y / (float)state.rowHeight) - 1) * state.rowHeight);
                     if (state.dropHereRect.y >= (float)(state.rowHeight * state.totalRows))
                     {
                         state.dropHereRect.y = (float)(state.rowHeight * (state.totalRows - 1));
                     }
                     state.drawDropHere = true;
                 }
             }
         }
         else
         {
             if (this.ilvState.wantsExternalFiles)
             {
                 EventType type = Event.current.type;
                 if (type != EventType.DragUpdated)
                 {
                     if (type != EventType.DragPerform)
                     {
                         if (type == EventType.DragExited)
                         {
                             this.ilvState.wantsExternalFiles = false;
                             this.ilvState.state.drawDropHere = false;
                             GUIUtility.hotControl            = 0;
                         }
                     }
                     else
                     {
                         if (GUIClipHelper.visibleRect.Contains(Event.current.mousePosition))
                         {
                             this.ilvState.state.fileNames = DragAndDrop.paths;
                             DragAndDrop.AcceptDrag();
                             Event.current.Use();
                             this.ilvState.wantsExternalFiles = false;
                             this.ilvState.state.drawDropHere = false;
                             this.ilvState.state.draggedTo    = Mathf.RoundToInt(Event.current.mousePosition.y / (float)this.ilvState.state.rowHeight);
                             if (this.ilvState.state.draggedTo > this.ilvState.state.totalRows)
                             {
                                 this.ilvState.state.draggedTo = this.ilvState.state.totalRows;
                             }
                             this.ilvState.state.row = this.ilvState.state.draggedTo;
                         }
                         GUIUtility.hotControl = 0;
                     }
                 }
                 else
                 {
                     if (GUIClipHelper.visibleRect.Contains(Event.current.mousePosition) && DragAndDrop.paths != null && DragAndDrop.paths.Length != 0)
                     {
                         DragAndDrop.visualMode = ((!this.ilvState.rect.Contains(Event.current.mousePosition)) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Copy);
                         Event.current.Use();
                         if (DragAndDrop.visualMode != DragAndDropVisualMode.None)
                         {
                             this.ilvState.state.dropHereRect = new Rect(this.ilvState.rect.x, (float)((Mathf.RoundToInt(Event.current.mousePosition.y / (float)this.ilvState.state.rowHeight) - 1) * this.ilvState.state.rowHeight), this.ilvState.rect.width, (float)this.ilvState.state.rowHeight);
                             if (this.ilvState.state.dropHereRect.y >= (float)(this.ilvState.state.rowHeight * this.ilvState.state.totalRows))
                             {
                                 this.ilvState.state.dropHereRect.y = (float)(this.ilvState.state.rowHeight * (this.ilvState.state.totalRows - 1));
                             }
                             this.ilvState.state.drawDropHere = true;
                         }
                     }
                 }
             }
             else
             {
                 if (this.ilvState.wantsToAcceptCustomDrag && ListViewShared.dragControlID != this.ilvState.state.ID)
                 {
                     EventType type = Event.current.type;
                     if (type != EventType.DragUpdated)
                     {
                         if (type != EventType.DragPerform)
                         {
                             if (type == EventType.DragExited)
                             {
                                 GUIUtility.hotControl = 0;
                             }
                         }
                         else
                         {
                             object genericData = DragAndDrop.GetGenericData("CustomDragID");
                             if (GUIClipHelper.visibleRect.Contains(Event.current.mousePosition) && genericData != null)
                             {
                                 this.ilvState.state.customDraggedFromID = (int)genericData;
                                 DragAndDrop.AcceptDrag();
                                 Event.current.Use();
                             }
                             GUIUtility.hotControl = 0;
                         }
                     }
                     else
                     {
                         object genericData2 = DragAndDrop.GetGenericData("CustomDragID");
                         if (GUIClipHelper.visibleRect.Contains(Event.current.mousePosition) && genericData2 != null)
                         {
                             DragAndDrop.visualMode = ((!this.ilvState.rect.Contains(Event.current.mousePosition)) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Move);
                             Event.current.Use();
                         }
                     }
                 }
             }
         }
         if (this.ilvState.beganHorizontal)
         {
             EditorGUILayout.EndScrollView();
             GUILayout.EndHorizontal();
             this.ilvState.beganHorizontal = false;
         }
         if (this.isLayouted)
         {
         }
         this.ilvState.wantsReordering    = false;
         this.ilvState.wantsExternalFiles = false;
     }
     else
     {
         if (this.isLayouted)
         {
         }
     }
     if (this.isLayouted)
     {
         if (!this.quiting)
         {
             GUILayout.BeginHorizontal(GUIStyle.none, new GUILayoutOption[0]);
         }
         else
         {
             GUILayout.EndHorizontal();
         }
     }
     return(!this.quiting);
 }
        internal static bool SendKey(ListViewShared.InternalListViewState ilvState, KeyCode keyCode, int totalCols)
        {
            ListViewState state = ilvState.state;

            switch (keyCode)
            {
            case KeyCode.UpArrow:
                if (state.row > 0)
                {
                    state.row--;
                }
                goto IL_136;

            case KeyCode.DownArrow:
                if (state.row < state.totalRows - 1)
                {
                    state.row++;
                }
                goto IL_136;

            case KeyCode.RightArrow:
                if (state.column < totalCols - 1)
                {
                    state.column++;
                }
                goto IL_136;

            case KeyCode.LeftArrow:
                if (state.column > 0)
                {
                    state.column--;
                }
                goto IL_136;

            case KeyCode.Home:
                state.row = 0;
                goto IL_136;

            case KeyCode.End:
                state.row = state.totalRows - 1;
                goto IL_136;

            case KeyCode.PageUp:
                if (!ListViewShared.DoLVPageUpDown(ilvState, ref state.row, ref state.scrollPos, true))
                {
                    Event.current.Use();
                    return(false);
                }
                goto IL_136;

            case KeyCode.PageDown:
                if (!ListViewShared.DoLVPageUpDown(ilvState, ref state.row, ref state.scrollPos, false))
                {
                    Event.current.Use();
                    return(false);
                }
                goto IL_136;
            }
            return(false);

IL_136:
            state.scrollPos = ListViewShared.ListViewScrollToRow(ilvState, state.scrollPos, state.row);
            Event.current.Use();
            return(true);
        }
 public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
 {
     return(ListViewGUI.ListView(state, lvOptions, null, dragTitle, style, options));
 }
 public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, int[] colWidths, GUIStyle style, params GUILayoutOption[] options)
 {
     return(ListViewGUI.ListView(state, (ListViewOptions)0, colWidths, string.Empty, style, options));
 }
 public static ListViewShared.ListViewElementsEnumerator ListView(Rect pos, ListViewState state)
 {
     return(ListViewGUI.DoListView(pos, state, null, string.Empty));
 }