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