Example #1
0
        /// <summary>
        /// Auto-show the given view
        /// </summary>
        /// <param name="view">view to show</param>
        public void UnsetAutoHideMode(FormsTabbedView view)
        {
            AutoHidePanel     panel     = (AutoHidePanel)view.Parent;
            DockableContainer container = panel.RestoreParent;

            DockStyle logicalDock = DockStyle.None;

            if (LeftAutohideButtons.Remove(panel))
            {
                logicalDock = DockStyle.Left;
            }
            else if (RightAutohideButtons.Remove(panel))
            {
                logicalDock = DockStyle.Right;
            }
            else if (TopAutohideButtons.Remove(panel))
            {
                logicalDock = DockStyle.Top;
            }
            else if (BottomAutohideButtons.Remove(panel))
            {
                logicalDock = DockStyle.Bottom;
            }
            else
            {
                Debug.Fail("Panel not found");
            }

            _host.Remove(panel);

            container.SetModeSingleChild(view);

            OnSetHostContainerDock(view, logicalDock);
            view.IsAutoHideMode        = false;
            view.PagesPanel.AutoHidden = false;

            ShowRestoreContainers(panel);

            ArrangeAutoButtonsPanels();

            _autoShowPanel = null;
        }
Example #2
0
        /// <summary>
        /// Auto-hide the given view
        /// </summary>
        /// <param name="view">view to hide</param>
        public void SetAutoHideMode(FormsTabbedView view)
        {
            AutoHidePanel panel = new AutoHidePanel();

            panel.RestoreParent = (DockableContainer)view.Parent;
            panel.Size          = view.Size;
            panel.Visible       = false;

            HideRestoreContainers(panel);

            panel.RestoreParent.SetModeLinked(view);
            view.Parent = panel;

            DockStyle logicalDock = view.HostContainerDock;

            OnSetHostContainerDock(view, Globals.DockAutoHide);

            view.Positioner         = new ControlPositioner(panel);
            view.Positioner.CanMove = false;

            if (logicalDock == DockStyle.Left)
            {
                panel.Bounds = new Rectangle(LeftAutohideButtons.Right, LeftAutohideButtons.Top, view.Width, LeftAutohideButtons.Height);

                view.Positioner.CanSizeLeft   = false;
                view.Positioner.CanSizeTop    = false;
                view.Positioner.CanSizeBottom = false;

                panel.AutoHideHandler = AutoHideLeftPane;
                panel.AutoShowHandler = AutoShowLeftPane;

                LeftAutohideButtons.Add(panel);
            }
            else if (logicalDock == DockStyle.Right)
            {
                panel.Bounds = new Rectangle(RightAutohideButtons.Left - view.Width, RightAutohideButtons.Top, view.Width, RightAutohideButtons.Height);

                view.Positioner.CanSizeRight  = false;
                view.Positioner.CanSizeTop    = false;
                view.Positioner.CanSizeBottom = false;

                panel.AutoHideHandler = AutoHideRightPane;
                panel.AutoShowHandler = AutoShowRightPane;

                RightAutohideButtons.Add(panel);
            }
            else if (logicalDock == DockStyle.Top)
            {
                panel.Bounds = new Rectangle(TopAutohideButtons.Left, TopAutohideButtons.Bottom, TopAutohideButtons.Width, view.Height);

                view.Positioner.CanSizeLeft  = false;
                view.Positioner.CanSizeRight = false;
                view.Positioner.CanSizeTop   = false;

                panel.AutoHideHandler = AutoHideTopPane;
                panel.AutoShowHandler = AutoShowTopPane;

                TopAutohideButtons.Add(panel);
            }
            else if (logicalDock == DockStyle.Bottom)
            {
                panel.Bounds = new Rectangle(BottomAutohideButtons.Left, BottomAutohideButtons.Top - view.Height, BottomAutohideButtons.Width, view.Height);

                view.Positioner.CanSizeLeft   = false;
                view.Positioner.CanSizeRight  = false;
                view.Positioner.CanSizeBottom = false;

                panel.AutoHideHandler = AutoHideBottomPane;
                panel.AutoShowHandler = AutoShowBottomPane;

                BottomAutohideButtons.Add(panel);
            }
            else
            {
                Debug.Fail("Autohide should be available only for docked left, right, top or bottom");
                return;
            }

            _host.AddFirst(panel);
            view.IsAutoHideMode        = true;
            view.PagesPanel.AutoHidden = true;

            ArrangeAutoButtonsPanels();
        }