Beispiel #1
0
        /// <exclude/>
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDOWN)
            {
                if (IsDisposed)
                {
                    return;
                }

                uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result == 2 && DockPanel.AllowRedocking && this.AllowRedocking)                     // HITTEST_CAPTION
                {
                    Activate();
                    m_dockPanel.DragHandler.BeginDragFloatWindow(this);
                }
                else
                {
                    base.WndProc(ref m);
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_CLOSE)
            {
                if (DockList.Count == 0)
                {
                    base.WndProc(ref m);
                    return;
                }

                for (int i = DockList.Count - 1; i >= 0; i--)
                {
                    DockContentCollection contents = DockList[i].Contents;
                    for (int j = contents.Count - 1; j >= 0; j--)
                    {
                        DockContent content = contents[j];
                        if (content.DockState != DockState.Float)
                        {
                            continue;
                        }

                        if (!content.CloseButton)
                        {
                            continue;
                        }

                        if (content.HideOnClose)
                        {
                            content.Hide();
                        }
                        else
                        {
                            content.Close();
                        }
                    }
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
            {
                uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result != 2)                        // HITTEST_CAPTION
                {
                    base.WndProc(ref m);
                    return;
                }

                // Restore to panel
                DockContent activeContent = DockPanel.ActiveContent;
                foreach (DockPane pane in DockList)
                {
                    if (pane.DockState != DockState.Float)
                    {
                        continue;
                    }
                    pane.RestoreToPanel();
                }
                if (activeContent != null)
                {
                    activeContent.Activate();
                }

                return;
            }
            else if (m.Msg == WM_CHECKDISPOSE)
            {
                if (DockList.Count == 0)
                {
                    Dispose();
                }

                return;
            }

            base.WndProc(ref m);
        }
Beispiel #2
0
        /// <exclude/>
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDOWN)
            {
                if (IsDisposed)
                {
                    return;
                }

                uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result == 2 && DockPanel.AllowRedocking && this.AllowRedocking)                     // HITTEST_CAPTION
                {
                    Activate();
                    m_dockPanel.DragHandler.BeginDragFloatWindow(this);
                }
                else
                {
                    base.WndProc(ref m);
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_CLOSE)
            {
                if (DockList.Count == 0)
                {
                    base.WndProc(ref m);
                    return;
                }

                for (int i = DockList.Count - 1; i >= 0; i--)
                {
                    DockContentCollection contents = DockList[i].Contents;
                    for (int j = contents.Count - 1; j >= 0; j--)
                    {
                        IDockContent content = contents[j];
                        if (content.DockHandler.DockState != DockState.Float)
                        {
                            continue;
                        }

                        if (!content.DockHandler.CloseButton)
                        {
                            continue;
                        }

                        if (content.DockHandler.HideOnClose)
                        {
                            content.DockHandler.Hide();
                        }
                        else
                        {
                            content.DockHandler.Close();
                        }
                    }
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
            {
                uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result != 2)                        // HITTEST_CAPTION
                {
                    base.WndProc(ref m);
                    return;
                }

                Visible = false;
                DockPanel.SuspendLayout(true);

                // Restore to panel
                foreach (DockPane pane in DockList)
                {
                    if (pane.DockState != DockState.Float)
                    {
                        continue;
                    }
                    pane.RestoreToPanel();
                }

                DockPanel.ResumeLayout(true, true);
                if (Visible != (DisplayingList.Count > 0))
                {
                    Visible = (DisplayingList.Count > 0);
                }
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_WINDOWPOSCHANGING)
            {
                int offset = (int)Marshal.OffsetOf(typeof(Win32.WINDOWPOS), "flags");
                int flags  = Marshal.ReadInt32(m.LParam, offset);
                Marshal.WriteInt32(m.LParam, offset, flags | (int)Win32.FlagsSetWindowPos.SWP_NOCOPYBITS);
            }
            else if (m.Msg == WM_CHECKDISPOSE)
            {
                if (DockList.Count == 0)
                {
                    Dispose();
                }

                return;
            }

            base.WndProc(ref m);
        }
Beispiel #3
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDOWN)
            {
                if (IsDisposed)
                {
                    return;
                }

                uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result == 2 && DockManager.AllowRedocking && this.AllowRedocking)                   // HITTEST_CAPTION
                {
                    Activate();
                    m_dockManager.DragHandler.BeginDragFloatWindow(this);
                }
                else
                {
                    base.WndProc(ref m);
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_CLOSE)
            {
                if (ContentWindows.Count == 0)
                {
                    base.WndProc(ref m);
                    return;
                }

                for (int i = ContentWindows.Count - 1; i >= 0; i--)
                {
                    if (ContentWindows[i].DockState != DockState.Float)
                    {
                        continue;
                    }

                    ContentCollection contents = ContentWindows[i].Contents;
                    for (int j = contents.Count - 1; j >= 0; j--)
                    {
                        Content c = contents[j];
                        if (c.HideOnClose)
                        {
                            c.Hide();
                        }
                        else
                        {
                            c.Close();
                        }
                    }
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
            {
                uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result != 2)                        // HITTEST_CAPTION
                {
                    base.WndProc(ref m);
                    return;
                }

                // Show as RestoreState
                foreach (ContentWindow cw in ContentWindows)
                {
                    if (cw.DockState != DockState.Float)
                    {
                        continue;
                    }

                    if (cw.RestoreState != DockState.Unknown)
                    {
                        cw.VisibleState = cw.RestoreState;
                        cw.Activate();
                    }
                }

                return;
            }

            base.WndProc(ref m);
        }