public ListViewState(int totalRows, int rowHeight)
 {
     this.drawDropHere        = false;
     this.dropHereRect        = new Rect(0f, 0f, 0f, 0f);
     this.fileNames           = null;
     this.customDraggedFromID = 0;
     this.ilvState            = new ListViewShared.InternalLayoutedListViewState();
     this.Init(totalRows, rowHeight);
 }
 public ListViewState()
 {
     this.drawDropHere        = false;
     this.dropHereRect        = new Rect(0f, 0f, 0f, 0f);
     this.fileNames           = null;
     this.customDraggedFromID = 0;
     this.ilvState            = new ListViewShared.InternalLayoutedListViewState();
     this.Init(0, 0x10);
 }
Exemple #3
0
 internal ListViewElementsEnumerator(ListViewShared.InternalListViewState ilvState, int[] colWidths, int yFrom, int yTo, string dragTitle, Rect firstRect)
 {
     this.colWidths  = colWidths;
     this.xTo        = colWidths.Length - 1;
     this.yFrom      = yFrom;
     this.yTo        = yTo;
     this.firstRect  = firstRect;
     this.rect       = firstRect;
     this.quiting    = ilvState.state.totalRows == 0;
     this.ilvState   = ilvState;
     this.ilvStateL  = ilvState as ListViewShared.InternalLayoutedListViewState;
     this.isLayouted = this.ilvStateL != null;
     this.dragTitle  = dragTitle;
     ilvState.state.customDraggedFromID = 0;
     this.Reset();
 }
Exemple #4
0
        private static ListViewShared.ListViewElementsEnumerator DoListView(ListViewState state, int[] colWidths, string dragTitle)
        {
            Rect rect  = ListViewGUILayout.dummyRect;
            int  yFrom = 0;
            int  yTo   = 0;

            ListViewShared.InternalLayoutedListViewState ilvState = state.ilvState;
            int controlId = GUIUtility.GetControlID(ListViewGUILayout.listViewHash, FocusType.Native);

            state.ID = controlId;
            state.selectionChanged = false;
            ilvState.state         = state;
            if (Event.current.type != EventType.Layout)
            {
                rect = new Rect(0.0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height);
                if ((double)rect.width <= 0.0)
                {
                    rect.width = 1f;
                }
                if ((double)rect.height <= 0.0)
                {
                    rect.height = 1f;
                }
                state.ilvState.rect = rect;
                yFrom = (int)rect.yMin / state.rowHeight;
                yTo   = yFrom + (int)Math.Ceiling(((double)rect.yMin % (double)state.rowHeight + (double)rect.height) / (double)state.rowHeight) - 1;
                ilvState.invisibleRows = yFrom;
                ilvState.endRow        = yTo;
                ilvState.rectHeight    = (int)rect.height;
                if (yFrom < 0)
                {
                    yFrom = 0;
                }
                if (yTo >= state.totalRows)
                {
                    yTo = state.totalRows - 1;
                }
            }
            if (colWidths == null)
            {
                ListViewGUILayout.dummyWidths[0] = (int)rect.width;
                colWidths = ListViewGUILayout.dummyWidths;
            }
            return(new ListViewShared.ListViewElementsEnumerator((ListViewShared.InternalListViewState)ilvState, colWidths, yFrom, yTo, dragTitle, new Rect(0.0f, (float)(yFrom * state.rowHeight), rect.width, (float)state.rowHeight)));
        }
Exemple #5
0
        private static ListViewShared.ListViewElementsEnumerator DoListView(ListViewState state, int[] colWidths, string dragTitle)
        {
            Rect rect = ListViewGUILayout.dummyRect;
            int  num  = 0;
            int  num2 = 0;

            ListViewShared.InternalLayoutedListViewState ilvState = state.ilvState;
            int controlID = GUIUtility.GetControlID(ListViewGUILayout.listViewHash, FocusType.Passive);

            state.ID = controlID;
            state.selectionChanged = false;
            ilvState.state         = state;
            if (Event.current.type != EventType.Layout)
            {
                rect = new Rect(0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height);
                if (rect.width <= 0f)
                {
                    rect.width = 1f;
                }
                if (rect.height <= 0f)
                {
                    rect.height = 1f;
                }
                state.ilvState.rect = rect;
                num  = (int)rect.yMin / state.rowHeight;
                num2 = num + (int)Math.Ceiling((double)((rect.yMin % (float)state.rowHeight + rect.height) / (float)state.rowHeight)) - 1;
                ilvState.invisibleRows = num;
                ilvState.endRow        = num2;
                ilvState.rectHeight    = (int)rect.height;
                if (num < 0)
                {
                    num = 0;
                }
                if (num2 >= state.totalRows)
                {
                    num2 = state.totalRows - 1;
                }
            }
            if (colWidths == null)
            {
                ListViewGUILayout.dummyWidths[0] = (int)rect.width;
                colWidths = ListViewGUILayout.dummyWidths;
            }
            return(new ListViewShared.ListViewElementsEnumerator(ilvState, colWidths, num, num2, dragTitle, new Rect(0f, (float)(num * state.rowHeight), rect.width, (float)state.rowHeight)));
        }
        static private ListViewShared.ListViewElementsEnumerator DoListView(ListViewState state, int[] colWidths, string dragTitle)
        {
            Rect vRect         = dummyRect;
            int  invisibleRows = 0;
            int  endRow        = 0;

            ListViewShared.InternalLayoutedListViewState ilvState = state.ilvState;

            //GUIUtility.CheckOnGUI ();
            int id = GUIUtility.GetControlID(listViewHash, FocusType.Passive);

            state.ID = id;
            state.selectionChanged = false;
            ilvState.state         = state;

            if (Event.current.type != EventType.Layout)
            {
                vRect = new Rect(0, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height);

                if (vRect.width <= 0)
                {
                    vRect.width = 1;
                }
                if (vRect.height <= 0)
                {
                    vRect.height = 1;
                }

                state.ilvState.rect = vRect;

                invisibleRows = (int)(vRect.yMin) / state.rowHeight;
                endRow        = invisibleRows + (int)System.Math.Ceiling(((vRect.yMin % state.rowHeight) + vRect.height) / state.rowHeight) - 1;

                //if (id == GUIUtility.hotControl)
                //{
                //  s = invisibleRows.ToString() + "::" + endRow.ToString();
                //}

                ilvState.invisibleRows = invisibleRows;
                ilvState.endRow        = endRow;
                ilvState.rectHeight    = (int)vRect.height;

                if (invisibleRows < 0)
                {
                    invisibleRows = 0;
                }

                if (endRow >= state.totalRows)
                {
                    endRow = state.totalRows - 1;
                }
            }

            if (colWidths == null)
            {
                dummyWidths[0] = (int)vRect.width;
                colWidths      = dummyWidths;
            }

            return(new ListViewShared.ListViewElementsEnumerator(ilvState, colWidths, invisibleRows, endRow, dragTitle, new Rect(0, invisibleRows * state.rowHeight, vRect.width, state.rowHeight)));
        }
Exemple #7
0
 public ListViewState(int totalRows, int rowHeight)
 {
     this.dropHereRect = new Rect(0f, 0f, 0f, 0f);
     this.ilvState     = new ListViewShared.InternalLayoutedListViewState();
     this.Init(totalRows, rowHeight);
 }
Exemple #8
0
 public ListViewState()
 {
     this.dropHereRect = new Rect(0f, 0f, 0f, 0f);
     this.ilvState     = new ListViewShared.InternalLayoutedListViewState();
     this.Init(0, 0x10);
 }