Fix the top-level window client size setting code such that the window position does not change as seen by wxWidgets.

Copyright 2007 Software 2000 Ltd.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48074 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2007-08-14 22:38:32 +00:00
parent 731eee9af2
commit 03859c918c

View File

@ -385,16 +385,22 @@ void wxTopLevelWindowCocoa::CocoaSetWxWindowSize(int width, int height)
{
// Set the NSView size by setting the frame size to enclose it
unsigned int styleMask = [m_cocoaNSWindow styleMask];
NSRect frameRect = [m_cocoaNSWindow frame];
NSRect oldFrameRect = [m_cocoaNSWindow frame];
NSRect contentRect = [NSWindow
contentRectForFrameRect: frameRect
contentRectForFrameRect: oldFrameRect
styleMask: styleMask];
contentRect.size.width = width;
contentRect.size.height = height;
frameRect = [NSWindow
NSRect newFrameRect = [NSWindow
frameRectForContentRect: contentRect
styleMask: styleMask];
[m_cocoaNSWindow setFrame: frameRect display: NO];
// Cocoa uses +y is up but wxWidgets uses +y is down. We want an increase/decrease in height
// to not effect where the top of the window is placed so we set the new y origin relative the
// old one taking the height change into account.
newFrameRect.origin.y = oldFrameRect.origin.y + oldFrameRect.size.height - newFrameRect.size.height;
[m_cocoaNSWindow setFrame: newFrameRect display: NO];
}
void wxTopLevelWindowCocoa::DoMoveWindow(int x, int y, int width, int height)