280north / cappuccino

Web Application Framework in JavaScript and Objective-J

This URL has Read+Write access

boucher (author)
Mon Nov 02 16:47:07 -0800 2009
commit  93c90274b5376b5c7ef0c9dea0c1ffcec4499ab7
tree    c1e8d95726cd11b873a89fc143ea104a0f436c03
parent  e8b1ff88461f8b4eb303e5435079f00b40159af2
cappuccino / Tools / nib2cib / NSCollectionView.j
100644 75 lines (58 sloc) 2.021 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* NSCollectionView.j
* nib2cib
*
* Created by Marc Nijdam.
* Copyright 2009, imadjine, LLC.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
 
@import <AppKit/CPCollectionView.j>
 
@implementation CPCollectionView (NSCoding)
 
- (id)NS_initWithCoder:(CPCoder)aCoder
{
    _items = [];
    _content = [];
  
    _cachedItems = [];
    
    _itemSize = CGSizeMakeZero();
    _minItemSize = CGSizeMakeZero();
    _maxItemSize = CGSizeMakeZero();
 
    _verticalMargin = 5.0;
    _tileWidth = -1.0;
    
    _selectionIndexes = [CPIndexSet indexSet];
    _allowsEmptySelection = YES;
        
    if (self = [super NS_initWithCoder:aCoder])
    {
        _backgroundColors = [aCoder decodeObjectForKey:@"NSBackgroundColors"];
 
        _maxNumberOfRows = [aCoder decodeIntForKey:@"NSMaxNumberOfGridRows"];
        _maxNumberOfColumns = [aCoder decodeIntForKey:@"NSMaxNumberOfGridColumns"];
        
        _isSelectable = [aCoder decodeBoolForKey:@"NSSelectable"];
        _allowsMultipleSelection = [aCoder decodeBoolForKey:@"NSAllowsMultipleSelection"];
    }
    
    return self;
}
 
@end
 
@implementation NSCollectionView : CPCollectionView
{
}
 
- (id)initWithCoder:(CPCoder)aCoder
{
    return [self NS_initWithCoder:aCoder];
}
 
- (Class)classForKeyedArchiver
{
    return [CPCollectionView class];
}
 
@end