* Headers/AppKit/NSKeyValueBinding.h,

* Source/externs.m: Additional binding names.
* Source/GSBindingHelpers.h,
* Source/NSKeyValueBinding.m: Additional helper methods.
* Source/NSObjectController.m: Use helper methods.
* Source/NSArrayController.m: Signal when the arranged objects
change.
* Source/NSTableColumn.m,
* Source/NSTableView.m: First attempt at support for content
binding.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34923 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2012-03-12 12:24:17 +00:00
parent df87a9f362
commit e8d2648aca
9 changed files with 282 additions and 83 deletions

View file

@ -201,19 +201,22 @@
- (void) setContent: (id)content
{
NSMutableArray *selection;
if (content != _content)
{
NSMutableArray *selection;
ASSIGN(_content, content);
if (content)
{
selection = [[NSMutableArray alloc] initWithObjects: &content count: 1];
ASSIGN(_content, content);
if (content)
{
selection = [[NSMutableArray alloc] initWithObjects: &content count: 1];
}
else
{
selection = [[NSMutableArray alloc] init];
}
ASSIGN(_selection, selection);
RELEASE(selection);
}
else
{
selection = [[NSMutableArray alloc] init];
}
ASSIGN(_selection, selection);
RELEASE(selection);
}
- (void)bind: (NSString *)binding
@ -221,7 +224,7 @@
withKeyPath: (NSString *)keyPath
options: (NSDictionary *)options
{
if ([binding isEqual:NSContentObjectBinding])
if ([binding isEqual: NSContentObjectBinding])
{
GSKeyValueBinding *kvb;
@ -290,16 +293,13 @@
- (void) addObject: (id)obj
{
NSDictionary * bindingInfo = [self infoForBinding: NSContentObjectBinding];
GSKeyValueBinding *theBinding;
[self setContent: obj];
if (bindingInfo)
{
// Change the relationship of the object that our content is bound to.
id masterObject = [bindingInfo objectForKey: NSObservedObjectKey];
NSString * keyPath = [bindingInfo objectForKey: NSObservedKeyPathKey];
[masterObject setValue: obj forKeyPath: keyPath];
}
theBinding = [GSKeyValueBinding getBinding: NSContentObjectBinding
forObject: self];
if (theBinding != nil)
[theBinding reverseSetValueFor: @"content"];
}
- (void) remove: (id)sender
@ -314,16 +314,13 @@
{
if (obj == [self content])
{
NSDictionary * bindingInfo = [self infoForBinding: NSContentObjectBinding];
GSKeyValueBinding *theBinding;
[self setContent: nil];
if (bindingInfo)
{
// Change the relationship of the object that our content is bound to.
id masterObject = [bindingInfo objectForKey: NSObservedObjectKey];
NSString * keyPath = [bindingInfo objectForKey: NSObservedKeyPathKey];
[masterObject setValue: nil forKeyPath: keyPath];
}
theBinding = [GSKeyValueBinding getBinding: NSContentObjectBinding
forObject: self];
if (theBinding != nil)
[theBinding reverseSetValueFor: @"content"];
}
}