-
Notifications
You must be signed in to change notification settings - Fork 0
/
BCCollectionView.h
executable file
·89 lines (69 loc) · 2.94 KB
/
BCCollectionView.h
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Created by Pieter Omvlee on 24/11/2010.
// Copyright 2010 Bohemian Coding. All rights reserved.
#import <Cocoa/Cocoa.h>
#import "BCCollectionViewDelegate.h"
#ifndef BCArray
#define BCArray(args...) [NSArray arrayWithObjects:args, nil]
#endif
@class BCCollectionViewLayoutManager;
@interface BCCollectionView : NSView
{
IBOutlet id<BCCollectionViewDelegate> delegate;
BCCollectionViewLayoutManager *layoutManager;
NSArray *contentArray;
NSArray *groups;
NSMutableArray *reusableViewControllers;
NSMutableDictionary *visibleViewControllers;
NSMutableIndexSet *selectionIndexes;
NSMutableDictionary *visibleGroupViewControllers;
NSColor *backgroundColor;
NSUInteger numberOfPreRenderedRows;
@private
NSPoint mouseDownLocation;
NSPoint mouseDraggedLocation;
NSRect previousFrameBounds;
NSUInteger lastSelectionIndex;
NSIndexSet *originalSelectionIndexes;
NSInteger dragHoverIndex;
BOOL isDragging;
BOOL firstDrag;
BOOL selectionChangedDisabled;
NSString *zoomValueObserverKey;
CGFloat lastPinchMagnification;
NSString *accumulatedKeyStrokes;
}
@property (nonatomic, assign) id<BCCollectionViewDelegate> delegate;
@property (nonatomic, retain) NSColor *backgroundColor;
@property (nonatomic) NSUInteger numberOfPreRenderedRows;
//private
@property (nonatomic, copy) NSIndexSet *originalSelectionIndexes;
@property (nonatomic, copy) NSArray *contentArray, *groups;
@property (nonatomic, copy) NSString *zoomValueObserverKey, *accumulatedKeyStrokes;
@property (readonly) NSArray *visibleViewControllerArray;
@property (readonly) BCCollectionViewLayoutManager *layoutManager;
//designated way to load BCCollectionView
- (void)reloadDataWithItems:(NSArray *)newContent emptyCaches:(BOOL)shouldEmptyCaches;
- (void)reloadDataWithItems:(NSArray *)newContent groups:(NSArray *)newGroups emptyCaches:(BOOL)shouldEmptyCaches;
- (void)reloadDataWithItems:(NSArray *)newContent groups:(NSArray *)newGroups emptyCaches:(BOOL)shouldEmptyCaches completionBlock:(dispatch_block_t)completionBlock;
//Managing Selections
- (void)selectItemAtIndex:(NSUInteger)index;
- (void)selectItemAtIndex:(NSUInteger)index inBulk:(BOOL)bulk;
- (void)selectItemsAtIndexes:(NSIndexSet *)indexes;
- (void)deselectItemAtIndex:(NSUInteger)index;
- (void)deselectItemAtIndex:(NSUInteger)index inBulk:(BOOL)bulk;
- (void)deselectItemsAtIndexes:(NSIndexSet *)indexes;
- (void)deselectAllItems;
- (NSIndexSet *)selectionIndexes;
//Basic Cell Information
- (NSSize)cellSize;
- (NSUInteger)groupHeaderHeight;
- (NSRange)rangeOfVisibleItems;
- (NSRange)rangeOfVisibleItemsWithOverflow;
- (NSIndexSet *)indexesOfItemsInRect:(NSRect)aRect;
- (NSIndexSet *)indexesOfItemContentRectsInRect:(NSRect)aRect;
//Querying ViewControllers
- (NSIndexSet *)indexesOfViewControllers;
- (NSIndexSet *)indexesOfInvisibleViewControllers;
- (NSViewController *)viewControllerForItemAtIndex:(NSUInteger)index;
- (void)softReloadDataWithCompletionBlock:(dispatch_block_t)block;
@end