Merge pull request #10 from gunyarakun/fix-invalid-return
[cocotron.git] / AppKit / NSCollectionView / NSCollectionView.m
blob5b1076509c6573929fc988443772d4bd77ac5a08
1 /* Copyright (c) 2009 Christopher J. W. Lloyd
3 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
8 #import <AppKit/NSCollectionView.h>
9 #import <AppKit/NSWindow.h>
10 #import <AppKit/NSRaise.h>
12 @implementation NSCollectionView
14 -initWithCoder:(NSCoder *)coder {
15    [super initWithCoder:coder];
17    if([coder allowsKeyedCoding]){
18     NSKeyedUnarchiver *keyed=(NSKeyedUnarchiver *)coder;
19    }
20    else
21     [NSException raise:NSInvalidArgumentException format:@"-[%@ %s] is not implemented for coder %@",isa,sel_getName(_cmd),coder];
22    
23    return self;
26 -(NSArray *)content {
27    return _content;
30 -(NSCollectionViewItem *)itemPrototype {
31    return _itemPrototype;
34 -(BOOL)isSelectable {
35    return _isSelectable;
38 -(NSSize)minItemSize {
39    return _minItemSize;
42 -(NSSize)maxItemSize {
43    return _maxItemSize;
46 -(NSUInteger)maxNumberOfRows {
47    return _maxNumberOfRows;
50 -(NSUInteger)maxNumberOfColumns {
51    return _maxNumberOfColumns;
54 -(NSArray *)backgroundColors {
55    return _backgroundColors;
58 -(BOOL)allowsMultipleSelection {
59    return _allowsMultipleSelection;
62 -(NSIndexSet *)selectionIndexes {
63    return _selectionIndexes;
66 -(void)setContent:(NSArray *)value {
67    value=[value retain];
68    [_content release];
69    _content=value;
72 -(void)setItemPrototype:(NSCollectionViewItem *)value {
73    value=[value retain];
74    [_itemPrototype release];
75    _itemPrototype=value;
78 -(void)setSelectable:(BOOL)value {
79    _isSelectable=value;
82 -(void)setMinItemSize:(NSSize)value {
83    _minItemSize=value;
86 -(void)setMaxItemSize:(NSSize)value {
87    _maxItemSize=value;
90 -(void)setMaxNumberOfRows:(NSUInteger)value {
91    _maxNumberOfRows=value;
94 -(void)setMaxNumberOfColumns:(NSUInteger)value {
95    _maxNumberOfColumns=value;
98 -(void)setBackgroundColors:(NSArray *)value {
99    value=[value copy];
100    [_backgroundColors release];
101    _backgroundColors=value;
104 -(void)setAllowsMultipleSelection:(BOOL)value {
105    _allowsMultipleSelection=value;
108 -(void)setSelectionIndexes:(NSIndexSet *)value {
109    value=[value copy];
110    [_selectionIndexes release];
111    _selectionIndexes=value;
114 -(BOOL)isFirstResponder {
115    return ([[self window] firstResponder]==self)?YES:NO;
118 -(NSCollectionViewItem *)newItemForRepresentedObject:object {
119    NSUnimplementedMethod();
120    return nil;
123 @end