/// <exclude />
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
            {
                DockPane.Activate();
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDOWN)
            {
                if (DockPane.DockPanel.AllowRedocking && DockPane.AllowRedocking &&
                    !DockHelper.IsDockStateAutoHide(DockPane.DockState))
                {
                    DockPane.DockPanel.DragHandler.BeginDragPane(DockPane, ClientRectangle.Location);
                }
                else
                {
                    base.WndProc(ref m);
                }
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
            {
                base.WndProc(ref m);

                if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
                {
                    DockPane.DockPanel.ActiveAutoHideContent = null;
                    return;
                }

                DockContent activeContent = DockPane.DockPanel.ActiveContent;
                for (int i = 0; i < DockPane.Tabs.Count; i++)
                {
                    DockContent content = DockPane.Tabs[i].Content;
                    if (DockPane.IsFloat)
                    {
                        DockPane.RestoreToPanel();
                    }
                    else
                    {
                        DockPane.Float();
                    }
                    if (activeContent != null)
                    {
                        activeContent.Activate();
                    }
                }
                return;
            }

            base.WndProc(ref m);
        }
Ejemplo n.º 2
0
        /// <include file='CodeDoc\DockPane.xml' path='//CodeDoc/Class[@name="DockPane"]/Method[@name="Float()"]/*'/>
        public DockPane Float()
        {
            IDockContent activeContent = ActiveContent;

            DockPane floatPane = GetFloatPaneFromContents();

            if (floatPane == null)
            {
                IDockContent firstContent = GetFirstContent(DockState.Float);
                if (firstContent == null)
                {
                    return(null);
                }
                floatPane = DockPanel.DockPaneFactory.CreateDockPane(firstContent, DockState.Float, true);
            }
            SetVisibleContentsToPane(floatPane, activeContent);
            floatPane.Activate();

            return(floatPane);
        }
        /// <exclude/>
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
            {
                DockPane.Activate();
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDOWN)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    DockContent content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        DockPane.ActiveContent = content;
                        Update();
                    }
                    if (DockPane.DockPanel.AllowRedocking && DockPane.AllowRedocking && DockPane.ActiveContent.AllowRedocking)
                    {
                        DockPane.DockPanel.DragHandler.BeginDragContent(DockPane, DockPane.ClientRectangle);                         //DockPane.DisplayingRectangle);
                    }
                }
                else
                {
                    base.WndProc(ref m);
                }
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_RBUTTONDOWN)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    DockContent content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        DockPane.ActiveContent = content;
                    }
                }
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_RBUTTONUP)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    DockContent content = Tabs[index].Content;
                    if (content.TabPageContextMenu != null)
                    {
                        content.TabPageContextMenu.Show(this, this.PointToClient(Control.MousePosition));
                    }
                }
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
            {
                base.WndProc(ref m);

                int index = GetHitTest();
                if (DockPane.DockPanel.AllowRedocking && index != -1)
                {
                    DockContent content = Tabs[index].Content;
                    try     { content.IsFloat = !content.IsFloat; }
                    catch   {       }
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_MBUTTONDOWN)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    if (Tabs[index].Content.ToString().StartsWith("FlashDevelop.TabbedDocument"))
                    {
                        Tabs[index].Content.Close();
                    }
                    else
                    {
                        Tabs[index].Content.Hide();
                    }
                }
            }

            base.WndProc(ref m);
            return;
        }
Ejemplo n.º 4
0
        /// <exclude/>
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDOWN)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    IDockContent content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        DockPane.ActiveContent = content;
                        DockPane.Activate();
                        Update();
                    }
                    if (DockPane.DockPanel.AllowRedocking && DockPane.AllowRedocking && DockPane.ActiveContent.DockHandler.AllowRedocking)
                    {
                        DockPane.DockPanel.DragHandler.BeginDragContent(DockPane.ActiveContent);
                    }
                }
                else
                {
                    base.WndProc(ref m);
                }
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_RBUTTONDOWN)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    IDockContent content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        DockPane.ActiveContent = content;
                    }
                }
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_RBUTTONUP)
            {
                int index = GetHitTest();
                if (index != -1)
                {
                    IDockContent content = Tabs[index].Content;
                    #if FRAMEWORK_VER_2x
                    if (content.DockHandler.TabPageContextMenuStrip != null)
                    {
                        content.DockHandler.TabPageContextMenuStrip.Show(this, this.PointToClient(Control.MousePosition));
                    }
                    else if (content.DockHandler.TabPageContextMenu != null)
                    {
                        content.DockHandler.TabPageContextMenu.Show(this, this.PointToClient(Control.MousePosition));
                    }
                    #else
                    if (content.DockHandler.TabPageContextMenu != null)
                    {
                        content.DockHandler.TabPageContextMenu.Show(this, this.PointToClient(Control.MousePosition));
                    }
                    #endif
                }
                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
            {
                base.WndProc(ref m);

                int index = GetHitTest();
                if (DockPane.DockPanel.AllowRedocking && index != -1)
                {
                    IDockContent content = Tabs[index].Content;
                    try     { content.DockHandler.IsFloat = !content.DockHandler.IsFloat; }
                    catch   {       }
                }

                return;
            }

            base.WndProc(ref m);
            return;
        }
Ejemplo n.º 5
0
        private void Pane_OnEndDrag(bool abort)
        {
            User32.SetCursor(DragControl.Cursor.Handle);

            if (abort)
            {
                return;
            }

            DockPane pane = (DockPane)DragControl;

            if (!DockOutline.FloatWindowBounds.IsEmpty)
            {
                if (pane.FloatWindow == null || pane.FloatWindow.DockList.Count != 1)
                {
                    pane.FloatWindow = pane.DockPanel.FloatWindowFactory.CreateFloatWindow(pane.DockPanel, pane, DockOutline.FloatWindowBounds);
                }
                else
                {
                    pane.FloatWindow.Bounds = DockOutline.FloatWindowBounds;
                }

                pane.DockState = DockState.Float;
                pane.Activate();
            }
            else if (DockOutline.DockTo is DockPane)
            {
                DockPane paneTo = DockOutline.DockTo as DockPane;

                if (DockOutline.Dock == DockStyle.Fill)
                {
                    for (int i = pane.Contents.Count - 1; i >= 0; i--)
                    {
                        IDockContent c = pane.Contents[i];
                        c.DockHandler.Pane = paneTo;
                        if (DockOutline.ContentIndex != -1)
                        {
                            paneTo.SetContentIndex(c, DockOutline.ContentIndex);
                        }
                        c.DockHandler.Activate();
                    }
                }
                else
                {
                    if (DockOutline.Dock == DockStyle.Left)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Left, 0.5);
                    }
                    else if (DockOutline.Dock == DockStyle.Right)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Right, 0.5);
                    }
                    else if (DockOutline.Dock == DockStyle.Top)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Top, 0.5);
                    }
                    else if (DockOutline.Dock == DockStyle.Bottom)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Bottom, 0.5);
                    }

                    pane.DockState = paneTo.DockState;
                    pane.Activate();
                }
            }
            else if (DockOutline.DockTo is DockPanel)
            {
                SetDockWindow();
                if (DockOutline.Dock == DockStyle.Top)
                {
                    pane.DockState = DockState.DockTop;
                }
                else if (DockOutline.Dock == DockStyle.Bottom)
                {
                    pane.DockState = DockState.DockBottom;
                }
                else if (DockOutline.Dock == DockStyle.Left)
                {
                    pane.DockState = DockState.DockLeft;
                }
                else if (DockOutline.Dock == DockStyle.Right)
                {
                    pane.DockState = DockState.DockRight;
                }
                else if (DockOutline.Dock == DockStyle.Fill)
                {
                    pane.DockState = DockState.Document;
                }

                pane.Activate();
            }
        }
Ejemplo n.º 6
0
        private void Content_OnEndDrag(bool abort)
        {
            User32.SetCursor(DragControl.Cursor.Handle);

            if (abort)
            {
                return;
            }

            IDockContent content = DragControl as IDockContent;

            if (!DockOutline.FloatWindowBounds.IsEmpty)
            {
                DockPane pane = content.DockHandler.DockPanel.DockPaneFactory.CreateDockPane(content, DockOutline.FloatWindowBounds, true);
                pane.Activate();
            }
            else if (DockOutline.DockTo is DockPane)
            {
                DockPane paneTo = DockOutline.DockTo as DockPane;

                if (DockOutline.Dock == DockStyle.Fill)
                {
                    bool samePane = (content.DockHandler.Pane == paneTo);
                    if (!samePane)
                    {
                        content.DockHandler.Pane = paneTo;
                    }

                    if (DockOutline.ContentIndex == -1 || !samePane)
                    {
                        paneTo.SetContentIndex(content, DockOutline.ContentIndex);
                    }
                    else
                    {
                        DockContentCollection contents = paneTo.Contents;
                        int oldIndex = contents.IndexOf(content);
                        int newIndex = DockOutline.ContentIndex;
                        if (oldIndex < newIndex)
                        {
                            newIndex += 1;
                            if (newIndex > contents.Count - 1)
                            {
                                newIndex = -1;
                            }
                        }
                        paneTo.SetContentIndex(content, newIndex);
                    }

                    content.DockHandler.Activate();
                }
                else
                {
                    DockPane           pane      = content.DockHandler.DockPanel.DockPaneFactory.CreateDockPane(content, paneTo.DockState, true);
                    IDockListContainer container = paneTo.DockListContainer;
                    if (DockOutline.Dock == DockStyle.Left)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Left, 0.5);
                    }
                    else if (DockOutline.Dock == DockStyle.Right)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Right, 0.5);
                    }
                    else if (DockOutline.Dock == DockStyle.Top)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Top, 0.5);
                    }
                    else if (DockOutline.Dock == DockStyle.Bottom)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Bottom, 0.5);
                    }

                    pane.DockState = paneTo.DockState;
                    pane.Activate();
                }
            }
            else if (DockOutline.DockTo is DockPanel)
            {
                DockPane  pane;
                DockPanel dockPanel = content.DockHandler.DockPanel;

                SetDockWindow();
                if (DockOutline.Dock == DockStyle.Top)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockTop, true);
                }
                else if (DockOutline.Dock == DockStyle.Bottom)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockBottom, true);
                }
                else if (DockOutline.Dock == DockStyle.Left)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockLeft, true);
                }
                else if (DockOutline.Dock == DockStyle.Right)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockRight, true);
                }
                else if (DockOutline.Dock == DockStyle.Fill)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.Document, true);
                }
                else
                {
                    return;
                }

                pane.Activate();
            }
        }
Ejemplo n.º 7
0
        private void Pane_OnEndDrag(bool abort)
        {
            User32.SetCursor(DragControl.Cursor.Handle);

            if (abort)
            {
                return;
            }

            DockPane pane = (DockPane)DragControl;

            if (DropTarget.DropTo is DockPane)
            {
                DockPane paneTo = DropTarget.DropTo as DockPane;

                if (DropTarget.Dock == DockStyle.Fill)
                {
                    for (int i = pane.Contents.Count - 1; i >= 0; i--)
                    {
                        DockContent c = pane.Contents[i];
                        c.Pane = paneTo;
                        if (DropTarget.ContentIndex != -1)
                        {
                            paneTo.SetContentIndex(c, DropTarget.ContentIndex);
                        }
                        c.Activate();
                    }
                }
                else
                {
                    if (DropTarget.Dock == DockStyle.Left)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Left, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Right)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Right, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Top)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Top, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Bottom)
                    {
                        pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Bottom, 0.5);
                    }

                    pane.DockState = paneTo.DockState;
                    pane.Activate();
                }
            }
            else if (DropTarget.DropTo is DockPanel)
            {
                if (DropTarget.Dock == DockStyle.Top)
                {
                    pane.DockState = DockState.DockTop;
                }
                else if (DropTarget.Dock == DockStyle.Bottom)
                {
                    pane.DockState = DockState.DockBottom;
                }
                else if (DropTarget.Dock == DockStyle.Left)
                {
                    pane.DockState = DockState.DockLeft;
                }
                else if (DropTarget.Dock == DockStyle.Right)
                {
                    pane.DockState = DockState.DockRight;
                }
                else if (DropTarget.Dock == DockStyle.Fill)
                {
                    pane.DockState = DockState.Document;
                }

                pane.Activate();
            }
            else if (IsDockStateValid(DockState.Float))
            {
                Point ptMouse = Control.MousePosition;

                Point location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y);
                Size  size;
                bool  createFloatWindow = true;
                if (pane.FloatWindow == null)
                {
                    size = FloatWindow.DefaultWindowSize;
                }
                else if (pane.FloatWindow.DockList.Count == 1)
                {
                    size = pane.FloatWindow.Size;
                    createFloatWindow = false;
                }
                else
                {
                    size = FloatWindow.DefaultWindowSize;
                }

                if (ptMouse.X > location.X + size.Width)
                {
                    location.X += ptMouse.X - (location.X + size.Width) + OutlineBorderWidth;
                }

                if (createFloatWindow)
                {
                    pane.FloatWindow = pane.DockPanel.FloatWindowFactory.CreateFloatWindow(pane.DockPanel, pane, new Rectangle(location, size));
                }
                else
                {
                    pane.FloatWindow.Bounds = new Rectangle(location, size);
                }

                pane.DockState = DockState.Float;
                pane.Activate();
            }
        }
Ejemplo n.º 8
0
        private void Content_OnEndDrag(bool abort)
        {
            User32.SetCursor(DragControl.Cursor.Handle);

            if (abort)
            {
                return;
            }

            DockContent content = ((DockPane)DragControl).ActiveContent;

            if (DropTarget.DropTo is DockPane)
            {
                DockPane paneTo = DropTarget.DropTo as DockPane;

                if (DropTarget.Dock == DockStyle.Fill)
                {
                    bool samePane = (content.Pane == paneTo);
                    if (!samePane)
                    {
                        content.Pane = paneTo;
                    }

                    if (DropTarget.ContentIndex == -1 || !samePane)
                    {
                        paneTo.SetContentIndex(content, DropTarget.ContentIndex);
                    }
                    else
                    {
                        DockContentCollection contents = paneTo.Contents;
                        int oldIndex = contents.IndexOf(content);
                        int newIndex = DropTarget.ContentIndex;
                        if (oldIndex < newIndex)
                        {
                            newIndex += 1;
                            if (newIndex > contents.Count - 1)
                            {
                                newIndex = -1;
                            }
                        }
                        paneTo.SetContentIndex(content, newIndex);
                    }

                    content.Activate();
                }
                else
                {
                    DockPane           pane      = content.DockPanel.DockPaneFactory.CreateDockPane(content, paneTo.DockState, true);
                    IDockListContainer container = paneTo.DockListContainer;
                    if (DropTarget.Dock == DockStyle.Left)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Left, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Right)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Right, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Top)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Top, 0.5);
                    }
                    else if (DropTarget.Dock == DockStyle.Bottom)
                    {
                        pane.AddToDockList(container, paneTo, DockAlignment.Bottom, 0.5);
                    }

                    pane.DockState = paneTo.DockState;
                    pane.Activate();
                }
            }
            else if (DropTarget.DropTo is DockPanel)
            {
                DockPane  pane;
                DockPanel dockPanel = content.DockPanel;
                if (DropTarget.Dock == DockStyle.Top)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockTop, true);
                }
                else if (DropTarget.Dock == DockStyle.Bottom)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockBottom, true);
                }
                else if (DropTarget.Dock == DockStyle.Left)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockLeft, true);
                }
                else if (DropTarget.Dock == DockStyle.Right)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockRight, true);
                }
                else if (DropTarget.Dock == DockStyle.Fill)
                {
                    pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.Document, true);
                }
                else
                {
                    return;
                }

                pane.Activate();
            }
            else if (IsDockStateValid(DockState.Float))
            {
                Point ptMouse = Control.MousePosition;

                Size  size = FloatWindow.DefaultWindowSize;
                Point location;
                if (content.DockState == DockState.Document)
                {
                    location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y);
                }
                else
                {
                    location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y - size.Height);
                }

                if (ptMouse.X > location.X + size.Width)
                {
                    location.X += ptMouse.X - (location.X + size.Width) + OutlineBorderWidth;
                }

                DockPane pane = content.DockPanel.DockPaneFactory.CreateDockPane(content, new Rectangle(location, size), true);
                pane.Activate();
            }
        }