PageRenderTime 27ms CodeModel.GetById 14ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/AppKit/GTMKeyValueAnimation.m

http://macfuse.googlecode.com/
Objective C | 52 lines | 27 code | 9 blank | 16 comment | 1 complexity | bd91bf6a95a0de4639f49497a05fc9ec MD5 | raw file
 1//
 2//  GTMKeyValueAnimation.m
 3//  Copyright 2011 Google Inc.
 4//
 5//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
 6//  use this file except in compliance with the License.  You may obtain a copy
 7//  of the License at
 8//
 9//  http://www.apache.org/licenses/LICENSE-2.0
10//
11//  Unless required by applicable law or agreed to in writing, software
12//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14//  License for the specific language governing permissions and limitations under
15//  the License.
16//
17
18#import "GTMKeyValueAnimation.h"
19
20
21@implementation GTMKeyValueAnimation
22
23- (id)initWithTarget:(id)target keyPath:(NSString*)keyPath {
24  if ((self = [super init])) {
25    target_ = [target retain];
26    keyPath_ = [keyPath copy];
27    [self setAnimationBlockingMode:NSAnimationNonblocking];
28  }
29  return self;
30}
31
32- (void)dealloc {
33  [target_ release];
34  [keyPath_ release];
35  [super dealloc];
36}
37
38- (void)setCurrentProgress:(NSAnimationProgress)progress {
39  [super setCurrentProgress:progress];
40  [target_ setValue:[NSNumber numberWithDouble:[self currentValue]]
41         forKeyPath:keyPath_];
42}
43
44- (id)target {
45  return target_;
46}
47
48- (NSString *)keyPath {
49  return keyPath_;
50}
51
52@end