Beispiel #1
0
        /// <summary>Create a <see cref="FullscreenWindow"/> for a given window.</summary>
        /// <param name="type">The type of the window to instantiate if the given window is null.</param>
        /// <param name="window">The window that will go fullscreen. If null a new one will be instantiated based on the given type.</param>
        /// <param name="disposableWindow">Set this to true when the target window was created solely for fullscreen,
        /// this will cause it to be destroyed once the fullscreen closes, it has no effects if the target window is null.</param>
        /// <returns>Returns the newly created <see cref="FullscreenWindow"/>.</returns>
        public static FullscreenWindow MakeFullscreen(Type type, EditorWindow window = null, bool disposableWindow = false)
        {
            var rect       = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, window);
            var fullscreen = ScriptableObject.CreateInstance <FullscreenWindow>();

            fullscreen.OpenWindow(rect, type, window, disposableWindow);
            return(fullscreen);
        }
Beispiel #2
0
        /// <summary>Create a <see cref="FullscreenView"/> for a given view.</summary>
        /// <param name="view">The view that will go fullscreen, cannot be null.</param>
        /// <returns>Returns the newly created <see cref="FullscreenView"/>.</returns>
        public static FullscreenView MakeFullscreen(ScriptableObject view)
        {
            if (!view)
            {
                throw new ArgumentNullException("view");
            }

            view.EnsureOfType(Types.View);

            var rect       = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, view);
            var fullscreen = ScriptableObject.CreateInstance <FullscreenView>();

            fullscreen.OpenView(rect, view);

            return(fullscreen);
        }
Beispiel #3
0
        /// <summary>Open a new fullscreen if there's none open, otherwise, close the one already open.</summary>
        /// <param name="view">The view that will go fullscreen, cannot be null.</param>
        public static void ToggleFullscreen(ScriptableObject view)
        {
            var rect       = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, view);
            var fullscreen = GetFullscreenOnRect(rect);

            if (!fullscreen)
            {
                fullscreen = GetFullscreenFromView(view);
            }

            if (fullscreen)
            {
                fullscreen.Close();
            }
            else
            {
                MakeFullscreen(view);
            }
        }
Beispiel #4
0
        /// <summary>Open a new fullscreen if there's none open, otherwise, close the one already open.</summary>
        /// <param name="window">The window that will go fullscreen. If null a new one will be instantiated based on the given type.</param>
        /// <param name="type">The type of the window to instantiate if the given window is null.</param>
        public static void ToggleFullscreen(Type type, EditorWindow window = null)
        {
            var rect       = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, window);
            var fullscreen = GetFullscreenOnRect(rect);

            if (!fullscreen)
            {
                fullscreen = GetFullscreenFromView(window);
            }

            if (fullscreen)
            {
                fullscreen.Close();
            }
            else
            {
                MakeFullscreen(type, window);
            }
        }
Beispiel #5
0
        /// <summary>Open a new fullscreen if there's none open, otherwise, close the one already open.</summary>
        /// <param name="view">The view that will go fullscreen, cannot be null.</param>
        public static void ToggleFullscreen(ScriptableObject view)
        {
            var rect          = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, view);
            var oldFullscreen = GetFullscreenFromView(view);

            if (oldFullscreen)
            {
                oldFullscreen.Close();
                return;
            }

            oldFullscreen = GetFullscreenOnRect(rect);

            var newFullscreen = MakeFullscreen(view);

            newFullscreen.didPresent += () => {
                if (oldFullscreen)
                {
                    oldFullscreen.Close();
                }
            };
        }
Beispiel #6
0
        /// <summary>Open a new fullscreen if there's none open, otherwise, close the one already open.</summary>
        /// <param name="window">The window that will go fullscreen. If null a new one will be instantiated based on the given type.</param>
        /// <param name="type">The type of the window to instantiate if the given window is null.</param>
        public static void ToggleFullscreen(Type type, EditorWindow window = null)
        {
            var rect          = FullscreenRects.GetFullscreenRect(FullscreenPreferences.RectSource, window);
            var oldFullscreen = GetFullscreenFromView(window);

            if (oldFullscreen)
            {
                oldFullscreen.Close();
                return;
            }

            oldFullscreen = GetFullscreenOnRect(rect);

            var newFullscreen = MakeFullscreen(type, window);

            newFullscreen.didPresent += () => {
                if (oldFullscreen)
                {
                    oldFullscreen.Close();
                }
            };
        }