static Vector2 ListViewScrollToRow(InternalListViewState ilvState, Vector2 currPos, int row) { Vector2 result; if (ilvState.invisibleRows < row && ilvState.endRow > row) { result = currPos; } else { if (row <= ilvState.invisibleRows) { currPos.y = (float)(ilvState.state.rowHeight * row); } else { currPos.y = (float)(ilvState.state.rowHeight * (row + 1) - ilvState.rectHeight); } if (currPos.y < 0f) { currPos.y = 0f; } else if (currPos.y > (float)(ilvState.state.totalRows * ilvState.state.rowHeight - ilvState.rectHeight)) { currPos.y = (float)(ilvState.state.totalRows * ilvState.state.rowHeight - ilvState.rectHeight); } result = currPos; } return(result); }
static bool ListViewKeyboard(InternalListViewState ilvState, int totalCols) { int totalRows = ilvState.state.totalRows; return(Event.current.type == EventType.KeyDown && totalRows != 0 && GUIUtility.keyboardControl == ilvState.state.ID && Event.current.GetTypeForControl(ilvState.state.ID) == EventType.KeyDown && SendKey(ilvState, Event.current.keyCode, totalCols)); }
public ListViewElementsEnumerator(InternalListViewState ilvState, int[] colWidths, int yFrom, int yTo, string dragTitle, Rect firstRect) { this.colWidths = colWidths; xTo = colWidths.Length - 1; this.yFrom = yFrom; this.yTo = yTo; this.firstRect = firstRect; rect = firstRect; quiting = (ilvState.state.totalRows == 0); this.ilvState = ilvState; ilvStateL = (ilvState as InternalLayoutedListViewState); isLayouted = (ilvStateL != null);; this.dragTitle = dragTitle; ilvState.state.customDraggedFromID = 0; Reset(); }
public static bool HasMouseDown(InternalListViewState ilvState, Rect r, int button) { bool result; if (Event.current.type == EventType.MouseDown && Event.current.button == button) { if (r.Contains(Event.current.mousePosition)) { GUIUtility.hotControl = ilvState.state.ID; GUIUtility.keyboardControl = ilvState.state.ID; isDragging = false; Event.current.Use(); result = true; return(result); } } result = false; return(result); }
public static bool DoLVPageUpDown(InternalListViewState ilvState, ref int selectedRow, ref Vector2 scrollPos, bool up) { int num = ilvState.endRow - ilvState.invisibleRows; bool result; if (up) { if (!OSX) { selectedRow -= num; if (selectedRow < 0) { selectedRow = 0; } result = true; return(result); } scrollPos.y -= (float)(ilvState.state.rowHeight * num); if (scrollPos.y < 0f) { scrollPos.y = 0f; } } else { if (!OSX) { selectedRow += num; if (selectedRow >= ilvState.state.totalRows) { selectedRow = ilvState.state.totalRows - 1; } result = true; return(result); } scrollPos.y += (float)(ilvState.state.rowHeight * num); } result = false; return(result); }
public static bool HasMouseDown(InternalListViewState ilvState, Rect r) { return(HasMouseDown(ilvState, r, 0)); }
static bool SendKey(InternalListViewState ilvState, KeyCode keyCode, int totalCols) { ListViewState state = ilvState.state; bool result; switch (keyCode) { case KeyCode.UpArrow: if (state.currentRow > 0) { state.currentRow--; } goto IL_14C; case KeyCode.DownArrow: if (state.currentRow < state.totalRows - 1) { state.currentRow++; } goto IL_14C; case KeyCode.RightArrow: if (state.column < totalCols - 1) { state.column++; } goto IL_14C; case KeyCode.LeftArrow: if (state.column > 0) { state.column--; } goto IL_14C; case KeyCode.Home: state.currentRow = 0; goto IL_14C; case KeyCode.End: state.currentRow = state.totalRows - 1; goto IL_14C; case KeyCode.PageUp: if (!DoLVPageUpDown(ilvState, ref state.currentRow, ref state.scrollPos, true)) { Event.current.Use(); result = false; return(result); } goto IL_14C; case KeyCode.PageDown: if (!DoLVPageUpDown(ilvState, ref state.currentRow, ref state.scrollPos, false)) { Event.current.Use(); result = false; return(result); } goto IL_14C; } result = false; return(result); IL_14C: state.scrollPos = ListViewScrollToRow(ilvState, state.scrollPos, state.currentRow); Event.current.Use(); result = true; return(result); }
static int ListViewScrollToRow(InternalListViewState ilvState, int currPosY, int row) { return((int)ListViewScrollToRow(ilvState, new Vector2(0f, (float)currPosY), row).y); }
static Vector2 ListViewScrollToRow(InternalListViewState ilvState, int row) { return(ListViewScrollToRow(ilvState, ilvState.state.scrollPos, row)); }