static ReorderableListGUI()
        {
            InitStyles();

            defaultListControl = new ReorderableListControl();

            // Duplicate default styles to prevent user scripts from interferring
            // with the default list control instance.
            defaultListControl.containerStyle = new GUIStyle(defaultContainerStyle);
            defaultListControl.addButtonStyle = new GUIStyle(defaultAddButtonStyle);
            defaultListControl.removeButtonStyle = new GUIStyle(defaultRemoveButtonStyle);

            indexOfChangedItem = -1;
        }
 /// <summary>
 /// Draw list field control for adapted collection.
 /// </summary>
 /// <param name="adaptor">Reorderable list adaptor.</param>
 /// <param name="drawEmpty">
 /// Callback to draw custom content for empty list (optional).
 /// </param>
 /// <param name="flags">Optional flags to pass into list field.</param>
 private static void DoListField(IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags)
 {
     ReorderableListControl.DrawControlFromState(adaptor, drawEmpty, flags);
 }
 /// <summary>
 /// Draw list field control for adapted collection.
 /// </summary>
 /// <param name="position">Position of control.</param>
 /// <param name="adaptor">Reorderable list adaptor.</param>
 /// <param name="drawEmpty">
 /// Callback to draw custom content for empty list (optional).
 /// </param>
 /// <param name="flags">Optional flags to pass into list field.</param>
 private static void DoListFieldAbsolute(Rect position, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags)
 {
     ReorderableListControl.DrawControlFromState(position, adaptor, drawEmpty, flags);
 }
 /// <inheritdoc cref="DoListField(IReorderableListAdaptor, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
 public static void ListField(IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmpty drawEmpty)
 {
     DoListField(adaptor, drawEmpty, 0);
 }
 /// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdaptor, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
 public static void ListFieldAbsolute(Rect position, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmptyAbsolute drawEmpty)
 {
     DoListFieldAbsolute(position, adaptor, drawEmpty, 0);
 }
 private void DrawEmptyListControl(Rect position, ReorderableListControl.DrawEmptyAbsolute drawEmpty)
 {
     if (Event.current.type == EventType.Repaint)
     {
         this.containerStyle.Draw(position, GUIContent.none, false, false, false, false);
     }
     position.x = position.x + (float)this.containerStyle.padding.left;
     position.y = position.y + (float)this.containerStyle.padding.top;
     position.width = position.width - (float)this.containerStyle.padding.horizontal;
     position.height = position.height - (float)this.containerStyle.padding.vertical;
     if (drawEmpty != null)
     {
         drawEmpty(position);
     }
 }
 private Rect DrawLayoutEmptyList(ReorderableListControl.DrawEmpty drawEmpty)
 {
     Rect result = EditorGUILayout.BeginVertical(this.containerStyle, new GUILayoutOption[0]);
     if (drawEmpty != null)
     {
         drawEmpty();
     }
     else
     {
         GUILayout.Space(5f);
     }
     EditorGUILayout.EndVertical();
     GUILayoutUtility.GetRect(0f, this.addButtonStyle.fixedHeight - 1f);
     return result;
 }
 private void Draw(Rect position, int controlID, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmptyAbsolute drawEmpty)
 {
     this.FixStyles();
     this.PrepareState(controlID, adaptor);
     if (this.hasAddButton)
     {
         position.height = position.height - this.addButtonStyle.fixedHeight;
     }
     if (adaptor.Count > 0)
     {
         this.DrawListContainerAndItems(position, controlID, adaptor);
         this.CheckForAutoFocusControl(controlID);
     }
     else
     {
         this.DrawEmptyListControl(position, drawEmpty);
     }
     this.DrawFooterControls(position, controlID, adaptor);
 }
 private void Draw(int controlID, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmpty drawEmpty)
 {
     this.FixStyles();
     this.PrepareState(controlID, adaptor);
     Rect position;
     if (adaptor.Count > 0)
     {
         position = this.DrawLayoutListField(controlID, adaptor);
     }
     else
     {
         position = this.DrawLayoutEmptyList(drawEmpty);
     }
     this.DrawFooterControls(position, controlID, adaptor);
 }
 public void Draw(Rect position, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmptyAbsolute drawEmpty)
 {
     int controlID = GUIUtility.GetControlID(FocusType.Passive);
     this.Draw(position, controlID, adaptor, drawEmpty);
 }
 public void Draw(IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmpty drawEmpty)
 {
     int controlID = GUIUtility.GetControlID(FocusType.Passive);
     this.Draw(controlID, adaptor, drawEmpty);
 }
 public static void DrawControlFromState(Rect position, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags)
 {
     int controlID = GUIUtility.GetControlID(FocusType.Passive);
     ReorderableListControl reorderableListControl = GUIUtility.GetStateObject(typeof(ReorderableListControl), controlID) as ReorderableListControl;
     reorderableListControl.flags = flags;
     reorderableListControl.Draw(position, controlID, adaptor, drawEmpty);
 }