Example #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="host">host</param>
        public MarginDockButtons(FormWrapper host)
        {
            _host = host;

            _leftButtonBounds.Size   = _dockLeftGuider.Size;
            _rightButtonBounds.Size  = _dockRightGuider.Size;
            _topButtonBounds.Size    = _dockTopGuider.Size;
            _bottomButtonBounds.Size = _dockBottomGuider.Size;

            _dockLeftGuider.Visible   = false;
            _dockRightGuider.Visible  = false;
            _dockTopGuider.Visible    = false;
            _dockBottomGuider.Visible = false;

            _dockLeftGuider.Text   = "outer left button";
            _dockRightGuider.Text  = "outer right button";
            _dockTopGuider.Text    = "outer top button";
            _dockBottomGuider.Text = "outer bottom button";

            _host.AddFirst(_dockLeftGuider);
            _host.AddFirst(_dockRightGuider);
            _host.AddFirst(_dockTopGuider);
            _host.AddFirst(_dockBottomGuider);

            _host.KeepFirst[0] = _dockLeftGuider;
            _host.KeepFirst[1] = _dockRightGuider;
            _host.KeepFirst[2] = _dockTopGuider;
            _host.KeepFirst[3] = _dockBottomGuider;

            _host.AddToIgnoreOnGetChildFromPoint(_dockLeftGuider);
            _host.AddToIgnoreOnGetChildFromPoint(_dockRightGuider);
            _host.AddToIgnoreOnGetChildFromPoint(_dockTopGuider);
            _host.AddToIgnoreOnGetChildFromPoint(_dockBottomGuider);
        }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="host">host</param>
        public CenterDockButtons(FormWrapper host)
        {
            _host = host;

            _leftButtonBounds.Size   = _dockLeftGuider.Size;
            _rightButtonBounds.Size  = _dockRightGuider.Size;
            _topButtonBounds.Size    = _dockTopGuider.Size;
            _bottomButtonBounds.Size = _dockBottomGuider.Size;
            _fillButtonBounds.Size   = _dockFillGuider.FillSize;

            _dockLeftGuider.Visible   = false;
            _dockRightGuider.Visible  = false;
            _dockTopGuider.Visible    = false;
            _dockBottomGuider.Visible = false;
            _dockFillGuider.Visible   = false;

            _dockLeftGuider.Text   = "inner left button";
            _dockRightGuider.Text  = "inner right button";
            _dockTopGuider.Text    = "inner top button";
            _dockBottomGuider.Text = "inner bottom button";
            _dockFillGuider.Text   = "inner fill button";

            _host.AddFirst(_dockLeftGuider);
            _host.AddFirst(_dockRightGuider);
            _host.AddFirst(_dockTopGuider);
            _host.AddFirst(_dockBottomGuider);
            _host.AddFirst(_dockFillGuider);

            _host.KeepFirst[4] = _dockLeftGuider;
            _host.KeepFirst[5] = _dockRightGuider;
            _host.KeepFirst[6] = _dockTopGuider;
            _host.KeepFirst[7] = _dockBottomGuider;
            _host.KeepFirst[8] = _dockFillGuider;

            _host.AddToIgnoreOnGetChildFromPoint(_dockLeftGuider);
            _host.AddToIgnoreOnGetChildFromPoint(_dockRightGuider);
            _host.AddToIgnoreOnGetChildFromPoint(_dockTopGuider);
            _host.AddToIgnoreOnGetChildFromPoint(_dockBottomGuider);
            _host.AddToIgnoreOnGetChildFromPoint(_dockFillGuider);
        }
Example #3
0
        /// <summary>
        /// Create floating container for the view
        /// </summary>
        /// <param name="view">view for which to create floating container</param>
        /// <param name="bounds">bounds of the floating container</param>
        /// <returns>floating container</returns>
        public DockingContainer CreateFloatingContainer(FormsTabbedView view, Rectangle bounds)
        {
            DockingContainer container = new DockingContainer();

            _host.AddFirst(container);

            container.Bounds = bounds;

            container.SetModeSingleChild(view);

            if (EnumUtility.Contains(view.AllowedDock, DockAllowed.None))
            {
                SetViewDock(view, DockStyle.None, DockStyle.None, DockableMode.None);
            }
            else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Left))
            {
                DockControl(container, null, DockStyle.Left, DockableMode.Outer);
            }
            else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Right))
            {
                DockControl(container, null, DockStyle.Right, DockableMode.Outer);
            }
            else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Top))
            {
                DockControl(container, null, DockStyle.Top, DockableMode.Outer);
            }
            else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Bottom))
            {
                DockControl(container, null, DockStyle.Bottom, DockableMode.Outer);
            }
            else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Fill))
            {
                DockControl(container, null, DockStyle.Fill, DockableMode.Inner);
            }
            else
            {
                _host.Remove(container);
                throw new NotSupportedException("Err");   // invalid allowed dock
            }

            return(container);
        }
Example #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="host">host</param>
        /// <param name="firstControlOffset">offset for first control</param>
        /// <param name="animationCommand">animation command</param>
        public Autohide(FormWrapper host, int firstControlOffset, Command animationCommand)
        {
            _host               = host;
            _animationCommand   = animationCommand;
            _firstControlOffset = firstControlOffset;

            _previewPane.Visible = false;
            _host.AddFirst(_previewPane);
            _host.KeepFirst[4 + _firstControlOffset] = _previewPane;

            _previewPane.BackColor = Color.Black;

            _host.SizeChanged    += OnHostSizeChanged;
            _host.VisibleChanged += OnHostVisibleChanged;

            LeftAutohideButtons.Visible   = false;
            RightAutohideButtons.Visible  = false;
            TopAutohideButtons.Visible    = false;
            BottomAutohideButtons.Visible = false;
            ArrangeAutoButtonsPanels();
        }
Example #5
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 = (DockingContainer)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();
        }