wxLogTrace(wxTRACE_COCOA,wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeKey"),this);
wxActivateEvent event(wxEVT_ACTIVATE, true, GetId());
event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
}
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignKey(void)
wxLogTrace(wxTRACE_COCOA,wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignKey"),this);
wxActivateEvent event(wxEVT_ACTIVATE, false, GetId());
event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
}
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeMain(void)
// is shown. I doubt this will cause any problems though.
wxSizeEvent event(GetSize(), GetId());
event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
[m_cocoaNSWindow makeKeyAndOrderFront:m_cocoaNSWindow];
}
{
// 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)