Example #1
0
		/// <summary>
		/// Duplicate specified item 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 DuplicateItem(IReorderableListAdaptor adaptor, int itemIndex) {
			adaptor.Duplicate(itemIndex);
			AutoFocusItem(s_ContextControlID, itemIndex + 1);

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

			var args = new ItemInsertedEventArgs(adaptor, itemIndex + 1, true);
			OnItemInserted(args);
		}
Example #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);
		}
Example #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);
		}