Skip to content

Commit

Permalink
Indentation and brace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CodaFi committed Nov 15, 2012
1 parent b4418d3 commit 31c9842
Showing 1 changed file with 17 additions and 30 deletions.
47 changes: 17 additions & 30 deletions lib/UIKit/TUIPopover.m
Expand Up @@ -81,8 +81,7 @@ @implementation TUIPopover

@synthesize originalViewSize = _originalViewSize;

- (id)initWithContentViewController:(TUIViewController *)viewController
{
- (id)initWithContentViewController:(TUIViewController *)viewController {
self = [super init];
if (self == nil)
return nil;
Expand All @@ -97,16 +96,14 @@ - (id)initWithContentViewController:(TUIViewController *)viewController
#pragma mark -
#pragma mark Derived Properties

- (BOOL)shown
{
- (BOOL)shown {
return (self.popoverWindow.contentView != nil);
}

#pragma mark -
#pragma mark Showing

- (void)showRelativeToRect:(CGRect)positioningRect ofView:(TUIView *)positioningView preferredEdge:(CGRectEdge)preferredEdge
{
- (void)showRelativeToRect:(CGRect)positioningRect ofView:(TUIView *)positioningView preferredEdge:(CGRectEdge)preferredEdge {
if (self.shown)
return;

Expand Down Expand Up @@ -246,7 +243,7 @@ - (void)showRelativeToRect:(CGRect)positioningRect ofView:(TUIView *)positioning

CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:@"alphaValue"];
fadeInAnimation.duration = 0.3;
fadeInAnimation.tui_completionBlock = ^ {
fadeInAnimation.tui_completionBlock = ^{
self.animating = NO;
[self.contentViewController viewDidAppear:YES];

Expand All @@ -262,13 +259,11 @@ - (void)showRelativeToRect:(CGRect)positioningRect ofView:(TUIView *)positioning
#pragma mark -
#pragma mark Closing

- (void)close
{
- (void)close {
[self closeWithFadeoutDuration:TUIPopoverDefaultFadeoutDuration];
}

- (void)closeWithFadeoutDuration:(NSTimeInterval)duration
{
- (void)closeWithFadeoutDuration:(NSTimeInterval)duration {
if (self.animating)
return;

Expand All @@ -281,7 +276,7 @@ - (void)closeWithFadeoutDuration:(NSTimeInterval)duration

CABasicAnimation *fadeOutAnimation = [CABasicAnimation animationWithKeyPath:@"alphaValue"];
fadeOutAnimation.duration = duration;
fadeOutAnimation.tui_completionBlock = ^ {
fadeOutAnimation.tui_completionBlock = ^{
[self.popoverWindow.parentWindow removeChildWindow:self.popoverWindow];
[self.popoverWindow close];
self.popoverWindow.contentView = nil;
Expand All @@ -298,16 +293,14 @@ - (void)closeWithFadeoutDuration:(NSTimeInterval)duration
[self.popoverWindow.animator setAlphaValue:0.0];
}

- (IBAction)performClose:(id)sender
{
- (IBAction)performClose:(id)sender {
[self close];
}

#pragma mark -
#pragma mark Event Monitor

- (void)removeEventMonitor
{
- (void)removeEventMonitor {
[NSEvent removeMonitor:self.transientEventMonitor];
self.transientEventMonitor = nil;
}
Expand All @@ -330,8 +323,7 @@ @implementation TUIPopoverBackgroundView
@synthesize screenOriginRect = _screenOriginRect;
@synthesize popoverEdge = _popoverEdge;

+ (CGSize)sizeForBackgroundViewWithContentSize:(CGSize)contentSize popoverEdge:(CGRectEdge)popoverEdge
{
+ (CGSize)sizeForBackgroundViewWithContentSize:(CGSize)contentSize popoverEdge:(CGRectEdge)popoverEdge {
CGSize returnSize = contentSize;
if (popoverEdge == CGRectMaxXEdge || popoverEdge == CGRectMinXEdge) {
returnSize.width += TUIPopoverBackgroundViewArrowHeight;
Expand All @@ -345,8 +337,7 @@ + (CGSize)sizeForBackgroundViewWithContentSize:(CGSize)contentSize popoverEdge:(
return returnSize;
}

+ (CGRect)contentViewFrameForBackgroundFrame:(CGRect)backgroundFrame popoverEdge:(CGRectEdge)popoverEdge
{
+ (CGRect)contentViewFrameForBackgroundFrame:(CGRect)backgroundFrame popoverEdge:(CGRectEdge)popoverEdge {
CGRect returnFrame = NSInsetRect(backgroundFrame, 1.0, 1.0);
switch (popoverEdge) {
case CGRectMinXEdge:
Expand All @@ -370,15 +361,13 @@ + (CGRect)contentViewFrameForBackgroundFrame:(CGRect)backgroundFrame popoverEdge
return returnFrame;
}

+ (TUIPopoverBackgroundView *)backgroundViewForContentSize:(CGSize)contentSize popoverEdge:(CGRectEdge)popoverEdge originScreenRect:(CGRect)originScreenRect
{
+ (TUIPopoverBackgroundView *)backgroundViewForContentSize:(CGSize)contentSize popoverEdge:(CGRectEdge)popoverEdge originScreenRect:(CGRect)originScreenRect {
CGSize size = [self sizeForBackgroundViewWithContentSize:contentSize popoverEdge:popoverEdge];
TUIPopoverBackgroundView *returnView = [[self.class alloc] initWithFrame:NSMakeRect(0.0, 0.0, size.width, size.height) popoverEdge:popoverEdge originScreenRect:originScreenRect];
return returnView;
}

- (CGPathRef)newPopoverPathForEdge:(CGRectEdge)popoverEdge inFrame:(CGRect)frame
{
- (CGPathRef)newPopoverPathForEdge:(CGRectEdge)popoverEdge inFrame:(CGRect)frame {
CGRectEdge arrowEdge = [self arrowEdgeForPopoverEdge:popoverEdge];

CGRect contentRect = CGRectIntegral([[self class] contentViewFrameForBackgroundFrame:frame popoverEdge:self.popoverEdge]);
Expand Down Expand Up @@ -470,8 +459,8 @@ - (CGPathRef)newPopoverPathForEdge:(CGRectEdge)popoverEdge inFrame:(CGRect)frame

}

- (id)initWithFrame:(CGRect)frame popoverEdge:(CGRectEdge)popoverEdge originScreenRect:(CGRect)originScreenRect //originScreenRect is in the screen coordinate space
{
//originScreenRect is in the screen coordinate space
- (id)initWithFrame:(CGRect)frame popoverEdge:(CGRectEdge)popoverEdge originScreenRect:(CGRect)originScreenRect {
self = [super initWithFrame:frame];
if (self == nil)
return nil;
Expand Down Expand Up @@ -500,8 +489,7 @@ - (id)initWithFrame:(CGRect)frame popoverEdge:(CGRectEdge)popoverEdge originScre
return self;
}

- (void)updateMaskLayer
{
- (void)updateMaskLayer {
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
CGPathRef path = [self newPopoverPathForEdge:self.popoverEdge inFrame:self.bounds];
maskLayer.path = path;
Expand All @@ -513,8 +501,7 @@ - (void)updateMaskLayer

}

- (CGRectEdge)arrowEdgeForPopoverEdge:(CGRectEdge)popoverEdge
{
- (CGRectEdge)arrowEdgeForPopoverEdge:(CGRectEdge)popoverEdge {
CGRectEdge arrowEdge = CGRectMinYEdge;
switch (popoverEdge) {
case CGRectMaxXEdge:
Expand Down

0 comments on commit 31c9842

Please sign in to comment.