Skip to content

Commit

Permalink
Added delegate method to inform when animated updates finished
Browse files Browse the repository at this point in the history
  • Loading branch information
myell0w committed May 5, 2011
1 parent 87f8f48 commit 150b372
Show file tree
Hide file tree
Showing 2 changed files with 336 additions and 329 deletions.
48 changes: 26 additions & 22 deletions Classes/AQGridView.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* AQGridView.h
* AQGridView
*
*
* Created by Jim Dovey on 10/2/2010.
* Copyright 2010 Kobo Inc. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
*
* Neither the name of the project's author nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Expand Down Expand Up @@ -80,6 +80,9 @@ typedef enum {
- (void) gridView: (AQGridView *) gridView didSelectItemAtIndex: (NSUInteger) index numFingersTouch:(NSUInteger)numFingers;
- (void) gridView: (AQGridView *) gridView didDeselectItemAtIndex: (NSUInteger) index;

// Called after animated updates finished
- (void) gridViewDidEndUpdateAnimation:(AQGridView *) gridView;

// NOT YET IMPLEMENTED
- (void) gridView: (AQGridView *) gridView gestureRecognizer: (UIGestureRecognizer *) recognizer activatedForItemAtIndex: (NSUInteger) index;

Expand All @@ -95,38 +98,38 @@ extern NSString * const AQGridViewSelectionDidChangeNotification;
@interface AQGridView : UIScrollView
{
id<AQGridViewDataSource> _dataSource;

AQGridViewData * _gridData;
NSMutableArray * _updateInfoStack;
NSInteger _animationCount;

CGRect _visibleBounds;
NSRange _visibleIndices;
NSMutableArray * _visibleCells;
NSMutableDictionary * _reusableGridCells;

NSSet * _animatingCells;
NSIndexSet * _animatingIndices;

NSMutableIndexSet * _highlightedIndices;
UIView * _touchedContentView; // weak reference

UIView * _backgroundView;
UIColor * _separatorColor;

NSInteger _reloadingSuspendedCount;
NSInteger _displaySuspendedCount;

NSInteger _updateCount;

NSUInteger _selectedIndex;
NSUInteger _pendingSelectionIndex;

CGPoint _touchBeganPosition;

UIView * _headerView;
UIView * _footerView;

struct
{
unsigned resizesCellWidths:1;
Expand All @@ -145,7 +148,7 @@ extern NSString * const AQGridViewSelectionDidChangeNotification;
unsigned isAnimatingUpdates:1; // unused, see _animationCount instead
unsigned requiresSelection:1;
unsigned contentSizeFillsBounds:1;

unsigned delegateWillDisplayCell:1;
unsigned delegateWillSelectItem:1;
unsigned delegateWillSelectItemMultiTouch:1;
Expand All @@ -155,11 +158,12 @@ extern NSString * const AQGridViewSelectionDidChangeNotification;
unsigned delegateDidDeselectItem:1;
unsigned delegateGestureRecognizerActivated:1;
unsigned delegateAdjustGridCellFrame:1;

unsigned delegateDidEndUpdateAnimation:1;

unsigned dataSourceGridCellSize:1;

unsigned int isEditing:1;

unsigned __RESERVED__:1;
} _flags;
}
Expand Down Expand Up @@ -265,4 +269,4 @@ extern NSString * const AQGridViewSelectionDidChangeNotification;
// The width/height values returned by this function will be rounded UP to the nearest denominator of the screen width.
- (CGSize) portraitGridCellSizeForGridView: (AQGridView *) gridView;

@end
@end
Loading

0 comments on commit 150b372

Please sign in to comment.