App/MTKeyMapEntry.m

00001 //
00002 //  MTKeyMapEntry.m
00003 //  MacTrek
00004 //
00005 //  Created by Aqua on 21/04/2006.
00006 //  Copyright 2006 Luky Soft. All rights reserved.
00007 //
00008 
00009 #import "MTKeyMapEntry.h"
00010 
00011 
00012 @implementation MTKeyMapEntry
00013 
00014 - (id) init {
00015     self = [super init];
00016     if (self != nil) {
00017         action = 0;
00018         key = 0;
00019         modifierFlags = 0;
00020         description = nil;
00021         defaultKey = 0;
00022         defaultModifierFlags = 0;
00023     }
00024     return self;
00025 }
00026 
00027 - (id) initAction:(int) newAction 
00028           withKey:(char)newKey 
00029     modifierFlags:(unsigned int) newModifierFlags
00030       description:(NSString*)newDescription {
00031     
00032     self = [self init];
00033     
00034     action = newAction;
00035     key = newKey;
00036     modifierFlags = newModifierFlags;
00037     description = newDescription;
00038     [description retain];
00039     defaultKey = newKey;
00040     defaultModifierFlags = newModifierFlags; 
00041     
00042     return self;
00043 }
00044 
00045 - (id) initWithDictionairy:(NSDictionary*)dict {
00046     
00047     int          _action = [[dict valueForKey:@"action"] intValue]; // NSNumber
00048     char         _key    = [[dict valueForKey:@"key"] charValue];   // NSNumber
00049     unsigned int _flags  = [[dict valueForKey:@"flags"] intValue];  // NSNumber
00050     NSString    *_descr  = [dict valueForKey:@"description"];
00051     
00052     return [self initAction:_action 
00053                     withKey:_key 
00054               modifierFlags:_flags
00055                 description:_descr];
00056 }
00057 
00058 - (NSDictionary*) asDictionary {
00059     return [NSDictionary dictionaryWithObjectsAndKeys: 
00060         [NSNumber numberWithInt:action], @"action",
00061         [NSNumber numberWithChar:key], @"key",
00062         [NSNumber numberWithInt:modifierFlags], @"flags",
00063         description, @"description",
00064         nil];
00065 }
00066 
00067 - (int) action {
00068     return action;
00069 }
00070 
00071 - (char) key {
00072     return key;
00073 }
00074 
00075 - (unsigned int) modifierFlags {
00076     return modifierFlags;
00077 }
00078 
00079 - (char) defaultKey {
00080     return defaultKey;
00081 }
00082 - (unsigned int) defaultModifierFlags {
00083     return defaultModifierFlags;
00084 }
00085 
00086 - (NSString *)description {
00087     return description;
00088 }
00089 
00090 - (void) setAction:(int) newAction {
00091     action = newAction;
00092 }
00093 
00094 - (void) setKey:(char) newKey {
00095     key = newKey;
00096 }
00097 
00098 - (void) setModifierFlags:(unsigned int) newModifierFlags{
00099     modifierFlags = newModifierFlags;
00100 }
00101 
00102 
00103 @end

Generated on Sat Aug 26 21:14:07 2006 for MacTrek by  doxygen 1.4.7