/// <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--)
{
IDockableWindow 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);
}