cog/Window/DualWindow.m

55 lines
1.1 KiB
Matlab
Raw Normal View History

2009-02-22 19:22:35 +00:00
//
// InvertedToolbarWindow.m
// Cog
//
// Created by Vincent Spader on 10/31/07.
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
#import "DualWindow.h"
@implementation DualWindow
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
2009-02-22 19:22:35 +00:00
self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
if(self) {
2009-02-22 19:22:35 +00:00
}
2009-02-22 19:22:35 +00:00
return self;
}
- (void)awakeFromNib {
if(![self isHidden]) {
[self show];
}
}
- (NSString *)hiddenDefaultsKey {
if([self frameAutosaveName]) {
return [[self frameAutosaveName] stringByAppendingString:@" Window Hidden"];
2009-02-22 19:22:35 +00:00
}
2009-02-22 19:22:35 +00:00
return nil;
}
- (BOOL)isHidden {
2009-02-22 19:22:35 +00:00
return [[NSUserDefaults standardUserDefaults] boolForKey:[self hiddenDefaultsKey]];
}
- (void)setHidden:(BOOL)h {
2009-02-22 19:22:35 +00:00
[[NSUserDefaults standardUserDefaults] setBool:h forKey:[self hiddenDefaultsKey]];
}
- (void)toggleToolbarShown:(id)sender {
[otherWindow show];
2009-02-22 19:22:35 +00:00
}
- (void)show {
[self setHidden:NO];
[otherWindow setHidden:YES];
2009-02-22 19:22:35 +00:00
[otherWindow close];
[self makeKeyAndOrderFront:self];
}
@end