Skip to content

Instantly share code, notes, and snippets.

@statonjr
Created January 17, 2011 22:25
Show Gist options
  • Save statonjr/783613 to your computer and use it in GitHub Desktop.
Save statonjr/783613 to your computer and use it in GitHub Desktop.
// In this case, we want the window from Cib to become our full browser window
[theWindow setFullBridge:YES];
// Instantiate the LayoutManager
[LayoutManager sharedManager];
// TODO: document
var SharedLayoutManager = nil;
@implementation LayoutManager : CPObject
{
}
+ (LayoutManager) sharedManager
{
if (!SharedLayoutManager) {
SharedLayoutManager = [[LayoutManager alloc] init];
// LayoutManager listens for CPWindowShouldCloseNotification
// Each window controller must implement this to have its window saved
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(saveWindowInfo:) name:@"CPWindowShouldCloseNotification" object:nil];
}
return SharedLayoutManager;
}
- (id)init
{
return SharedLayoutManager;
}
+ (void)saveWindowInfo:(CPNotification)aNotification
{
// This window data is in [aNotification object]
console.log("[LayoutManager saveWindowInfo] window closing: ", [aNotification object]);
// TODO: Save window data to server
}
@end
- (void)windowShouldClose:(id)aWindow
{
if (timer) {
[timer invalidate];
[currentTimeTimer invalidate];
[aWindow close];
}
// WindowController posts this notification for LayoutManager and sends the window as the object
[[CPNotificationCenter defaultCenter] postNotificationName:@"CPWindowShouldCloseNotification" object:aWindow];
SharedSymbolQuickViewWindowController = nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment