mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Update bindings
This commit is contained in:
parent
11714585a9
commit
e420ab54d0
3 changed files with 72 additions and 31 deletions
|
@ -46,7 +46,8 @@ APPKIT_EXPORT_CLASS
|
|||
NSString *_childrenKeyPath;
|
||||
NSString *_countKeyPath;
|
||||
NSString *_leafKeyPath;
|
||||
NSArray *_sortDescriptors;
|
||||
NSArray *_sort_descriptors;
|
||||
NSArray *_arranged_objects;
|
||||
BOOL _alwaysUsesMultipleValuesMarker;
|
||||
BOOL _avoidsEmptySelection;
|
||||
BOOL _preservesSelection;
|
||||
|
|
|
@ -158,6 +158,7 @@ static NSImage *unexpandable = nil;
|
|||
keyCallBacks = NSObjectMapKeyCallBacks;
|
||||
keyCallBacks.isEqual = NSOwnedPointerMapKeyCallBacks.isEqual;
|
||||
|
||||
[self exposeBinding: NSContentArrayBinding];
|
||||
[self exposeBinding: NSContentBinding];
|
||||
[self exposeBinding: NSSelectionIndexesBinding];
|
||||
[self exposeBinding: NSSortDescriptorsBinding];
|
||||
|
@ -697,7 +698,7 @@ static NSImage *unexpandable = nil;
|
|||
{
|
||||
GSKeyValueBinding *theBinding;
|
||||
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentBinding
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentArrayBinding
|
||||
forObject: self];
|
||||
|
||||
#define CHECK_REQUIRED_METHOD(selector_name) \
|
||||
|
@ -956,7 +957,7 @@ static NSImage *unexpandable = nil;
|
|||
CGFloat x_pos;
|
||||
GSKeyValueBinding *theBinding;
|
||||
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentBinding
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentArrayBinding
|
||||
forObject: self];
|
||||
|
||||
if (_dataSource == nil && theBinding == nil)
|
||||
|
@ -1974,7 +1975,7 @@ Also returns the child index relative to this parent. */
|
|||
|
||||
// If we have content binding the data source is used only
|
||||
// like a delegate
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentBinding
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentArrayBinding
|
||||
forObject: self];
|
||||
if (theBinding != nil)
|
||||
{
|
||||
|
@ -2085,7 +2086,7 @@ Also returns the child index relative to this parent. */
|
|||
{
|
||||
id sitem = (startitem == nil) ? (id)[NSNull null] : (id)startitem;
|
||||
GSKeyValueBinding *theBinding =
|
||||
[GSKeyValueBinding getBinding: NSContentBinding
|
||||
[GSKeyValueBinding getBinding: NSContentArrayBinding
|
||||
forObject: self];
|
||||
NSMutableArray *anarray = nil;
|
||||
NSInteger num = 0;
|
||||
|
@ -2130,11 +2131,11 @@ Also returns the child index relative to this parent. */
|
|||
}
|
||||
else
|
||||
{
|
||||
id source = [theBinding sourceValueFor: NSContentBinding];
|
||||
id source = [theBinding sourceValueFor: NSContentArrayBinding];
|
||||
NSArray *contentArray = nil;
|
||||
|
||||
// If sitem is NSNull then get the array..
|
||||
if (sitem == [NSNull null])
|
||||
if (sitem == [NSNull null] || sitem == nil)
|
||||
{
|
||||
contentArray = (NSArray *)[theBinding destinationValue];
|
||||
num = [contentArray count];
|
||||
|
|
|
@ -54,23 +54,34 @@
|
|||
|
||||
- (id) initWithContent: (id)content
|
||||
{
|
||||
NSLog(@"Content = %@", content);
|
||||
if ((self = [super initWithContent: content]) != nil)
|
||||
{
|
||||
_childrenKeyPath = nil;
|
||||
_countKeyPath = nil;
|
||||
_leafKeyPath = nil;
|
||||
_sortDescriptors = nil;
|
||||
_sort_descriptors = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
NSMutableArray *array = [[NSMutableArray alloc] init];
|
||||
|
||||
self = [self initWithContent: array];
|
||||
|
||||
RELEASE(array);
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_childrenKeyPath);
|
||||
RELEASE(_countKeyPath);
|
||||
RELEASE(_leafKeyPath);
|
||||
RELEASE(_sortDescriptors);
|
||||
RELEASE(_sort_descriptors);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -130,10 +141,28 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (NSArray*) arrangeObjects: (NSArray*)obj
|
||||
{
|
||||
NSArray *temp = obj;
|
||||
return [temp sortedArrayUsingDescriptors: _sort_descriptors];
|
||||
}
|
||||
|
||||
- (id) arrangedObjects
|
||||
{
|
||||
// FIXME
|
||||
return nil;
|
||||
if (_arranged_objects == nil)
|
||||
{
|
||||
[self rearrangeObjects];
|
||||
}
|
||||
return _arranged_objects;
|
||||
}
|
||||
|
||||
- (void) rearrangeObjects
|
||||
{
|
||||
[self willChangeValueForKey: @"arrangedObjects"];
|
||||
DESTROY(_arranged_objects);
|
||||
_arranged_objects = [[GSObservableArray alloc]
|
||||
initWithArray: [self arrangeObjects: _content]];
|
||||
[self didChangeValueForKey: @"arrangedObjects"];
|
||||
}
|
||||
|
||||
- (NSArray *) selectedObjects
|
||||
|
@ -156,7 +185,7 @@
|
|||
|
||||
- (NSArray*) sortDescriptors
|
||||
{
|
||||
return _sortDescriptors;
|
||||
return _sort_descriptors;
|
||||
}
|
||||
|
||||
- (NSString*) childrenKeyPath
|
||||
|
@ -174,15 +203,34 @@
|
|||
return _leafKeyPath;
|
||||
}
|
||||
|
||||
- (void) addChild: (id)sender
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
- (void) add: (id)sender
|
||||
{
|
||||
// FIXME
|
||||
[super add: sender];
|
||||
if ([self canAddChild])
|
||||
{
|
||||
id new = [self newObject];
|
||||
|
||||
[self addChild: new];
|
||||
RELEASE(new);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) addChild: (id)obj
|
||||
{
|
||||
GSKeyValueBinding *theBinding;
|
||||
|
||||
[self setContent: obj];
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentObjectBinding
|
||||
forObject: self];
|
||||
if (theBinding != nil)
|
||||
[theBinding reverseSetValueFor: @"content"];
|
||||
}
|
||||
|
||||
- (void) remove: (id)sender
|
||||
{
|
||||
if ([self canRemove])
|
||||
{
|
||||
[self removeObject: [self content]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) insertChild: (id)sender
|
||||
|
@ -205,11 +253,6 @@
|
|||
// FIXME
|
||||
}
|
||||
|
||||
- (void) rearrangeObjects
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
- (void) removeObjectAtArrangedObjectIndexPath: (NSIndexPath*)indexPath
|
||||
{
|
||||
// FIXME
|
||||
|
@ -225,12 +268,6 @@
|
|||
// FIXME
|
||||
}
|
||||
|
||||
- (void) remove: (id)sender
|
||||
{
|
||||
// FIXME
|
||||
[super remove: sender];
|
||||
}
|
||||
|
||||
- (void) setAlwaysUsesMultipleValuesMarker: (BOOL)flag
|
||||
{
|
||||
_alwaysUsesMultipleValuesMarker = flag;
|
||||
|
@ -249,7 +286,9 @@
|
|||
- (void) setContent: (id)content
|
||||
{
|
||||
// FIXME
|
||||
NSLog(@"in setContent... %@", content);
|
||||
[super setContent: content];
|
||||
[self rearrangeObjects];
|
||||
}
|
||||
|
||||
- (void) setCountKeyPath: (NSString*)path
|
||||
|
@ -274,7 +313,7 @@
|
|||
|
||||
- (void) setSortDescriptors: (NSArray*)descriptors
|
||||
{
|
||||
ASSIGN(_sortDescriptors, descriptors);
|
||||
ASSIGN(_sort_descriptors, descriptors);
|
||||
}
|
||||
|
||||
- (NSString*) childrenKeyPathForNode: (NSTreeNode*)node
|
||||
|
|
Loading…
Reference in a new issue