CloseContent() private method

private CloseContent ( IDockContent content ) : void
content IDockContent
return void
Beispiel #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            int index = HitTest();

            if (index != -1)
            {
                if (e.Button == MouseButtons.Middle)
                {
                    // Close the specified content.
                    IDockContent content = Tabs[index].Content;
                    DockPane.CloseContent(content);
                }
                else
                {
                    IDockContent content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        DockPane.ActiveContent = content;
                    }
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                var dragSize = SystemInformation.DragSize;
                _dragBox = new Rectangle(new Point(e.X - (dragSize.Width / 2),
                                                   e.Y - (dragSize.Height / 2)), dragSize);
            }
        }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            int index = HitTest(e.Location);

            if (index != -1)
            {
                if (e.Button == MouseButtons.Middle)
                {
                    // Close the specified content.
                    IDockContent content = Tabs[index].Content;
                    DockPane.CloseContent(content);
                }
                else
                {
                    IDockContent content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        DockPane.ActiveContent = content;
                    }
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                if (DockPane.DockPanel.AllowEndUserDocking && DockPane.AllowDockDragAndDrop && DockPane.ActiveContent != null && DockPane.ActiveContent.DockHandler.AllowEndUserDocking)
                {
                    DockPane.DockPanel.BeginDrag(DockPane.ActiveContent.DockHandler);
                }
            }
        }
Beispiel #3
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
            {
                base.WndProc(ref m);

                int index = HitTest();
                if (DockPane.DockPanel.AllowEndUserDocking && index != -1)
                {
                    IDockContent content = Tabs[index].Content;
                    if (content.DockHandler.CheckDockState(!content.DockHandler.IsFloat) != DockState.Unknown)
                    {
                        content.DockHandler.IsFloat = !content.DockHandler.IsFloat;
                    }
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_MBUTTONUP)
            {
                base.WndProc(ref m);
                int index = HitTest();
                if (index != -1)
                {
                    DockPane.CloseContent(Tabs[index].Content);
                }
                return;
            }

            base.WndProc(ref m);
            return;
        }
Beispiel #4
0
 protected bool TryCloseTab(int index)
 {
     if (index >= 0 || index < Tabs.Count)
     {
         // Close the specified content.
         IDockContent content = Tabs[index].Content;
         DockPane.CloseContent(content);
         return(true);
     }
     return(false);
 }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            int index = HitTest(e.Location);

            if (index != -1)
            {
                IDockContent content;
                if (e.Button == MouseButtons.Middle)
                {
                    // Close the specified content.
                    content = Tabs[index].Content;
                    if (DockPane.DockPanel.ShowDockWindowThumbnail && _tipContent == content)
                    {
                        HideContentTooltip(_tipContent, _imageToolTip);
                        _canShowToolTip = true;
                    }

                    content.DockHandler.Activate();
                    DockPane.CloseContent(content);
                }
                else
                {
                    content = Tabs[index].Content;
                    if (DockPane.ActiveContent != content)
                    {
                        if (this.DockPane.DockPanel.ShowDockWindowThumbnail)
                        {
                            DockPane.ActiveContent.DockHandler.CaptureWindowThumbnail();
                        }

                        DockPane.ActiveContent = content;
                    }
                }

                if (e.Button == MouseButtons.Left)
                {
                    var dragSize = SystemInformation.DragSize;
                    _dragBox = new Rectangle(new Point(e.X - (dragSize.Width / 2),
                                                       e.Y - (dragSize.Height / 2)), dragSize);
                }
                if (e.Button == MouseButtons.Right)
                {
                    DockPane.OnPaneStripRightClicked(content, e);
                }
            }
        }
        protected bool TryCloseTab(int index)
        {
            if (index >= 0 || index < Tabs.Count)
            {
                // Close the specified content.
                IDockContent content = Tabs[index].Content;
                DockPane.CloseContent(content);
                if (PatchController.EnableSelectClosestOnClose == true)
                {
                    SelectClosestPane(index);
                }

                return(true);
            }
            return(false);
        }
Beispiel #7
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (e.Button == MouseButtons.Right)
            {
                ShowTabPageContextMenu(new Point(e.X, e.Y));
            }
            else if ((e.Button == MouseButtons.Middle) && (DockPane.Appearance == Docking.DockPane.AppearanceStyle.Document))
            {
                // Get the content located under the click (if there is one)
                int index = HitTest();
                if (index != -1)
                {
                    // Close the specified content.
                    IDockContent content = Tabs[index].Content;
                    DockPane.CloseContent(content);
                }
            }
        }