Skip to content

Commit

Permalink
Added convenience method. Updated README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizage committed Jan 8, 2011
1 parent 4b5ff7e commit cc6ff94
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions NSWindowFlipper.h
Expand Up @@ -21,6 +21,7 @@

@interface NSWindow (Flipper)

-(void)flipToWindow:(NSWindow*)to withDuration:(CFTimeInterval)duration shadowed:(BOOL)shadowed;
-(void)flipWithArguments:(FlipArguments*)flipArguments;

@end
8 changes: 7 additions & 1 deletion NSWindowFlipper.m
Expand Up @@ -84,8 +84,14 @@ -(id)autorelease

@implementation NSWindow (Flipper)

-(void)flipToWindow:(NSWindow*)to withDuration:(CFTimeInterval)duration shadowed:(BOOL)shadowed
{
FlipArguments* args = [[FlipArguments alloc] initWithToWindow:to flipDuration:duration shadowed:shadowed];
[self flipWithArguments:args];
[args release];
}

-(void)flipWithArguments:(FlipArguments*)flipArguments;
-(void)flipWithArguments:(FlipArguments*)flipArguments
{
NSWindow* toWindow = [flipArguments toWindow];
CFTimeInterval duration = [flipArguments duration];
Expand Down
10 changes: 9 additions & 1 deletion README
Expand Up @@ -5,6 +5,14 @@ Usage:
NSWindow* from = ...
NSWindow* to = ...


//To support performSelector:withObject:afterDelay:, use:

FlipArguments* flipArgs = [[FlipArguments alloc] initWithToWindow:to flipDuration:2.5 shadowed:NO];

[from flipWithArguments:flipArgs];
//0.0 is used to fire this on the next runloop iteration. This makes it so a button will be in its "pressed" state if you use a button to do the flip.
[from performSelector:@selector(flipWithArguments) withObject:flipArgs afterDelay:0.0];

//To execute the flip immediately, use:

[from flipToWindow:to withDuration:2.5 shadowed:NO];

0 comments on commit cc6ff94

Please sign in to comment.