Пример #1
0
 private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
     if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1)
     {
         if (this.isSearching && selectedSearchItemFunction != null)
         {
             this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
         }
         if (!this.isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null)
         {
             ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
         }
     }
     if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !this.isSearching)
     {
         KeyCode keyCode = Event.current.keyCode;
         if (keyCode != KeyCode.RightArrow)
         {
             if (keyCode == KeyCode.LeftArrow)
             {
                 this.m_ColumnToFocusKeyboard = columnIndex - 1;
                 Event.current.Use();
             }
         }
         else
         {
             this.m_ColumnToFocusKeyboard = columnIndex + 1;
             Event.current.Use();
         }
     }
     foreach (ListViewElement element in ListViewGUILayout.ListView(listView, ColumnView.s_Styles.background, new GUILayoutOption[]
     {
         GUILayout.Width(this.columnWidth)
     }))
     {
         ColumnViewElement columnViewElement = columnViewElements[element.row];
         if (element.row == listView.row && Event.current.type == EventType.Repaint)
         {
             Rect position = element.position;
             position.x += 1f;
             position.y += 1f;
             ColumnView.s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
         }
         GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]);
         if (columnViewElement.value is List <ColumnViewElement> )
         {
             Rect position2 = element.position;
             position2.x  = position2.xMax - (float)ColumnView.s_Styles.categoryArrowIcon.width - 5f;
             position2.y += 2f;
             GUI.Label(position2, ColumnView.s_Styles.categoryArrowIcon);
         }
         this.DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
         ColumnView.DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction);
     }
     if (Event.current.type == EventType.Layout)
     {
         selectedIndex = listView.row;
     }
     return(selectedIndex);
 }
Пример #2
0
 private void DoDoubleClick(ListViewElement element, ColumnViewElement columnViewElement, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction)
 {
     if (((Event.current.type == EventType.MouseDown) && element.position.Contains(Event.current.mousePosition)) && ((Event.current.button == 0) && (Event.current.clickCount == 2)))
     {
         if (this.isSearching)
         {
             this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElement.value);
         }
         else
         {
             DoItemSelectedEvent(selectedRegularItemFunction, columnViewElement.value);
         }
     }
 }
Пример #3
0
 private void DoDoubleClick(ListViewElement element, ColumnViewElement columnViewElement, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction)
 {
     if (((Event.current.type == EventType.MouseDown) && element.position.Contains(Event.current.mousePosition)) && ((Event.current.button == 0) && (Event.current.clickCount == 2)))
     {
         if (this.isSearching)
         {
             this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElement.value);
         }
         else
         {
             DoItemSelectedEvent(selectedRegularItemFunction, columnViewElement.value);
         }
     }
 }
Пример #4
0
 private void DoDoubleClick(ListViewElement element, ColumnViewElement columnViewElement, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction)
 {
     if (Event.current.type != EventType.MouseDown || !element.position.Contains(Event.current.mousePosition) || (Event.current.button != 0 || Event.current.clickCount != 2))
     {
         return;
     }
     if (this.isSearching)
     {
         this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElement.value);
     }
     else
     {
         ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElement.value);
     }
 }
Пример #5
0
 private void DoDoubleClick(ListViewElement element, ColumnViewElement columnViewElement, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction)
 {
   if (Event.current.type != EventType.MouseDown || !element.position.Contains(Event.current.mousePosition) || (Event.current.button != 0 || Event.current.clickCount != 2))
     return;
   if (this.isSearching)
     this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElement.value);
   else
     ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElement.value);
 }
Пример #6
0
        private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction, ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return)) && (listView.row > -1))
            {
                if (this.isSearching && (selectedSearchItemFunction != null))
                {
                    this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
                }
                if ((!this.isSearching && (GUIUtility.keyboardControl == listView.ID)) && (selectedRegularItemFunction != null))
                {
                    DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
                }
            }
            if (((GUIUtility.keyboardControl == listView.ID) && (Event.current.type == EventType.KeyDown)) && !this.isSearching)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.LeftArrow:
                    this.m_ColumnToFocusKeyboard = columnIndex - 1;
                    Event.current.Use();
                    break;

                case KeyCode.RightArrow:
                    this.m_ColumnToFocusKeyboard = columnIndex + 1;
                    Event.current.Use();
                    break;
                }
            }
            GUILayoutOption[] options    = new GUILayoutOption[] { GUILayout.Width(this.columnWidth) };
            IEnumerator       enumerator = ListViewGUILayout.ListView(listView, s_Styles.background, options).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement   current           = (ListViewElement)enumerator.Current;
                    ColumnViewElement columnViewElement = columnViewElements[current.row];
                    if ((current.row == listView.row) && (Event.current.type == EventType.Repaint))
                    {
                        Rect position = current.position;
                        position.x++;
                        position.y++;
                        s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
                    }
                    GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]);
                    if (columnViewElement.value is List <ColumnViewElement> )
                    {
                        Rect rect2 = current.position;
                        rect2.x  = (rect2.xMax - s_Styles.categoryArrowIcon.width) - 5f;
                        rect2.y += 2f;
                        GUI.Label(rect2, s_Styles.categoryArrowIcon);
                    }
                    this.DoDoubleClick(current, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
                    DoDragAndDrop(listView, current, columnViewElements, getDataForDraggingFunction);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (Event.current.type == EventType.Layout)
            {
                selectedIndex = listView.row;
            }
            return(selectedIndex);
        }
Пример #7
0
        private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1)
            {
                if (this.isSearching && selectedSearchItemFunction != null)
                {
                    this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
                }
                if (!this.isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null)
                {
                    ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
                }
            }
            if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !this.isSearching)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.RightArrow:
                    this.m_ColumnToFocusKeyboard = columnIndex + 1;
                    Event.current.Use();
                    break;

                case KeyCode.LeftArrow:
                    this.m_ColumnToFocusKeyboard = columnIndex - 1;
                    Event.current.Use();
                    break;
                }
            }
            ListViewState state      = listView;
            GUIStyle      background = ColumnView.s_Styles.background;

            GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1] {
                GUILayout.Width(this.columnWidth)
            };
            foreach (ListViewElement element in ListViewGUILayout.ListView(state, background, guiLayoutOptionArray))
            {
                ColumnViewElement columnViewElement = columnViewElements[element.row];
                if (element.row == listView.row && Event.current.type == EventType.Repaint)
                {
                    Rect position = element.position;
                    ++position.x;
                    ++position.y;
                    ColumnView.s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
                }
                GUILayout.Label(columnViewElement.name);
                if (columnViewElement.value is List <ColumnViewElement> )
                {
                    Rect position = element.position;
                    position.x  = (float)((double)position.xMax - (double)ColumnView.s_Styles.categoryArrowIcon.width - 5.0);
                    position.y += 2f;
                    GUI.Label(position, (Texture)ColumnView.s_Styles.categoryArrowIcon);
                }
                this.DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
                ColumnView.DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction);
            }
            if (Event.current.type == EventType.Layout)
            {
                selectedIndex = listView.row;
            }
            return(selectedIndex);
        }