コード例 #1
0
        public static float GetWidth(this EditorWindow window)
        {
            object dockArea = window.GetParent();
            Rect   p        = (Rect)ViewR.Wrap(dockArea).windowPosition;

            return(p.width);
        }
コード例 #2
0
        public static bool DockWindowLeft(EditorWindow window)
        {
            EditorWindow mostLeft = GetMostLeftWindow(window);

            if (mostLeft == null)
            {
                return(false);
            }
            object parent = mostLeft.GetParent();

            if (parent == null)
            {
                return(false);
            }
            // force the after-dock reflow to respect the current window widths
            EditorWindow[] windows  = Host.windows;
            Vector2[]      minSizes = new Vector2[windows.Length];
            for (int i = 0; i < minSizes.Length; i++)
            {
                minSizes[i] = windows[i].minSize;
                Vector2 size = windows[i].minSize;
                size.x             = windows[i].position.size.x;
                windows[i].minSize = size;
            }
            // dock the window
            Rect rect = ViewR.Wrap(parent).screenPosition;

            DockWindow(window, mostLeft, rect.position);
            // restore min sizes
            for (int i = 0; i < windows.Length; i++)
            {
                windows[i].minSize = minSizes[i];
            }
            return(true);
        }
コード例 #3
0
        public static void SetWidth(this EditorWindow window, float width)
        {
            object dockArea = window.GetParent();
            Rect   p        = (Rect)ViewR.Wrap(dockArea).position;

            p.width = width;
            ViewR.Wrap(dockArea).position = p;
            object dockAreaParent = ViewR.Wrap(dockArea).parent;

            ViewR.Wrap(dockAreaParent).Reflow();
        }
コード例 #4
0
        public static bool IsFloating(this EditorWindow window)
        {
            object parent = window.GetParent();

            if (parent == null)
            {
                return(true);
            }
            parent = ViewR.Wrap(parent).parent;
            if (parent == null)
            {
                return(true);
            }
            parent = ViewR.Wrap(parent).parent;
            return(parent == null);
        }
コード例 #5
0
        public static Rect GetWindowPosition(this EditorWindow window)
        {
            object dockArea = window.GetParent();

            return((Rect)ViewR.Wrap(dockArea).windowPosition);
        }