support app activated and deactivated events, also bring back float_on_parent windows to normal level on deactivate to avoid behaving like stay_on_top
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67146 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user