public void ToolkitExternalMove(int x, int y) { IToolkitEventSink co = this.mControlWeakRef.Target as IToolkitEventSink; if (null != co) { co.ToolkitExternalMove(x, y); } }
// Override the resize event from Xsharp. protected override void OnMoveResize(int x, int y, int width, int height) { base.OnMoveResize(x, y, width, height); if (sink != null) { sink.ToolkitExternalMove(x, y); sink.ToolkitExternalResize(width, height); } }
//WM_WINDOWPOSCHANGING internal void WindowPosChanging(int lParam) { //When window is created - CreateWindow(), WindowPosChanging is called when the initial size is set //because sink==null, its size and position will be set if (sink != null) { //TODO Pointers are not available yet //Win32.Api.WINDOWPOS *pos = (Win32.Api.WINDOWPOS*)lParam; Win32.Api.WINDOWPOS pos = (Win32.Api.WINDOWPOS)Marshal.PtrToStructure(new IntPtr(lParam), typeof(Win32.Api.WINDOWPOS)); if (suspendExternalMoveResizeNotify) { return; } // If moving if (((Win32.Api.SetWindowsPosFlags)pos.flags & Win32.Api.SetWindowsPosFlags.SWP_NOMOVE) == 0) { int leftAdjust, topAdjust, rightAdjust, bottomAdjust; Toolkit.GetWindowAdjust(out leftAdjust, out topAdjust, out rightAdjust, out bottomAdjust, flags); sink.ToolkitExternalMove(pos.x + leftAdjust, pos.y + topAdjust); } // If sizing if (((Win32.Api.SetWindowsPosFlags)pos.flags & Win32.Api.SetWindowsPosFlags.SWP_NOSIZE) == 0) { int leftAdjust, topAdjust, rightAdjust, bottomAdjust; Toolkit.GetWindowAdjust(out leftAdjust, out topAdjust, out rightAdjust, out bottomAdjust, flags); int width = pos.cx; int height = pos.cy; DrawingTopLevelWindow form = this as DrawingTopLevelWindow; // Restrict the size if necessary. if (form != null) { if (form.minimumSize != Size.Empty) { if (width < form.minimumSize.Width) { width = form.minimumSize.Width; } if (height < form.minimumSize.Height) { height = form.minimumSize.Height; } } if (form.maximumSize != Size.Empty) { if (width > form.maximumSize.Width) { width = form.maximumSize.Width; } if (height > form.maximumSize.Height) { height = form.maximumSize.Height; } } } sink.ToolkitExternalResize(width - leftAdjust - rightAdjust, height - topAdjust - bottomAdjust); } // Now prevent windows from changing the position or size, System.Windows.Control will do that //TODO Pointers are not available yet //pos.flags |= (uint)0x3; Marshal.WriteInt32(new IntPtr(lParam), 24, (int)pos.flags | 0x3); } }