cog/Application/InvertedToolbarWindow.m

64 lines
1.3 KiB
Matlab
Raw Normal View History

2007-11-01 01:53:52 +00: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-11-01 02:15:14 +00:00
if (contentHidden) //Show
{
2007-11-01 01:53:52 +00:00
NSRect newFrame = [self frame];
newFrame.origin.y -= contentHeight;
newFrame.size.height += contentHeight;
[[self contentView] resizeSubviewsWithOldSize:NSMakeSize(contentWidth, 0)];
2007-11-01 01:53:52 +00:00
[self setFrame:newFrame display:YES animate:YES];
[[self contentView] setAutoresizesSubviews:YES];
2007-11-01 01:53:52 +00:00
[self setShowsResizeIndicator:YES];
}
2007-11-01 02:15:14 +00:00
else //Hide
{
2007-11-01 01:53:52 +00:00
NSRect newFrame = [self frame];
contentWidth = [[self contentView] bounds].size.width;
2007-11-01 01:53:52 +00:00
contentHeight = [[self contentView] bounds].size.height;
newFrame.origin.y += contentHeight;
newFrame.size.height -= contentHeight;
[self setShowsResizeIndicator:NO];
2007-11-01 02:15:14 +00:00
[[self contentView] setAutoresizesSubviews:NO];
2007-11-01 01:53:52 +00: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