public static void ClearAll(EditorToolbarOrientation orientation)
 {
     if (orientation == EditorToolbarOrientation.Left)
     {
         leftGroups.Clear();
     }
     else if (orientation == EditorToolbarOrientation.Right)
     {
         rightGroups.Clear();
     }
 }
 public static void AddItemGroup(EditorToolbarGroup itemGroup, EditorToolbarOrientation orientation)
 {
     if (orientation == EditorToolbarOrientation.Left)
     {
         leftGroups.Add(itemGroup);
     }
     else if (orientation == EditorToolbarOrientation.Right)
     {
         rightGroups.Add(itemGroup);
     }
 }
 public static void AddItem(EditorToolbarItem item, EditorToolbarOrientation orientation)
 {
     if (orientation == EditorToolbarOrientation.Left)
     {
         leftGroups.Add(EditorToolbarGroup.CreateGroup(item));
     }
     else if (orientation == EditorToolbarOrientation.Right)
     {
         rightGroups.Add(EditorToolbarGroup.CreateGroup(item));
     }
 }
 public static void RemoveItem(EditorToolbarItem item, EditorToolbarOrientation orientation)
 {
 }
        private static void DrawerToolbar(Rect rect, EditorToolbarOrientation orientation, List <EditorToolbarGroup> itemGroups)
        {
            if (itemGroups.Count == 0)
            {
                return;
            }

#if EDITOR_TOOLBAR_GIZMO
            DEGUI.DrawAreaLine(rect, Color.blue);
#endif

            float groupStartX = rect.x;
            if (orientation == EditorToolbarOrientation.Left)
            {
                groupStartX = rect.x + rect.width;
            }
            foreach (var itemGroup in itemGroups)
            {
                float groupWidth = GetGroupWidth(itemGroup);
                Rect  groupRect  = new Rect(groupStartX, rect.y, groupWidth, rect.height);
                if (orientation == EditorToolbarOrientation.Left)
                {
                    groupStartX -= groupWidth;
                    groupRect.x  = groupStartX;
                }
                else if (orientation == EditorToolbarOrientation.Right)
                {
                    groupStartX += groupWidth;
                }

#if EDITOR_TOOLBAR_GIZMO
                DEGUI.DrawAreaLine(groupRect, Color.yellow);
#endif

                float itemStartX = groupRect.x;
                if (orientation == EditorToolbarOrientation.Left)
                {
                    itemStartX = groupRect.x + groupRect.width;
                }
                for (int i = 0; i < itemGroup.Items.Length; ++i)
                {
                    var   item      = itemGroup.Items[i];
                    float itemWidth = item.GetItemWidth();
                    Rect  itemRect  = new Rect(itemStartX, groupRect.y, itemWidth, groupRect.height);
                    if (orientation == EditorToolbarOrientation.Left)
                    {
                        itemStartX -= itemWidth;
                        itemRect.x  = itemStartX;
                    }
                    else if (orientation == EditorToolbarOrientation.Right)
                    {
                        itemStartX += itemWidth;
                    }

#if EDITOR_TOOLBAR_GIZMO
                    DEGUI.DrawAreaLine(itemRect, Color.green);
#endif

                    GUIStyle style = null;
                    if (item.GetType() == typeof(EditorToolbarButton))
                    {
                        if (itemGroup.Items.Length == 1)
                        {
                            style = Styles.commandStyle;
                        }
                        else
                        {
                            if (i == 0)
                            {
                                if (orientation == EditorToolbarOrientation.Left)
                                {
                                    style = Styles.commandRightStyle;
                                }
                                else if (orientation == EditorToolbarOrientation.Right)
                                {
                                    style = Styles.commandLeftStyle;
                                }
                            }
                            else if (i == itemGroup.Items.Length - 1)
                            {
                                if (orientation == EditorToolbarOrientation.Left)
                                {
                                    style = Styles.commandLeftStyle;
                                }
                                else if (orientation == EditorToolbarOrientation.Right)
                                {
                                    style = Styles.commandRightStyle;
                                }
                            }
                            else
                            {
                                style = Styles.commandMidStyle;
                            }
                        }
                    }
                    item.OnItemGUI(itemRect, style);
                }

                if (orientation == EditorToolbarOrientation.Left)
                {
                    groupStartX -= Styles.ITEM_GROUP_SPACE;
                }
                else if (orientation == EditorToolbarOrientation.Right)
                {
                    groupStartX += Styles.ITEM_GROUP_SPACE;
                }
            }
        }