Cog/Application/InvertedToolbarWindow.m

62 lines
1.2 KiB
Mathematica
Raw Normal View History

2007-10-31 22:53:52 -03:00
//
// InvertedToolbarWindow.m
// Cog
//
// Created by Vincent Spader on 10/31/07.
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
#import "InvertedToolbarWindow.h"
@implementation InvertedToolbarWindow
- (void)awakeFromNib
{
contentHidden = NO;
}
- (void)toggleToolbarShown:(id)sender
{
2007-10-31 23:15:14 -03:00
if (contentHidden) //Show
{
2007-10-31 22:53:52 -03:00
NSRect newFrame = [self frame];
newFrame.origin.y -= contentHeight;
newFrame.size.height += contentHeight;
[self setFrame:newFrame display:YES animate:YES];
[self setShowsResizeIndicator:YES];
2007-10-31 23:15:14 -03:00
[[self contentView] setAutoresizesSubviews:YES];
2007-10-31 22:53:52 -03:00
}
2007-10-31 23:15:14 -03:00
else //Hide
{
2007-10-31 22:53:52 -03:00
NSRect newFrame = [self frame];
contentHeight = [[self contentView] bounds].size.height;
newFrame.origin.y += contentHeight;
newFrame.size.height -= contentHeight;
[self setShowsResizeIndicator:NO];
2007-10-31 23:15:14 -03:00
[[self contentView] setAutoresizesSubviews:NO];
2007-10-31 22:53:52 -03:00
[self setFrame:newFrame display:YES animate:YES];
}
contentHidden = !contentHidden;
}
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize {
if (contentHidden) {
proposedFrameSize.height = [self frame].size.height;
}
return proposedFrameSize;
}
@end