From c107c67ba787e6fa2058964d7ecf99a8e1953022 Mon Sep 17 00:00:00 2001 From: vspader <unknown> Date: Sun, 22 Feb 2009 11:22:35 -0800 Subject: [PATCH] Added dual window classes. --- Application/DualWindow.h | 21 +++++++++++++++ Application/DualWindow.m | 55 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 Application/DualWindow.h create mode 100644 Application/DualWindow.m diff --git a/Application/DualWindow.h b/Application/DualWindow.h new file mode 100644 index 000000000..48e32e4f7 --- /dev/null +++ b/Application/DualWindow.h @@ -0,0 +1,21 @@ +// +// InvertedToolbarWindow.h +// Cog +// +// Created by Vincent Spader on 10/31/07. +// Copyright 2007 __MyCompanyName__. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + + +@interface DualWindow : NSWindow { + IBOutlet DualWindow *otherWindow; +} + +- (void)showWindow; + +- (BOOL)isHidden; +- (void)setHidden:(BOOL)h; + +@end diff --git a/Application/DualWindow.m b/Application/DualWindow.m new file mode 100644 index 000000000..a61584221 --- /dev/null +++ b/Application/DualWindow.m @@ -0,0 +1,55 @@ +// +// 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; +} + +- (NSString *)hiddenDefaultsKey +{ + if ([self frameAutosaveName]) + { + return [[self frameAutosaveName] stringByAppendingString:@" Window Content Height"]; + } + + 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 showWindow]; +} + +- (void)showWindow +{ + [otherWindow close]; + [self makeKeyAndOrderFront:self]; +} + +@end