private bool ToolButton(GUIContent content, bool on = false)
        {
            Rect position = GUILayoutUtility.GetRect(content, s_ToolButtonStyle);

            int controlID = RotorzEditorGUI.GetHoverControlID(position, content.image != null ? content.text : null);

            switch (Event.current.GetTypeForControl(controlID))
            {
            case EventType.MouseDown:
                if (Event.current.button == 0 && position.Contains(Event.current.mousePosition))
                {
                    GUIUtility.hotControl = controlID;
                    Event.current.Use();
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlID)
                {
                    GUIUtility.hotControl = 0;
                    Event.current.Use();
                    return(position.Contains(Event.current.mousePosition));
                }
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    Event.current.Use();
                }
                break;

            case EventType.Repaint:
                if (content.image != null)
                {
                    using (var tempContent = ControlContent.Basic(content.image)) {
                        s_ToolButtonStyle.Draw(position, tempContent, controlID, on);
                    }
                }
                else
                {
                    using (var tempContent = ControlContent.Basic(content.text)) {
                        s_ToolButtonStyle.Draw(position, tempContent, controlID, on);
                    }
                }
                break;
            }

            return(false);
        }
        public static bool DropdownMenu(Rect position, GUIContent content, GUIStyle style)
        {
            int controlID = RotorzEditorGUI.GetHoverControlID(position, content.tooltip);

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                switch (Event.current.GetTypeForControl(controlID))
                {
                case EventType.MouseDown:
                    if (position.Contains(Event.current.mousePosition))
                    {
                        GUIUtility.hotControl = controlID;
                        Event.current.Use();
                    }
                    break;

                case EventType.MouseDrag:
                    if (GUIUtility.hotControl == controlID && Event.current.button == 42)
                    {
                        GUIUtility.hotControl = 0;
                        return(true);
                    }
                    break;

                case EventType.Repaint:
                    s_TempMenuContent.text  = content.text;
                    s_TempMenuContent.image = content.image;
                    style.Draw(position, s_TempMenuContent, controlID);

                    if (GUIUtility.hotControl == controlID)
                    {
                        s_QueueDropDownWindow       = EditorWindow.focusedWindow;// window;
                        s_QueueDropDownEvent        = new Event();
                        s_QueueDropDownEvent.type   = EventType.MouseDrag;
                        s_QueueDropDownEvent.button = 42;
                    }
                    break;
                }
            }
            else
            {
                switch (Event.current.GetTypeForControl(controlID))
                {
                case EventType.MouseDown:
                    if (position.Contains(Event.current.mousePosition))
                    {
                        Event.current.Use();
                        return(true);
                    }
                    break;

                case EventType.Repaint:
                    s_TempMenuContent.text  = content.text;
                    s_TempMenuContent.image = content.image;
                    style.Draw(position, s_TempMenuContent, controlID);
                    break;
                }
            }

            return(false);
        }
        private ToolBase DrawAvailableToolEntry(Rect position, ToolBase tool)
        {
            position.width -= 25;

            Rect eyePosition = position;

            eyePosition.x     = position.xMax;
            eyePosition.width = 25;

            string tipText = tool.Visible
                ? TileLang.ParticularText("Action", "Click to hide tool")
                : TileLang.ParticularText("Action", "Click to show tool");
            int eyeControlID = RotorzEditorGUI.GetHoverControlID(eyePosition, tipText);

            switch (Event.current.GetTypeForControl(eyeControlID))
            {
            case EventType.Repaint:
                Color restoreColor = GUI.color;
                if (!tool.Visible)
                {
                    GUI.color = new Color(0f, 0f, 0f, 0.55f);
                }

                if (tool.IconNormal != null)
                {
                    Rect iconPosition = position;
                    iconPosition.width  = 22;
                    iconPosition.height = 22;

                    GUI.DrawTexture(iconPosition, tool.IconNormal);
                }

                position.x      += 25;
                position.width  -= 25;
                position.height -= 2;
                RotorzEditorStyles.Instance.LabelMiddleLeft.Draw(position, tool.Label, false, false, false, false);

                if (!tool.Visible)
                {
                    GUI.color = restoreColor;
                }

                eyePosition.x     += 3;
                eyePosition.y      = eyePosition.y + (eyePosition.height - 18) / 2;
                eyePosition.width  = 21;
                eyePosition.height = 18;
                GUI.DrawTexture(eyePosition, tool.Visible ? RotorzEditorStyles.Skin.EyeOpen : RotorzEditorStyles.Skin.EyeShut);
                break;

            case EventType.MouseDown:
                if (Event.current.button == 0 && eyePosition.Contains(Event.current.mousePosition))
                {
                    tool.Visible = !tool.Visible;
                    GUI.changed  = true;
                    Event.current.Use();
                }
                break;
            }

            return(tool);
        }