aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/BWToolkitFramework.framework/BWSplitViewInspectorAutosizingView.m
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2009-12-20 01:19:52 +0000
committeravenjamin <avenjamin@gmail.com>2009-12-20 01:19:52 +0000
commitea1b48967ce34718d2645c4a30fab6b67e66f9fa (patch)
treea51ebe2f74a0c8e6c89f085df4240336c98aedf7 /Frameworks/BWToolkitFramework.framework/BWSplitViewInspectorAutosizingView.m
parentc25a2f4561a4cde2d2d9a431cd941704d79bb428 (diff)
downloadsequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.tar.gz
sequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.tar.bz2
sequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.zip
- Updating Growl to 1.2
- Updating BWToolkit to 1.2.2 - Changed BWToolkit from building it ourselves to just include the latest release of the framework - Changed build settings to build 32 and 64 universal binaries - Changed compiler to Clang
Diffstat (limited to 'Frameworks/BWToolkitFramework.framework/BWSplitViewInspectorAutosizingView.m')
-rw-r--r--Frameworks/BWToolkitFramework.framework/BWSplitViewInspectorAutosizingView.m171
1 files changed, 0 insertions, 171 deletions
diff --git a/Frameworks/BWToolkitFramework.framework/BWSplitViewInspectorAutosizingView.m b/Frameworks/BWToolkitFramework.framework/BWSplitViewInspectorAutosizingView.m
deleted file mode 100644
index 72d64f4a..00000000
--- a/Frameworks/BWToolkitFramework.framework/BWSplitViewInspectorAutosizingView.m
+++ /dev/null
@@ -1,171 +0,0 @@
-//
-// BWSplitViewInspectorAutosizingView.m
-// BWToolkit
-//
-// Created by Brandon Walkin (www.brandonwalkin.com)
-// All code is provided under the New BSD license.
-//
-
-#import "BWSplitViewInspectorAutosizingView.h"
-#import "BWSplitViewInspectorAutosizingButtonCell.h"
-
-@implementation BWSplitViewInspectorAutosizingView
-
-@synthesize splitView;
-
-- (id)initWithFrame:(NSRect)frameRect
-{
- if (self = [super initWithFrame:frameRect])
- {
- buttons = [[NSMutableArray alloc] init];
- }
- return self;
-}
-
-- (void)drawRect:(NSRect)aRect
-{
- aRect = self.bounds;
-
- if ([[self subviews] count] > 0)
- {
- [[NSColor windowBackgroundColor] set];
- NSRectFill(aRect);
- }
-}
-
-- (BOOL)isFlipped
-{
- return YES;
-}
-
-- (BOOL)isVertical
-{
- return [splitView isVertical];
-}
-
-- (void)layoutButtons
-{
- // Remove existing buttons
- [buttons removeAllObjects];
- while ([[self subviews] count] > 0)
- {
- [[[self subviews] objectAtIndex:0] removeFromSuperview];
- }
-
- // Create new buttons and draw them
- float x, y;
- int numberOfSubviews = [[splitView subviews] count];
-
- for (int i = 0; i < numberOfSubviews; i++)
- {
- NSRect buttonRect = NSZeroRect;
-
- if ([splitView isVertical])
- {
- if (i != numberOfSubviews - 1)
- buttonRect = NSMakeRect(x, 0, floorf((self.bounds.size.width + numberOfSubviews) / numberOfSubviews), self.bounds.size.height);
- else
- buttonRect = NSMakeRect(x, 0, self.bounds.size.width - x, self.bounds.size.height);
- }
-
- if ([splitView isVertical] == NO)
- {
- if (i != numberOfSubviews - 1)
- buttonRect = NSMakeRect(0, y, self.bounds.size.width, floorf((self.bounds.size.height + numberOfSubviews) / numberOfSubviews));
- else
- buttonRect = NSMakeRect(0, y, self.bounds.size.width, self.bounds.size.height - y);
- }
-
- NSButton *subviewButton = [[[NSButton alloc] initWithFrame:buttonRect] autorelease];
- [subviewButton setCell:[[[BWSplitViewInspectorAutosizingButtonCell alloc] initTextCell:@""] autorelease]];
- [subviewButton setTarget:self];
- [subviewButton setAction:@selector(updateValues:)];
- [subviewButton setTag:i];
-
- // Make the new buttons represent whether the subviews are set to resize or not
- if ([splitView isVertical])
- {
- if ([[[splitView subviews] objectAtIndex:i] autoresizingMask] & NSViewWidthSizable)
- [subviewButton setIntValue:1];
- }
- else
- {
- if ([[[splitView subviews] objectAtIndex:i] autoresizingMask] & NSViewHeightSizable)
- [subviewButton setIntValue:1];
- }
-
- if ([splitView isVertical] && numberOfSubviews < 6 || ![splitView isVertical] && numberOfSubviews < 4)
- [self addSubview:subviewButton];
-
- [buttons addObject:subviewButton];
-
- x += buttonRect.size.width - 1;
- y += buttonRect.size.height - 1;
- }
-
- // At least 1 subview must be resizable, so if none of the subviews are set to resize, then we'll set all subviews to resize (which will make it the default state)
- BOOL resizableViewExists = NO;
- for (NSButton *button in buttons)
- {
- if ([button intValue] == 1)
- resizableViewExists = YES;
- }
-
- if (resizableViewExists == NO)
- {
- for (NSButton *button in buttons)
- {
- [button setIntValue:1];
-
- NSView *subviewForButton = [[splitView subviews] objectAtIndex:[button tag]];
- int mask = [subviewForButton autoresizingMask];
-
- if ([splitView isVertical])
- [subviewForButton setAutoresizingMask:(mask | NSViewWidthSizable)];
- else
- [subviewForButton setAutoresizingMask:(mask | NSViewHeightSizable)];
- }
- }
-}
-
-- (void)updateValues:(id)sender
-{
- // Make sure there is always at least one resizable view
- NSView *subviewForSender = [[splitView subviews] objectAtIndex:[sender tag]];
-
- BOOL resizableViewExists = NO;
- for (NSButton *button in buttons)
- {
- if ([button intValue] == 1)
- resizableViewExists = YES;
- }
-
- if (resizableViewExists == NO)
- [sender setIntValue:1];
-
- // Set the autorezising mask on the subview according to the button state
- int mask = [subviewForSender autoresizingMask];
-
- if ([splitView isVertical])
- {
- if ([sender intValue] == 1)
- [subviewForSender setAutoresizingMask:(mask | NSViewWidthSizable)];
- else
- [subviewForSender setAutoresizingMask:(mask & ~NSViewWidthSizable)];
- }
- else
- {
- if ([sender intValue] == 1)
- [subviewForSender setAutoresizingMask:(mask | NSViewHeightSizable)];
- else
- [subviewForSender setAutoresizingMask:(mask & ~NSViewHeightSizable)];
- }
-}
-
-- (void)dealloc
-{
- [buttons release];
- [super dealloc];
-}
-
-@end \ No newline at end of file