mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 12:30:47 +00:00
* 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:
parent
df87a9f362
commit
e8d2648aca
9 changed files with 282 additions and 83 deletions
|
@ -31,6 +31,7 @@
|
|||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSIndexSet.h>
|
||||
#import <Foundation/NSKeyValueObserving.h>
|
||||
#import <Foundation/NSPredicate.h>
|
||||
#import <Foundation/NSSortDescriptor.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
@ -46,7 +47,7 @@
|
|||
{
|
||||
if (self == [NSArrayController class])
|
||||
{
|
||||
[self exposeBinding: @"contentArray"];
|
||||
[self exposeBinding: NSContentArrayBinding];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +55,7 @@
|
|||
{
|
||||
if ((self = [super initWithContent: content]) != nil)
|
||||
{
|
||||
_arranged_objects = [content copy];
|
||||
[self rearrangeObjects];
|
||||
[self setSelectsInsertedObjects: YES];
|
||||
}
|
||||
|
||||
|
@ -124,6 +125,12 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void) setContent: (id)content
|
||||
{
|
||||
[super setContent: content];
|
||||
[self rearrangeObjects];
|
||||
}
|
||||
|
||||
- (void) insert: (id)sender
|
||||
{
|
||||
id new = [self newObject];
|
||||
|
@ -334,7 +341,9 @@
|
|||
|
||||
- (void) rearrangeObjects
|
||||
{
|
||||
[self willChangeValueForKey: @"arrangedObjects"];
|
||||
ASSIGN(_arranged_objects, [self arrangeObjects: _content]);
|
||||
[self didChangeValueForKey: @"arrangedObjects"];
|
||||
}
|
||||
|
||||
- (void) setSortDescriptors: (NSArray*)desc
|
||||
|
@ -360,15 +369,15 @@
|
|||
- (void) insertObject: (id)obj
|
||||
atArrangedObjectIndex: (NSUInteger)idx
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
// FIXME
|
||||
[self addObject: obj];
|
||||
}
|
||||
|
||||
- (void) insertObjects: (NSArray*)obj
|
||||
atArrangedObjectIndexes: (NSIndexSet*)idx
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
// FIXME
|
||||
[self addObjects: obj];
|
||||
}
|
||||
|
||||
- (void) removeObjectAtArrangedObjectIndex: (NSUInteger)idx
|
||||
|
@ -386,7 +395,7 @@ atArrangedObjectIndexes: (NSIndexSet*)idx
|
|||
withKeyPath: (NSString *)keyPath
|
||||
options: (NSDictionary *)options
|
||||
{
|
||||
if ([binding isEqual: @"contentArray"])
|
||||
if ([binding isEqual: NSContentArrayBinding])
|
||||
{
|
||||
GSKeyValueBinding *kvb;
|
||||
|
||||
|
@ -409,6 +418,18 @@ atArrangedObjectIndexes: (NSIndexSet*)idx
|
|||
}
|
||||
}
|
||||
|
||||
- (Class) valueClassForBinding: (NSString *)binding
|
||||
{
|
||||
if ([binding isEqual: NSContentArrayBinding])
|
||||
{
|
||||
return [NSArray class];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [super valueClassForBinding: binding];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
[super encodeWithCoder: coder];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue