Exemplo n.º 1
0
        /// <summary>
        /// Insert item at specified index and raises the event <see cref="ItemInserted"/>.
        /// </summary>
        /// <param name="adaptor">Reorderable list adaptor.</param>
        /// <param name="itemIndex">Zero-based index of item.</param>
        protected void InsertItem(IReorderableListAdaptor adaptor, int itemIndex)
        {
            adaptor.Insert(itemIndex);
            AutoFocusItem(s_ContextControlID, itemIndex);

            GUI.changed = true;
            ReorderableListGUI.IndexOfChangedItem = -1;

            var args = new ItemInsertedEventArgs(adaptor, itemIndex, false);
            OnItemInserted(args);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Raises event after list item is inserted or duplicated.
 /// </summary>
 /// <param name="args">Event arguments.</param>
 protected virtual void OnItemInserted(ItemInsertedEventArgs args)
 {
     if (ItemInserted != null)
         ItemInserted(this, args);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Add item at end of list and raises the event <see cref="ItemInserted"/>.
        /// </summary>
        /// <param name="adaptor">Reorderable list adaptor.</param>
        protected void AddItem(IReorderableListAdaptor adaptor)
        {
            adaptor.Add();
            AutoFocusItem(s_ContextControlID, adaptor.Count - 1);

            GUI.changed = true;
            ReorderableListGUI.IndexOfChangedItem = -1;

            var args = new ItemInsertedEventArgs(adaptor, adaptor.Count - 1, false);
            OnItemInserted(args);
        }