diff options
Diffstat (limited to 'SmartDeviceLink-iOS/SmartDeviceLink/SDLOnTouchEvent.m')
-rw-r--r-- | SmartDeviceLink-iOS/SmartDeviceLink/SDLOnTouchEvent.m | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLOnTouchEvent.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLOnTouchEvent.m new file mode 100644 index 000000000..e27305801 --- /dev/null +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLOnTouchEvent.m @@ -0,0 +1,60 @@ +// SDLOnTouchEvent.m +// +// Copyright (c) 2014 Ford Motor Company. All rights reserved. + +#import "SDLOnTouchEvent.h" + +#import "SDLNames.h" +#import "SDLTouchEvent.h" + +@implementation SDLOnTouchEvent + +-(id) init { + if (self = [super initWithName:NAMES_OnTouchEvent]) {} + return self; +} + +-(id) initWithDictionary:(NSMutableDictionary*) dict { + if (self = [super initWithDictionary:dict]) {} + return self; +} + +-(void) setType:(SDLTouchType*) type { + if (type != nil) { + [parameters setObject:type forKey:NAMES_type]; + } else { + [parameters removeObjectForKey:NAMES_type]; + } +} + +-(SDLTouchType*) type { + NSObject* obj = [parameters objectForKey:NAMES_type]; + if ([obj isKindOfClass:SDLTouchType.class]) { + return (SDLTouchType*)obj; + } else { + return [SDLTouchType valueOf:(NSString*)obj]; + } +} + +-(void) setEvent:(NSMutableArray*) event { + if (event != nil) { + [parameters setObject:event forKey:NAMES_event]; + } else { + [parameters removeObjectForKey:NAMES_event]; + } +} + +-(NSMutableArray*) event { + NSMutableArray* array = [parameters objectForKey:NAMES_event]; + if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLTouchEvent.class]) { + return array; + } else { + NSMutableArray* newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (NSDictionary* dict in array) { + [newList addObject:[[SDLTouchEvent alloc] initWithDictionary:(NSMutableDictionary*)dict]]; + } + return newList; + } +} + +@end |