mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 22:10:58 +00:00
* Source/NSObjectController.m: Complete encoding/decoding methods.
* Headers/AppKit/NSArrayController.h, * Source/NSArrayController.m: Add some implementation to this class. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34904 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1f151a6e95
commit
107d5060b5
4 changed files with 316 additions and 94 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2012-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSObjectController.m: Complete encoding/decoding methods.
|
||||||
|
* Headers/AppKit/NSArrayController.h,
|
||||||
|
* Source/NSArrayController.m: Add some implementation to this
|
||||||
|
class.
|
||||||
|
|
||||||
2012-03-05 Eric Wasylishen <ewasylishen@gmail.com>
|
2012-03-05 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* Source/NSMenuItemCell.m (-titleRectForBounds:): Attempted fix
|
* Source/NSMenuItemCell.m (-titleRectForBounds:): Attempted fix
|
||||||
|
|
|
@ -31,21 +31,32 @@
|
||||||
|
|
||||||
#import <AppKit/NSObjectController.h>
|
#import <AppKit/NSObjectController.h>
|
||||||
|
|
||||||
#if OS_API_VERSION(100300,GS_API_LATEST)
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3,GS_API_LATEST)
|
||||||
|
|
||||||
@class NSArray;
|
@class NSArray;
|
||||||
|
@class NSMutableArray;
|
||||||
@class NSIndexSet;
|
@class NSIndexSet;
|
||||||
|
@class NSPredicate;
|
||||||
|
|
||||||
@interface NSArrayController : NSObjectController
|
@interface NSArrayController : NSObjectController
|
||||||
{
|
{
|
||||||
NSMutableArray *_arrange_objects;
|
NSMutableArray *_arranged_objects;
|
||||||
NSArray *_sort_descriptors;
|
|
||||||
NSIndexSet *_selection_indexes;
|
NSIndexSet *_selection_indexes;
|
||||||
BOOL _avoids_empty_Selection;
|
NSArray *_sort_descriptors;
|
||||||
BOOL _preserves_selection;
|
NSPredicate *_filter_predicate;
|
||||||
|
struct GSArrayControllerFlagsType {
|
||||||
|
unsigned always_uses_multiple_values_marker: 1;
|
||||||
|
unsigned automatically_rearranges_objects: 1;
|
||||||
|
unsigned avoids_empty_selection: 1;
|
||||||
|
unsigned clears_filter_predicate_on_insertion: 1;
|
||||||
|
unsigned preserves_selection: 1;
|
||||||
|
unsigned selects_inserted_objects: 1;
|
||||||
|
} _acflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) addObject: (id)obj;
|
||||||
- (void) addObjects: (NSArray*)obj;
|
- (void) addObjects: (NSArray*)obj;
|
||||||
|
- (void) removeObject: (id)obj;
|
||||||
- (void) removeObjects: (NSArray*)obj;
|
- (void) removeObjects: (NSArray*)obj;
|
||||||
- (BOOL) canInsert;
|
- (BOOL) canInsert;
|
||||||
- (void) insert: (id)sender;
|
- (void) insert: (id)sender;
|
||||||
|
@ -53,36 +64,50 @@
|
||||||
- (BOOL) addSelectedObjects: (NSArray*)obj;
|
- (BOOL) addSelectedObjects: (NSArray*)obj;
|
||||||
- (BOOL) addSelectionIndexes: (NSIndexSet*)idx;
|
- (BOOL) addSelectionIndexes: (NSIndexSet*)idx;
|
||||||
- (BOOL) setSelectedObjects: (NSArray*)obj;
|
- (BOOL) setSelectedObjects: (NSArray*)obj;
|
||||||
- (BOOL) setSelectionIndex: (unsigned int)idx;
|
- (BOOL) setSelectionIndex: (NSUInteger)idx;
|
||||||
- (BOOL) setSelectionIndexes: (NSIndexSet*)idx;
|
- (BOOL) setSelectionIndexes: (NSIndexSet*)idx;
|
||||||
- (BOOL) removeSelectedObjects: (NSArray*)obj;
|
- (BOOL) removeSelectedObjects: (NSArray*)obj;
|
||||||
- (BOOL) removeSelectionIndexes: (NSIndexSet*)idx;
|
- (BOOL) removeSelectionIndexes: (NSIndexSet*)idx;
|
||||||
|
- (BOOL) canSelectNext;
|
||||||
|
- (BOOL) canSelectPrevious;
|
||||||
- (void) selectNext: (id)sender;
|
- (void) selectNext: (id)sender;
|
||||||
- (void) selectPrevious: (id)sender;
|
- (void) selectPrevious: (id)sender;
|
||||||
- (NSArray*) selectedObjects;
|
- (NSArray*) selectedObjects;
|
||||||
- (unsigned int) selectionIndex;
|
- (NSUInteger) selectionIndex;
|
||||||
- (NSIndexSet*) selectionIndexes;
|
- (NSIndexSet*) selectionIndexes;
|
||||||
|
|
||||||
- (BOOL) canSelectNext;
|
|
||||||
- (BOOL) canSelectPrevious;
|
|
||||||
- (BOOL) avoidsEmptySelection;
|
- (BOOL) avoidsEmptySelection;
|
||||||
- (void) setAvoidsEmptySelection: (BOOL)flag;
|
- (void) setAvoidsEmptySelection: (BOOL)flag;
|
||||||
- (BOOL) preservesSelection;
|
- (BOOL) preservesSelection;
|
||||||
- (void) setPreservesSelection: (BOOL)flag;
|
- (void) setPreservesSelection: (BOOL)flag;
|
||||||
- (BOOL) selectsInsertedObjects;
|
- (BOOL) selectsInsertedObjects;
|
||||||
- (void) setSelectsInsertedObjects: (BOOL)flag;
|
- (void) setSelectsInsertedObjects: (BOOL)flag;
|
||||||
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||||
|
- (BOOL) alwaysUsesMultipleValuesMarker;
|
||||||
|
- (void) setAlwaysUsesMultipleValuesMarker: (BOOL)flag;
|
||||||
|
- (BOOL) clearsFilterPredicateOnInsertion;
|
||||||
|
- (void) setClearsFilterPredicateOnInsertion: (BOOL)flag;
|
||||||
|
#endif
|
||||||
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||||
|
- (BOOL) automaticallyRearrangesObjects;
|
||||||
|
- (void) setAutomaticallyRearrangesObjects: (BOOL)flag;
|
||||||
|
#endif
|
||||||
|
|
||||||
- (NSArray*) arrangeObjects: (NSArray*)obj;
|
- (NSArray*) arrangeObjects: (NSArray*)obj;
|
||||||
- (id) arrangedObjects;
|
- (id) arrangedObjects;
|
||||||
- (void) rearrangeObjects;
|
- (void) rearrangeObjects;
|
||||||
- (void) setSortDescriptors: (NSArray*)desc;
|
- (void) setSortDescriptors: (NSArray*)desc;
|
||||||
- (NSArray*) sortDescriptors;
|
- (NSArray*) sortDescriptors;
|
||||||
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||||
|
- (void) setFilterPredicate: (NSPredicate*)filterPredicate;
|
||||||
|
- (NSPredicate*) filterPredicate;
|
||||||
|
#endif
|
||||||
|
|
||||||
- (void) insertObject: (id)obj
|
- (void) insertObject: (id)obj
|
||||||
atArrangedObjectIndex: (unsigned int)idx;
|
atArrangedObjectIndex: (NSUInteger)idx;
|
||||||
- (void) insertObjects: (NSArray*)obj
|
- (void) insertObjects: (NSArray*)obj
|
||||||
atArrangedObjectIndexes: (NSIndexSet*)idx;
|
atArrangedObjectIndexes: (NSIndexSet*)idx;
|
||||||
- (void) removeObjectAtArrangedObjectIndex: (unsigned int)idx;
|
- (void) removeObjectAtArrangedObjectIndex: (NSUInteger)idx;
|
||||||
- (void) removeObjectsAtArrangedObjectIndexes: (NSIndexSet*)idx;
|
- (void) removeObjectsAtArrangedObjectIndexes: (NSIndexSet*)idx;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -27,18 +27,35 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#import <Foundation/NSArchiver.h>
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
|
#import <Foundation/NSIndexSet.h>
|
||||||
|
#import <Foundation/NSPredicate.h>
|
||||||
|
#import <Foundation/NSSortDescriptor.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
#import "AppKit/NSArrayController.h"
|
#import "AppKit/NSArrayController.h"
|
||||||
|
#import "AppKit/NSKeyValueBinding.h"
|
||||||
|
#import "GSBindingHelpers.h"
|
||||||
|
#import "GSFastEnumeration.h"
|
||||||
|
|
||||||
@implementation NSArrayController
|
@implementation NSArrayController
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
if (self == [NSArrayController class])
|
||||||
|
{
|
||||||
|
[self exposeBinding: @"contentArray"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (id) initWithContent: (id)content
|
- (id) initWithContent: (id)content
|
||||||
{
|
{
|
||||||
if ((self = [super initWithContent: content]) != nil)
|
if ((self = [super initWithContent: content]) != nil)
|
||||||
{
|
{
|
||||||
_arrange_objects = [[NSMutableArray alloc] init];
|
_arranged_objects = [content copy];
|
||||||
|
[self setSelectsInsertedObjects: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -53,31 +70,53 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
DESTROY(_arranged_objects);
|
||||||
|
DESTROY(_selection_indexes);
|
||||||
|
DESTROY(_sort_descriptors);
|
||||||
|
DESTROY(_filter_predicate);
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) addObject: (id)obj
|
- (void) addObject: (id)obj
|
||||||
{
|
{
|
||||||
[_content addObject: obj];
|
[_content addObject: obj];
|
||||||
[_arrange_objects addObject: obj];
|
if ([self automaticallyRearrangesObjects])
|
||||||
|
{
|
||||||
|
[self rearrangeObjects];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) addObjects: (NSArray*)obj
|
- (void) addObjects: (NSArray*)obj
|
||||||
{
|
{
|
||||||
[_content addObjectsFromArray: obj];
|
[_content addObjectsFromArray: obj];
|
||||||
|
if ([self automaticallyRearrangesObjects])
|
||||||
|
{
|
||||||
|
[self rearrangeObjects];
|
||||||
|
}
|
||||||
if ([self selectsInsertedObjects])
|
if ([self selectsInsertedObjects])
|
||||||
{
|
{
|
||||||
[_arrange_objects addObjectsFromArray: obj];
|
[self addSelectedObjects: obj];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeObject: (id)obj
|
- (void) removeObject: (id)obj
|
||||||
{
|
{
|
||||||
[_content removeObject: obj];
|
[_content removeObject: obj];
|
||||||
[_arrange_objects removeObject: obj];
|
if ([self automaticallyRearrangesObjects])
|
||||||
|
{
|
||||||
|
[self rearrangeObjects];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeObjects: (NSArray*)obj
|
- (void) removeObjects: (NSArray*)obj
|
||||||
{
|
{
|
||||||
[_content removeObjectsInArray: obj];
|
[_content removeObjectsInArray: obj];
|
||||||
[_arrange_objects removeObjectsInArray: obj];
|
if ([self automaticallyRearrangesObjects])
|
||||||
|
{
|
||||||
|
[self rearrangeObjects];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) canInsert
|
- (BOOL) canInsert
|
||||||
|
@ -93,161 +132,233 @@
|
||||||
RELEASE(new);
|
RELEASE(new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSIndexSet*) _indexSetForObjects: (NSArray*)objects
|
||||||
|
{
|
||||||
|
NSMutableIndexSet *tmp = [NSMutableIndexSet new];
|
||||||
|
id<NSFastEnumeration> enumerator = objects;
|
||||||
|
|
||||||
|
FOR_IN (id, obj, enumerator)
|
||||||
|
{
|
||||||
|
NSUInteger index = [_arranged_objects indexOfObject: obj];
|
||||||
|
if (NSNotFound != index)
|
||||||
|
{
|
||||||
|
[tmp addIndex: index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END_FOR_IN(enumerator)
|
||||||
|
|
||||||
|
return AUTORELEASE(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) addSelectedObjects: (NSArray*)obj
|
- (BOOL) addSelectedObjects: (NSArray*)obj
|
||||||
{
|
{
|
||||||
// TODO
|
return [self addSelectionIndexes: [self _indexSetForObjects: obj]];
|
||||||
return NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) addSelectionIndexes: (NSIndexSet*)idx
|
- (BOOL) addSelectionIndexes: (NSIndexSet*)idx
|
||||||
{
|
{
|
||||||
// TODO
|
NSMutableIndexSet *tmp = AUTORELEASE([_selection_indexes mutableCopy]);
|
||||||
return NO;
|
|
||||||
|
[tmp addIndexes: idx];
|
||||||
|
return [self setSelectionIndexes: tmp];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) setSelectedObjects: (NSArray*)obj
|
- (BOOL) setSelectedObjects: (NSArray*)obj
|
||||||
{
|
{
|
||||||
// TODO
|
return [self setSelectionIndexes: [self _indexSetForObjects: obj]];
|
||||||
return NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) setSelectionIndex: (unsigned int)idx
|
- (BOOL) setSelectionIndex: (NSUInteger)idx
|
||||||
{
|
{
|
||||||
// TODO
|
return [self setSelectionIndexes:
|
||||||
return NO;
|
[NSIndexSet indexSetWithIndex: idx]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) setSelectionIndexes: (NSIndexSet*)idx
|
- (BOOL) setSelectionIndexes: (NSIndexSet*)idx
|
||||||
{
|
{
|
||||||
// TODO
|
if ([_selection_indexes isEqual: idx])
|
||||||
return NO;
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSIGNCOPY(_selection_indexes, idx);
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) removeSelectedObjects: (NSArray*)obj
|
- (BOOL) removeSelectedObjects: (NSArray*)obj
|
||||||
{
|
{
|
||||||
// TODO
|
return [self removeSelectionIndexes: [self _indexSetForObjects: obj]];
|
||||||
return NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) removeSelectionIndexes: (NSIndexSet*)idx
|
- (BOOL) removeSelectionIndexes: (NSIndexSet*)idx
|
||||||
{
|
{
|
||||||
// TODO
|
NSMutableIndexSet *tmp = AUTORELEASE([_selection_indexes mutableCopy]);
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) selectNext: (id)sender
|
[tmp removeIndexes: idx];
|
||||||
{
|
return [self setSelectionIndexes: tmp];
|
||||||
// TODO
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) selectPrevious: (id)sender
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray*) selectedObjects
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (unsigned int) selectionIndex
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSIndexSet*) selectionIndexes
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (BOOL) canSelectNext
|
- (BOOL) canSelectNext
|
||||||
{
|
{
|
||||||
// TODO
|
NSUInteger cur = [self selectionIndex];
|
||||||
return NO;
|
|
||||||
|
if ((cur == NSNotFound) || (cur + 1 == [_content count]))
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) canSelectPrevious
|
- (BOOL) canSelectPrevious
|
||||||
{
|
{
|
||||||
// TODO
|
NSUInteger cur = [self selectionIndex];
|
||||||
return NO;
|
|
||||||
|
if ((cur == NSNotFound) || (cur == 0))
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) selectNext: (id)sender
|
||||||
|
{
|
||||||
|
NSUInteger cur = [self selectionIndex];
|
||||||
|
|
||||||
|
[self setSelectionIndexes:
|
||||||
|
[NSIndexSet indexSetWithIndex: cur + 1]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) selectPrevious: (id)sender
|
||||||
|
{
|
||||||
|
NSUInteger cur = [self selectionIndex];
|
||||||
|
|
||||||
|
[self setSelectionIndexes:
|
||||||
|
[NSIndexSet indexSetWithIndex: cur - 1]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray*) selectedObjects
|
||||||
|
{
|
||||||
|
// We make the selection work on the arranged objects
|
||||||
|
return [_arranged_objects objectsAtIndexes: _selection_indexes];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSUInteger) selectionIndex
|
||||||
|
{
|
||||||
|
return [_selection_indexes firstIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSIndexSet*) selectionIndexes
|
||||||
|
{
|
||||||
|
return AUTORELEASE([_selection_indexes copy]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) avoidsEmptySelection
|
- (BOOL) avoidsEmptySelection
|
||||||
{
|
{
|
||||||
// TODO
|
return _acflags.avoids_empty_selection;
|
||||||
return NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setAvoidsEmptySelection: (BOOL)flag
|
- (void) setAvoidsEmptySelection: (BOOL)flag
|
||||||
{
|
{
|
||||||
// TODO
|
_acflags.avoids_empty_selection = flag;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) preservesSelection
|
- (BOOL) preservesSelection
|
||||||
{
|
{
|
||||||
// TODO
|
return _acflags.preserves_selection;
|
||||||
return NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setPreservesSelection: (BOOL)flag
|
- (void) setPreservesSelection: (BOOL)flag
|
||||||
{
|
{
|
||||||
// TODO
|
_acflags.preserves_selection = flag;
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
- (BOOL) alwaysUsesMultipleValuesMarker;
|
||||||
|
{
|
||||||
|
return _acflags.always_uses_multiple_values_marker;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setAlwaysUsesMultipleValuesMarker: (BOOL)flag;
|
||||||
|
{
|
||||||
|
_acflags.always_uses_multiple_values_marker = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) clearsFilterPredicateOnInsertion;
|
||||||
|
{
|
||||||
|
return _acflags.clears_filter_predicate_on_insertion;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setClearsFilterPredicateOnInsertion: (BOOL)flag;
|
||||||
|
{
|
||||||
|
_acflags.clears_filter_predicate_on_insertion = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) automaticallyRearrangesObjects;
|
||||||
|
{
|
||||||
|
return _acflags.automatically_rearranges_objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setAutomaticallyRearrangesObjects: (BOOL)flag;
|
||||||
|
{
|
||||||
|
_acflags.automatically_rearranges_objects = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) selectsInsertedObjects
|
- (BOOL) selectsInsertedObjects
|
||||||
{
|
{
|
||||||
// TODO
|
return _acflags.selects_inserted_objects;
|
||||||
return NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setSelectsInsertedObjects: (BOOL)flag
|
- (void) setSelectsInsertedObjects: (BOOL)flag
|
||||||
{
|
{
|
||||||
// TODO
|
_acflags.selects_inserted_objects = flag;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NSArray*) arrangeObjects: (NSArray*)obj
|
- (NSArray*) arrangeObjects: (NSArray*)obj
|
||||||
{
|
{
|
||||||
// TODO
|
NSArray *temp = [obj filteredArrayUsingPredicate: _filter_predicate];
|
||||||
return nil;
|
|
||||||
|
return [temp sortedArrayUsingDescriptors: _sort_descriptors];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) arrangedObjects
|
- (id) arrangedObjects
|
||||||
{
|
{
|
||||||
// TODO
|
return _arranged_objects;
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) rearrangeObjects
|
- (void) rearrangeObjects
|
||||||
{
|
{
|
||||||
// TODO
|
ASSIGN(_arranged_objects, [self arrangeObjects: _content]);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setSortDescriptors: (NSArray*)desc
|
- (void) setSortDescriptors: (NSArray*)desc
|
||||||
{
|
{
|
||||||
// TODO
|
ASSIGNCOPY(_sort_descriptors, desc);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray*) sortDescriptors
|
- (NSArray*) sortDescriptors
|
||||||
{
|
{
|
||||||
// TODO
|
return AUTORELEASE([_sort_descriptors copy]);
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setFilterPredicate: (NSPredicate*)filterPredicate
|
||||||
|
{
|
||||||
|
ASSIGN(_filter_predicate, filterPredicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSPredicate*) filterPredicate
|
||||||
|
{
|
||||||
|
return _filter_predicate;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) insertObject: (id)obj
|
- (void) insertObject: (id)obj
|
||||||
atArrangedObjectIndex: (unsigned int)idx
|
atArrangedObjectIndex: (NSUInteger)idx
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return;
|
return;
|
||||||
|
@ -260,16 +371,88 @@ atArrangedObjectIndexes: (NSIndexSet*)idx
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeObjectAtArrangedObjectIndex: (unsigned int)idx
|
- (void) removeObjectAtArrangedObjectIndex: (NSUInteger)idx
|
||||||
{
|
{
|
||||||
// TODO
|
[self removeObject: [_arranged_objects objectAtIndex: idx]];
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeObjectsAtArrangedObjectIndexes: (NSIndexSet*)idx
|
- (void) removeObjectsAtArrangedObjectIndexes: (NSIndexSet*)idx
|
||||||
{
|
{
|
||||||
// TODO
|
[self removeObjects: [_arranged_objects objectsAtIndexes: idx]];
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
- (void)bind: (NSString *)binding
|
||||||
|
toObject: (id)anObject
|
||||||
|
withKeyPath: (NSString *)keyPath
|
||||||
|
options: (NSDictionary *)options
|
||||||
|
{
|
||||||
|
if ([binding isEqual: @"contentArray"])
|
||||||
|
{
|
||||||
|
GSKeyValueBinding *kvb;
|
||||||
|
|
||||||
|
[self unbind: binding];
|
||||||
|
kvb = [[GSKeyValueBinding alloc] initWithBinding: @"content"
|
||||||
|
withName: binding
|
||||||
|
toObject: anObject
|
||||||
|
withKeyPath: keyPath
|
||||||
|
options: options
|
||||||
|
fromObject: self];
|
||||||
|
// The binding will be retained in the binding table
|
||||||
|
RELEASE(kvb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[super bind: binding
|
||||||
|
toObject: anObject
|
||||||
|
withKeyPath: keyPath
|
||||||
|
options: options];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) encodeWithCoder: (NSCoder *)coder
|
||||||
|
{
|
||||||
|
[super encodeWithCoder: coder];
|
||||||
|
if ([coder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
[coder encodeBool: [self avoidsEmptySelection] forKey: @"NSAvoidsEmptySelection"];
|
||||||
|
[coder encodeBool: [self preservesSelection] forKey: @"NSPreservesSelection"];
|
||||||
|
[coder encodeBool: [self selectsInsertedObjects] forKey: @"NSSelectsInsertedObjects"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithCoder: (NSCoder *)coder
|
||||||
|
{
|
||||||
|
if ((self = [super initWithCoder: coder]) == nil)
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([coder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
if ([coder containsValueForKey: @"NSAvoidsEmptySelection"])
|
||||||
|
{
|
||||||
|
[self setAvoidsEmptySelection:
|
||||||
|
[coder decodeBoolForKey: @"NSAvoidsEmptySelection"]];
|
||||||
|
}
|
||||||
|
if ([coder containsValueForKey: @"NSPreservesSelection"])
|
||||||
|
{
|
||||||
|
[self setPreservesSelection:
|
||||||
|
[coder decodeBoolForKey: @"NSPreservesSelection"]];
|
||||||
|
}
|
||||||
|
if ([coder containsValueForKey: @"NSSelectsInsertedObjects"])
|
||||||
|
{
|
||||||
|
[self setSelectsInsertedObjects:
|
||||||
|
[coder decodeBoolForKey: @"NSSelectsInsertedObjects"]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -145,6 +145,8 @@
|
||||||
[coder encodeBool: _is_editable forKey: @"NSEditable"];
|
[coder encodeBool: _is_editable forKey: @"NSEditable"];
|
||||||
[coder encodeBool: _automatically_prepares_content forKey: @"NSAutomaticallyPreparesContent"];
|
[coder encodeBool: _automatically_prepares_content forKey: @"NSAutomaticallyPreparesContent"];
|
||||||
[coder encodeObject: _managed_proxy forKey: @"_NSManagedProxy"];
|
[coder encodeObject: _managed_proxy forKey: @"_NSManagedProxy"];
|
||||||
|
[coder encodeObject: NSStringFromClass([self objectClass])
|
||||||
|
forKey: @"NSObjectClassName"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -175,6 +177,11 @@
|
||||||
_is_editable = [coder decodeBoolForKey: @"NSEditable"];
|
_is_editable = [coder decodeBoolForKey: @"NSEditable"];
|
||||||
_automatically_prepares_content = [coder decodeBoolForKey: @"NSAutomaticallyPreparesContent"];
|
_automatically_prepares_content = [coder decodeBoolForKey: @"NSAutomaticallyPreparesContent"];
|
||||||
ASSIGN(_managed_proxy, [coder decodeObjectForKey: @"_NSManagedProxy"]);
|
ASSIGN(_managed_proxy, [coder decodeObjectForKey: @"_NSManagedProxy"]);
|
||||||
|
if ([coder containsValueForKey: @"NSObjectClassName"])
|
||||||
|
{
|
||||||
|
NSString *className = [coder decodeObjectForKey: @"NSObjectClassName"];
|
||||||
|
[self setObjectClass: NSClassFromString(className)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue