diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index 23fbf5b1e..6d38c32dc 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -23,6 +23,7 @@ @import "CPFont.j" @import "CPShadow.j" @import "CPView.j" +@import "CPKeyValueBinding.j" #include "Platform/Platform.h" @@ -118,6 +119,19 @@ var CPControlBlackColor = [CPColor blackColor]; CPString _currentBackgroundColorName; } ++ (void)initialize +{ + [self exposeBinding:"value"]; +} + ++ (BOOL)automaticallyNotifiesObserversForKey:(CPString)aKey +{ + if (aKey === @"value") + return NO; + + return YES; +} + - (id)initWithFrame:(CGRect)aFrame { self = [super initWithFrame:aFrame]; @@ -478,7 +492,9 @@ var CPControlBlackColor = [CPColor blackColor]; */ - (void)setObjectValue:(id)anObject { + [self willChangeValueForKey:@"value"]; _value = anObject; + [self didChangeValueForKey:@"value"]; } /*! diff --git a/Foundation/CPController.j b/Foundation/CPController.j deleted file mode 100644 index 2271f60b7..000000000 --- a/Foundation/CPController.j +++ /dev/null @@ -1,80 +0,0 @@ -// -// CPController.j -// AppKit -// -// Created by Ross Boucher 1/15/09 -// Copyright 280 North -// -// Adapted from GNUStep -// Copyright (C) 2007 Free Software Foundation, Inc -// Released under the LGPL. -// - -var CPControllerDeclaredKeysKey = @"CPControllerDeclaredKeysKey"; - -@implementation CPController : CPObject -{ - CPArray _editors; - CPArray _declaredKeys; -} - -- (id)init -{ - self = [super init]; - - if (self) - { - _editors = []; - _declaredKeys = []; - } - - return self; -} - -- (void)encodeWithCoder:(CPCoder)aCoder -{ - [aCoder encodeObject:_declaredKeys forKey:CPControllerDeclaredKeysKey]; -} - -- (id)initWithCoder:(CPCoder)aDecoder -{ - self = [self init]; - - if (self) - _declaredKeys = [aDecoder decodeObjectForKey:CPControllerDeclaredKeysKey] || _declaredKeys; - - return nil; -} - -- (BOOL)isEditing -{ - return [_editors count] > 0; -} - -- (BOOL)commitEditing -{ - for (var i=0, count=_editors.length; i