cog/Window/DualWindow.m

66 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:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
{
self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
if (self)
{
}
return self;
}
- (void)awakeFromNib
{
if (![self isHidden])
{
[self show];
}
}
2009-02-22 19:22:35 +00:00
- (NSString *)hiddenDefaultsKey
{
if ([self frameAutosaveName])
{
return [[self frameAutosaveName] stringByAppendingString:@" Window Hidden"];
2009-02-22 19:22:35 +00:00
}
return nil;
}
- (BOOL)isHidden
{
return [[NSUserDefaults standardUserDefaults] boolForKey:[self hiddenDefaultsKey]];
}
- (void)setHidden:(BOOL)h
{
[[NSUserDefaults standardUserDefaults] setBool:h forKey:[self hiddenDefaultsKey]];
}
- (void)toggleToolbarShown:(id)sender
{
[otherWindow show];
2009-02-22 19:22:35 +00:00
}
- (void)show
2009-02-22 19:22:35 +00:00
{
[self setHidden:NO];
[otherWindow setHidden:YES];
2009-02-22 19:22:35 +00:00
[otherWindow close];
[self makeKeyAndOrderFront:self];
}
@end