Skip to content

Commit

Permalink
Merge changes from github.com/perspx.
Browse files Browse the repository at this point in the history
  • Loading branch information
uliwitness committed Sep 6, 2010
2 parents 526e6aa + 439dd0d commit 1ce50e2
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 101 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
*.mode1v3
*.mode2v3
*.perspectivev3
xcuserdata
/Build
/build
2 changes: 2 additions & 0 deletions Classes/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
NSMutableArray *_listItems;
}

- (IBAction) reloadTable: (id)sender;

@end
6 changes: 6 additions & 0 deletions Classes/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,10 @@ - (NSDragOperation) listView: (PXListView*)aListView validateDrop:(id <NSDraggin
return NSDragOperationCopy;
}

- (IBAction) reloadTable: (id)sender
{
#pragma unused(sender)
[listView reloadData];
}

@end
25 changes: 24 additions & 1 deletion Classes/MyListViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,41 @@ @implementation MyListViewCell

@synthesize title = _title;

#if DEBUG
// Counter for the amount of current cells
+ (void)updateCount:(BOOL)status {
static NSInteger count = 0;
if (status) {
count++;
} else {
count--;
}
NSLog(@"Current amount of allocated cells: %d", count);
}
#endif

#pragma mark -
#pragma mark Init/Dealloc

- (id) initWithReusableIdentifier: (NSString*)identifier
{
if(( self = [super initWithReusableIdentifier: identifier] ))
{

#if DEBUG
NSLog(@"Allocating cell");
[MyListViewCell updateCount:YES];
#endif
}

return self;
}

- (void) dealloc
{
#if DEBUG
NSLog(@"Deallocating cell");
[MyListViewCell updateCount:NO];
#endif
[_title release];
[super dealloc];
}
Expand All @@ -39,6 +59,9 @@ - (void) dealloc

- (void) prepareForReuse
{
#if DEBUG
NSLog(@"Reusing cell");
#endif
[_title release];
_title = nil;
}
Expand Down
17 changes: 13 additions & 4 deletions Classes/PXListView+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
// Copyright 2010 Alex Rozanski. http://perspx.com. All rights reserved.
//

// This is a renamed copy of UKIsDragStart from <http://github.com/uliwitness/UliKit>:
// Possible return values from UKIsDragStart:
enum
{
PXIsDragStartMouseReleased = 0,
PXIsDragStartTimedOut,
PXIsDragStartMouseMovedHorizontally,
PXIsDragStartMouseMovedVertically
};
typedef NSInteger PXIsDragStartResult;

@interface PXListView ()

- (NSRect) contentViewRect;
Expand All @@ -19,17 +30,15 @@
- (PXListViewCell*) visibleCellForRow: (NSUInteger)row;
- (NSArray*) visibleCellsForRowIndexes: (NSIndexSet*)rows;

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

- (void) updateCells;

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

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

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

-(NSUInteger) numberOfRows;

@end
Loading

0 comments on commit 1ce50e2

Please sign in to comment.