/core/externals/update-engine/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. #import "GTMKeyValueAnimation.h"
  18. @implementation GTMKeyValueAnimation
  19. - (id)initWithTarget:(id)target keyPath:(NSString*)keyPath {
  20. if ((self = [super init])) {
  21. target_ = [target retain];
  22. keyPath_ = [keyPath copy];
  23. [self setAnimationBlockingMode:NSAnimationNonblocking];
  24. }
  25. return self;
  26. }
  27. - (void)dealloc {
  28. [target_ release];
  29. [keyPath_ release];
  30. [super dealloc];
  31. }
  32. - (void)setCurrentProgress:(NSAnimationProgress)progress {
  33. [super setCurrentProgress:progress];
  34. [target_ setValue:[NSNumber numberWithDouble:[self currentValue]]
  35. forKeyPath:keyPath_];
  36. }
  37. - (id)target {
  38. return target_;
  39. }
  40. - (NSString *)keyPath {
  41. return keyPath_;
  42. }
  43. @end