mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-12 13:41:29 +00:00
New: added method closeAllPlatformWindows in CPPlatform
Added the method closeAllPlatformWindows in CPPlatform. This platform close all platform windows of the application (except the main one). This method is now used when reloading or leaving a cappuccino application, the application will now close every external window openend by the application.
This commit is contained in:
@@ -48,10 +48,13 @@ var screenNeedsInitialization = NO,
|
||||
document.documentElement.style.overflow = "hidden";
|
||||
|
||||
if ([CPPlatform isBrowser])
|
||||
{
|
||||
window.onunload = function()
|
||||
{
|
||||
[self closeAllPlatformWindows];
|
||||
[CPApp terminate:nil];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)isBrowser
|
||||
@@ -138,4 +141,18 @@ var screenNeedsInitialization = NO,
|
||||
object:self];
|
||||
}
|
||||
|
||||
+ (void)closeAllPlatformWindows
|
||||
{
|
||||
var platformWindows = [CPPlatformWindow visiblePlatformWindows],
|
||||
primaryPlatformWindow = [CPPlatformWindow primaryPlatformWindow],
|
||||
platformWindowEnumerator = [platformWindows objectEnumerator],
|
||||
platformWindow = nil;
|
||||
|
||||
while ((platformWindow = [platformWindowEnumerator nextObject]) !== nil)
|
||||
{
|
||||
if (platformWindow != primaryPlatformWindow)
|
||||
[platformWindow orderOut:self];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user