Permalink
Browse files

Support NSValueBinding.

  • Loading branch information...
1 parent 7a6810a commit 885d772e20a660a8787e4bd2e1aa757fa637b3ac @mikeabdullah mikeabdullah committed Nov 16, 2011
Showing with 38 additions and 0 deletions.
  1. +3 −0 UKDockProgressIndicator.h
  2. +35 −0 UKDockProgressIndicator.m
@@ -32,6 +32,9 @@
on top of the app's icon in the dock. Use it just like an NSProgressIndicator.
You can even have it call through to another progress indicator if desired. */
+/* Supports NSValueBinding
+ */
+
@interface UKDockProgressIndicator : NSObject
{
double max;
@@ -43,6 +43,13 @@ - (id) init
return self;
}
+- (void)dealloc;
+{
+ [self unbind:NSValueBinding];
+
+ [super dealloc];
+}
+
- (void) release
{
[NSApp setApplicationIconImage: savedDockIcon];
@@ -158,4 +165,32 @@ -(void) updateDockTile
[NSApp setApplicationIconImage: dockIcon];
}
+#pragma mark Bindings
+
++ (void)initialize; { [self exposeBinding:NSValueBinding]; }
+
+- (id)valueForUndefinedKey:(NSString *)key;
+{
+ if ([key isEqualToString:NSValueBinding])
+ {
+ return [self valueForKey:@"doubleValue"];
+ }
+ else
+ {
+ return [super valueForUndefinedKey:key];
+ }
+}
+
+- (void)setValue:(id)value forUndefinedKey:(NSString *)key;
+{
+ if ([key isEqualToString:NSValueBinding])
+ {
+ return [self setValue:value forKey:@"doubleValue"];
+ }
+ else
+ {
+ return [super setValue:value forUndefinedKey:key];
+ }
+}
+
@end

0 comments on commit 885d772

Please sign in to comment.