Skip to content

Commit

Permalink
Update core PXListView methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Rozanski committed Mar 4, 2011
1 parent ed41292 commit 4c4487c
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 213 deletions.
30 changes: 15 additions & 15 deletions Classes/PXListView+Private.h
Expand Up @@ -17,28 +17,28 @@ enum
};
typedef NSInteger PXIsDragStartResult;


@interface PXListView ()

- (NSRect) contentViewRect;
- (NSRect)contentViewRect;

- (void) cacheCellLayout;
- (void) layoutCells;
- (void) layoutCell: (PXListViewCell*)cell;
- (void)cacheCellLayout;
- (void)layoutCells;
- (void)layoutCell:(PXListViewCell*)cell atRow:(NSUInteger)row;

- (void) addCellsFromVisibleRange;
- (void) addNewVisibleCell: (PXListViewCell*)cell atRow: (NSUInteger)row;
- (PXListViewCell*) visibleCellForRow: (NSUInteger)row;
- (NSArray*) visibleCellsForRowIndexes: (NSIndexSet*)rows;
- (void)addCellsFromVisibleRange;
- (PXListViewCell*)visibleCellForRow:(NSUInteger)row;
- (NSArray*)visibleCellsForRowIndexes:(NSIndexSet*)rows;

- (NSUInteger) numberOfRows;
- (void) deselectRowIndexes: (NSIndexSet*)rows;
- (NSUInteger)numberOfRows;
- (void)deselectRowIndexes:(NSIndexSet*)rows;

- (void) updateCells;
- (void) enqueueCell: (PXListViewCell*)cell viewController: (NSViewController*)viewController;
- (void)updateCells;
- (void)enqueueCell:(PXListViewCell*)cell;

- (void) handleMouseDown: (NSEvent*)theEvent inCell: (PXListViewCell*)theCell;
- (void) handleMouseDownOutsideCells: (NSEvent*)theEvent;
- (void)handleMouseDown:(NSEvent*)theEvent inCell:(PXListViewCell*)theCell;
- (void)handleMouseDownOutsideCells:(NSEvent*)theEvent;

- (void) contentViewBoundsDidChange: (NSNotification *)notification;
- (void)contentViewBoundsDidChange:(NSNotification*)notification;

@end
77 changes: 36 additions & 41 deletions Classes/PXListView.h
Expand Up @@ -12,63 +12,58 @@
#import "PXListViewCell.h"


#ifndef PXLog
#define PXLog(...)
#endif


@interface PXListView : NSScrollView
{
id <PXListViewDelegate> _delegate;

NSMutableArray *_reusableCells;
NSMutableArray *_reusableViewControllers;
NSMutableArray *_visibleCells;
NSMutableArray *_visibleViewControllers;
NSRange _currentRange;
NSMutableArray *_reusableCells;
NSMutableArray *_visibleCells;
NSRange _currentRange;

NSUInteger _numberOfRows;
NSMutableIndexSet *_selectedRows;
NSUInteger _numberOfRows;
NSMutableIndexSet *_selectedRows;

NSRange _visibleRange;
CGFloat _totalHeight;
CGFloat *_cellYOffsets;
NSRange _visibleRange;
CGFloat _totalHeight;
CGFloat *_cellYOffsets;

CGFloat _cellSpacing;
CGFloat _cellSpacing;

BOOL _inLiveResize;
BOOL _allowsEmptySelection;
BOOL _allowsMultipleSelection;
BOOL _verticalMotionCanBeginDrag;
BOOL _inLiveResize;
BOOL _allowsEmptySelection;
BOOL _allowsMultipleSelection;
BOOL _verticalMotionCanBeginDrag;

NSUInteger _dropRow;
NSUInteger _dropRow;
PXListViewDropHighlight _dropHighlight;
}

@property (readwrite, assign) IBOutlet id <PXListViewDelegate> delegate;
@property (readwrite, assign) CGFloat cellSpacing;
@property (readwrite, retain) NSIndexSet* selectedRows;
@property (readwrite, assign) NSUInteger selectedRow; // shorthand for selectedRows.
@property (readwrite, assign) BOOL allowsEmptySelection;
@property (readwrite, assign) BOOL allowsMultipleSelection;
@property (readwrite, assign) BOOL verticalMotionCanBeginDrag;
@property (nonatomic, assign) IBOutlet id <PXListViewDelegate> delegate;

@property (nonatomic, retain) NSIndexSet *selectedRows;
@property (nonatomic, assign) NSUInteger selectedRow;

@property (nonatomic, assign) BOOL allowsEmptySelection;
@property (nonatomic, assign) BOOL allowsMultipleSelection;
@property (nonatomic, assign) BOOL verticalMotionCanBeginDrag;

@property (nonatomic, assign) CGFloat cellSpacing;

- (void) reloadData;
- (void)reloadData;

- (PXListViewCell*) dequeueCellWithReusableIdentifier: (NSString*)identifier;
- (NSViewController*) dequeueViewControllerWithReusableIdentifier: (NSString*)identifier;
- (PXListViewCell*)dequeueCellWithReusableIdentifier:(NSString*)identifier;

- (NSRange) visibleRange;
- (NSRect) rectOfRow: (NSUInteger)row;
- (void) deselectRows;
- (void) selectRowIndexes:(NSIndexSet*)rows byExtendingSelection: (BOOL)doExtend;
- (NSRange)visibleRange;
- (NSRect)rectOfRow:(NSUInteger)row;
- (void)deselectRows;
- (void)selectRowIndexes:(NSIndexSet*)rows byExtendingSelection:(BOOL)doExtend;

- (void) scrollRowToVisible: (NSUInteger)row;
- (void)scrollRowToVisible: (NSUInteger)row;

-(NSImage*) dragImageForRowsWithIndexes: (NSIndexSet *)dragRows
event: (NSEvent*)dragEvent clickedCell: (PXListViewCell*)clickedCell
offset: (NSPointPointer)dragImageOffset;
-(void) setShowsDropHighlight: (BOOL)inState;
-(void) setDropRow: (NSUInteger)row dropHighlight:(PXListViewDropHighlight)dropHighlight;
- (NSImage*)dragImageForRowsWithIndexes:(NSIndexSet *)dragRows
event:(NSEvent*)dragEvent clickedCell:(PXListViewCell*)clickedCell
offset:(NSPointPointer)dragImageOffset;
- (void)setShowsDropHighlight:(BOOL)inState;
- (void)setDropRow:(NSUInteger)row dropHighlight:(PXListViewDropHighlight)dropHighlight;

@end

0 comments on commit 4c4487c

Please sign in to comment.