d6833fcd1888e08f2733731b171313c22d465417
[enjoyable.git] / TargetToggleMouseScope.m
1 //
2 // TargetToggleMouseScope.m
3 // Enjoy
4 //
5 // Created by Yifeng Huang on 7/28/12.
6 // Copyright (c) 2012 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "TargetToggleMouseScope.h"
10
11 #import "ApplicationController.h"
12 #import "JoystickController.h"
13
14 @implementation TargetToggleMouseScope
15
16 -(NSString*) stringify {
17 return [[NSString alloc] initWithFormat: @"mtoggle"];
18 }
19
20 +(TargetToggleMouseScope*) unstringifyImpl: (NSArray*) comps {
21 NSParameterAssert([comps count] == 1);
22 TargetToggleMouseScope* target = [[TargetToggleMouseScope alloc] init];
23 return target;
24 }
25
26 - (void)trigger {
27 // FIXME: It's hacky to get at the controller this way, but it's
28 // also hacky to pass it. Shouldn't need to do either.
29 ApplicationController *ac = [NSApplication sharedApplication].delegate;
30 JoystickController *jc = ac.jsController;
31 [jc setFrontWindowOnly: ![jc frontWindowOnly]];
32 printf("Front window only: %d\n", [jc frontWindowOnly]);
33 }
34
35 @end