X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e08efb8dd9d9af576baec04aa77a7ea4bd31de3b..4fe9efc1b937af4f1b4f5da545de9f24464fa01b:/src/cocoa/toplevel.mm?ds=inline diff --git a/src/cocoa/toplevel.mm b/src/cocoa/toplevel.mm index 3b5bf13131..fa9ffc308c 100644 --- a/src/cocoa/toplevel.mm +++ b/src/cocoa/toplevel.mm @@ -128,8 +128,20 @@ void wxTopLevelWindowCocoa::CocoaReplaceView(WX_NSView oldView, WX_NSView newVie [m_cocoaNSWindow setContentView:newView]; } -void wxTopLevelWindowCocoa::Cocoa_wxMenuItemAction(wxMenuItem& item) +void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeKey(void) { + wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeKey",this); + wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId()); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); +} + +void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignKey(void) +{ + wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignKey",this); + wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId()); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); } void wxTopLevelWindowCocoa::Cocoa_close(void) @@ -142,7 +154,7 @@ void wxTopLevelWindowCocoa::Cocoa_close(void) wxTheApp->CocoaInstallRequestedIdleHandler(); } -bool wxTopLevelWindowCocoa::Cocoa_windowShouldClose() +bool wxTopLevelWindowCocoa::CocoaDelegate_windowShouldClose() { return wxWindowBase::Close(false); } @@ -177,7 +189,16 @@ bool wxTopLevelWindowCocoa::Show(bool show) { wxAutoNSAutoreleasePool pool; if(show) + { + // Send the window a size event because wxWindows apps expect it + // NOTE: This should really only be done the first time a window + // is shown. I doubt this will cause any problems though. + wxSizeEvent event(GetSize(), GetId()); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); + [m_cocoaNSWindow makeKeyAndOrderFront:m_cocoaNSWindow]; + } else [m_cocoaNSWindow orderOut:m_cocoaNSWindow]; return true; @@ -239,7 +260,7 @@ void wxTopLevelWindowCocoa::CocoaSetWxWindowSize(int width, int height) void wxTopLevelWindowCocoa::DoMoveWindow(int x, int y, int width, int height) { - wxLogDebug("wxTopLevelWindow=%p::DoMoveWindow(%d,%d,%d,%d)",this,x,y,width,height); +// wxLogDebug("wxTopLevelWindow=%p::DoMoveWindow(%d,%d,%d,%d)",this,x,y,width,height); NSRect cocoaRect = NSMakeRect(x,y,width,height); [m_cocoaNSWindow setFrame: cocoaRect display:NO]; @@ -252,7 +273,7 @@ void wxTopLevelWindowCocoa::DoGetSize(int *w, int *h) const *w=(int)cocoaRect.size.width; if(h) *h=(int)cocoaRect.size.height; - wxLogDebug("wxTopLevelWindow=%p::DoGetSize = (%d,%d)",this,(int)cocoaRect.size.width,(int)cocoaRect.size.height); +// wxLogDebug("wxTopLevelWindow=%p::DoGetSize = (%d,%d)",this,(int)cocoaRect.size.width,(int)cocoaRect.size.height); } void wxTopLevelWindowCocoa::DoGetPosition(int *x, int *y) const @@ -262,6 +283,6 @@ void wxTopLevelWindowCocoa::DoGetPosition(int *x, int *y) const *x=(int)cocoaRect.origin.x; if(y) *y=(int)cocoaRect.origin.y; - wxLogDebug("wxTopLevelWindow=%p::DoGetPosition = (%d,%d)",this,(int)cocoaRect.origin.x,(int)cocoaRect.origin.y); +// wxLogDebug("wxTopLevelWindow=%p::DoGetPosition = (%d,%d)",this,(int)cocoaRect.origin.x,(int)cocoaRect.origin.y); }