FullInspector.Rotorz.ReorderableList.ReorderableListControl.AddItemsToMenu C# (CSharp) Method

AddItemsToMenu() protected method

Invoked to generate context menu for list item.
protected AddItemsToMenu ( GenericMenu menu, int itemIndex, IReorderableListAdaptor adaptor ) : void
menu UnityEditor.GenericMenu Menu which can be populated.
itemIndex int /// Zero-based index of item which was right-clicked. ///
adaptor IReorderableListAdaptor Reorderable list adaptor.
return void
        protected virtual void AddItemsToMenu(GenericMenu menu, int itemIndex, IReorderableListAdaptor adaptor)
        {
            if ((flags & ReorderableListFlags.DisableReordering) == 0) {
                if (itemIndex > 0)
                    menu.AddItem(commandMoveToTop, false, defaultContextHandler, commandMoveToTop);
                else
                    menu.AddDisabledItem(commandMoveToTop);

                if (itemIndex + 1 < adaptor.Count)
                    menu.AddItem(commandMoveToBottom, false, defaultContextHandler, commandMoveToBottom);
                else
                    menu.AddDisabledItem(commandMoveToBottom);

                if (hasAddButton) {
                    menu.AddSeparator("");

                    menu.AddItem(commandInsertAbove, false, defaultContextHandler, commandInsertAbove);
                    menu.AddItem(commandInsertBelow, false, defaultContextHandler, commandInsertBelow);

                    if ((flags & ReorderableListFlags.DisableDuplicateCommand) == 0)
                        menu.AddItem(commandDuplicate, false, defaultContextHandler, commandDuplicate);
                }
            }

            if (hasRemoveButtons) {
                if (menu.GetItemCount() > 0)
                    menu.AddSeparator("");

                menu.AddItem(commandRemove, false, defaultContextHandler, commandRemove);
                menu.AddSeparator("");
                menu.AddItem(commandClearAll, false, defaultContextHandler, commandClearAll);
            }
        }