]> git.saurik.com Git - wxWidgets.git/commitdiff
support app activated and deactivated events, also bring back float_on_parent windows...
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 7 Mar 2011 20:26:40 +0000 (20:26 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 7 Mar 2011 20:26:40 +0000 (20:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67146 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/utils.mm

index f8926e800b6c41d574ecd2e57a876273367f4b2d..8d32b3a5c73f1093f20d0486e8de49adfca8366d 100644 (file)
@@ -127,6 +127,49 @@ void wxBell()
     return NO;
 }
 
+- (void)applicationDidBecomeActive:(NSNotification *)notification
+{
+    wxUnusedVar(notification);
+
+    for ( wxWindowList::const_iterator i = wxTopLevelWindows.begin(),
+         end = wxTopLevelWindows.end();
+         i != end;
+         ++i )
+    {
+        wxTopLevelWindow * const win = static_cast<wxTopLevelWindow *>(*i);
+        wxNonOwnedWindowImpl* winimpl = win ? win->GetNonOwnedPeer() : NULL;
+        WXWindow nswindow = win ? win->GetWXWindow() : nil;
+        
+        if ( nswindow && [nswindow hidesOnDeactivate] == NO && winimpl)
+            winimpl->RestoreWindowLevel();
+    }
+    if ( wxTheApp )
+        wxTheApp->SetActive( true , NULL ) ;
+}
+
+- (void)applicationWillResignActive:(NSNotification *)notification
+{
+    wxUnusedVar(notification);
+    for ( wxWindowList::const_iterator i = wxTopLevelWindows.begin(),
+         end = wxTopLevelWindows.end();
+         i != end;
+         ++i )
+    {
+        wxTopLevelWindow * const win = static_cast<wxTopLevelWindow *>(*i);
+        WXWindow nswindow = win ? win->GetWXWindow() : nil;
+        
+        if ( nswindow && [nswindow level] == kCGFloatingWindowLevel && [nswindow hidesOnDeactivate] == NO )
+            [nswindow setLevel:kCGNormalWindowLevel];
+    }
+}
+
+- (void)applicationDidResignActive:(NSNotification *)notification
+{
+    wxUnusedVar(notification);
+    if ( wxTheApp )
+        wxTheApp->SetActive( false , NULL ) ;
+}
+
 @end
 
 /*