protected virtual IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { handled = false; switch (msg) { case Win32Helper.NCCALCSIZE: if (wParam != IntPtr.Zero) { handled = true; var client = (RECT)Marshal.PtrToStructure(lParam, typeof(RECT)); client.Bottom -= 1; Marshal.StructureToPtr(client, lParam, false); } break; //case Win32Helper.WM_NCHITTEST: // { // handled = true; // //var htLocation = DefWindowProc( hwnd, msg, wParam, lParam ).ToInt32(); // //switch( htLocation ) // //{ // // case (int)HitTestResult.HTBOTTOM: // // case (int)HitTestResult.HTBOTTOMLEFT: // // case (int)HitTestResult.HTBOTTOMRIGHT: // // case (int)HitTestResult.HTLEFT: // // case (int)HitTestResult.HTRIGHT: // // case (int)HitTestResult.HTTOP: // // case (int)HitTestResult.HTTOPLEFT: // // case (int)HitTestResult.HTTOPRIGHT: // // htLocation = (int)HitTestResult.HTBORDER; // } // break; case Win32Helper.WM_ACTIVATE: if (((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE) { if (lParam == this.GetParentWindowHandle()) { Win32Helper.SetActiveWindow(_hwndSrc.Handle); handled = true; } } break; case Win32Helper.WM_EXITSIZEMOVE: UpdatePositionAndSizeOfPanes(); if (_dragService != null) { bool dropFlag; var mousePosition = this.TransformToDeviceDPI(Win32Helper.GetMousePosition()); _dragService.Drop(mousePosition, out dropFlag); _dragService = null; SetIsDragging(false); if (dropFlag) { InternalClose(); } } break; case Win32Helper.WM_MOVING: { UpdateDragPosition(); if (this.IsMaximized) { this.UpdateMaximizedState(false); } } break; case Win32Helper.WM_LBUTTONUP: //set as handled right button click on title area (after showing context menu) if (_dragService != null && Mouse.LeftButton == MouseButtonState.Released) { _dragService.Abort(); _dragService = null; SetIsDragging(false); } break; case Win32Helper.WM_SYSCOMMAND: int command = (int)wParam & 0xFFF0; if (command == Win32Helper.SC_MAXIMIZE || command == Win32Helper.SC_RESTORE) { UpdateMaximizedState(command == Win32Helper.SC_MAXIMIZE); } break; } return(IntPtr.Zero); }
protected virtual IntPtr FilterMessage( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled ) { handled = false; switch (msg) { case Win32Helper.WM_ACTIVATE: if (((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE) { if (lParam == this.GetParentWindowHandle()) { Win32Helper.SetActiveWindow(_hwndSrc.Handle); handled = true; } } break; case Win32Helper.WM_EXITSIZEMOVE: UpdatePositionAndSizeOfPanes(); if (_dragService != null) { bool dropFlag; var mousePosition = this.TransformToDeviceDPI(Win32Helper.GetMousePosition()); var manager = _model.Root.Manager; _dragService.Drop(mousePosition, out dropFlag); _dragService = null; SetIsDragging(false); if (dropFlag) { InternalClose(); if (manager != null) { manager.OnLayoutConfigurationChanged(); } } else { var floatingWindow = Model as LayoutDocumentFloatingWindow; if (floatingWindow != null) { floatingWindow.RootDocument.Dock(); } } } break; case Win32Helper.WM_MOVING: { UpdateDragPosition(); } break; case Win32Helper.WM_LBUTTONUP: //set as handled right button click on title area (after showing context menu) if (_dragService != null && Mouse.LeftButton == MouseButtonState.Released) { _dragService.Abort(); _dragService = null; SetIsDragging(false); } break; case Win32Helper.WM_SYSCOMMAND: IntPtr wMaximize = new IntPtr(Win32Helper.SC_MAXIMIZE); IntPtr wRestore = new IntPtr(Win32Helper.SC_RESTORE); if (wParam == wMaximize || wParam == wRestore) { UpdateMaximizedState(wParam == wMaximize); } break; } return(IntPtr.Zero); }
protected virtual IntPtr FilterMessage( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled ) { handled = false; switch (msg) { case Win32Helper.WM_ACTIVATE: if (((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE) { if (lParam == this.GetParentWindowHandle()) { Win32Helper.SetActiveWindow(_hwndSrc.Handle); handled = true; } } break; case Win32Helper.WM_EXITSIZEMOVE: UpdatePositionAndSizeOfPanes(); if (_dragService != null) { bool dropFlag; var mousePosition = this.TransformToDeviceDPI(Win32Helper.GetMousePosition()); _dragService.Drop(mousePosition, out dropFlag); _dragService = null; SetIsDragging(false); if (dropFlag) { InternalClose(); } } break; case Win32Helper.WM_MOVING: { UpdateDragPosition(); } break; case Win32Helper.WM_LBUTTONUP: //set as handled right button click on title area (after showing context menu) if (_dragService != null && Mouse.LeftButton == MouseButtonState.Released) { _dragService.Abort(); _dragService = null; SetIsDragging(false); } break; case Win32Helper.WM_SYSCOMMAND: int command = (int)wParam & 0xFFF0; if (command == Win32Helper.SC_MAXIMIZE || command == Win32Helper.SC_RESTORE) { UpdateMaximizedState(command == Win32Helper.SC_MAXIMIZE); } break; } return(IntPtr.Zero); }