Forked Enjoy, mouse movement
[enjoyable.git] / JSActionButton.m
diff --git a/JSActionButton.m b/JSActionButton.m
new file mode 100644 (file)
index 0000000..98a186a
--- /dev/null
@@ -0,0 +1,31 @@
+//
+//  JSActionButton.m
+//  Enjoy
+//
+//  Created by Sam McCall on 5/05/09.
+//
+
+@implementation JSActionButton
+
+@synthesize max, active;
+
+-(id)initWithIndex: (int)newIndex andName: (NSString *)newName {
+       if(self= [ super init]) {
+               subActions = NULL;
+               index = newIndex;
+               name = [[NSString alloc] initWithFormat: @"Button %d %@", (index+1), newName];
+       }
+       return self;
+}
+
+-(id) findSubActionForValue: (IOHIDValueRef) val {
+       if(IOHIDValueGetIntegerValue(val) == max)
+               return self;
+       return NULL;
+}
+
+-(void) notifyEvent: (IOHIDValueRef) value {
+       active = IOHIDValueGetIntegerValue(value) == max;
+}
+
+@end