BWToolkit copy / BWAnchoredButtonBarInspector.m

//
//  BWAnchoredButtonBarViewInspector.m
//  BWToolkit
//
//  Created by Brandon Walkin (www.brandonwalkin.com)
//  All code is provided under the New BSD license.
//

#import "BWAnchoredButtonBarInspector.h"

@implementation BWAnchoredButtonBarInspector

- (NSString *)viewNibName 
{
    return @"BWAnchoredButtonBarInspector";
}

- (void)refresh 
{
	[super refresh];
}

- (IBAction)selectMode1:(id)sender
{
	float xOrigin = matrix.frame.origin.x-1;
	float deltaX = fabsf(xOrigin - selectionView.frame.origin.x);
	float doubleSpaceMultiplier = 1;
	
	if (deltaX > 65)
		doubleSpaceMultiplier = 1.5;
	
	float duration = 0.1*doubleSpaceMultiplier;
	
	[NSAnimationContext beginGrouping];
	[[NSAnimationContext currentContext] setDuration:(duration)];
	[[selectionView animator] setFrameOrigin:NSMakePoint(xOrigin,selectionView.frame.origin.y)];
	[NSAnimationContext endGrouping];
}

- (IBAction)selectMode2:(id)sender
{
	float xOrigin = matrix.frame.origin.x + NSWidth(matrix.frame) / matrix.numberOfColumns;
	float deltaX = fabsf(xOrigin - selectionView.frame.origin.x);
	float doubleSpaceMultiplier = 1;
	
	if (deltaX > 65)
		doubleSpaceMultiplier = 1.5;
	
	float duration = 0.1*doubleSpaceMultiplier;
	
	[NSAnimationContext beginGrouping];
	[[NSAnimationContext currentContext] setDuration:(duration)];
	[[selectionView animator] setFrameOrigin:NSMakePoint(xOrigin,selectionView.frame.origin.y)];
	[NSAnimationContext endGrouping];
}

- (IBAction)selectMode3:(id)sender
{
	float xOrigin = NSMaxX(matrix.frame) - NSWidth(matrix.frame) / matrix.numberOfColumns + matrix.numberOfColumns - 1;
	float deltaX = fabsf(xOrigin - selectionView.frame.origin.x);
	float doubleSpaceMultiplier = 1;
	
	if (deltaX > 65)
		doubleSpaceMultiplier = 1.5;
	
	float duration = 0.1*doubleSpaceMultiplier;
	
	[NSAnimationContext beginGrouping];
	[[NSAnimationContext currentContext] setDuration:(duration)];
	[[selectionView animator] setFrameOrigin:NSMakePoint(xOrigin,selectionView.frame.origin.y)];
	[NSAnimationContext endGrouping];
}

@end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.