예제 #1
0
        /// <summary>
        /// Gets the dock for given point
        /// </summary>
        /// <param name="screenPoint">screen point</param>
        /// <returns></returns>
        public DockStyle GetDockAtPoint(Point screenPoint)
        {
            ValidateNotDisposed();

            Point clientPoint = _host.PointToClient(screenPoint);

            if (_dockLeftGuider.Bounds.Contains(clientPoint) && _dockLeftGuider.Visible)
            {
                return(DockStyle.Left);
            }

            if (_dockRightGuider.Bounds.Contains(clientPoint) && _dockRightGuider.Visible)
            {
                return(DockStyle.Right);
            }

            if (_dockTopGuider.Bounds.Contains(clientPoint) && _dockTopGuider.Visible)
            {
                return(DockStyle.Top);
            }

            if (_dockBottomGuider.Bounds.Contains(clientPoint) && _dockBottomGuider.Visible)
            {
                return(DockStyle.Bottom);
            }

            return(DockStyle.None);
        }
예제 #2
0
        /// <summary>
        /// Undock the view
        /// </summary>
        /// <param name="view">view</param>
        public void Undock(FormsTabbedView view)
        {
            Point mousePosition = _host.PointToClient(Control.MousePosition);

            DockingContainer container = (DockingContainer)view.Parent;
            Rectangle        bounds    = _host.GetBoundsInHost(container);

            ComputeFloatingBounds(mousePosition, view.FloatingSize, ref bounds);

            Undock(view, bounds);
        }
예제 #3
0
        /// <summary>
        /// Gets the dock result for given screen location
        /// </summary>
        /// <param name="allowedDockMode">allowed dock mode</param>
        /// <param name="screenLocation">screen location</param>
        /// <returns>dock result</returns>
        public GuidedDockResult GetDockResult(DockAllowed allowedDockMode, Point screenLocation)
        {
            ValidateNotDisposed();

            _dockResult.Dock     = DockStyle.None;
            _dockResult.DockMode = DockableMode.Outer;

            Point clientLocation = _host.PointToClient(screenLocation);

            if (_marginGuiders.LeftButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Left))
            {
                _dockResult.Dock = DockStyle.Left;
            }
            else if (_marginGuiders.RightButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Right))
            {
                _dockResult.Dock = DockStyle.Right;
            }
            else if (_marginGuiders.TopButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Top))
            {
                _dockResult.Dock = DockStyle.Top;
            }
            else if (_marginGuiders.BottomButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Bottom))
            {
                _dockResult.Dock = DockStyle.Bottom;
            }
            else if (_centerGuider.IsVisible)
            {
                _dockResult.DockMode = DockableMode.Inner;

                if (_centerGuider.LeftButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Left))
                {
                    _dockResult.Dock = DockStyle.Left;
                }
                else if (_centerGuider.TopButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Top))
                {
                    _dockResult.Dock = DockStyle.Top;
                }
                else if (_centerGuider.RightButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Right))
                {
                    _dockResult.Dock = DockStyle.Right;
                }
                else if (_centerGuider.BottomButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Bottom))
                {
                    _dockResult.Dock = DockStyle.Bottom;
                }
                else if (_centerGuider.FillButtonBounds.Contains(clientLocation) && EnumUtility.Contains(allowedDockMode, DockAllowed.Fill))
                {
                    _dockResult.Dock = DockStyle.Fill;
                }
            }

            return(_dockResult);
        }
예제 #4
0
        /// <summary>
        /// Hide auto pane when mouse exits
        /// </summary>
        public void HideAutoPaneWhenMouseExits()
        {
            Point mousePosition = Control.MousePosition;


            bool checkIfShouldHideAutoPane = false;
            bool checkIfShouldHidePreview  = _previewPane.Visible;

            if (checkIfShouldHidePreview)
            {
                checkIfShouldHidePreview = (_host.RectangleToScreen(_previewPane.Bounds).Contains(mousePosition) == false);
            }

            AutoHidePanel panel = _autoShowPanel;

            if (panel != null)
            {
                if (panel.Visible)
                {
                    checkIfShouldHideAutoPane = (panel.RectangleToScreen(panel.ClientRectangle).Contains(mousePosition) == false);
                }
                else
                {
                    _autoShowPanel = null;
                }
            }

            if (checkIfShouldHideAutoPane || checkIfShouldHidePreview)
            {
                Point clientPosition = _host.PointToClient(mousePosition);

                if (IsPointInSpacers(clientPosition))
                {
                    return;
                }

                if (checkIfShouldHideAutoPane)
                {
                    _autoHidePanel            = panel;
                    _animationCommand.Handler = panel.AutoHideHandler;
                }

                if (checkIfShouldHidePreview)
                {
                    _previewPane.Visible = false;
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Occurs when undock form from view is raised
        /// </summary>
        /// <param name="sender">sender of the event</param>
        /// <param name="e">event argument</param>
        private void OnUndockFormFromView(object sender, FormEventArgs e)
        {
            Point position = _host.PointToClient(Control.MousePosition);

            Undock(e.Form, new Rectangle(position.X - 150, position.Y - 4, 300, 300));
        }