Ejemplo n.º 1
0
 public DataViewPair(T data, CellView <T> cellView, IComparer <T> comparer, bool isSelected = false)
 {
     Data            = data;
     CellView        = cellView;
     this.isSelected = isSelected;
     this.comparer   = comparer;
 }
        /// <summary>
        /// Create a Mutli Selection Search PopupWindow.
        /// </summary>
        /// <param name="sourceItems">Items to search from.</param>
        /// <param name="filter">Filter to validate items on search.</param>
        /// <param name="cellView">CellView used by results ListView.</param>
        /// <param name="comparer">Comparer to sort results ListView's Cells.</param>
        /// <param name="useFinishButton">Show finish button on bottom of SearchWindow.</param>
        public MultipleSelectionSearchWindow(T[] sourceItems, Filter filter, CellView <T> cellView, IComparer <T> comparer, bool useFinishButton = true) : base(sourceItems, filter, cellView, comparer, SelectionType.multiple)
        {
            this.useFinishButton = useFinishButton;

            if (useFinishButton)
            {
                listViewHeightOffset = -5f - 2.5f * EditorGUIUtility.singleLineHeight;
            }
            else
            {
                listViewHeightOffset = -5f - 1.5f * EditorGUIUtility.singleLineHeight;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates SearchWindow.
        /// </summary>
        /// <param name="sourceItems">Items to search from.</param>
        /// <param name="filter">Filter to validate search.</param>
        /// <param name="cellView">CellView used by results ListView.</param>
        /// <param name="comparer">Comparer used to sort results ListView Cells.</param>
        /// <param name="selectionType">Type of selection.</param>
        public SearchWindow(T[] sourceItems, Filter filter, CellView <T> cellView, IComparer <T> comparer, SelectionType selectionType)
        {
            this.sourceItems = sourceItems;
            this.filter      = filter;
            this.cellView    = cellView;

            filteredItems = new List <T>();
            listView      = new ListView <T>(sourceItems.ToList(), cellView, comparer, selectionType, true);


            CellClicked       += OnCellClickedHandler;
            CellDoubleClicked += OnCellDoubleClickedHandler;
        }
Ejemplo n.º 4
0
            public bool OnCellGUI(Rect viewRect, Vector2 padding, Event e, out bool isDoubleClick)
            {
                bool tempSelected = isSelected;

                CellView.OnGUI(Data, viewRect, padding, e, ref isSelected, out isDoubleClick);

                if (tempSelected != isSelected)
                {
                    return(true);
                }

                return(false);
            }
Ejemplo n.º 5
0
        public ListView(List <T> items, CellView <T> cellView, IComparer <T> comparer, SelectionType selectionType, bool autoSort = false)
        {
            this.items         = items;
            this.cellView      = cellView;
            this.selectionType = selectionType;
            dataViewPairs      = new List <DataViewPair>();
            pairsPool          = new List <DataViewPair>();
            this.comparer      = comparer;
            foreach (var item in items)
            {
                dataViewPairs.Add(new DataViewPair(item, cellView.Clone(), comparer));
            }

            CellClicked       += OnCellClickedHandler;
            CellDoubleClicked += OnCellDoubleClickedHandler;

            if (autoSort)
            {
                SortListViewCells();
            }
        }
 /// <summary>
 /// Create a Single Selection Search PopupWindow.
 /// </summary>
 /// <param name="sourceItems">Items to search from.</param>
 /// <param name="filter">Filter to validate items on search.</param>
 /// <param name="cellView">CellView used by results ListView.</param>
 /// <param name="comparer">Comparer to sort results ListView's Cells.</param>
 public SingleSelectionSearchWindow(T[] sourceItems, Filter filter, CellView <T> cellView, IComparer <T> comparer) : base(sourceItems, filter, cellView, comparer, SelectionType.single)
 {
     listViewHeightOffset = -5f - 1.5f * EditorGUIUtility.singleLineHeight;
 }