Re-import exported files.
[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 *)serializationCode {
17 return @"mtoggle";
18 }
19
20 - (NSDictionary *)serialize {
21 return @{ @"type": @"mtoggle" };
22 }
23
24 + (Target *)targetDeserialize:(NSDictionary *)serialization
25 withConfigs:(NSArray *)configs {
26 TargetToggleMouseScope *target = [[TargetToggleMouseScope alloc] init];
27 return target;
28 }
29 - (void)trigger {
30 // FIXME: It's hacky to get at the controller this way, but it's
31 // also hacky to pass it. Shouldn't need to do either.
32 ApplicationController *ac = [NSApplication sharedApplication].delegate;
33 JoystickController *jc = ac.jsController;
34 [jc setFrontWindowOnly: ![jc frontWindowOnly]];
35 printf("Front window only: %d\n", [jc frontWindowOnly]);
36 }
37
38 @end