+ AssociateNSWindow(m_cocoaNSWindow);
+ if(need_debug) wxLogTrace(wxTRACE_COCOA_RetainRelease,wxT("wxTopLevelWindowCocoa=%p::SetNSWindow [cocoaNSWindow=%p retainCount]=%d"),this,cocoaNSWindow,[cocoaNSWindow retainCount]);
+}
+
+void wxTopLevelWindowCocoa::CocoaReplaceView(WX_NSView oldView, WX_NSView newView)
+{
+ if([m_cocoaNSWindow contentView] == (id)oldView)
+ [m_cocoaNSWindow setContentView:newView];
+}
+
+/*static*/ void wxTopLevelWindowCocoa::DeactivatePendingWindow()
+{
+ if(sm_cocoaDeactivateWindow)
+ sm_cocoaDeactivateWindow->wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignKey();
+ sm_cocoaDeactivateWindow = NULL;
+}
+
+void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeKey(void)
+{
+ DeactivatePendingWindow();
+ wxLogTrace(wxTRACE_COCOA,wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeKey"),this);
+ wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId());
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(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);
+}
+
+void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeMain(void)
+{
+ wxLogTrace(wxTRACE_COCOA,wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeMain"),this);